From: uz Date: Mon, 2 Nov 2009 22:31:32 +0000 (+0000) Subject: Do not use a separate byte for an END opcode, instead place the bit into the X-Git-Tag: V2.13.1~96 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6078953baaa24a3b53167d4ae0af5e48439a4bf5;p=cc65 Do not use a separate byte for an END opcode, instead place the bit into the previous opcode. This saves one byte per character with the exception of characters without a vector representation, where we loose one byte, because we need to add a dummy vector just to apply our END bit. git-svn-id: svn://svn.cc65.org/cc65/trunk@4433 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/chrcvt/main.c b/src/chrcvt/main.c index 4629ecfa1..8b402655b 100644 --- a/src/chrcvt/main.c +++ b/src/chrcvt/main.c @@ -238,7 +238,13 @@ static void ConvertChar (StrBuf* Data, const unsigned char* Buf) case 0x0000: /* End */ - SB_AppendChar (Data, 0x80); + if (SB_IsEmpty (Data)) { + /* No ops. We need to add an empty one */ + SB_AppendChar (Data, 0x00); + SB_AppendChar (Data, 0x00); + } + /* Add an end marker to the last op in the buffer */ + SB_GetBuf (Data)[SB_GetLen (Data) - 2] |= 0x80; return; case 0x0080: