24 #define LELY_LIBC_STRINGS_INLINE extern inline
27 #if !LELY_HAVE_STRINGS_H
31 #if !(defined(__GNUC__) || __has_builtin(__builtin_ffs))
36 static const int ffs_tab[] = {
37 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
38 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
39 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
40 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
41 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
42 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
43 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
44 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
45 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
46 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
47 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
48 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
49 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
50 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
51 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
52 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8
60 unsigned int x = i & -i;
62 unsigned int n = x > UINT32_C(0x00ffffff)
63 ? 24 : (x > UINT16_C(0xffffu)
64 ? 16 : (x > UINT8_C(0xff) ? 8 : 0));
66 return n + ffs_tab[(x >> n) & UINT8_C(0xff)];
72 strcasecmp(
const char *s1,
const char *s2)
79 while ((result = tolower((
unsigned char)*s1)
80 - tolower((
unsigned char)*s2++)) == 0 && *s1++)
87 strncasecmp(
const char *s1,
const char *s2,
size_t n)
94 while ((result = tolower((
unsigned char)*s1)
95 - tolower((
unsigned char)*s2++)) == 0 && --n && *s1++)
This is the internal header file of the C11 and POSIX compatibility library.
This header file is part of the C11 and POSIX compatibility library; it includes <stdint....
This header file is part of the C11 and POSIX compatibility library; it includes <strings....