Need elegant way to cast four bytes into a long
skip at pobox.com
Sat Aug 9 19:06:57 CEST 2003
>> You mean like this:
>> l = long(a + a << 8 + a << 16 + a << 24)
John> Bzzzzzt. Oh the joys of operator precedence!
Yeah, I realized that after seeing a couple other responses. Should have
kept my mouth shut. I tend to think of << and >> as X2 and /2 operators and
thus mentally lump them together with * / and %. Fortunately, I don't do
much bit twiddling or I'd be in real trouble...
More information about the Python-list