diff options
author | Michel Dänzer <[email protected]> | 2011-11-02 18:21:48 +0100 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2011-11-02 18:24:09 +0100 |
commit | 4a3be16fd2d126a84ff2f087f2a2900afa19d235 (patch) | |
tree | 719521cdf09fa51ee402199e97237b2cd4176636 /src/gallium/auxiliary | |
parent | 29e2bc8b13be0f7ec48f8514e47322353e041365 (diff) |
gallium/util: Add macros for converting from little endian to CPU byte order.
Signed-off-by: Michel Dänzer <[email protected]>
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | 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 c74c1da7675..b9295f4f85c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -574,6 +574,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 |