Two Birds with One Stone

Thomas H{meenaho thomas at kuling.UUCP
Sat Dec 21 12:34:44 AEST 1985


In article <874 at dataioDataio.UUCP> bright at dataio.UUCP (Walter Bright writes:
>Almost but not quite true. A compiler CANNOT normally replace a divide
>by a right-shift if it is an integer divide. This is because a right
>shift of a negative integer is not the same as a divide.


However most useable processors provide arithmetic shifts which will give
the right result even if it is a signed divide.
-- 
Thomas Hameenaho, Dept. of Computer Science, Uppsala University, Sweden
Phone: +46 18 138650
UUCP: thomas at kuling.UUCP (...!{seismo,mcvax}!enea!kuling!thomas)



More information about the Comp.lang.c mailing list