some obvious optimizations
This commit is contained in:
@@ -627,16 +627,15 @@ RTL
|
||||
; caller is responsible for setting 8-bit mode and preserving X and Y
|
||||
;--------------------------------------------------------------------------------
|
||||
CountBits:
|
||||
PHB : PHK : PLB
|
||||
TAX ; Save a copy of value
|
||||
LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||
TAY ; And save <7:4> in Y
|
||||
TXA ; Recover value
|
||||
AND.b #$07 ; Put out <2:0> in X
|
||||
TAX ; And save in X
|
||||
LDA NybbleBitCounts, Y; Fetch count for Y
|
||||
ADC.l NybbleBitCounts, X; Add count for X & C
|
||||
PLB
|
||||
TAX ; Save a copy of value
|
||||
LSR #4 ; Shift down hi nybble, Leave <3> in C
|
||||
TAY ; And save <7:4> in Y
|
||||
TXA ; Recover value
|
||||
AND.b #$07 ; Put out <2:0> in X
|
||||
TAX ; And save in X
|
||||
LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
|
||||
TYX ; get <7:4>
|
||||
ADC.l NybbleBitCounts, X ; Add count for Y & C
|
||||
RTL
|
||||
|
||||
; Look up table of bit counts in the values $00-$0F
|
||||
|
||||
Reference in New Issue
Block a user