X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/52b88d2428a808d0636a1cb8205a1f891fc23e6a..05b75f8d50b83e943af3be4071449304d82dbdcd:/lib/bits.h diff --git a/lib/bits.h b/lib/bits.h index 856db68..e0f7c62 100644 --- a/lib/bits.h +++ b/lib/bits.h @@ -25,7 +25,13 @@ #ifndef BITS_H #define BITS_H +#if HAVE_FLS +static inline int leftmost_bit(uint32_t n) { + return fls(n) - 1; +} +#else int leftmost_bit(uint32_t n); +#endif #endif /* BITS_H */