From cf00cc00bc53ab26b23b810b4bfbdfb43262538a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 24 Aug 2009 18:05:48 -0700 Subject: 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. --- math/math_private.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'math') 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 +#include #include /* 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) \ -- cgit v1.2.3