Re: nibtools, GCR, G64

From: Pete Rittwage <peter_at_rittwage.com>
Date: Fri, 31 May 2013 08:20:14 -0400 (EDT)
Message-ID: <50501.10.2.0.31.1370002814.squirrel@rittwage.com>
On Fri, May 31, 2013 6:36 am, Marko Mäkelä wrote:
> On Fri, May 31, 2013 at 12:18:03PM +0300, Marko Mäkelä wrote:
>>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;
>>...
>
> I realized an even better way:
>
> const unsigned mask = (1 << 10) - 1;
>
> if (!(b & mask)) break;
> b >>= 1;
> if (!(b & mask)) break;
> b >>= 1;
> ...

Yes, this is the elegant way.  Similar is done in the weak bit
searching/handling.

-Pete


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

Archive generated by hypermail 2.2.0.