| delorie.com/archives/browse.cgi | search |
| From: | ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Allegro ex11.c |
| Date: | 16 Feb 1998 09:18:05 GMT |
| Organization: | The National Capital FreeNet |
| Lines: | 22 |
| Message-ID: | <6c908d$1mj@freenet-news.carleton.ca> |
| References: | <34DF7294 DOT 21D0 AT home DOT com> <34e39746 DOT 1884750 AT news DOT compusmart DOT ab DOT ca> <34E7EFA0 DOT 6DF9E92 AT alcyone DOT com> |
| Reply-To: | ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire) |
| NNTP-Posting-Host: | freenet3.carleton.ca |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |