1. Sebastian Freundt
  2. uterus

Commits

Sebastian Freundt  committed ed440cf Merge

Merge branch 'next'

* next:
chore, define htooe*() in terms of le*toh or be*toh if defined and endianness implies a swap

  • Participants
  • Parent commits d9b5e0a, e289d71
  • Branches master
  • Tags v0.2.4

Comments (0)

Files changed (1)

File src/boobs.h

View file
 # define htooe16(x)	__bswap_16(x)
 #elif defined __swap16
 # define htooe16(x)	__swap16(x)
+#elif defined WORDS_BIGENDIAN && defined le16toh
+# define htooe16(x)	le16toh(x)
+#elif !defined WORDS_BIGENDIAN && defined be16toh
+# define htooe16(x)	be16toh(x)
 #else
 # warning htooe16() will not convert anything
 # define htooe16(x)	(x)
 # define htooe32(x)	__bswap_32(x)
 #elif defined __swap32
 # define htooe32(x)	__swap32(x)
+#elif defined WORDS_BIGENDIAN && defined le32toh
+# define htooe32(x)	le32toh(x)
+#elif !defined WORDS_BIGENDIAN && defined be32toh
+# define htooe32(x)	be32toh(x)
 #else
 # warning htooe32() will not convert anything
 # define htooe32(x)	(x)
 # define htooe64(x)	__bswap_64(x)
 #elif defined __swap64
 # define htooe64(x)	__swap64(x)
+#elif defined WORDS_BIGENDIAN && defined le64toh
+# define htooe64(x)	le64toh(x)
+#elif !defined WORDS_BIGENDIAN && defined be64toh
+# define htooe64(x)	be64toh(x)
 #else
 # warning htooe64() will not convert anything
 # define htooe64(x)	(x)