
Chapter 7 131
Programming Examples
1. Binary Search for Highest Bit Position
;
; if extracted bit is zero, fall thru and keep assumption
; else make conclusion
;
EXTRU,= %arg0,0,1,%r0 ; check next bit
ADDI -1,%ret0,%ret0 ; next higher power of 2
B,N tally
all_zeros
LDI -1,%ret0
tally
.LEAVE
.PROCEND