BitsSet Function |
Unit
QESBPCSSystem
Declaration
Function BitsSet(const BitList: TESBLongBitList): Byte;
Description
This is also known as the Hamming Weight. Can pass both types of BitList to this.
Parameters |
BitList | BitList to process. |
Category
Memory OperationsImplementation
function BitsSet (const BitList: TESBLongBitList): Byte; asm mov edx, eax // EDX <- BitList xor eax, eax // Clear EAX @@Loop: add edx, edx // "Shift Left" // if no carry then no increment adc eax, 0 // Otherwise Inc EAX (which is the function Result) and edx, edx jnz @@Loop // Loop for all Bits in BitList End; |
|