Article View: comp.arch
Article #13600Re: Optimization vs. the programmer
From: desj
Date: Sat, 11 Apr 1987 22:24
Date: Sat, 11 Apr 1987 22:24
11 lines
1164 bytes
1164 bytes
In article <3300003@uiucdcsm> grunwald@uiucdcsm.cs.uiuc.edu writes:
>
>Strength reduction is replacement of operations such as "i = j * 8" by
>"i = j << 3", or "i = j % 8" by "i = j & 0x3" (if j is unsigned).
^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
I'm sure you mean "i = j & 0x7". But, more importantly, this is the
right remainder to compute even if j is signed (assuming two's-complement,
of course). It's too bad more people (especially hardware designers!)
don't realize this.
-- David desJardins
Technical Details
Message-ID:
<3135@jade.BERKELEY.EDU>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!jade!brahms!desjReferences:
<479@danews.ATT.COM> <3300003@uiucdcsm>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ucbcad!ucbvax!jade!brahms!desj From: desj@brahms.UUCP Newsgroups: comp.arch Subject: Re: Optimization vs. the programmer Message-ID: <3135@jade.BERKELEY.EDU> Date: Sat, 11-Apr-87 17:24:04 EST Article-I.D.: jade.3135 Posted: Sat Apr 11 17:24:04 1987 Date-Received: Sun, 12-Apr-87 19:49:25 EST References: <479@danews.ATT.COM> <3300003@uiucdcsm> Sender: usenet@jade.BERKELEY.EDU Reply-To: desj@brahms.Berkeley.EDU (David desJardins) Organization: UC Berkeley Math Dept [IN EXILE] Lines: 11