rdos/lib/log2.asm
2020-03-01 12:03:35 +00:00

16 lines
183 B
NASM

; Calculate dual logarithm (int)
; IN AX number
; OUT AX dual logarithm
log2:
push cx
mov cx, 15
.loop:
rcl ax, 1
jc .ret
loop .loop
.ret:
cmc
mov ax, cx
pop cx
ret