going fancy to allow static_assert
This commit is contained in:
parent
6a1d9d4777
commit
efa16b1b9b
|
@ -7,8 +7,12 @@
|
|||
#include <cstddef>
|
||||
|
||||
// absolute value
|
||||
int absI(int value);
|
||||
float absF(float value);
|
||||
constexpr int absI(int value) {
|
||||
return value > 0 ? value : -value;
|
||||
}
|
||||
constexpr float absF(float value) {
|
||||
return value > 0 ? value : -value;
|
||||
}
|
||||
|
||||
// Min/max
|
||||
int maxI(int i1, int i2);
|
||||
|
|
|
@ -2,14 +2,6 @@
|
|||
|
||||
#include <cstdint>
|
||||
|
||||
float absF(float value) {
|
||||
return value > 0 ? value : -value;
|
||||
}
|
||||
|
||||
int absI(int value) {
|
||||
return value >= 0 ? value : -value;
|
||||
}
|
||||
|
||||
int maxI(int i1, int i2) {
|
||||
return i1 > i2 ? i1 : i2;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue