File tree Expand file tree Collapse file tree 9 files changed +85
-82
lines changed Expand file tree Collapse file tree 9 files changed +85
-82
lines changed Original file line number Diff line number Diff line change 1+ #ifndef _CXX_ABS_H
2+ #define _CXX_ABS_H
3+
4+ #include < __stdlib_abs.h>
5+ #include < __math_abs.h>
6+
7+ #pragma clang system_header
8+
9+ // https://cplusplus.github.io/LWG/issue2192
10+
11+ namespace std {
12+ using ::abs;
13+
14+ inline constexpr long abs (long __x) { return labs (__x); }
15+
16+ #ifdef __SIZEOF_INT48__
17+ inline signed __int48 abs (signed __int48 __x) { return i48abs (__x); }
18+ #endif // __SIZEOF_INT48__
19+
20+ inline constexpr long long abs (long long __x) { return llabs (__x); }
21+
22+ inline constexpr float abs (float __x) { return fabsf (__x); }
23+
24+ inline constexpr double abs (double __x) { return fabs (__x); }
25+
26+ inline constexpr long double abs (long double __x) { return fabsl (__x); }
27+
28+ } // namespace std
29+
30+ #endif /* _CXX_ABS_H */
Original file line number Diff line number Diff line change 1+ #ifndef _MATH_ABS_H
2+ #define _MATH_ABS_H
3+
4+ #include <cdefs.h>
5+
6+ __BEGIN_DECLS
7+
8+ float fabsf (float );
9+
10+ double fabs (double );
11+
12+ long double fabsl (long double );
13+
14+ __END_DECLS
15+
16+ #endif /* _MATH_ABS_H */
Original file line number Diff line number Diff line change 33
44#include <cdefs.h>
55#include <stdbool.h>
6+ #include <__math_abs.h>
7+
8+ #ifdef __cplusplus
9+ #include <__cxx_abs.h>
10+ #endif /* __cplusplus */
611
712#define NAN __builtin_nanf("")
813#define INFINITY __builtin_inff()
3742typedef float float_t ;
3843typedef double double_t ;
3944
40- #ifdef __cplusplus
41- extern "C" {
42- #endif
45+ __BEGIN_DECLS
4346
4447int _fpclassifyf (float ) __NOEXCEPT_CONST ;
4548int _fpclassifyl (long double ) __NOEXCEPT_CONST ;
@@ -141,13 +144,6 @@ double expm1(double);
141144float expm1f (float );
142145long double expm1l (long double );
143146
144- #ifndef _ABS_FLOAT_DEFINED
145- #define _ABS_FLOAT_DEFINED
146- double fabs (double );
147- float fabsf (float );
148- long double fabsl (long double );
149- #endif /* _ABS_FLOAT_DEFINED */
150-
151147double fdim (double , double );
152148float fdimf (float , float );
153149long double fdiml (long double , long double );
@@ -328,8 +324,6 @@ double trunc(double);
328324float truncf (float );
329325long double truncl (long double );
330326
331- #ifdef __cplusplus
332- }
333- #endif
327+ __END_DECLS
334328
335329#endif /* _MATH_DEF_H */
Original file line number Diff line number Diff line change 1+ #ifndef _STDLIB_ABS_H
2+ #define _STDLIB_ABS_H
3+
4+ #include <cdefs.h>
5+
6+ __BEGIN_DECLS
7+
8+ int abs (int );
9+
10+ long labs (long );
11+
12+ #ifdef __SIZEOF_INT48__
13+ signed __int48 i48abs (signed __int48 n ) __NOEXCEPT_CONST ;
14+ #endif /* __SIZEOF_INT48__ */
15+
16+ long long llabs (long long );
17+
18+ __END_DECLS
19+
20+ #endif /* _STDLIB_ABS_H */
Original file line number Diff line number Diff line change 44#include <cdefs.h>
55#include <stdint.h>
66
7+ #ifdef __cplusplus
8+ #include <__cxx_abs.h>
9+ #endif /* __cplusplus */
10+
711#define PRId8 __INT8_FMTd__
812#define PRIi8 __INT8_FMTi__
913#define PRIo8 __UINT8_FMTo__
Original file line number Diff line number Diff line change 22#define _STDLIB_H
33
44#include <cdefs.h>
5+ #include <__stdlib_abs.h>
6+
7+ #ifdef __cplusplus
8+ #include <__cxx_abs.h>
9+ #endif /* __cplusplus */
510
611typedef struct {
712 int quot ;
@@ -100,19 +105,6 @@ void quick_exit(int) __NOEXCEPT __attribute__((noreturn));
100105
101106void _Exit (int ) __NOEXCEPT __attribute__((noreturn ));
102107
103- #ifndef _ABS_INT_DEFINED
104- #define _ABS_INT_DEFINED
105-
106- int abs (int n );
107- long labs (long n );
108- long long llabs (long long n );
109-
110- #ifdef __SIZEOF_INT48__
111- signed __int48 i48abs (signed __int48 n ) __NOEXCEPT_CONST ;
112- #endif /* __SIZEOF_INT48__ */
113-
114- #endif /* _ABS_INT_DEFINED */
115-
116108div_t div (int numer , int denom );
117109
118110ldiv_t ldiv (long numer , long denom );
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 44
55#include < __math_def.h>
66#include < __cmath_type_traits>
7- #include < __abs_overloads>
87
98#pragma clang system_header
109
Original file line number Diff line number Diff line change 33#define _EZCXX_CSTDLIB
44
55#include < stdlib.h>
6- #include < __abs_overloads>
76
87#pragma clang system_header
98
@@ -41,6 +40,9 @@ using ::_Exit;
4140
4241using ::labs;
4342using ::llabs;
43+ #ifdef __SIZEOF_INT48__
44+ using ::i48abs;
45+ #endif // __SIZEOF_INT48__
4446
4547using ::div;
4648using ::ldiv;
You can’t perform that action at this time.
0 commit comments