aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2010-07-26 22:33:54 -0400
committerKevin O'Connor <kevin@koconnor.net>2010-07-26 22:33:54 -0400
commitabf31d367a8e80a13cb6d2a8a6c499914c2e91e7 (patch)
tree5631dff26b005399692c4a6103a451237ca49af6
parent1d5c333e224cc95fb12563d8437abfeadda7734a (diff)
downloadseabios-abf31d367a8e80a13cb6d2a8a6c499914c2e91e7.zip
seabios-abf31d367a8e80a13cb6d2a8a6c499914c2e91e7.tar.gz
seabios-abf31d367a8e80a13cb6d2a8a6c499914c2e91e7.tar.bz2
Fix integer truncating bug in calc_future_timer().
Be sure to promote to u64 before multiplication.
-rw-r--r--src/clock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/clock.c b/src/clock.c
index 49ab901..6d46501 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -1,6 +1,6 @@
// 16bit code to handle system clocks.
//
-// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
+// Copyright (C) 2008-2010 Kevin O'Connor <kevin@koconnor.net>
// Copyright (C) 2002 MandrakeSoft S.A.
//
// This file may be distributed under the terms of the GNU LGPLv3 license.
@@ -238,7 +238,7 @@ calc_future_timer(u32 msecs)
{
if (!msecs)
return GET_BDA(timer_counter);
- u32 kticks = DIV_ROUND_UP((u64)(msecs * PIT_TICK_RATE), PIT_TICK_INTERVAL);
+ u32 kticks = DIV_ROUND_UP((u64)msecs * PIT_TICK_RATE, PIT_TICK_INTERVAL);
u32 ticks = DIV_ROUND_UP(kticks, 1000);
return calc_future_timer_ticks(ticks);
}