2 changed files with 19 additions and 1 deletions
@ -0,0 +1,17 @@ |
|||||||
|
#pragma once |
||||||
|
|
||||||
|
#include <algorithm> |
||||||
|
|
||||||
|
namespace devilution { |
||||||
|
|
||||||
|
template <typename T> |
||||||
|
constexpr T abs(const T &a) |
||||||
|
{ |
||||||
|
#if defined(__GNUC__) || defined(__GNUG__) || defined(_MSC_VER) |
||||||
|
return std::abs(a); |
||||||
|
#else |
||||||
|
return (a < 0) ? -a : a; |
||||||
|
#endif |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue