diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-05-02 19:18:42 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-05-02 19:18:42 -0400 |
commit | b9095fd8a7f41dc7ac0b0b7864f74766a3056f96 (patch) | |
tree | 85653322dfb5b0c2faef3973d9d480d8117e4454 /kernel/time.c | |
parent | c25bd29805f4d854c3a0b4176813f3c1bff569d3 (diff) |
Make constants in kernel/timeconst.h fixed 64 bits
Force constants in kernel/timeconst.h (except shift counts) to be 64 bits,
using U64_C() constructor macros, and eliminate constants that cannot
be represented at all in 64 bits. This avoids warnings with some gcc
versions.
Drop generating 64-bit constants, since we have no real hope of
getting a full set (operation on 64-bit values requires a 128-bit
intermediate result, which gcc only supports on 64-bit platforms, and
only with libgcc support on some.) Note that the use of these
constants does not depend on if we are on a 32- or 64-bit architecture.
This resolves Bugzilla 10153.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'kernel/time.c')
-rw-r--r-- | kernel/time.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/time.c b/kernel/time.c index cbe0d5a222ff..6a08660b4fac 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -246,7 +246,7 @@ unsigned int inline jiffies_to_msecs(const unsigned long j) | |||
246 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); | 246 | return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC); |
247 | #else | 247 | #else |
248 | # if BITS_PER_LONG == 32 | 248 | # if BITS_PER_LONG == 32 |
249 | return ((u64)HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; | 249 | return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32; |
250 | # else | 250 | # else |
251 | return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN; | 251 | return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN; |
252 | # endif | 252 | # endif |
@@ -262,7 +262,7 @@ unsigned int inline jiffies_to_usecs(const unsigned long j) | |||
262 | return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); | 262 | return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC); |
263 | #else | 263 | #else |
264 | # if BITS_PER_LONG == 32 | 264 | # if BITS_PER_LONG == 32 |
265 | return ((u64)HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32; | 265 | return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32; |
266 | # else | 266 | # else |
267 | return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN; | 267 | return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN; |
268 | # endif | 268 | # endif |
@@ -476,7 +476,7 @@ unsigned long msecs_to_jiffies(const unsigned int m) | |||
476 | if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) | 476 | if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) |
477 | return MAX_JIFFY_OFFSET; | 477 | return MAX_JIFFY_OFFSET; |
478 | 478 | ||
479 | return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) | 479 | return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32) |
480 | >> MSEC_TO_HZ_SHR32; | 480 | >> MSEC_TO_HZ_SHR32; |
481 | #endif | 481 | #endif |
482 | } | 482 | } |
@@ -491,7 +491,7 @@ unsigned long usecs_to_jiffies(const unsigned int u) | |||
491 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) | 491 | #elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC) |
492 | return u * (HZ / USEC_PER_SEC); | 492 | return u * (HZ / USEC_PER_SEC); |
493 | #else | 493 | #else |
494 | return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32) | 494 | return (USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32) |
495 | >> USEC_TO_HZ_SHR32; | 495 | >> USEC_TO_HZ_SHR32; |
496 | #endif | 496 | #endif |
497 | } | 497 | } |