From: Jens Axboe Date: Mon, 17 Sep 2018 03:52:22 +0000 (-0600) Subject: lfsr: use unsigned long long for 64-bit values X-Git-Tag: fio-3.11~40 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=fe6e1197f2ccba76bb3791093c480665bf1796ba;p=fio.git lfsr: use unsigned long long for 64-bit values 1UL is bit 64-bit on Windows builds. Signed-off-by: Jens Axboe --- diff --git a/lib/lfsr.c b/lib/lfsr.c index a4f1fb13..49e34a8c 100644 --- a/lib/lfsr.c +++ b/lib/lfsr.c @@ -78,7 +78,7 @@ static uint8_t lfsr_taps[64][FIO_MAX_TAPS] = #define __LFSR_NEXT(__fl, __v) \ __v = ((__v >> 1) | __fl->cached_bit) ^ \ - (((__v & 1UL) - 1UL) & __fl->xormask); + (((__v & 1ULL) - 1ULL) & __fl->xormask); static inline void __lfsr_next(struct fio_lfsr *fl, unsigned int spin) { @@ -146,7 +146,7 @@ static uint64_t lfsr_create_xormask(uint8_t *taps) uint64_t xormask = 0; for(i = 0; i < FIO_MAX_TAPS && taps[i] != 0; i++) - xormask |= 1UL << (taps[i] - 1); + xormask |= 1ULL << (taps[i] - 1); return xormask; } @@ -161,7 +161,7 @@ static uint8_t *find_lfsr(uint64_t size) * take that into account. */ for (i = 3; i < 64; i++) - if ((1UL << i) > size) + if ((1ULL << i) > size) return lfsr_taps[i]; return NULL; @@ -241,7 +241,7 @@ int lfsr_init(struct fio_lfsr *fl, uint64_t nums, unsigned long seed, fl->max_val = nums - 1; fl->xormask = lfsr_create_xormask(taps); - fl->cached_bit = 1UL << (taps[0] - 1); + fl->cached_bit = 1ULL << (taps[0] - 1); if (prepare_spin(fl, spin)) return 1;