1
0
mirror of https://github.com/cc65/cc65.git synced 2024-07-05 21:29:03 +00:00

Squeezed out a few bytes

git-svn-id: svn://svn.cc65.org/cc65/trunk@3039 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2004-05-13 23:01:53 +00:00
parent bfdfd83fde
commit 57851eda12

View File

@ -207,15 +207,26 @@ static void AssignInt (void)
*/ */
{ {
if (!NoAssign) { if (!NoAssign) {
/* Get the next argument pointer */
void* P = va_arg (ap, void*);
/* Assign to the converted value */ /* Get the next argument pointer */
if (IsLong) { __AX__ = (unsigned) va_arg (ap, void*);
*(long*)P = IntVal;
} else { /* Store the argument pointer into ptr1 */
*(int*)P = (int) IntVal; asm ("sta ptr1");
} asm ("stx ptr1+1");
/* Get the number of bytes-1 to copy */
asm ("ldy #3");
asm ("lda %v", IsLong);
asm ("bne L1");
asm ("ldy #1");
/* Assign the integer value */
asm ("L1: lda %v,y", IntVal);
asm ("sta (ptr1),y");
asm ("dey");
asm ("bpl L1");
} }
} }
@ -343,11 +354,11 @@ FlagsDone:
case 'i': case 'i':
/* Optionally signed integer with a base */ /* Optionally signed integer with a base */
SkipWhite (); SkipWhite ();
ReadSign (); ReadSign ();
if (C == '0') { if (C == '0') {
ReadChar (); ReadChar ();
switch (C) { switch (C) {
case 'x': case 'x':
case 'X': case 'X':
Base = 16; Base = 16;
ReadChar(); ReadChar();
@ -396,11 +407,11 @@ FlagsDone:
break; break;
case 's': case 's':
/* Whitespace terminated string */ /* Whitespace terminated string */
SkipWhite (); SkipWhite ();
if (!NoAssign) { if (!NoAssign) {
S = va_arg (ap, char*); S = va_arg (ap, char*);
} }
while (!isspace (C) && Width--) { while (!isspace (C) && Width--) {
if (!NoAssign) { if (!NoAssign) {
*S++ = C; *S++ = C;
@ -433,7 +444,7 @@ FlagsDone:
} }
} }
++Conversions; ++Conversions;
break; break;
case '[': case '[':
/* String using characters from a set */ /* String using characters from a set */
@ -502,11 +513,11 @@ FlagsDone:
} }
} }
++Conversions; ++Conversions;
break; break;
case 'p': case 'p':
/* Pointer, format is 0xABCD */ /* Pointer, format is 0xABCD */
SkipWhite (); SkipWhite ();
if (C != '0') { if (C != '0') {
longjmp (JumpBuf, RC_NOCONV); longjmp (JumpBuf, RC_NOCONV);
} }