1 /* Manipulation of the bit representation of 'long double' quantities.
2 Copyright (C) 1999-2017 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #define _MATH_LDBL_H_ 1
25 /* A union which permits us to convert between a long double and
26 four 32 bit ints or two 64 bit ints. */
28 #if __FLOAT_WORD_ORDER == __BIG_ENDIAN
40 uint32_t w0
, w1
, w2
, w3
;
42 } ieee854_long_double_shape_type
;
46 #if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
58 uint32_t w3
, w2
, w1
, w0
;
60 } ieee854_long_double_shape_type
;
64 /* Get two 64 bit ints from a long double. */
66 #define GET_LDOUBLE_WORDS64(ix0,ix1,d) \
68 ieee854_long_double_shape_type qw_u; \
70 (ix0) = qw_u.parts64.msw; \
71 (ix1) = qw_u.parts64.lsw; \
74 /* Set a long double from two 64 bit ints. */
76 #define SET_LDOUBLE_WORDS64(d,ix0,ix1) \
78 ieee854_long_double_shape_type qw_u; \
79 qw_u.parts64.msw = (ix0); \
80 qw_u.parts64.lsw = (ix1); \
84 /* Get the more significant 64 bits of a long double mantissa. */
86 #define GET_LDOUBLE_MSW64(v,d) \
88 ieee854_long_double_shape_type sh_u; \
90 (v) = sh_u.parts64.msw; \
93 /* Set the more significant 64 bits of a long double mantissa from an int. */
95 #define SET_LDOUBLE_MSW64(d,v) \
97 ieee854_long_double_shape_type sh_u; \
99 sh_u.parts64.msw = (v); \
103 /* Get the least significant 64 bits of a long double mantissa. */
105 #define GET_LDOUBLE_LSW64(v,d) \
107 ieee854_long_double_shape_type sh_u; \
109 (v) = sh_u.parts64.lsw; \
113 On a platform already supporting a binary128 long double,
114 _Float128 will alias to long double. This transformation
115 makes aliasing *l functions to *f128 trivial.
117 #define _Float128 long double
120 #endif /* math_ldbl.h */