From 4c37f12a4d5a35e113a59b9f8299801f616564da Mon Sep 17 00:00:00 2001 From: Polluks Date: Sat, 8 May 2021 18:23:19 +0200 Subject: [PATCH] Optimised strlen --- libsrc/common/strlen.s | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libsrc/common/strlen.s b/libsrc/common/strlen.s index e89039179..8d5bc20fc 100644 --- a/libsrc/common/strlen.s +++ b/libsrc/common/strlen.s @@ -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