Re: duplicated modulo
"Michal Nazarewicz" <[email protected]> Fri, 01 Apr 2011 13:20:28 +0200
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <op.vs9a4ecl3l0zgt@mnazarewicz-glaptop> |
On Fri, 01 Apr 2011 12:19:16 +0200, Nicolas Kaiser <[email protected]> wrote: > * "Michal Nazarewicz" <[email protected]>: >> On Fri, 01 Apr 2011 11:41:13 +0200, Nicolas Kaiser wrote: >> > I'm curious: a duplicated modulo operation can't possibly make >> > any difference, can it? >> > >> > diff -u -p ./arch/powerpc/platforms/powermac/nvram.c >> > /tmp/nothing/arch/powerpc/platforms/powermac/nvram.c >> > --- ./arch/powerpc/platforms/powermac/nvram.c 2011-03-31 >> > 09:52:41.674292401 +0200 >> > +++ /tmp/nothing/arch/powerpc/platforms/powermac/nvram.c >> > @@ -246,7 +246,6 @@ static u32 core99_calc_adler(u8 *buffer) >> > high = 0; >> > for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) { >> > if ((cnt % 5000) == 0) { >> > - high %= 65521UL; >> > high %= 65521UL; >> > } >> > low += buffer[cnt]; >> >> It's not just a module. It's also an assignment. > > Sure. But I fail to see where between > > a %= b; > a %= b; > > and > > a = (a % b) % b; > > and > > a %= b; > > would be a difference? Ah, sorry, you are right. I should stop responding to mail just after waking up. -- Best regards, _ _ .o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o ..o | Computer Science, Michal "mina86" Nazarewicz (o o) ooo +-----<email/xmpp: [email protected]>-----ooO--(_)--Ooo--