Use the defines Mesa configure sets to indicate presence of the bswap32
builtins. This lets i965 work on OpenBSD again after the changes that
were made in
0a5d8d9af42fd77fce1492d55f958da97816961a.
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
return (n >> d) | (n << (32 - d));
}
+static inline uint32_t
+bswap32(uint32_t n)
+{
+#if defined(HAVE___BUILTIN_BSWAP32)
+ return __builtin_bswap32(n);
+#else
+ return (n >> 24) |
+ ((n >> 8) & 0x0000ff00) |
+ ((n << 8) & 0x00ff0000) |
+ (n << 24);
+#endif
+}
+
/**
* Copy RGBA to BGRA - swap R and B.
*/
assert(bytes % 4 == 0);
while (bytes >= 4) {
- *d = ror(__builtin_bswap32(*s), 8);
+ *d = ror(bswap32(*s), 8);
d += 1;
s += 1;
bytes -= 4;