2014-10-22 11:45:02 +00:00
|
|
|
; unsigned long __cdecl _lrotr(unsigned long val, int rotate_count)
|
2014-11-05 17:20:02 +00:00
|
|
|
__lrotr proc
|
2014-10-22 11:45:02 +00:00
|
|
|
@@val = dword ptr (cPtrSize + 2)
|
|
|
|
@@rotate_count = word ptr (cPtrSize + 2 + 4)
|
|
|
|
|
|
|
|
push bp
|
|
|
|
mov bp, sp
|
|
|
|
push si
|
|
|
|
push di
|
|
|
|
mov ax, word ptr [bp+@@val]
|
|
|
|
mov dx, word ptr [bp+@@val+2]
|
|
|
|
mov cx, [bp+@@rotate_count]
|
|
|
|
and cx, 1Fh
|
|
|
|
jz short @@Rotated
|
|
|
|
|
|
|
|
@@Rotating:
|
|
|
|
mov bx, dx
|
|
|
|
shr bx, 1
|
|
|
|
rcr ax, 1
|
|
|
|
rcr dx, 1
|
|
|
|
loop @@Rotating
|
|
|
|
|
|
|
|
@@Rotated:
|
|
|
|
pop di
|
|
|
|
pop si
|
|
|
|
pop bp
|
|
|
|
ret
|
|
|
|
__lrotr endp
|