From 833702e25fa0eb8a5f9da7855658919dfdd9f110 Mon Sep 17 00:00:00 2001 From: cuz Date: Mon, 18 Aug 2003 11:25:31 +0000 Subject: [PATCH] Speed optimization git-svn-id: svn://svn.cc65.org/cc65/trunk@2362 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/strncpy.s | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libsrc/common/strncpy.s b/libsrc/common/strncpy.s index 564814599..21de3a159 100644 --- a/libsrc/common/strncpy.s +++ b/libsrc/common/strncpy.s @@ -42,19 +42,21 @@ L2: lda (ptr1),y ; Copy one character inc ptr2+1 ; Bump high bytes bne L1 ; Branch always -; Fill the remaining bytes. +; Fill the remaining bytes. -L3: inx - bne L4 - inc tmp2 - beq L9 - -L4: sta (ptr2),y -L5: iny +L3: inx ; Counter low byte + beq L6 ; Branch on overflow +L4: sta (ptr2),y ; Clear one byte +L5: iny ; Bump pointer bne L3 inc ptr2+1 ; Bump high byte bne L3 ; Branch always +; Bump the counter high byte + +L6: inc tmp2 + bne L4 + ; Done, return dest L9: lda ptr2 ; Get low byte -- 2.39.5