Re: Q: Fast computation of parity
From: Tom St Denis (tomstdenis_at_iahu.ca)
Date: 12/31/03
- Next message: Jean-Luc Cooke: "Re: Delivering on talk"
- Previous message: Tom St Denis: "Re: ANNOUNCE: SHA-224 in Digest::SHA"
- In reply to: Foo Bar: "Re: Q: Fast computation of parity"
- Next in thread: Michael J. Fromberger: "Re: Q: Fast computation of parity"
- Reply: Michael J. Fromberger: "Re: Q: Fast computation of parity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 31 Dec 2003 14:25:06 GMT
"Foo Bar" <foobar965@hotmail.com> wrote in message
news:YkwIb.40486$mU6.150890@newsb.telia.net...
> "Tom St Denis" <tomstdenis@iahu.ca> writes:
>
> > "Foo Bar" <foobar965@hotmail.com> wrote in message
> > news:CViIb.44244$dP1.176220@newsc.telia.net...
> > > Mok-Kong Shen <mok-kong.shen@t-online.de> writes:
> > >
> > > > Could someone please give an optimized C code to get the
> > > > parity of bits in a 32-bit word? Could xor-ing the bytes
> > > > and then using a lookup table be a good idea? Thanks.
> > >
> >
> <SNIP xor-and-shift based code>
> >
> > My guess is on any decent modern processor Gregs is faster.
>
> Try it. I think you'll be surprised.
Actually no I wasn't.
$ ./pars
Greg: 5513474
Xor: 11888907
y = 1048576
Greg's method is 2.15 times faster on my Athlon. Not surprised.
Tom
- Next message: Jean-Luc Cooke: "Re: Delivering on talk"
- Previous message: Tom St Denis: "Re: ANNOUNCE: SHA-224 in Digest::SHA"
- In reply to: Foo Bar: "Re: Q: Fast computation of parity"
- Next in thread: Michael J. Fromberger: "Re: Q: Fast computation of parity"
- Reply: Michael J. Fromberger: "Re: Q: Fast computation of parity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]