union {
int16_t w;
int8_t b[2];
} chimera.
chimera x;
x.w = 0x100;
tes x.b[0]t
> On Feb 4, 2024, at 11:48, David McClain <[email protected]> wrote:
>
> #x100 will generally do it for me, for the past 50 years. Reads back as a
> 2-byte stream as 00 01 on little-endian, and 01 00 on big-endian.
>
> But yes, ARM is like Intel, little endian.
>
> - DM
>
>> On Feb 4, 2024, at 10:03, Marco Antoniotti <[email protected]>
>> wrote:
>>
>> Hello everybody,
>>
>> I am in a rabbit hole (don't ask!), and I need to drag some other people
>> with me.
>>
>> What is the consensus about the most portable way to detect the endianness
>> of a machine/platform? (Ok, we can assume that while running on an ARM the
>> endianness is "fixed" by the OS)
>>
>> All the best
>>
>> MA
>>
>> --
>> Marco Antoniotti, Professor tel. +39 - 02 64 48 79 01
>> DISCo, Università Milano Bicocca U14 2043 http://dcb.disco.unimib.it
>> <http://dcb.disco.unimib.it/>
>> Viale Sarca 336
>> I-20126 Milan (MI) ITALY
>