X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=smalloc.c;h=5ba20047b37676ec8659dffc53dd6459061a5e4d;hp=a925a653e5d5571e9fff8686b7378efe3a343704;hb=e55f8f307385e77ea561e7bbf9c76842ead9d7a3;hpb=8d5844e9df308cc06d86a83d6bf28a29db46b6a9 diff --git a/smalloc.c b/smalloc.c index a925a653..5ba20047 100644 --- a/smalloc.c +++ b/smalloc.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -171,8 +172,8 @@ static void clear_blocks(struct pool *pool, unsigned int pool_idx, static int find_next_zero(int word, int start) { assert(word != -1U); - word >>= (start + 1); - return ffz(word) + start + 1; + word >>= start; + return ffz(word) + start; } static int add_pool(struct pool *pool, unsigned int alloc_size) @@ -253,9 +254,9 @@ void scleanup(void) #ifdef SMALLOC_REDZONE static void *postred_ptr(struct block_hdr *hdr) { - unsigned long ptr; + uintptr_t ptr; - ptr = (unsigned long) hdr + hdr->size - sizeof(unsigned int); + ptr = (uintptr_t) hdr + hdr->size - sizeof(unsigned int); ptr = (ptr + int_mask) & ~int_mask; return (void *) ptr;