Add abs function

This commit is contained in:
Dennis Eichhorn 2022-04-05 17:28:34 +02:00 committed by GitHub
parent 4829158b78
commit 207d3ef978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,10 @@
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#define abs(a) \
({ __typeof__ (a) _a = (a); \
_a > 0 ? _a : -_a; })
#define deg2rad(angle) \
({ __typeof__ (angle) _angle = (angle); \
(_angle) * M_PI / 180.0; })
@ -28,4 +32,4 @@
({ __typeof__ (angle) _angle = (angle); \
(_angle) * 180.0 / M_PI; })
#endif
#endif