X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=smalloc.c;h=6cbf59cf320a0eb0fcf1bf9166f6b581bfe0c983;hb=6164890e4db96c073274990edca12706e9c41659;hp=dfddfba9fcc0eef0246af80b566fec0d8171c97f;hpb=89da54e865169abcf0a99c6e7ee12ec2c8ddd8b9;p=fio.git diff --git a/smalloc.c b/smalloc.c index dfddfba9..6cbf59cf 100644 --- a/smalloc.c +++ b/smalloc.c @@ -12,6 +12,7 @@ #include #include "mutex.h" +#include "lib/ffz.h" #define MP_SAFE /* define to make thread safe */ #define SMALLOC_REDZONE /* define to detect memory corruption */ @@ -173,34 +174,6 @@ static void clear_blocks(struct pool *pool, unsigned int pool_idx, blocks_iter(pool, pool_idx, idx, nr_blocks, mask_clear); } -static inline int __ffs(int word) -{ - int r = 0; - - if (!(word & 0xffff)) { - word >>= 16; - r += 16; - } - if (!(word & 0xff)) { - word >>= 8; - r += 8; - } - if (!(word & 0xf)) { - word >>= 4; - r += 4; - } - if (!(word & 3)) { - word >>= 2; - r += 2; - } - if (!(word & 1)) { - word >>= 1; - r += 1; - } - - return r; -} - static int find_next_zero(int word, int start) { assert(word != -1U);