Skip to content

Commit 7ff2ef5

Browse files
[libc] optimize __isupper and __islower
1 parent e2fe112 commit 7ff2ef5

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

src/libc/islower.src

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ _islower:
77
ex (sp),hl
88
push de
99
ld a,l
10-
or a,a
10+
sub a,97
11+
add a,-26
1112
sbc hl,hl
12-
cp a,97
13-
ret c
14-
cp a,122+1
15-
ret nc
16-
inc l
13+
inc hl
1714
ret

src/libc/isupper.src

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,8 @@ _isupper:
77
ex (sp),hl
88
push de
99
ld a,l
10-
or a,a
10+
sub a,65
11+
add a,-26
1112
sbc hl,hl
12-
cp a,65
13-
ret c
14-
cp a,90+1
15-
ret nc
16-
inc l
13+
inc hl
1714
ret
18-

0 commit comments

Comments
 (0)