ReC98/libs/BorlandC/lrotr.asm

29 lines
471 B
NASM
Raw Normal View History

2014-10-22 11:45:02 +00:00
; unsigned long __cdecl _lrotr(unsigned long val, int rotate_count)
__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