Skip to content

Commit a13c2d7

Browse files
committed
merged llshru into llshrs. This saves 4 bytes and 3F by turning jp into jr
1 parent fc0ab8f commit a13c2d7

File tree

2 files changed

+26
-23
lines changed

2 files changed

+26
-23
lines changed

src/crt/llshrs.src

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
section .text
44

5+
public __llshru
6+
7+
__llshru:
8+
; Suboptimal for large shift amounts
9+
push af
10+
push iy
11+
ld iy, 0
12+
add iy, sp
13+
ld a, (iy + 9)
14+
or a, a
15+
jr z, __llshr_common.finish
16+
push de
17+
push hl
18+
srl b
19+
jr __llshr_common.hijack_llshru
20+
21+
section .text
22+
523
public __llshrs
624

725
__llshrs:
@@ -12,12 +30,17 @@ __llshrs:
1230
add iy, sp
1331
ld a, (iy + 9)
1432
or a, a
15-
jr z, .finish
33+
jr z, __llshr_common.finish
1634
push de
1735
push hl
36+
37+
section .text
38+
39+
private __llshr_common
40+
__llshr_common:
1841
.loop:
1942
sra b
20-
public __llshrs.hijack_llshru
43+
private __llshr_common.hijack_llshru
2144
.hijack_llshru:
2245
rr c
2346
rr (iy - 1)
@@ -36,7 +59,7 @@ __llshrs:
3659
ld l, e
3760
ld h, d
3861
pop de
39-
public __llshrs.finish
62+
private __llshr_common.finish
4063
.finish:
4164
pop iy
4265
pop af

src/crt/llshru.src

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)