]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
riscv: byteorder: add test for big-endian
authorBen Dooks <ben.dooks@codethink.co.uk>
Fri, 13 Jun 2025 16:12:58 +0000 (17:12 +0100)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Thu, 3 Jul 2025 10:10:50 +0000 (18:10 +0800)
Test for big-endian either via __RISCVEB__ which migth be
rather old, or check the BYTE_ORDER if the compiler defines
it (which should be any modern gcc like v12)

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
arch/riscv/include/asm/byteorder.h

index d26ac5688fa5dad442145649e48bc501863a54e9..3140c1f585e9b8c3b3dad54589e3e6541947fe2f 100644 (file)
@@ -26,7 +26,7 @@
 #  define __SWAB_64_THRU_32__
 #endif
 
-#ifdef __RISCVEB__
+#if  defined(__RISCVEB__) || (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
 #include <linux/byteorder/big_endian.h>
 #else
 #include <linux/byteorder/little_endian.h>