aboutsummaryrefslogtreecommitdiff
path: root/hw/timer/i8254_common.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-22 13:04:16 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2017-08-31 12:29:07 +0200
commitec34748507c3eb812fe38afc59cc19a3bb713466 (patch)
tree9d26e8834b775289bed4bb1b914231a917cba8b7 /hw/timer/i8254_common.c
parent33c5793bd92b85b0d3666f35e44cef855b48e76a (diff)
i8254: use QEMU_ALIGN_DOWN
I used the clang-tidy qemu-round check to generate the fix: https://github.com/elmarco/clang-tools-extra Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'hw/timer/i8254_common.c')
-rw-r--r--hw/timer/i8254_common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/timer/i8254_common.c b/hw/timer/i8254_common.c
index 976d5200f1..ee064aa819 100644
--- a/hw/timer/i8254_common.c
+++ b/hw/timer/i8254_common.c
@@ -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;