initial commit
[glibc.git] / sysdeps / generic / libm-alias-float.h
1 /* Define aliases for libm float functions.
2 Copyright (C) 2017-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4
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.
9
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.
14
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/>. */
18
19 #ifndef _LIBM_ALIAS_FLOAT_H
20 #define _LIBM_ALIAS_FLOAT_H
21
22 #include <bits/floatn.h>
23
24 /* Define _FloatN / _FloatNx aliases for a float libm function that
25 has internal name FROM ## f ## R and public names TO ## suffix ## R
26 for each suffix of a supported _FloatN / _FloatNx floating-point
27 type with the same format as float. */
28 #if __HAVE_FLOAT32 && !__HAVE_DISTINCT_FLOAT32
29 # define libm_alias_float_other_r(from, to, r) \
30 weak_alias (from ## f ## r, to ## f32 ## r)
31 #else
32 # define libm_alias_float_other_r(from, to, r)
33 #endif
34
35 /* Likewise, but without the R suffix. */
36 #define libm_alias_float_other(from, to) \
37 libm_alias_float_other_r (from, to, )
38
39 /* Define aliases for a float libm function that has internal name
40 FROM ## f ## R and public names TO ## suffix ## R for each suffix
41 of a supported floating-point type with the same format as float.
42 This should only be used for functions where such public names
43 exist for _FloatN types, not for implementation-namespace exported
44 names (where there is one name per format, not per type) or for
45 obsolescent functions not provided for _FloatN types. */
46 #define libm_alias_float_r(from, to, r) \
47 weak_alias (from ## f ## r, to ## f ## r); \
48 libm_alias_float_other_r (from, to, r)
49
50 /* Likewise, but without the R suffix. */
51 #define libm_alias_float(from, to) libm_alias_float_r (from, to, )
52
53 #endif