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