Skip to content

Commit 45c7141

Browse files
committed
optimized carry in strcspn/strpbrk
1 parent 96942a2 commit 45c7141

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/libc/strcspn.src

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,15 @@ __strcspn_strpbrk_common:
3131
ld c, a
3232
cpir
3333
sbc hl, hl
34-
scf
3534
sbc hl, bc ; Always sets carry
3635
ex (sp), hl
37-
pop iy ; IY = strlen(reject)
36+
pop iy ; IY = strlen(reject) + 1
3837
dec hl ; HL = reject - 1
3938
push de
4039
.loop:
4140
ld a, (de) ; A = *str++
4241
inc de
43-
lea bc, iy + 1 ; BC = strlen(reject) + 1
42+
lea bc, iy ; BC = strlen(reject) + 1
4443
add hl, bc ; HL = reject + strlen(reject)
4544
cpdr ; Find A in reject, including null terminator
4645
jr nz, .loop ; Loop if no match

0 commit comments

Comments
 (0)