From 4a3be16fd2d126a84ff2f087f2a2900afa19d235 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michel=20D=C3=A4nzer?= Date: Wed, 2 Nov 2011 18:21:48 +0100 Subject: [PATCH] gallium/util: Add macros for converting from little endian to CPU byte order. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michel Dänzer Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/util/u_math.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index c74c1da7675..b9295f4f85c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -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. */ -- 2.30.2