Mercurial > sdl-ios-xcode
annotate src/libm/math_private.h @ 5134:7b7da52e8775
Fixed spacing
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 01 Feb 2011 08:59:22 -0800 |
parents | c2539ff054c8 |
children |
rev | line source |
---|---|
2756
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 * ==================================================== |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 * |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 * Developed at SunPro, a Sun Microsystems, Inc. business. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 * Permission to use, copy, modify, and distribute this |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 * software is freely granted, provided that this notice |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 * is preserved. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 * ==================================================== |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 /* |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 * from: @(#)fdlibm.h 5.1 93/09/24 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 * $Id: math_private.h,v 1.3 2004/02/09 07:10:38 andersen Exp $ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 #ifndef _MATH_PRIVATE_H_ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 #define _MATH_PRIVATE_H_ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 /*#include <endian.h>*/ |
4909
fd40b483d489
Use SDL endian macros in libm.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
2760
diff
changeset
|
21 #include "SDL_endian.h" |
5088
c2539ff054c8
Fixed compiling on Windows Mobile SDK 5.0 with Visual Studio 2008
Sam Lantinga <slouken@libsdl.org>
parents:
4909
diff
changeset
|
22 /*#include <sys/types.h>*/ |
2756
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #define attribute_hidden |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 #define libm_hidden_proto(x) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 #define libm_hidden_def(x) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
2760
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2756
diff
changeset
|
28 typedef unsigned int u_int32_t; |
02aa80d7905f
Updated Visual C++ build
Sam Lantinga <slouken@libsdl.org>
parents:
2756
diff
changeset
|
29 |
2756
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 /* The original fdlibm code used statements like: |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 n0 = ((*(int*)&one)>>29)^1; * index of high word * |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 ix0 = *(n0+(int*)&x); * high word of x * |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 ix1 = *((1-n0)+(int*)&x); * low word of x * |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 to dig two 32 bit words out of the 64 bit IEEE floating point |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 value. That is non-ANSI, and, moreover, the gcc instruction |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 scheduler gets it wrong. We instead use the following macros. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 Unlike the original code, we determine the endianness at compile |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 time, not at run time; I don't see much benefit to selecting |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 endianness at run time. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 /* A union which permits us to convert between a double and two 32 bit |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 ints. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 /* |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 * Math on arm is special: |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 * For FPA, float words are always big-endian. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 * For VFP, floats words follow the memory system mode. |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
4909
fd40b483d489
Use SDL endian macros in libm.
Daniel Wyatt <Daniel.Wyatt@gmail.com>
parents:
2760
diff
changeset
|
50 #if (SDL_BYTEORDER == SDL_BIG_ENDIAN) |
2756
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 typedef union |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 { |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 double value; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 struct |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 { |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 u_int32_t msw; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 u_int32_t lsw; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 } parts; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } ieee_double_shape_type; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 #else |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 typedef union |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 { |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 double value; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 struct |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 { |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 u_int32_t lsw; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 u_int32_t msw; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 } parts; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 } ieee_double_shape_type; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 #endif |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 /* Get two 32 bit ints from a double. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 #define EXTRACT_WORDS(ix0,ix1,d) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 ieee_double_shape_type ew_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 ew_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 (ix0) = ew_u.parts.msw; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 (ix1) = ew_u.parts.lsw; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 /* Get the more significant 32 bit int from a double. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 #define GET_HIGH_WORD(i,d) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 ieee_double_shape_type gh_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 gh_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 (i) = gh_u.parts.msw; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 /* Get the less significant 32 bit int from a double. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 #define GET_LOW_WORD(i,d) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 ieee_double_shape_type gl_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 gl_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 (i) = gl_u.parts.lsw; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 /* Set a double from two 32 bit ints. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 #define INSERT_WORDS(d,ix0,ix1) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 ieee_double_shape_type iw_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 iw_u.parts.msw = (ix0); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 iw_u.parts.lsw = (ix1); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 (d) = iw_u.value; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 /* Set the more significant 32 bits of a double from an int. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 #define SET_HIGH_WORD(d,v) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 ieee_double_shape_type sh_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 sh_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 sh_u.parts.msw = (v); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 (d) = sh_u.value; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 /* Set the less significant 32 bits of a double from an int. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 #define SET_LOW_WORD(d,v) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 ieee_double_shape_type sl_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 sl_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 sl_u.parts.lsw = (v); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 (d) = sl_u.value; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 /* A union which permits us to convert between a float and a 32 bit |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 int. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 typedef union |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 { |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 float value; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 u_int32_t word; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 } ieee_float_shape_type; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 /* Get a 32 bit int from a float. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 #define GET_FLOAT_WORD(i,d) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 ieee_float_shape_type gf_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 gf_u.value = (d); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 (i) = gf_u.word; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 /* Set a float from a 32 bit int. */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 #define SET_FLOAT_WORD(d,i) \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 do { \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 ieee_float_shape_type sf_u; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 sf_u.word = (i); \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 (d) = sf_u.value; \ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 } while (0) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 /* ieee style elementary functions */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 extern double |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 __ieee754_sqrt(double) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 extern double __ieee754_acos(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 extern double __ieee754_acosh(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 extern double __ieee754_log(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 extern double __ieee754_atanh(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 extern double __ieee754_asin(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 extern double __ieee754_atan2(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 extern double __ieee754_exp(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 extern double __ieee754_cosh(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 extern double __ieee754_fmod(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 extern double __ieee754_pow(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 extern double __ieee754_lgamma_r(double, int *) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 extern double __ieee754_gamma_r(double, int *) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 extern double __ieee754_lgamma(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 extern double __ieee754_gamma(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 extern double __ieee754_log10(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 extern double __ieee754_sinh(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 extern double __ieee754_hypot(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 extern double __ieee754_j0(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 extern double __ieee754_j1(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 extern double __ieee754_y0(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 extern double __ieee754_y1(double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 extern double __ieee754_jn(int, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 extern double __ieee754_yn(int, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 extern double __ieee754_remainder(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 extern int __ieee754_rem_pio2(double, double *) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 #if defined(_SCALB_INT) |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 extern double __ieee754_scalb(double, int) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 #else |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 extern double __ieee754_scalb(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 #endif |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 /* fdlibm kernel function */ |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 #ifndef _IEEE_LIBM |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 extern double __kernel_standard(double, double, int) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 #endif |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 extern double __kernel_sin(double, double, int) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 extern double __kernel_cos(double, double) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 extern double __kernel_tan(double, double, int) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 extern int __kernel_rem_pio2(double *, double *, int, int, int, |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 const int *) attribute_hidden; |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 |
a98604b691c8
Expanded the libm support and put it into a separate directory.
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 #endif /* _MATH_PRIVATE_H_ */ |