mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-25 21:35:41 +00:00
2fb6cea457
add cinttypes
31 lines
640 B
C++
31 lines
640 B
C++
#ifndef SPROUT_CSTDLIB_ABS_HPP
|
||
#define SPROUT_CSTDLIB_ABS_HPP
|
||
|
||
#include <sprout/config.hpp>
|
||
|
||
namespace sprout {
|
||
// Copyright (C) 2011 RiSK (sscrisk)
|
||
|
||
// 7.20.6.1 abs<62>Clabs<62>C‹y‚Ñ llabs ŠÖ<C5A0>”
|
||
SPROUT_CONSTEXPR int abs(int j) {
|
||
return j < 0 ? -j : j;
|
||
}
|
||
|
||
SPROUT_CONSTEXPR long labs(long j) {
|
||
return j < 0 ? -j : j;
|
||
}
|
||
|
||
SPROUT_CONSTEXPR long long llabs(long long j) {
|
||
return j < 0 ? -j : j;
|
||
}
|
||
|
||
SPROUT_CONSTEXPR long abs(long j) {
|
||
return sprout::labs(j);
|
||
}
|
||
|
||
SPROUT_CONSTEXPR long long abs(long long j) {
|
||
return sprout::llabs(j);
|
||
}
|
||
} // namespace sprout
|
||
|
||
#endif // #ifndef SPROUT_CSTDLIB_ABS_HPP
|