From bf959f926ff6dee99a15d91652256169a6484042 Mon Sep 17 00:00:00 2001 From: skidd13 Date: Sat, 24 Nov 2007 10:38:43 +0000 Subject: (svn r11510) -Codechange: merge the IS_*INSIDE* functions and rename them fitting to the naming style --- src/core/math_func.hpp | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) (limited to 'src/core/math_func.hpp') diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp index b47b06482..a7f07d614 100644 --- a/src/core/math_func.hpp +++ b/src/core/math_func.hpp @@ -82,7 +82,7 @@ static inline uint minu(const uint a, const uint b) * @param a The value we want to unsign * @return The unsigned value */ -template static inline T abs(T a) +template static inline T abs(const T a) { return (a < (T)0) ? -a : a; } @@ -191,37 +191,22 @@ template static inline T delta(const T a, const T b) { * @param size The size of the interval * @return True if the value is in the interval, false else. */ -template static inline bool IS_INSIDE_1D(const T x, const int base, const uint size) +template static inline bool IsInsideBS(const T x, const uint base, const uint size) { return (uint)(x - base) < size; } /** - * Checks if a byte is in an interval. + * Checks if a value is in an interval. * - * Returns true if a byte value is in the interval of [min, max). + * Returns true if a value is in the interval of [min, max). * - * @param a The byte value to check + * @param a The value to check * @param min The minimum of the interval * @param max The maximum of the interval - * @see IS_INSIDE_1D + * @see IsInsideBS() */ -template static inline bool IS_BYTE_INSIDE(const T x, const byte min, const byte max) -{ - return (byte)(x - min) < (max - min); -} - -/** - * Checks if an int is in an interval. - * - * Returns true if a integer value is in the interval of [min, max). - * - * @param a The integer value to check - * @param min The minimum of the interval - * @param max The maximum of the interval - * @see IS_INSIDE_1D - */ -template static inline bool IS_INT_INSIDE(const T x, const int min, const uint max) +template static inline bool IsInsideMM(const T x, const uint min, const uint max) { return (uint)(x - min) < (max - min); } -- cgit v1.2.3-54-g00ecf