summaryrefslogtreecommitdiff
path: root/libc/string/sh64
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2005-12-14 02:33:36 +0000
committerEric Andersen <andersen@codepoet.org>2005-12-14 02:33:36 +0000
commit7635b30f9d62e33b057d830780a937c6c1d140f5 (patch)
tree9991bb6bc9f6233ed784521c588cf9e90c8520b3 /libc/string/sh64
parentf32600208f4e9db972eb47f7d4959994b31199e6 (diff)
Fixup byte order handling. Not all architectures define __BIG_ENDIAN__ so i.e.
on big endian mips the code is compiled as little-endian and the wrong half of the 64-bit point value is examined to check for NaN, etc. This bug also broke fpclassify(), isfinite(), isnormal(), isinf(), finite(), and signbit().
Diffstat (limited to 'libc/string/sh64')
-rw-r--r--libc/string/sh64/memset.S4
-rw-r--r--libc/string/sh64/strcpy.S6
2 files changed, 7 insertions, 3 deletions
diff --git a/libc/string/sh64/memset.S b/libc/string/sh64/memset.S
index e1679230b..d87879717 100644
--- a/libc/string/sh64/memset.S
+++ b/libc/string/sh64/memset.S
@@ -9,7 +9,9 @@
! Copyright 2002 SuperH Ltd.
!
-#ifdef __LITTLE_ENDIAN__
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
#define SHHI shlld
#define SHLO shlrd
#else
diff --git a/libc/string/sh64/strcpy.S b/libc/string/sh64/strcpy.S
index faa071c50..f662cc859 100644
--- a/libc/string/sh64/strcpy.S
+++ b/libc/string/sh64/strcpy.S
@@ -6,7 +6,9 @@
!
! SH5 code Copyright 2002 SuperH Ltd.
-#ifdef __LITTLE_ENDIAN__
+#include <endian.h>
+
+#if __BYTE_ORDER == __LITTLE_ENDIAN
#define SHHI shlld
#define SHLO shlrd
#else
@@ -67,7 +69,7 @@ no_lddst:
add r5, r63, r4
addi r0, 8, r0
shortstring:
-#ifndef __LITTLE_ENDIAN__
+#if __BYTE_ORDER != __LITTLE_ENDIAN
pta/l shortstring2,tr1
byterev r4,r4
#endif