summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornia <nia@NetBSD.org>2024-05-04 02:47:08 +0200
committerMarge Bot <emma+marge@anholt.net>2024-06-02 18:41:52 +0000
commitb65036af74bbb5084587d3d5743b8b97292235bc (patch)
tree7ccfd8213785826099ff792aae4099216181f874 /src
parent1f81004bfc32e1200dc2224a73831248f5d38eeb (diff)
Avoid namespace collision: rename bswap_XX to radeon_bswap_XXHEADmaster
xorg-server includes its own bswap_16, bswap_32 etc macros in its misc.h. This is transcluded after radeon.h in some files. If the operating system defines bswap_XX in a way that is unsuitable for a function name (e.g. on NetBSD), this results in build failures. Signed-off-by: Nia Alarie <nia@NetBSD.org> Part-of: <https://gitlab.freedesktop.org/xorg/driver/xf86-video-ati/-/merge_requests/23>
Diffstat (limited to 'src')
-rw-r--r--src/radeon.h25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/radeon.h b/src/radeon.h
index 68d7756a..6d1d21ee 100644
--- a/src/radeon.h
+++ b/src/radeon.h
@@ -125,27 +125,30 @@ RegionDuplicate(RegionPtr pOld)
#if HAVE_BYTESWAP_H
#include <byteswap.h>
+#define radeon_bswap_16 bswap_16
+#define radeon_bswap_32 bswap_32
+#define radeon_bswap_64 bswap_64
#elif defined(USE_SYS_ENDIAN_H)
#include <sys/endian.h>
#else
-#define bswap_16(value) \
+#define radeon_bswap_16(value) \
((((value) & 0xff) << 8) | ((value) >> 8))
-#define bswap_32(value) \
- (((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
- (uint32_t)bswap_16((uint16_t)((value) >> 16)))
+#define radeon_bswap_32(value) \
+ (((uint32_t)radeon_bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
+ (uint32_t)radeon_bswap_16((uint16_t)((value) >> 16)))
-#define bswap_64(value) \
- (((uint64_t)bswap_32((uint32_t)((value) & 0xffffffff)) \
+#define radeon_bswap_64(value) \
+ (((uint64_t)radeon_bswap_32((uint32_t)((value) & 0xffffffff)) \
<< 32) | \
- (uint64_t)bswap_32((uint32_t)((value) >> 32)))
+ (uint64_t)radeon_bswap_32((uint32_t)((value) >> 32)))
#endif
#if X_BYTE_ORDER == X_BIG_ENDIAN
-#define le32_to_cpu(x) bswap_32(x)
-#define le16_to_cpu(x) bswap_16(x)
-#define cpu_to_le32(x) bswap_32(x)
-#define cpu_to_le16(x) bswap_16(x)
+#define le32_to_cpu(x) radeon_bswap_32(x)
+#define le16_to_cpu(x) radeon_bswap_16(x)
+#define cpu_to_le32(x) radeon_bswap_32(x)
+#define cpu_to_le16(x) radeon_bswap_16(x)
#else
#define le32_to_cpu(x) (x)
#define le16_to_cpu(x) (x)