elf: Make glibc.rtld.enable_secure ignore alias environment variables
[glibc.git] / sysdeps / ieee754 / ldbl-128 / math_ldbl.h
blob231c73b37a8f30cfe976658076ae44fa0ab79d73
1 /* Manipulation of the bit representation of 'long double' quantities.
2 Copyright (C) 1999-2024 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 <https://www.gnu.org/licenses/>. */
19 #ifndef _MATH_LDBL_H_
20 #define _MATH_LDBL_H_ 1
22 #include <stdint.h>
23 #include <endian.h>
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
30 typedef union
32 long double value;
33 struct
35 uint64_t msw;
36 uint64_t lsw;
37 } parts64;
38 struct
40 uint32_t w0, w1, w2, w3;
41 } parts32;
42 } ieee854_long_double_shape_type;
44 #endif
46 #if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
48 typedef union
50 long double value;
51 struct
53 uint64_t lsw;
54 uint64_t msw;
55 } parts64;
56 struct
58 uint32_t w3, w2, w1, w0;
59 } parts32;
60 } ieee854_long_double_shape_type;
62 #endif
64 /* Get two 64 bit ints from a long double. */
66 #define GET_LDOUBLE_WORDS64(ix0,ix1,d) \
67 do { \
68 ieee854_long_double_shape_type qw_u; \
69 qw_u.value = (d); \
70 (ix0) = qw_u.parts64.msw; \
71 (ix1) = qw_u.parts64.lsw; \
72 } while (0)
74 /* Set a long double from two 64 bit ints. */
76 #define SET_LDOUBLE_WORDS64(d,ix0,ix1) \
77 do { \
78 ieee854_long_double_shape_type qw_u; \
79 qw_u.parts64.msw = (ix0); \
80 qw_u.parts64.lsw = (ix1); \
81 (d) = qw_u.value; \
82 } while (0)
84 /* Get the more significant 64 bits of a long double mantissa. */
86 #define GET_LDOUBLE_MSW64(v,d) \
87 do { \
88 ieee854_long_double_shape_type sh_u; \
89 sh_u.value = (d); \
90 (v) = sh_u.parts64.msw; \
91 } while (0)
93 /* Set the more significant 64 bits of a long double mantissa from an int. */
95 #define SET_LDOUBLE_MSW64(d,v) \
96 do { \
97 ieee854_long_double_shape_type sh_u; \
98 sh_u.value = (d); \
99 sh_u.parts64.msw = (v); \
100 (d) = sh_u.value; \
101 } while (0)
103 /* Get the least significant 64 bits of a long double mantissa. */
105 #define GET_LDOUBLE_LSW64(v,d) \
106 do { \
107 ieee854_long_double_shape_type sh_u; \
108 sh_u.value = (d); \
109 (v) = sh_u.parts64.lsw; \
110 } while (0)
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
118 #define L(x) x##L
120 #endif /* math_ldbl.h */