16 lines
183 B
NASM
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
|