Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2023 23:45:56 GMT
From:      Piotr Kubaj <pkubaj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fd774e065c5d - main - gdtoa: fix endianness issue on powerpc64le
Message-ID:  <202306282345.35SNjuKG030103@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/src/commit/?id=fd774e065c5d4df1f708a33139bf820ac8bfb7a7

commit fd774e065c5d4df1f708a33139bf820ac8bfb7a7
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-06-28 23:41:56 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-06-28 23:45:50 +0000

    gdtoa: fix endianness issue on powerpc64le
    
    The current code assumes running on big-endian, which causes issues with
    e.g. strtod() as reported on https://github.com/ocaml/ocaml/pull/10837#issuecomment-1605346422
    This is probably a leftover from when powerpc64le was introduced.
    
    Approved by:    jhibbits (on IRC)
---
 lib/libc/powerpc64/gd_qnan.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lib/libc/powerpc64/gd_qnan.h b/lib/libc/powerpc64/gd_qnan.h
index d70d8c318c4c..8ce5594b81b1 100644
--- a/lib/libc/powerpc64/gd_qnan.h
+++ b/lib/libc/powerpc64/gd_qnan.h
@@ -8,6 +8,19 @@
  */
 
 #define f_QNAN 0x7fc00000
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define d_QNAN0 0x0
+#define d_QNAN1 0x7ff80000
+#define ld_QNAN0 0x0
+#define ld_QNAN1 0x7ff80000
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x0
+#define ldus_QNAN0 0x0
+#define ldus_QNAN1 0x0
+#define ldus_QNAN2 0x0
+#define ldus_QNAN3 0x7ff8
+#define ldus_QNAN4 0x0
+#else
 #define d_QNAN0 0x7ff80000
 #define d_QNAN1 0x0
 #define ld_QNAN0 0x7ff80000
@@ -19,3 +32,4 @@
 #define ldus_QNAN2 0x0
 #define ldus_QNAN3 0x0
 #define ldus_QNAN4 0x0
+#endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306282345.35SNjuKG030103>