mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
defs: use C++ min/max when compiling in C++ mode
This commit is contained in:
parent
1272a6a71a
commit
d3b29c50e6
1 changed files with 6 additions and 0 deletions
|
@ -14,6 +14,11 @@
|
||||||
#define GAUTOTYPE __auto_type
|
#define GAUTOTYPE __auto_type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#include <algorithm>
|
||||||
|
using std::min;
|
||||||
|
using std::max;
|
||||||
|
#else
|
||||||
/* min(), max() (without double evaluation) */
|
/* min(), max() (without double evaluation) */
|
||||||
#define min(a, b) ({ \
|
#define min(a, b) ({ \
|
||||||
GAUTOTYPE _a = (a); \
|
GAUTOTYPE _a = (a); \
|
||||||
|
@ -25,6 +30,7 @@
|
||||||
GAUTOTYPE _b = (b); \
|
GAUTOTYPE _b = (b); \
|
||||||
_a > _b ? _a : _b; \
|
_a > _b ? _a : _b; \
|
||||||
})
|
})
|
||||||
|
#endif
|
||||||
|
|
||||||
/* sgn() (without double evaluation) */
|
/* sgn() (without double evaluation) */
|
||||||
#define sgn(s) ({ \
|
#define sgn(s) ({ \
|
||||||
|
|
Loading…
Reference in a new issue