From f79473f53a534c7bdf29015a073933cd34df3c0a Mon Sep 17 00:00:00 2001 From: uz Date: Wed, 26 Jan 2011 22:07:59 +0000 Subject: [PATCH] =?utf8?q?Slightly=20improved=20memset=20function=20by=20C?= =?utf8?q?hristian=20Kr=C3=BCger.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit git-svn-id: svn://svn.cc65.org/cc65/trunk@4923 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/common/memset.s | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libsrc/common/memset.s b/libsrc/common/memset.s index fcdbd98bc..6634e8fb7 100644 --- a/libsrc/common/memset.s +++ b/libsrc/common/memset.s @@ -5,7 +5,7 @@ ; ; Ullrich von Bassewitz, 29.05.1998 ; Performance increase (about 20%) by -; Christian Krueger, 12.09.2009 +; Christian Krueger, 12.09.2009, slightly improved 12.01.2011 ; ; NOTE: bzero will return it's first argument as memset does. It is no problem ; to declare the return value as void, since it may be ignored. _bzero @@ -81,15 +81,13 @@ L1: .repeat 2 ; Unroll this a bit to make it faster ; Set the remaining bytes if any L2: ldy ptr3 ; Get the low byte of n - bne L3 ; something to set? - jmp popax ; no -> Pop ptr and return as result + beq leave ; something to set? No -> leave -L3a: sta (ptr1),y ; set bytes in low - sta (ptr2),y ; and high section -L3: dey - bne L3a - sta (ptr1),y ; Set remaining byte(s) - sta (ptr2),y +L3: dey + sta (ptr1),y ; set bytes in low + sta (ptr2),y ; and high section + bne L3 ; flags still up to date from dey! +leave: jmp popax ; Pop ptr and return as result -- 2.39.5