summaryrefslogtreecommitdiff
path: root/src/helpers.hpp
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-11-19 18:58:04 +0000
committerskidd13 <skidd13@openttd.org>2007-11-19 18:58:04 +0000
commit50bfe1a19d26d99b6ee10236771bd8c7cd38be01 (patch)
tree18ac24e0b26fa3cf7cb17962dde493f142f39a03 /src/helpers.hpp
parent8be526e4990ef8c7a742e6f3f67a42d0036750eb (diff)
downloadopenttd-50bfe1a19d26d99b6ee10236771bd8c7cd38be01.tar.xz
(svn r11476) -Codechange: rename the function myabs to abs to get rid of an unneeded define
Diffstat (limited to 'src/helpers.hpp')
-rw-r--r--src/helpers.hpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/helpers.hpp b/src/helpers.hpp
index 4163be4ac..b69f17ae9 100644
--- a/src/helpers.hpp
+++ b/src/helpers.hpp
@@ -39,8 +39,6 @@ template<typename T> void Swap(T& a, T& b)
}
-/** returns the absolute value of (scalar) variable. @note assumes variable to be signed */
-template <typename T> static inline T myabs(T a) { return a < (T)0 ? -a : a; }
/** returns the (absolute) difference between two (scalar) variables */
template <typename T> static inline T delta(T a, T b) { return a < b ? b - a : a - b; }
@@ -198,7 +196,7 @@ public:
*/
FORCEINLINE OverflowSafeInt& operator += (const OverflowSafeInt& other)
{
- if ((T_MAX - myabs(other.m_value)) < myabs(this->m_value) &&
+ if ((T_MAX - abs(other.m_value)) < abs(this->m_value) &&
(this->m_value < 0) == (other.m_value < 0)) {
this->m_value = (this->m_value < 0) ? T_MIN : T_MAX ;
} else {
@@ -229,7 +227,7 @@ public:
*/
FORCEINLINE OverflowSafeInt& operator *= (const int factor)
{
- if (factor != 0 && (T_MAX / myabs(factor)) < myabs(this->m_value)) {
+ if (factor != 0 && (T_MAX / abs(factor)) < abs(this->m_value)) {
this->m_value = ((this->m_value < 0) == (factor < 0)) ? T_MAX : T_MIN ;
} else {
this->m_value *= factor ;