From: cuz Date: Sun, 2 May 2004 21:01:12 +0000 (+0000) Subject: Optimization X-Git-Tag: V2.12.0~819 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=86b00e81575512451b6b247b03b52924429f299b;p=cc65 Optimization git-svn-id: svn://svn.cc65.org/cc65/trunk@3007 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/libsrc/common/_scanf.c b/libsrc/common/_scanf.c index 8dbe2cb77..490b75329 100644 --- a/libsrc/common/_scanf.c +++ b/libsrc/common/_scanf.c @@ -105,6 +105,20 @@ static unsigned char IsCharInSet (unsigned char C) +static void InvertCharSet (void) +/* Invert the character set */ +{ + asm ("ldy #%b", sizeof (CharSet) - 1); + asm ("L1:"); + asm ("lda %v,y", CharSet); + asm ("eor #$FF"); + asm ("sta %v,y", CharSet); + asm ("dey"); + asm ("bpl L1"); +} + + + /*****************************************************************************/ /* Code */ /*****************************************************************************/ @@ -206,7 +220,7 @@ static void AssignInt (void) -int _scanf (struct indesc* D_, const char* format, va_list ap_) +int _scanf (struct indesc* D_, register const char* format, va_list ap_) /* This is the routine used to do the actual work. It is called from several * types of wrappers to implement the actual ISO xxscanf functions. */ @@ -467,9 +481,7 @@ FlagsDone: /* Invert the set if requested */ if (Invert) { - for (Start = 0; Start < sizeof (CharSet); ++Start) { - CharSet[Start] ^= 0xFF; - } + InvertCharSet (); } /* We have the set in CharSet. Read characters and