| www.delorie.com/archives/browse.cgi | search |
| Sender: | nate AT cartsys DOT com |
| Message-ID: | <35BD6187.A151342E@cartsys.com> |
| Date: | Mon, 27 Jul 1998 22:28:39 -0700 |
| From: | Nate Eldredge <nate AT cartsys DOT com> |
| MIME-Version: | 1.0 |
| To: | "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT gov DOT ar> |
| CC: | EDWARD CASHIN <cashin AT pollux DOT cs DOT uga DOT edu>, djgpp AT delorie DOT com |
| Subject: | Re: implementation of modulo operator in djgpp |
| References: | <m0z0rEP-000S4rC AT inti DOT gov DOT ar> |
Salvador Eduardo Tropea (SET) wrote: > > EDWARD CASHIN <cashin AT pollux DOT cs DOT uga DOT edu> wrote: > > ...which begs the question, "How fast is the modulo?" > > and more specifically, how is it implemented? > > Modulo is just the rest of a division. So if last is a variable (not a macro > and not a constant) you'll get a div or idiv and that's sllloooowwww. > But I think you must call gcc with -S to take a look at the generated > assembler ;-) True. Suggested optimization: Make the buffer size a power of 2. Then do: front = (front + 1) & (size - 1); -- Nate Eldredge nate AT cartsys DOT com
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |