Uh... big-endian and little-endian are bit orderings. Rather, byte orderings.
On your producing machine, have it output numbers which it thinks has the 32bit value 0x12345678. Look at the individual bytes. On your consuming machine, have it read those bytes. Look at the individual bytes again. Then interpret the bytes as a 32bit number. It needs to be seen as 0x12345678.
It's entirely possible, but doesn't sound like you're dealing with, a bit shifting problem. That's more likely to come up when you are working with a serial port driver where each bit is sent individually without any byte-handling layer. You said the bytes looked right in the debugger.
For us to help you further, you'll have to go an example with those steps, and show us your results.
The two machines have to be in agreement as to whether it's going to write the high byte first, the low byte first, or some other unusual encoding. They have to match for your code to receive the same number.
All versions of Perl are going to use the native ordering at runtime for scalars and various mathematical operations. It's up to your pack/unpack to get it right for any values in serialization.
--
[ e d @ h a l l e y . c c ]
In reply to Re: Re: Re: Bit order
by halley
in thread Bit order
by spoulson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |