You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
280 B
18 lines
280 B
|
5 years ago
|
#pragma once
|
||
|
|
|
||
|
|
#include <cstdlib>
|
||
|
|
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
} // namespace devilution
|