Mail Archives: djgpp/2001/10/12/05:34:16
Tomasz Bywalec <bywale-t AT zszosw DOT petex DOT com DOT pl> wrote:
> 2. a<<4.
> And here is my first question: will the result be 0x23 0x40
> (0x2340) on first and 0x41 0x20 (0x2041) on second machine (just
> contents of memory were shifted) or byte-order doesn't mean, and the
> result will be always 0x2340 (0x23 0x40 on first and 0x40 0x23 on
> second).
No. The results of C operators are defined based on *values*, not bit
patterns. I.e. " << 4" is required to do exactly the same as " * 16".
Endianness doesn't change that.
> 3. Some boolean-logic operation: for example a & 0xFF00 - will it be
> always 0x1200 or 0x1200 on first and 0x3400 on second machine?
The FF of 0xFF will always end up in the same place as the 0x12 of
0x1234, by definition. So again, no endianness problem.
> 4. And now really fool question - 0x12 0x34 and 0x34 0x12 - which one
> is big-endian and which is little-endian. According to Ralph Brown's
> Interrupt List Glossary the first one is big-endian,
Correct. The meaning comes from "Gulliver's Travels", where the giants
had a religious war about whether to crack open an egg at the big end
or the little end of it. I.e. 'big-endian' means: big end first.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -