in reply to Re^2: sprintf %X endianness
in thread sprintf %X endianness
Does above sprintf return 00204110 on non-win32 machines?
No. Because your raw input isn't 00204110 as either big-endian or little-endian:
$raw = "\1\24\2\0";; $local = unpack 'L>', $raw;; printf "%08x\n", $local;; 01140200 $local = unpack 'L<', $raw;; printf "%08x\n", $local;; 00021401
I don't know of any machine that would represent that hex value with your input bit pattern.
In fact, I would say it was impossible, because it would mean that the nybbles of the 3rd byte (and only the 3rd byte) would be reversed; and no machine does that!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: sprintf %X endianness
by Anonymous Monk on May 14, 2013 at 22:46 UTC | |
by BrowserUk (Patriarch) on May 14, 2013 at 23:23 UTC | |
by Anonymous Monk on May 15, 2013 at 02:01 UTC | |
by BrowserUk (Patriarch) on May 15, 2013 at 02:43 UTC | |
by Anonymous Monk on May 15, 2013 at 03:10 UTC | |
|