Index: arm64/include/cpufunc.h =================================================================== --- arm64/include/cpufunc.h +++ arm64/include/cpufunc.h @@ -38,6 +38,62 @@ #ifdef _KERNEL +#define HAVE_INLINE_FFS + +static __inline __pure2 int +ffs(int mask) +{ + + return (mask == 0 ? 0 : __builtin_ctz((u_int)mask) + 1); +} + +#define HAVE_INLINE_FFSL + +static __inline __pure2 int +ffsl(long mask) +{ + + return (mask == 0 ? 0 : __builtin_ctzl((u_long)mask) + 1); +} + +#define HAVE_INLINE_FFSLL + +static __inline __pure2 int +ffsll(long long mask) +{ + + return (ffsl((long)mask)); +} + +#define HAVE_INLINE_FLS + +static __inline __pure2 int +fls(int mask) +{ + + return (mask == 0 ? 0 : + 8 * sizeof(mask) - __builtin_clz((u_int)mask)); +} + +#define HAVE_INLINE_FLSL + +static __inline __pure2 int +flsl(long mask) +{ + + return (mask == 0 ? 0 : + 8 * sizeof(mask) - __builtin_clzl((u_long)mask)); +} + +#define HAVE_INLINE_FLSLL + +static __inline __pure2 int +flsll(long long mask) +{ + + return (flsl((long)mask)); +} + #include void pan_enable(void); Index: conf/files.arm64 =================================================================== --- conf/files.arm64 +++ conf/files.arm64 @@ -258,12 +258,6 @@ kern/subr_devmap.c standard kern/subr_intr.c optional intrng libkern/bcmp.c standard -libkern/ffs.c standard -libkern/ffsl.c standard -libkern/ffsll.c standard -libkern/fls.c standard -libkern/flsl.c standard -libkern/flsll.c standard libkern/memcmp.c standard libkern/memset.c standard libkern/arm64/crc32c_armv8.S standard