summaryrefslogtreecommitdiffstats
path: root/modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch
blob: b4374fc948eb3cab8c05a7a101e7ab82e92a5d35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
diff --git a/math_private.h b/math_private.h
--- a/math_private.h
+++ b/math_private.h
@@ -14,52 +14,38 @@
  * $FreeBSD$
  */
 
 #ifndef _MATH_PRIVATE_H_
 #define	_MATH_PRIVATE_H_
 
 #include <stdint.h>
 #include <sys/types.h>
-#include <machine/endian.h>
+
+#include "mozilla/EndianUtils.h"
 
 #include "fdlibm.h"
 
 /*
  * The original fdlibm code used statements like:
  *	n0 = ((*(int*)&one)>>29)^1;		* index of high word *
  *	ix0 = *(n0+(int*)&x);			* high word of x *
  *	ix1 = *((1-n0)+(int*)&x);		* low word of x *
  * to dig two 32 bit words out of the 64 bit IEEE floating point
  * value.  That is non-ANSI, and, moreover, the gcc instruction
  * scheduler gets it wrong.  We instead use the following macros.
  * Unlike the original code, we determine the endianness at compile
  * time, not at run time; I don't see much benefit to selecting
  * endianness at run time.
  */
 
-/*
- * A union which permits us to convert between a double and two 32 bit
- * ints.
- */
-
-#ifdef __arm__
-#if defined(__VFP_FP__) || defined(__ARM_EABI__)
-#define	IEEE_WORD_ORDER	BYTE_ORDER
-#else
-#define	IEEE_WORD_ORDER	BIG_ENDIAN
-#endif
-#else /* __arm__ */
-#define	IEEE_WORD_ORDER	BYTE_ORDER
-#endif
-
 /* A union which permits us to convert between a long double and
    four 32 bit ints.  */
 
-#if IEEE_WORD_ORDER == BIG_ENDIAN
+#if MOZ_BIG_ENDIAN()
 
 typedef union
 {
   long double value;
   struct {
     u_int32_t mswhi;
     u_int32_t mswlo;
     u_int32_t lswhi;
@@ -68,17 +54,17 @@ typedef union
   struct {
     u_int64_t msw;
     u_int64_t lsw;
   } parts64;
 } ieee_quad_shape_type;
 
 #endif
 
-#if IEEE_WORD_ORDER == LITTLE_ENDIAN
+#if MOZ_LITTLE_ENDIAN()
 
 typedef union
 {
   long double value;
   struct {
     u_int32_t lswlo;
     u_int32_t lswhi;
     u_int32_t mswlo;
@@ -87,17 +73,17 @@ typedef union
   struct {
     u_int64_t lsw;
     u_int64_t msw;
   } parts64;
 } ieee_quad_shape_type;
 
 #endif
 
-#if IEEE_WORD_ORDER == BIG_ENDIAN
+#if MOZ_BIG_ENDIAN()
 
 typedef union
 {
   double value;
   struct
   {
     u_int32_t msw;
     u_int32_t lsw;
@@ -105,17 +91,17 @@ typedef union
   struct
   {
     u_int64_t w;
   } xparts;
 } ieee_double_shape_type;
 
 #endif
 
-#if IEEE_WORD_ORDER == LITTLE_ENDIAN
+#if MOZ_LITTLE_ENDIAN()
 
 typedef union
 {
   double value;
   struct
   {
     u_int32_t lsw;
     u_int32_t msw;