1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Make inline __isnan, __isinf_ns, __finite generic.

For code generation to stay identical on x86_64, this requires that
we define the fp word manipulation macros before including the
generic header.
This commit is contained in:
Richard Henderson
2012-03-09 12:38:23 -08:00
parent e79d442ee6
commit 4851a949b4
5 changed files with 111 additions and 40 deletions

View File

@ -76,50 +76,59 @@ do { \
/* Get the more significant 32 bit int from a double. */
#define GET_HIGH_WORD(i,d) \
#ifndef GET_HIGH_WORD
# define GET_HIGH_WORD(i,d) \
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.parts.msw; \
} while (0)
#endif
/* Get the less significant 32 bit int from a double. */
#define GET_LOW_WORD(i,d) \
#ifndef GET_LOW_WORD
# define GET_LOW_WORD(i,d) \
do { \
ieee_double_shape_type gl_u; \
gl_u.value = (d); \
(i) = gl_u.parts.lsw; \
} while (0)
#endif
/* Get all in one, efficient on 64-bit machines. */
#define EXTRACT_WORDS64(i,d) \
#ifndef EXTRACT_WORDS64
# define EXTRACT_WORDS64(i,d) \
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.word; \
} while (0)
#endif
/* Set a double from two 32 bit ints. */
#define INSERT_WORDS(d,ix0,ix1) \
#ifndef INSERT_WORDS
# define INSERT_WORDS(d,ix0,ix1) \
do { \
ieee_double_shape_type iw_u; \
iw_u.parts.msw = (ix0); \
iw_u.parts.lsw = (ix1); \
(d) = iw_u.value; \
} while (0)
#endif
/* Get all in one, efficient on 64-bit machines. */
#define INSERT_WORDS64(d,i) \
#ifndef INSERT_WORDS64
# define INSERT_WORDS64(d,i) \
do { \
ieee_double_shape_type iw_u; \
iw_u.word = (i); \
(d) = iw_u.value; \
} while (0)
#endif
/* Set the more significant 32 bits of a double from an int. */
#ifndef SET_HIGH_WORD
#define SET_HIGH_WORD(d,v) \
do { \
ieee_double_shape_type sh_u; \
@ -127,16 +136,18 @@ do { \
sh_u.parts.msw = (v); \
(d) = sh_u.value; \
} while (0)
#endif
/* Set the less significant 32 bits of a double from an int. */
#define SET_LOW_WORD(d,v) \
#ifndef SET_LOW_WORD
# define SET_LOW_WORD(d,v) \
do { \
ieee_double_shape_type sl_u; \
sl_u.value = (d); \
sl_u.parts.lsw = (v); \
(d) = sl_u.value; \
} while (0)
#endif
/* A union which permits us to convert between a float and a 32 bit
int. */
@ -148,22 +159,24 @@ typedef union
} ieee_float_shape_type;
/* Get a 32 bit int from a float. */
#define GET_FLOAT_WORD(i,d) \
#ifndef GET_FLOAT_WORD
# define GET_FLOAT_WORD(i,d) \
do { \
ieee_float_shape_type gf_u; \
gf_u.value = (d); \
(i) = gf_u.word; \
} while (0)
#endif
/* Set a float from a 32 bit int. */
#define SET_FLOAT_WORD(d,i) \
#ifndef SET_FLOAT_WORD
# define SET_FLOAT_WORD(d,i) \
do { \
ieee_float_shape_type sf_u; \
sf_u.word = (i); \
(d) = sf_u.value; \
} while (0)
#endif
/* Get long double macros from a separate header. */
#include <math_ldbl.h>