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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.