mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 22:30:12 +00:00
Optimised strlen
This commit is contained in:
parent
3ea330f15f
commit
4c37f12a4d
@ -5,17 +5,27 @@
|
||||
; the usage of only ptr2 here! Keep in mind when appling changes
|
||||
; and check the other implementations too!
|
||||
;
|
||||
; int strlen (const char* s);
|
||||
; size_t __fastcall__ strlen (const char* s);
|
||||
;
|
||||
|
||||
.export _strlen
|
||||
.importzp ptr2
|
||||
.macpack cpu
|
||||
|
||||
_strlen:
|
||||
sta ptr2 ; Save s
|
||||
stx ptr2+1
|
||||
.if (.cpu .bitand ::CPU_ISET_HUC6280)
|
||||
clx
|
||||
cly
|
||||
.else
|
||||
ldx #0 ; YX used as counter
|
||||
.if (.cpu .bitand ::CPU_ISET_65816)
|
||||
txy
|
||||
.else
|
||||
ldy #0
|
||||
.endif
|
||||
.endif
|
||||
|
||||
L1: lda (ptr2),y
|
||||
beq L9
|
||||
|
Loading…
Reference in New Issue
Block a user