On 05/03/2016 18:03, Bart wrote:
Hi,

Does FreePascal have a routine for counting bits?
So that e.g. BitCount(%1001100100001) gives 5 (number of bits that are 1)?

I came up with (extracted from IntToBin()):

Have a look at
http://stackoverflow.com/questions/3815165/how-to-implement-bitcount-using-only-bitwise-operators
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to