]> Git Repo - qemu.git/blobdiff - hw/timer/i8254_common.c
scsi: add persistent reservation manager using qemu-pr-helper
[qemu.git] / hw / timer / i8254_common.c
index 976d5200f1ad3cd68d0ad635ea352320d9545fc6..ee064aa8192c02deb63cc876929eb1a063a09343 100644 (file)
@@ -93,7 +93,7 @@ int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time)
         }
         break;
     case 2:
-        base = (d / s->count) * s->count;
+        base = QEMU_ALIGN_DOWN(d, s->count);
         if ((d - base) == 0 && d != 0) {
             next_time = base + s->count;
         } else {
@@ -101,7 +101,7 @@ int64_t pit_get_next_transition_time(PITChannelState *s, int64_t current_time)
         }
         break;
     case 3:
-        base = (d / s->count) * s->count;
+        base = QEMU_ALIGN_DOWN(d, s->count);
         period2 = ((s->count + 1) >> 1);
         if ((d - base) < period2) {
             next_time = base + period2;
This page took 0.023699 seconds and 4 git commands to generate.