Related articles |
---|
Java static analysis tool (JavaChecker) has been released ronih@luukku.com (Roni Hursti) (2002-11-17) |
Re: Java static analysis tool (JavaChecker) has been released sander@haldjas.folklore.ee (Sander Vesik) (2002-12-01) |
Re: Java static analysis tool (JavaChecker) has been released joachim_d@gmx.de (Joachim Durchholz) (2002-12-03) |
From: | "Joachim Durchholz" <joachim_d@gmx.de> |
Newsgroups: | comp.compilers |
Date: | 3 Dec 2002 00:42:13 -0500 |
Organization: | Compilers Central |
References: | 02-11-090 02-12-027 |
Keywords: | arithmetic, comment |
Posted-Date: | 03 Dec 2002 00:42:13 EST |
John wrote:
> [Right shifting three bits is not the same as dividing by 8. That's a
> famous optimizer bug from way back. -John]
Is it still a bug if it's an arithmetic shift on a two's complement machine?
One thing that I can think of is how your integer division rounds for
negative numbers: towards zero or towards negative infinity. If it's
towards negative infinity, an arithmetic right shift should handle this
correctly (if I did my math correctly).
Are there other factors?
Regards,
Joachim
[That's the problem. If you know that the dividend is non-negative,
shifting is OK. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.