ReverseBits Routines |
Unit
QESBPCSSystem
Overloaded Variants |
Procedure ReverseBits(var BitList: TESBBitList); |
Procedure ReverseBits(var BitList: TESBLongBitList); |
Declaration
Procedure ReverseBits(var BitList: TESBBitList);
Parameters |
BitList | BitList to process. |
Category
Memory OperationsImplementation
procedure ReverseBits (var BitList: TESBBitList); asm push esi // Preserve ESI mov dx, [eax] // DX <- BitList mov esi, eax // Move addr BitList into ESI mov cx, 16 // 16 iterations needed for a word @@Loop: shr dx, 1 // move least significant bit into CF adc ax, ax // ax := 2 * ax + carry bit dec cx jnz @@Loop mov [esi], ax // AX -> BitList pop esi // Restore ESI End; |
Declaration
Procedure ReverseBits(var BitList: TESBLongBitList);Implementation
procedure ReverseBits (var BitList: TESBLongBitList); asm push esi // Preserve ESI mov dx, [eax] // DX <- BitList mov esi, eax // Move addr BitList into ESI mov cx, 16 // 16 iterations needed for a word @@Loop: shr dx, 1 // move least significant bit into CF adc ax, ax // ax := 2 * ax + carry bit dec cx jnz @@Loop mov [esi], ax // AX -> BitList pop esi // Restore ESI End; |
|