| return ~n & (n + 1); | return ~n & (n + 1); | ||||
| } | } | ||||
| #if defined(__GLIBC__) && ( \ | |||||
| #if 0 && defined(__GLIBC__) && ( \ | |||||
| (__GLIBC__>= 2 && __GLIBC_MINOR__ >= 27) || \ | (__GLIBC__>= 2 && __GLIBC_MINOR__ >= 27) || \ | ||||
| _GNU_SOURCE) | _GNU_SOURCE) | ||||
| #define first_set ffsll | #define first_set ffsll | ||||
| #else | #else | ||||
| static int first_set(l2_bitmap_entry n) { | static int first_set(l2_bitmap_entry n) { | ||||
| if (n == 0) { | |||||
| return 0; | |||||
| } | |||||
| int num = 1; | |||||
| while ((n & 1) == 0) { | |||||
| n >>= 1; | |||||
| num += 1; | |||||
| } | |||||
| return num; | |||||
| } | } | ||||
| #endif | #endif | ||||