mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux Arch Mailing List <linux-arch@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH 24/24] Use U64_C() instead of casts in kernel/time.c
Date: Thu, 24 Apr 2008 16:05:52 -0700	[thread overview]
Message-ID: <1209078352-7593-46-git-send-email-hpa@zytor.com> (raw)
In-Reply-To: <1209078352-7593-45-git-send-email-hpa@zytor.com>

Use the new U64_C() constructor macro instead of using casts for
constants in kernel/time.c.  This avoids warnings with some gcc
versions.

This resolves Bugzilla 10153.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 kernel/time.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/time.c b/kernel/time.c
index 35d373a..519822b 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -244,7 +244,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 (U64_C(HZ_TO_MSEC_MUL32) * j) >> HZ_TO_MSEC_SHR32;
 # else
 	return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN;
 # endif
@@ -260,7 +260,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 (U64_C(HZ_TO_USEC_MUL32) * j) >> HZ_TO_USEC_SHR32;
 # else
 	return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN;
 # endif
@@ -470,7 +470,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 (U64_C(MSEC_TO_HZ_MUL32) * m + MSEC_TO_HZ_ADJ32)
 		>> MSEC_TO_HZ_SHR32;
 #endif
 }
@@ -485,7 +485,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 (U64_C(USEC_TO_HZ_MUL32) * u + USEC_TO_HZ_ADJ32)
 		>> USEC_TO_HZ_SHR32;
 #endif
 }
