mirror of
https://github.com/exoticorn/upkr.git
synced 2026-01-20 11:36:42 +01:00
z80_unpacker: optimisation: -1B in decode_number (fwd 171B / rev 168B)
This commit is contained in:
Binary file not shown.
@@ -187,6 +187,9 @@ int upkr_decode_bit(int context_index) {
|
|||||||
return bit;
|
return bit;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
inc_c_decode_bit:
|
||||||
|
; ++low(context_index) before decode_bit (to get -1B by two calls in decode_number)
|
||||||
|
inc c
|
||||||
decode_bit:
|
decode_bit:
|
||||||
; HL = upkr_state
|
; HL = upkr_state
|
||||||
; IX = upkr_data_ptr
|
; IX = upkr_data_ptr
|
||||||
@@ -298,13 +301,11 @@ decode_number:
|
|||||||
ld de,$7FFF ; length = 0 with positional-stop-bit
|
ld de,$7FFF ; length = 0 with positional-stop-bit
|
||||||
jr .loop_entry
|
jr .loop_entry
|
||||||
.loop:
|
.loop:
|
||||||
inc c ; context_index + 1
|
call inc_c_decode_bit ; context_index + 1
|
||||||
call decode_bit
|
|
||||||
rr d
|
rr d
|
||||||
rr e ; DE = length = (length >> 1) | (bit << 15);
|
rr e ; DE = length = (length >> 1) | (bit << 15);
|
||||||
.loop_entry:
|
.loop_entry:
|
||||||
inc c ; context_index += 2
|
call inc_c_decode_bit ; context_index += 2
|
||||||
call decode_bit
|
|
||||||
jr c,.loop
|
jr c,.loop
|
||||||
.fix_bit_pos:
|
.fix_bit_pos:
|
||||||
ccf ; NC will become this final `| (1 << bit_pos)` bit
|
ccf ; NC will become this final `| (1 << bit_pos)` bit
|
||||||
|
|||||||
Reference in New Issue
Block a user