gallium/util: Add macros for converting from little endian to CPU byte order.
authorMichel Dänzer <michel.daenzer@amd.com>
Wed, 2 Nov 2011 17:21:48 +0000 (18:21 +0100)
committerMichel Dänzer <michel@daenzer.net>
Wed, 2 Nov 2011 17:24:09 +0000 (18:24 +0100)
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/util/u_math.h

index c74c1da76754915fce872238d40beaa571a3a403..b9295f4f85cb2f3424e2b98ec56e786b63049e4a 100644 (file)
@@ -573,6 +573,19 @@ util_bitcount(unsigned n)
 }
 
 
+/**
+ * Convert from little endian to CPU byte order.
+ */
+
+#ifdef PIPE_ARCH_BIG_ENDIAN
+#define util_le32_to_cpu(x) util_bswap32(x)
+#define util_le16_to_cpu(x) util_bswap16(x)
+#else
+#define util_le32_to_cpu(x) (x)
+#define util_le16_to_cpu(x) (x)
+#endif
+
+
 /**
  * Reverse byte order of a 32 bit word.
  */