gallium/util: Add macros for converting from little endian to CPU byte order.

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
Michel Dänzer 2011-11-02 18:21:48 +01:00 committed by Michel Dänzer
parent 29e2bc8b13
commit 4a3be16fd2

View 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.
*/