util: Cleanup util/compiler.h

Remove MESA_*_ENDIAN
Use UTIL_ARCH_*_ENDIAN to define CPU_TO_LE32

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19646>
This commit is contained in:
Yonggang Luo 2022-11-10 16:01:35 +08:00 committed by Marge Bot
parent 6e8229c45a
commit 6eb2512fab

View file

@ -37,15 +37,15 @@
#include <assert.h>
#include "util/macros.h"
#include "util/u_endian.h"
/**
* Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
* Define CPU_TO_LE32
* Do not use these unless absolutely necessary!
* Try to use a runtime test instead.
* For now, only used by some DRI hardware drivers for color/texel packing.
*/
#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
#if UTIL_ARCH_BIG_ENDIAN
#if defined(__linux__)
#include <byteswap.h>
#define CPU_TO_LE32( x ) bswap_32( x )
@ -59,10 +59,8 @@
#include <sys/endian.h>
#define CPU_TO_LE32( x ) bswap32( x )
#endif /*__linux__*/
#define MESA_BIG_ENDIAN 1
#else
#define CPU_TO_LE32( x ) ( x )
#define MESA_LITTLE_ENDIAN 1
#endif
#define LE32_TO_CPU( x ) CPU_TO_LE32( x )