summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-08-24 18:05:48 -0700
committerUlrich Drepper <drepper@redhat.com>2009-08-24 18:05:48 -0700
commitcf00cc00bc53ab26b23b810b4bfbdfb43262538a (patch)
tree3d09caa3ecb83249ccaa5e0f874b9128c1de78e7 /math
parentb42a214c1807dc596cf3647fc35a0eb42ccc7e68 (diff)
Add ceil implementation for 64-bit machines.
On 64-bit machines we should not split doubles into two 32 bit integer and handle the words separately. We have wide registers. This patch implements a 64-bit ceil version. Ideally all other functions will be converted over time.
Diffstat (limited to 'math')
-rw-r--r--math/math_private.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/math/math_private.h b/math/math_private.h
index 129646f8c5..fade7e1181 100644
--- a/math/math_private.h
+++ b/math/math_private.h
@@ -17,6 +17,7 @@
#define _MATH_PRIVATE_H_
#include <endian.h>
+#include <stdint.h>
#include <sys/types.h>
/* The original fdlibm code used statements like:
@@ -43,6 +44,7 @@ typedef union
u_int32_t msw;
u_int32_t lsw;
} parts;
+ uint64_t word;
} ieee_double_shape_type;
#endif
@@ -57,6 +59,7 @@ typedef union
u_int32_t lsw;
u_int32_t msw;
} parts;
+ uint64_t word;
} ieee_double_shape_type;
#endif
@@ -89,6 +92,14 @@ do { \
(i) = gl_u.parts.lsw; \
} while (0)
+/* Get all in one, efficient on 64-bit machines. */
+#define EXTRACT_WORDS64(i,d) \
+do { \
+ ieee_double_shape_type gh_u; \
+ gh_u.value = (d); \
+ (i) = gh_u.word; \
+} while (0)
+
/* Set a double from two 32 bit ints. */
#define INSERT_WORDS(d,ix0,ix1) \
@@ -99,6 +110,14 @@ do { \
(d) = iw_u.value; \
} while (0)
+/* Get all in one, efficient on 64-bit machines. */
+#define INSERT_WORDS64(i,d) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.word = (i); \
+ (d) = iw_u.value; \
+} while (0)
+
/* Set the more significant 32 bits of a double from an int. */
#define SET_HIGH_WORD(d,v) \