From 3a407bb6b73a186eafd99bcec570f88097c4b2e1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 4 Sep 2012 19:11:53 +0300 Subject: Add const to more classes. --- src/utils/mathutils.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/utils/mathutils.h') diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index 6d5a8339d..7e43a3574 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -27,7 +27,7 @@ #include #include -static uint16_t crc_table[256] = +static const uint16_t crc_table[256] = { 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, @@ -90,7 +90,7 @@ inline uint16_t getCrc16(const std::string &str) inline float fastInvSqrt(float x) { union { int i; float x; } tmp; - float xhalf = 0.5f * x; + const float xhalf = 0.5f * x; tmp.x = x; tmp.i = 0x5f375a86 - (tmp.i >> 1); x = tmp.x; @@ -98,12 +98,12 @@ inline float fastInvSqrt(float x) return x; } -inline float fastSqrt(float x) +inline float fastSqrt(const float x) { return 1.0f / fastInvSqrt(x); } -inline float weightedAverage(float n1, float n2, float w) +inline float weightedAverage(const float n1, const float n2, const float w) { if (w < 0.0f) return n1; @@ -114,7 +114,7 @@ inline float weightedAverage(float n1, float n2, float w) return w * n2 + (1.0f - w) * n1; } -inline int roundDouble(double v) +inline int roundDouble(const double v) { return (v > 0.0) ? (v + 0.5) : (v - 0.5); } -- cgit v1.2.3-60-g2f50