[fpc-pascal] Bitcounting

David W Noon dwnoon at spamtrap.ntlworld.com
Sat Mar 5 19:14:38 CET 2016

On Sat, 5 Mar 2016 19:03:24 +0100, Bart (bartjunk64 at gmail.com) wrote
about "[fpc-pascal] Bitcounting" (in
<CAMye31xHge_eGOUAQK7hEgk7by0steko5eN11dKg3DMjYxDZHA at mail.gmail.com>):

> Does FreePascal have a routine for counting bits?
> Surely this can be done better?

If you don't mind a bit of C, attached is what I use. It is blazingly
fast compared to examining each bit.

It uses ASCIIZ strings, but can easily be converted to Pascal and
AnsiStrings (or whatever). However, I'll leave that to you.

Dave  [RLU #314465]
david.w.noon at googlemail.com (David W Noon)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bit_count.h
Type: text/x-chdr
Size: 3023 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160305/16f918c9/attachment.h>

More information about the fpc-pascal mailing list