Skip to content

Commit f631bd6

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. While we are here, move an existing comma loop body to explicit braces.
1 parent 7dee1bf commit f631bd6

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

CoreFoundation/Base.subproj/CoreFoundation_Prefix.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,15 @@ 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) {
208+
mask = (unsigned long)mask >> 1;
209+
idx++;
210+
}
211+
return idx;
212+
}
204213
#endif // TARGET_OS_LINUX || TARGET_OS_WIN32 || defined(__OpenBSD__)
205214

206215
#if TARGET_OS_LINUX
@@ -391,12 +400,6 @@ CF_INLINE int popcountll(long long x) {
391400

392401
#include <stdarg.h>
393402

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-
400403
CF_PRIVATE int asprintf(char **ret, const char *format, ...);
401404

402405
#endif

0 commit comments

Comments
 (0)