Skip to content

Commit 2edc38f

Browse files
committed
[CF] flsl is required for OpenBSD.
flsl is available on FreeBSD (and thus macOS), but not OpenBSD. This commit makes the implementation of flsl currently exposed to Linux and Windows also available to OpenBSD. Thus, we can move this implementation up to the existing block of shared infrastructure. Additionally, this commit separates it from the block below which declares asprintf. The asprintf declaration is still required for Linux and Windows, but not OpenBSD.
1 parent 7dee1bf commit 2edc38f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ CF_INLINE uint64_t mach_absolute_time() {
201201
#define strtol_l(a,b,c,locale) strtol(a,b,c)
202202

203203
#define fprintf_l(a,locale,b,...) fprintf(a, b, __VA_ARGS__)
204+
205+
CF_INLINE int flsl( long mask ) {
206+
int idx = 0;
207+
while (mask != 0) mask = (unsigned long)mask >> 1, idx++;
208+
return idx;
209+
}
204210
#endif // TARGET_OS_LINUX || TARGET_OS_WIN32 || defined(__OpenBSD__)
205211

206212
#if TARGET_OS_LINUX
@@ -391,12 +397,6 @@ CF_INLINE int popcountll(long long x) {
391397

392398
#include <stdarg.h>
393399

394-
CF_INLINE int flsl( long mask ) {
395-
int idx = 0;
396-
while (mask != 0) mask = (unsigned long)mask >> 1, idx++;
397-
return idx;
398-
}
399-
400400
CF_PRIVATE int asprintf(char **ret, const char *format, ...);
401401

402402
#endif

0 commit comments

Comments
 (0)