Mesa (7.11): gallium/util: Add macros for converting from little endian to CPU byte order.
Marek Olšák
mareko at kemper.freedesktop.org
Wed Nov 2 21:30:24 UTC 2011
Module: Mesa
Branch: 7.11
Commit: f60e81ecb2a01944b8ac8ece891c2e22a9797c76
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f60e81ecb2a01944b8ac8ece891c2e22a9797c76
Author: Michel Dänzer <michel.daenzer at amd.com>
Date: Wed Nov 2 18:21:48 2011 +0100
gallium/util: Add macros for converting from little endian to CPU byte order.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
(cherry picked from commit 4a3be16fd2d126a84ff2f087f2a2900afa19d235)
---
src/gallium/auxiliary/util/u_math.h | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index 0b52844..50a5b2c 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -548,6 +548,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.
*/
static INLINE uint32_t
More information about the mesa-commit
mailing list