Fix off-by-one in generic ffz
[fio.git] / io_u.c
diff --git a/io_u.c b/io_u.c
index 1637b74daf69ede187ad5c063ac95e1dcee31cd5..c662470a09142fa83c3ba337a84b7125ace2ed12 100644 (file)
--- a/io_u.c
+++ b/io_u.c
@@ -7,7 +7,6 @@
 
 #include "fio.h"
 #include "hash.h"
-#include "lib/ffz.h"
 
 /*
  * Change this define to play with the timeout handling
@@ -33,7 +32,7 @@ static int random_map_free(struct fio_file *f, const unsigned long long block)
 
        dprint(FD_RANDOM, "free: b=%llu, idx=%u, bit=%u\n", block, idx, bit);
 
-       return (f->file_map[idx] & (1UL << bit)) == 0;
+       return (f->file_map[idx] & (1 << bit)) == 0;
 }
 
 /*
@@ -66,7 +65,7 @@ static void mark_random_map(struct thread_data *td, struct io_u *io_u)
 
                fio_assert(td, idx < f->num_maps);
 
-               f->file_map[idx] |= (1UL << bit);
+               f->file_map[idx] |= (1 << bit);
                block++;
                blocks++;
        }
@@ -108,7 +107,7 @@ static int get_next_free_block(struct thread_data *td, struct fio_file *f,
        i = f->last_free_lookup;
        *b = (i * BLOCKS_PER_MAP);
        while ((*b) * min_bs < f->real_file_size) {
-               if (f->file_map[i] != -1UL) {
+               if (f->file_map[i] != (unsigned int) -1) {
                        *b += ffz(f->file_map[i]);
                        if (*b > last_block(td, f, ddir))
                                break;