1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/sprout/cstdlib/abs.hpp
bolero-MURAKAMI 2fb6cea457 add sprout::abs, fabs
add cinttypes
2012-05-05 15:57:55 +09:00

31 lines
640 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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>CyÑ 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