netdev
[Top] [All Lists]

Re: MSEC_TO_JIFFIES is messed up...

To: "J. Bruce Fields" <bfields@xxxxxxxxxxxx>
Subject: Re: MSEC_TO_JIFFIES is messed up...
From: Andreas Schwab <schwab@xxxxxxx>
Date: Wed, 12 May 2004 23:55:18 +0200
Cc: Davide Libenzi <davidel@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, Greg KH <greg@xxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>, Netdev <netdev@xxxxxxxxxxx>
In-reply-to: <20040512213913.GA16658@fieldses.org> (J. Bruce Fields's message of "Wed, 12 May 2004 17:39:13 -0400")
References: <20040512020700.6f6aa61f.akpm@osdl.org> <20040512181903.GG13421@kroah.com> <40A26FFA.4030701@pobox.com> <20040512193349.GA14936@elte.hu> <Pine.LNX.4.58.0405121247011.11950@bigblue.dev.mdolabs.com> <20040512200305.GA16078@elte.hu> <Pine.LNX.4.58.0405121400360.11950@bigblue.dev.mdolabs.com> <20040512213913.GA16658@fieldses.org>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)
"J. Bruce Fields" <bfields@xxxxxxxxxxxx> writes:

> If gcc really optimizes that to just the identity function, then surely
> that's a gcc bug?  Multiplication is left-associative, so i * 1000 /
> 1000 = (i * 1000) / 1000, but (i * 1000) should be zero for any i
> divisible by i^(sizeof(int) - 12).

Signed integer overflow is undefined in C, so the compiler is allowed to
assume it does not happen.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


<Prev in Thread] Current Thread [Next in Thread>