Optimization ideas?
; esi = source

; edi = destination
; ecx = number of bits to copy
; ebx = source bit position
; edx = destination bit position
putbits:
mov eax,edx
shr eax,03h
add edi,eax
and edx,07h
.next: btr [edi],edx
bt [esi],ebx
jnc .noset
bts [edi],edx
.noset: inc ebx
inc edx
cmp ebx,20h
jb @F
xor ebx,ebx
inc esi
@@: cmp edx,20h
jb @F
xor edx,edx
inc edi
@@: loop .next
retn


I am not sure it even works correctly...
Posted on 2004-01-20 23:34:01 by comrade
Thank you KaliPara on EFnet #asm:
; esi = source

; edi = destination
; ecx = number of bits to copy
; ebx = source bit position
; edx = destination bit position
putbits:
.next: btr [edi],edx
bt [esi],ebx
jnc .noset
bts [edi],edx
.noset: inc ebx
inc edx
loop .next
retn
Posted on 2004-01-21 00:07:30 by comrade
Untested, and possibly entirely wrong, but how about:


or eax, -1
shl eax, cl

mov cl, dl
rol eax, cl
and [edi], eax
not eax
sub cl, bl

ror eax, cl
and eax, [esi]

sub cl, dl
rol eax, cl
or [edi], eax


Mirno
Posted on 2004-01-21 15:30:15 by Mirno