[haiku-commits] Re: haiku: hrev53410 - in headers/posix: . sys

  • From: "Adrien Destugues" <pulkomandy@xxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 27 Aug 2019 12:13:10 +0000

27 août 2019 13:46 "Jessica Hamilton" <jessica.l.hamilton@xxxxxxxxx> a écrit:

On Tue., 27 Aug. 2019, 23:12 Stephan Aßmus, <superstippi@xxxxxx> wrote:

Am 27.08.2019 um 12:02 schrieb Adrien Destugues:
#if defined(__HAIKU_LITTLE_ENDIAN)
# define LITTLE_ENDIAN 1234
-# define BIG_ENDIAN 0
+# define BIG_ENDIAN 4321
# define BYTE_ORDER LITTLE_ENDIAN
#elif defined(__HAIKU_BIG_ENDIAN)
# define BIG_ENDIAN 4321
-# define LITTLE_ENDIAN 0
+# define LITTLE_ENDIAN 1234
# define BYTE_ORDER BIG_ENDIAN
#endif

But now BIG_ENDIAN and LITTLE_ENDIAN are defined to the exact same thing
in both cases. Is this intentional?

Yes, this got merged without that fixed up.

According to the Gerrit dicussion and the glibc/FreeBSD/... code linked there, 
this is what happens on other platforms as well.

glibc documents it this way:


  23 /* Definitions for byte order, according to significance of bytes,
  24    from low addresses to high addresses.  The value is what you get by
  25    putting '4' in the most significant byte, '3' in the second most
  26    significant byte, '2' in the second least significant byte, and '1'
  27    in the least significant byte, and then writing down one digit for
  28    each byte, starting with the byte at the lowest address at the left,
  29    and proceeding to the byte with the highest address at the right.  */

We could move the definitions outside of the #if, since they are indeed 
constants now.
This was indeed mentionned in the Gerrit comments, but I did not notice it.

-- 
Adrien.


Other related posts: