Re: Endianness - How to test code for portability

2021-03-13 Thread Patrick Schluter via Digitalmars-d-learn
On Friday, 12 March 2021 at 05:53:40 UTC, Preetpal wrote: In the portability section of the language spec, they talk about endianness (https://dlang.org/spec/portability.html#endianness) which refers "to the order in which multibyte types are stored." IMO if you wanted to actually be sure

Re: Endianness - How to test code for portability

2021-03-12 Thread Preetpal via Digitalmars-d-learn
On Friday, 12 March 2021 at 10:26:55 UTC, Dennis wrote: ``` version(BigEndian) { private enum bigEndian = true; } else { private enum bigEndian = false; } int parse(in ubyte[] data) { if (__ctfe || bigEndian) { // Portable code } else { // Little-endian optimized

Re: Endianness - How to test code for portability

2021-03-12 Thread Dennis via Digitalmars-d-learn
On Friday, 12 March 2021 at 05:53:40 UTC, Preetpal wrote: This is not an important issue to me but I was just curious to see if anyone actually tests for portability issues related to endianness by compiling their D Lang code for a big endian architecture and actually running it on that

Endianness - How to test code for portability

2021-03-11 Thread Preetpal via Digitalmars-d-learn
In the portability section of the language spec, they talk about endianness (https://dlang.org/spec/portability.html#endianness) which refers "to the order in which multibyte types are stored." IMO if you wanted to actually be sure your code is portable across both big endian and little