Module: Mesa
Branch: master
Commit: 8cee9ce750e7edc6e3b38de09628dba679b3391f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=8cee9ce750e7edc6e3b38de09628dba679b3391f

Author: Jan Beich <[email protected]>
Date:   Wed Oct 21 17:32:02 2020 +0000

spirv: switch to util_bswap32 to improve portability

`bswap_32` and `<byteswap.h>` aren't available on BSDs. Instead the
same function is spelled slightly different and is provided by
different header file. However, Mesa provides `util_bswap32` to avoid
complicated conditionals.

Fixes: fb6b243c113a ("spirv: Support big-endian strings")
Tested-by: Piotr Kubaj <[email protected]>
Reviewed-by: Erik Faye-Lund <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7257>

---

 src/compiler/spirv/spirv_to_nir.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/compiler/spirv/spirv_to_nir.c 
b/src/compiler/spirv/spirv_to_nir.c
index ec976c49506..35e2f551884 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -36,9 +36,6 @@
 #include "util/u_math.h"
 
 #include <stdio.h>
-#if UTIL_ARCH_BIG_ENDIAN
-#include <byteswap.h>
-#endif
 
 void
 vtn_log(struct vtn_builder *b, enum nir_spirv_debug_level level,
@@ -415,7 +412,7 @@ vtn_string_literal(struct vtn_builder *b, const uint32_t 
*words,
    {
       uint32_t *copy = ralloc_array(b, uint32_t, word_count);
       for (unsigned i = 0; i < word_count; i++)
-         copy[i] = bswap_32(words[i]);
+         copy[i] = util_bswap32(words[i]);
       words = copy;
    }
 #endif

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to