Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: perl bitology - breaking into bytesby Tardis (Pilgrim) |
on Oct 21, 2003 at 04:41 UTC ( [id://300828]=note: print w/replies, xml ) | Need Help?? |
I use a fairly simple method, for some files which I use as indices. It seems fairly efficient. I open the bit file, read in chunks 64K at a time, and use some simple operations to determine 'on' bits. I only care about bytes that have at least one 'on' bit, so this makes things a little easier. Here is some code:
BTW, I had a bad bug with this code initially. Instead of:
I had: I leave it to the reader to discover the evil bug in this code :-)
In Section
Seekers of Perl Wisdom
|
|