Debian Codegraph @

modules/fdlibm/patches/06_use_mfbt_endian_h_in_math_private_h.patch

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