"Tino Wildenhain" wrote:
>This is what I meant by "jumping through hoops".
byte1 byte2? this does not look very practical
to me. In the simplest form of storing
your values in a text string, you could just
use ord() to get the byte value and
operate on it with 1<<0 1<<1 1<<3 and so on.
If you want, put a module in which defines the
constants
bit1=1<<0
bit2=1<<1
and so on and use it via
if byte & bit1: ...
>Sure, one could for instance make a list of eight-entry lists:
more efficiently for operations on really big
bit strings is probably just using integers.
io = [[b0,b1,b2,b3,b4,b5,b6,b7], ]
Then the hoop jumping goes in the opposite
direction - to get hold of an actual byte, you
have to rotate the bits into some byte one at a
time.
This approach has the advantage that you can
add a ninth "dirty" bit to indicate that the "byte"
in question needs to be written out.
Is there not some OO way of hiding this
bit banging complexity?
Using getters and setters? - I tend to go "tilt"
like a cheap slot machine when I read that stuff.
- Hendrik
--
Reality is the bane of the sane