aboutsummaryrefslogtreecommitdiffhomepage
path: root/endian.h
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-03-02 17:52:57 +0100
committerlemon <lsof@mailbox.org>2026-03-02 17:52:57 +0100
commitf2285400e65dafe730a073b3ca92494d72c7295b (patch)
treed5a96f09fbd0402ada3c39165a9d2d8202ee8e5d /endian.h
parenta498f851ef2f50c9b8ac47e238137af52b54057d (diff)
add bswap16/32/64
- frontend: __builtin_bswapX intrinsics - backend: ObswapX instructions
Diffstat (limited to 'endian.h')
-rw-r--r--endian.h5
1 files changed, 3 insertions, 2 deletions
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;
}