From f2285400e65dafe730a073b3ca92494d72c7295b Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 2 Mar 2026 17:52:57 +0100 Subject: add bswap16/32/64 - frontend: __builtin_bswapX intrinsics - backend: ObswapX instructions --- endian.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'endian.h') diff --git a/endian.h b/endian.h index 08ce78f..34b7721 100644 --- a/endian.h +++ b/endian.h @@ -2,6 +2,7 @@ #define ENDIAN_H_ #include "common.h" +extern bool targ_bigendian; /*** Macros and functions for endian specific memory access ***/ @@ -121,7 +122,7 @@ rd32targ(uchar *p) { uint x; memcpy(&x, p, sizeof x); - if (!hostntarg_sameendian()) x = bswap16(x); + if (!hostntarg_sameendian()) x = bswap32(x); return x; } @@ -130,7 +131,7 @@ rd64targ(uchar *p) { uvlong x; memcpy(&x, p, sizeof x); - if (!hostntarg_sameendian()) x = bswap16(x); + if (!hostntarg_sameendian()) x = bswap64(x); return x; } -- cgit v1.2.3