Re: nibtools, GCR, G64

From: Marko Mäkelä <msmakela_at_gmail.com>
Date: Fri, 31 May 2013 12:18:03 +0300
Message-ID: <20130531091803.GA4079@x220>
On Fri, May 31, 2013 at 10:42:19AM +0200, silverdr@wfmh.org.pl wrote:
>if (*byte0 == 0xff && *byte1 & 0xc0 == 0xc0)	// 8 bits in first byte, 
>2 bits in the second

If you assigned the bytes to local variables and inverted them, you 
could compare against zero, which is implicit in many ISAs (including 
the 6502 and x86) and thus save some instructions.

char b0 = *byte0;
char b1 = *byte1;

if (!b0 && !(b1 & 0xc0)) break;

If this is at least a 16-bit system, you could also assign the two bytes 
to an integer, invert it and write code like this (I guess you can keep 
the loop unrolled):

unsigned mask = (1 << 10) - 1;

if (!(b & mask)) break;
mask <<= 1;
if (!(b & mask)) break;
...

Best regards,

	Marko

       Message was sent through the cbm-hackers mailing list
Received on 2013-05-31 10:00:04

Archive generated by hypermail 2.2.0.