flat assembler
Message board for the users of flat assembler.
Index
> Main > Fast Bitset in block of data |
Author |
|
omegicus 26 Mar 2015, 21:21
My draft version is (in my code i need to CLEAR bit in 0xFFFFFFF-filled array, not set);
Code: align 4 clearBit: ; esi: data, ecx: index of byte pushad mov eax, ecx ; shr eax, 3 ; /8 add esi, eax shl eax, 3 ; *8 sub ecx, eax ; mov eax, 0xFFFFFF7F dec ecx ; needed in my code only shr eax, cl and byte[esi], al ; popad ret also set bit should be: Code: align 4 setBit: ; esi: data, ecx: index of byte pushad mov eax, ecx ; shr eax, 3 ; /8 add esi, eax shl eax, 3 ; *8 sub ecx, eax ; mov eax, 0xFFFFFF80 dec ecx ; needed in my code only shr eax, cl or byte[esi], al ; popad ret This functions sets bits in linear-style, left-to-right, not in x86 specific low-order bitwise... so setting insex 0 will produce 1000000... real data... With Revolution code: Code: align 4 clearBit_RevolutionMod: ; esi: data, ecx: index of byte pushad mov eax, ecx ; shr eax, 3 ; /8 add esi, eax shl eax, 3 ; *8 sub ecx, eax ; xor ecx, 7 bts byte[esi],ecx ; popad ret Last edited by omegicus on 27 Mar 2015, 07:51; edited 3 times in total |
|||
26 Mar 2015, 21:21 |
|
revolution 26 Mar 2015, 23:26
What about this?
Code: xor ecx,7 bts byte[esi],ecx |
|||
26 Mar 2015, 23:26 |
|
omegicus 26 Mar 2015, 23:34
puted modified code in 1'st post
|
|||
26 Mar 2015, 23:34 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.