rdos/lib/log2.asm

16 lines
183 B
NASM
Raw Normal View History

2019-10-08 19:54:39 +02:00
; Calculate dual logarithm (int)
; IN AX number
; OUT AX dual logarithm
log2:
push cx
mov cx, 15
2019-10-08 19:54:39 +02:00
.loop:
rcl ax, 1
jc .ret
loop .loop
.ret:
cmc
mov ax, cx
2019-10-08 19:54:39 +02:00
pop cx
ret