2012-04-01 13:15:09 +00:00
|
|
|
|
#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<EFBFBD>y<EFBFBD><79> llabs <20><EFBFBD>
|
|
|
|
|
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) {
|
2012-05-05 06:57:55 +00:00
|
|
|
|
return sprout::labs(j);
|
2012-04-01 13:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SPROUT_CONSTEXPR long long abs(long long j) {
|
2012-05-05 06:57:55 +00:00
|
|
|
|
return sprout::llabs(j);
|
2012-04-01 13:15:09 +00:00
|
|
|
|
}
|
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_CSTDLIB_ABS_HPP
|