-- 
1.5.4.1


  reply	other threads:[~2008-04-24 23:13 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24 23:05 [PATCH 00/24] Unify integer type definitions, and add fixed type constructor macros H. Peter Anvin
     [not found] ` <1209078352-7593-2-git-send-email-hpa@zytor.com>
2008-04-24 23:05   ` [PATCH 01/24] types: create <asm-generic/int-*.h> H. Peter Anvin
2008-04-24 23:05     ` [PATCH 02/24] alpha: types: use <asm-generic/int-*.h> for the alpha architecture H. Peter Anvin
2008-04-24 23:05       ` H. Peter Anvin
2008-04-24 23:05         ` [PATCH 03/24] arm: types: use <asm-generic/int-*.h> for the arm architecture H. Peter Anvin
2008-04-24 23:05           ` H. Peter Anvin
2008-04-24 23:05             ` [PATCH 04/24] avr32: types: use <asm-generic/int-*.h> for the avr32 architecture H. Peter Anvin
2008-04-24 23:05               ` H. Peter Anvin
2008-04-24 23:05                 ` [PATCH 05/24] blackfin: types: use <asm-generic/int-*.h> for the blackfin architecture H. Peter Anvin
2008-04-24 23:05                   ` H. Peter Anvin
2008-04-24 23:05                     ` [PATCH 06/24] cris: types: use <asm-generic/int-*.h> for the cris architecture H. Peter Anvin
2008-04-24 23:05                       ` H. Peter Anvin
2008-04-24 23:05                         ` [PATCH 07/24] frv: types: use <asm-generic/int-*.h> for the frv architecture H. Peter Anvin
2008-04-24 23:05                           ` H. Peter Anvin
2008-04-24 23:05                             ` [PATCH 08/24] h8300: types: use <asm-generic/int-*.h> for the h8300 architecture H. Peter Anvin
2008-04-24 23:05                               ` H. Peter Anvin
2008-04-24 23:05                                 ` [PATCH 09/24] ia64: types: use <asm-generic/int-*.h> for the ia64 architecture H. Peter Anvin
2008-04-24 23:05                                   ` H. Peter Anvin
2008-04-24 23:05                                     ` [PATCH 10/24] m32r: types: use <asm-generic/int-*.h> for the m32r architecture H. Peter Anvin
2008-04-24 23:05                                       ` H. Peter Anvin
2008-04-24 23:05                                         ` [PATCH 11/24] m68k: types: use <asm-generic/int-*.h> for the m68k architecture H. Peter Anvin
2008-04-24 23:05                                           ` H. Peter Anvin
2008-04-24 23:05                                             ` [PATCH 12/24] mips: types: use <asm-generic/int-*.h> for the mips architecture H. Peter Anvin
2008-04-24 23:05                                               ` H. Peter Anvin
2008-04-24 23:05                                                 ` [PATCH 13/24] mn10300: types: use <asm-generic/int-*.h> for the mn10300 architecture H. Peter Anvin
2008-04-24 23:05                                                   ` H. Peter Anvin
2008-04-24 23:05                                                     ` [PATCH 14/24] parisc: types: use <asm-generic/int-*.h> for the parisc architecture H. Peter Anvin
2008-04-24 23:05                                                       ` H. Peter Anvin
2008-04-24 23:05                                                         ` [PATCH 15/24] powerpc: types: use <asm-generic/int-*.h> for the powerpc architecture H. Peter Anvin
2008-04-24 23:05                                                           ` H. Peter Anvin
2008-04-24 23:05                                                             ` [PATCH 16/24] s390: types: use <asm-generic/int-*.h> for the s390 architecture H. Peter Anvin
2008-04-24 23:05                                                               ` H. Peter Anvin
2008-04-24 23:05                                                                 ` [PATCH 17/24] sh: types: use <asm-generic/int-*.h> for the sh architecture H. Peter Anvin
2008-04-24 23:05                                                                   ` H. Peter Anvin
2008-04-24 23:05                                                                     ` [PATCH 18/24] sparc: types: use <asm-generic/int-*.h> for the sparc architecture H. Peter Anvin
2008-04-24 23:05                                                                       ` H. Peter Anvin
2008-04-24 23:05                                                                         ` [PATCH 19/24] sparc64: types: use <asm-generic/int-*.h> for the sparc64 architecture H. Peter Anvin
2008-04-24 23:05                                                                           ` H. Peter Anvin
2008-04-24 23:05                                                                             ` [PATCH 20/24] v850: types: use <asm-generic/int-*.h> for the v850 architecture H. Peter Anvin
2008-04-24 23:05                                                                               ` [PATCH 21/24] x86: types: use <asm-generic/int-*.h> for the x86 architecture H. Peter Anvin
2008-04-24 23:05                                                                                 ` H. Peter Anvin
2008-04-24 23:05                                                                                   ` [PATCH 22/24] xtensa: types: use <asm-generic/int-*.h> for the xtensa architecture H. Peter Anvin
2008-04-24 23:05                                                                                     ` H. Peter Anvin
2008-04-24 23:05                                                                                       ` [PATCH 23/24] types: add C99-style constructors to <asm-generic/int-*.h> H. Peter Anvin
2008-04-24 23:05                                                                                         ` H. Peter Anvin [this message]
2008-04-25  0:44                                                                           ` [PATCH 19/24] sparc64: types: use <asm-generic/int-*.h> for the sparc64 architecture David Miller
2008-04-25  0:44                                                                       ` [PATCH 18/24] sparc: types: use <asm-generic/int-*.h> for the sparc architecture David Miller
2008-04-25  1:37                                   ` [PATCH 09/24] ia64: types: use <asm-generic/int-*.h> for the ia64 architecture Luck, Tony
2008-04-25  3:42                                     ` H. Peter Anvin
2008-04-25  4:10                                     ` [PATCH 24/24] Use U64_C() instead of casts in kernel/time.c H. Peter Anvin
2008-04-25  4:44                                       ` Luck, Tony
2008-04-25  0:14           ` [PATCH 03/24] arm: types: use <asm-generic/int-*.h> for the arm architecture Lennert Buytenhek
2008-04-25 18:27     ` [PATCH 01/24] types: create <asm-generic/int-*.h> Jan Engelhardt
2008-04-25 18:36       ` Linus Torvalds
2008-04-25 18:52         ` Matthew Wilcox
2008-04-25 19:03           ` Linus Torvalds
2008-04-25 19:10           ` H. Peter Anvin
2008-04-25 19:28             ` Matthew Wilcox
2008-04-25 19:38               ` H. Peter Anvin
2008-04-25 19:43                 ` Jan Engelhardt
2008-04-25 19:45                 ` Linus Torvalds
2008-04-25 19:48                   ` H. Peter Anvin
2008-04-25 19:49                   ` Harvey Harrison
2008-04-28 13:55                 ` David Howells
2008-04-25 20:30       ` David Miller
2008-04-25  0:15   ` Lennert Buytenhek
2008-04-25  7:17 ` [PATCH 00/24] Unify integer type definitions, and add fixed type constructor macros Geert Uytterhoeven
2008-04-25  7:49   ` Andreas Schwab
2008-04-25  8:15 ` Arnd Bergmann
2008-04-27 17:44   ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1209078352-7593-46-git-send-email-hpa@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®