From: mert0407 AT sable DOT ox DOT ac DOT uk (George Foot) Newsgroups: comp.os.msdos.djgpp Subject: Re: (none) Date: 10 Jul 1997 20:52:30 GMT Organization: Oxford University, England Lines: 28 Message-ID: <5q3i2e$rff@news.ox.ac.uk> References: NNTP-Posting-Host: sable.ox.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Chirayu Krishnappa (chirayu AT poboxes DOT com) (chirayu AT giasbga DOT vsnl DOT net DOT in) wrote: : i need to find out if a 4 byte (default) integer has an even number of 1's : in its binary representation or not. I need to operate on 15Mb data and do : it fast. shifts (<<) and & is quite slow. is there some lib. function to : do this? what is the fastest way to get it done? I don't know how fast it would be, but I think XORing them all together would be pretty fast: int get_parity(int *buffer,int bufsize) { int a,b,c; a=0; for (b=0;b>=1; } return c; } I expect inline assembler is probably the fastest way though. -- George Foot Merton College, Oxford