You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
+4
-4
@@ -246,7 +246,7 @@ unsigned int inline jiffies_to_msecs(const unsigned long j)
|
||||
return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
|
||||
#else
|
||||
# if BITS_PER_LONG == 32
|
||||
return ((u64)HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32;
|
||||
return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32;
|
||||
# else
|
||||
return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN;
|
||||
# endif
|
||||
@@ -262,7 +262,7 @@ unsigned int inline jiffies_to_usecs(const unsigned long j)
|
||||
return (j + (HZ / USEC_PER_SEC) - 1)/(HZ / USEC_PER_SEC);
|
||||
#else
|
||||
# if BITS_PER_LONG == 32
|
||||
return ((u64)HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32;
|
||||
return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32;
|
||||
# else
|
||||
return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN;
|
||||
# endif
|
||||
@@ -476,7 +476,7 @@ unsigned long msecs_to_jiffies(const unsigned int m)
|
||||
if (HZ > MSEC_PER_SEC && m > jiffies_to_msecs(MAX_JIFFY_OFFSET))
|
||||
return MAX_JIFFY_OFFSET;
|
||||
|
||||
return ((u64)MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
|
||||
return (MSEC_TO_HZ_MUL32 * m + MSEC_TO_HZ_ADJ32)
|
||||
>> MSEC_TO_HZ_SHR32;
|
||||
#endif
|
||||
}
|
||||
@@ -491,7 +491,7 @@ unsigned long usecs_to_jiffies(const unsigned int u)
|
||||
#elif HZ > USEC_PER_SEC && !(HZ % USEC_PER_SEC)
|
||||
return u * (HZ / USEC_PER_SEC);
|
||||
#else
|
||||
return ((u64)USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)
|
||||
return (USEC_TO_HZ_MUL32 * u + USEC_TO_HZ_ADJ32)
|
||||
>> USEC_TO_HZ_SHR32;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user