python and bit shifts and byte order, oh my!

Daniel Dittmar daniel.dittmar at sap.corp
Fri Sep 10 04:26:58 EDT 2004


Reid Nichol wrote:
> I played with bit shifts on my PC and tried the same thing on a Mac OS X 
> machine.  They produced the same results, so I would assume that the way 
> the bits and how they are interpreted are as in this link:
> 
> http://www.khakipants.org/archives/2003/03/bitlevel_input_and_output.html
> 
> At least in memory while the interpreter is running.

CPUs differ in the way integers are stored in memory. But the shift 
operators of the CPU are implemented to work on logical integers in 
registers, not on consecutive bytes in memory.

Daniel



More information about the Python-list mailing list