Mail Archives: djgpp/1998/02/17/07:44:16
Erik Max Francis (max AT alcyone DOT com) writes:
> x%n is the same as x&(n - 1), when n is a power of 2.
>
> Bitwise operations are much, much faster than integer division operators
> (/, %).
I sincerely hope GCC's optimizer is smart enough to silently use a
bitshift when optimizing
int x;
...
y = x % 8;
for instance.
--
.*. Friendship, companionship, love, and having fun are the reasons for
-() < life. All else; sex, money, fame, etc.; are just to get/express these.
`*' Send any and all mail with attachments to the hotmail address please.
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca pgd73 AT hotmail DOT com
- Raw text -