summaryrefslogtreecommitdiffstats
path: root/lib/msun/src
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2011-10-15 04:22:55 +0000
committerdas <das@FreeBSD.org>2011-10-15 04:22:55 +0000
commitd52547cd89a3789c9c46868a6c50dc4d4227c902 (patch)
treefb042125194360c6083870c0c68f6760d967879e /lib/msun/src
parentd8a1d878136d970d8e35ce2e72416ac02c251c95 (diff)
downloadFreeBSD-src-d52547cd89a3789c9c46868a6c50dc4d4227c902.zip
FreeBSD-src-d52547cd89a3789c9c46868a6c50dc4d4227c902.tar.gz
Add INSERT_WORD64 and EXTRACT_WORD64 macros for use in s_fma.c.
Diffstat (limited to 'lib/msun/src')
-rw-r--r--lib/msun/src/math_private.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/msun/src/math_private.h b/lib/msun/src/math_private.h
index d79f808..fd6f141 100644
--- a/lib/msun/src/math_private.h
+++ b/lib/msun/src/math_private.h
@@ -58,6 +58,10 @@ typedef union
u_int32_t msw;
u_int32_t lsw;
} parts;
+ struct
+ {
+ u_int64_t w;
+ } xparts;
} ieee_double_shape_type;
#endif
@@ -72,6 +76,10 @@ typedef union
u_int32_t lsw;
u_int32_t msw;
} parts;
+ struct
+ {
+ u_int64_t w;
+ } xparts;
} ieee_double_shape_type;
#endif
@@ -86,6 +94,14 @@ do { \
(ix1) = ew_u.parts.lsw; \
} while (0)
+/* Get a 64-bit int from a double. */
+#define EXTRACT_WORD64(ix,d) \
+do { \
+ ieee_double_shape_type ew_u; \
+ ew_u.value = (d); \
+ (ix) = ew_u.xparts.w; \
+} while (0)
+
/* Get the more significant 32 bit int from a double. */
#define GET_HIGH_WORD(i,d) \
@@ -114,6 +130,14 @@ do { \
(d) = iw_u.value; \
} while (0)
+/* Set a double from a 64-bit int. */
+#define INSERT_WORD64(d,ix) \
+do { \
+ ieee_double_shape_type iw_u; \
+ iw_u.xparts.w = (ix); \
+ (d) = iw_u.value; \
+} while (0)
+
/* Set the more significant 32 bits of a double from an int. */
#define SET_HIGH_WORD(d,v) \
OpenPOWER on IntegriCloud