Merge branch 'fixes' of https://github.com/sitsofe/fio
authorJens Axboe <axboe@kernel.dk>
Sun, 27 Aug 2017 16:03:38 +0000 (10:03 -0600)
committerJens Axboe <axboe@kernel.dk>
Sun, 27 Aug 2017 16:03:38 +0000 (10:03 -0600)
stat.c
time.c

diff --git a/stat.c b/stat.c
index 4aa9cb8..91c74ab 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -100,7 +100,8 @@ static unsigned int plat_val_to_idx(unsigned long long val)
  */
 static unsigned long long plat_idx_to_val(unsigned int idx)
 {
-       unsigned int error_bits, k, base;
+       unsigned int error_bits;
+       unsigned long long k, base;
 
        assert(idx < FIO_IO_U_PLAT_NR);
 
@@ -111,7 +112,7 @@ static unsigned long long plat_idx_to_val(unsigned int idx)
 
        /* Find the group and compute the minimum value of that group */
        error_bits = (idx >> FIO_IO_U_PLAT_BITS) - 1;
-       base = 1 << (error_bits + FIO_IO_U_PLAT_BITS);
+       base = ((unsigned long long) 1) << (error_bits + FIO_IO_U_PLAT_BITS);
 
        /* Find its bucket number of the group */
        k = idx % FIO_IO_U_PLAT_VAL;
diff --git a/time.c b/time.c
index edfe779..0798419 100644 (file)
--- a/time.c
+++ b/time.c
@@ -8,17 +8,17 @@ static unsigned long ns_granularity;
 
 void timespec_add_msec(struct timespec *ts, unsigned int msec)
 {
-       unsigned long adj_nsec = 1000000 * msec;
+       uint64_t adj_nsec = 1000000ULL * msec;
 
        ts->tv_nsec += adj_nsec;
        if (adj_nsec >= 1000000000) {
-               unsigned long adj_sec = adj_nsec / 1000000000UL;
+               uint64_t adj_sec = adj_nsec / 1000000000;
 
-               ts->tv_nsec -=  adj_sec * 1000000000UL;
+               ts->tv_nsec -= adj_sec * 1000000000;
                ts->tv_sec += adj_sec;
        }
-       if (ts->tv_nsec >= 1000000000UL){
-               ts->tv_nsec -= 1000000000UL;
+       if (ts->tv_nsec >= 1000000000){
+               ts->tv_nsec -= 1000000000;
                ts->tv_sec++;
        }
 }