diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-21 13:30:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-21 13:30:39 +0300 |
commit | 1fcc02e803d83ae8415ff44f9696cb215f475daa (patch) | |
tree | 3c4ccb5160624db095a139cb5a81a982e156d81c /src/utils | |
parent | 126fa885664da8a8de86f3a38c04469f7006e447 (diff) | |
download | plus-1fcc02e803d83ae8415ff44f9696cb215f475daa.tar.gz plus-1fcc02e803d83ae8415ff44f9696cb215f475daa.tar.bz2 plus-1fcc02e803d83ae8415ff44f9696cb215f475daa.tar.xz plus-1fcc02e803d83ae8415ff44f9696cb215f475daa.zip |
fix signed shifts.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/mathutils.h | 6 | ||||
-rw-r--r-- | src/utils/stringutils.cpp | 2 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/utils/mathutils.h b/src/utils/mathutils.h index 545a1cc4b..f5a3dc102 100644 --- a/src/utils/mathutils.h +++ b/src/utils/mathutils.h @@ -70,7 +70,7 @@ inline float fastSqrt(const float x) A_WARN_UNUSED; constexpr inline float weightedAverage(const float n1, const float n2, const float w) A_WARN_UNUSED; constexpr inline int roundDouble(const double v) A_WARN_UNUSED; -inline int powerOfTwo(const int input) A_WARN_UNUSED; +inline int powerOfTwo(const unsigned int input) A_WARN_UNUSED; inline uint16_t getCrc16(const std::string &str) { @@ -123,9 +123,9 @@ constexpr inline int roundDouble(const double v) return (v > 0.0) ? static_cast<int>(v + 0.5) : static_cast<int>(v - 0.5); } -inline int powerOfTwo(const int input) +inline int powerOfTwo(const unsigned int input) { - int value = 1; + unsigned int value = 1; while (value < input) value <<= 1; return value; diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 224c2a8e8..f47f724a8 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -73,7 +73,7 @@ unsigned int atox(const std::string &str) return value; } -const char *ipToString(const int address) +const char *ipToString(const uint32_t address) { static char asciiIP[18]; diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 4a73b3e58..7cf924d98 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -90,7 +90,7 @@ std::string toStringPrint(const unsigned int val); * @param address the address to convert to a string * @return the string representation of the address */ -const char *ipToString(const int address) A_WARN_UNUSED; +const char *ipToString(const uint32_t address) A_WARN_UNUSED; /** * A safe version of sprintf that returns a std::string of the result. |