diff --git a/src/helpers.cpp b/src/helpers.cpp index 4ca778590..529098bbb 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -329,27 +329,27 @@ bool Helpers::check_abs(const int32_t i) { } // for booleans, use isBool true (EMS_VALUE_BOOL) -bool Helpers::hasValue(const uint8_t v, const uint8_t isBool) { +bool Helpers::hasValue(const uint8_t &v, const uint8_t isBool) { if (isBool == EMS_VALUE_BOOL) { return (v != EMS_VALUE_BOOL_NOTSET); } return (v != EMS_VALUE_UINT_NOTSET); } -bool Helpers::hasValue(const int8_t v) { +bool Helpers::hasValue(const int8_t &v) { return (v != EMS_VALUE_INT_NOTSET); } // for short these are typically 0x8300, 0x7D00 and sometimes 0x8000 -bool Helpers::hasValue(const int16_t v) { +bool Helpers::hasValue(const int16_t &v) { return (abs(v) < EMS_VALUE_USHORT_NOTSET); } -bool Helpers::hasValue(const uint16_t v) { +bool Helpers::hasValue(const uint16_t &v) { return (v < EMS_VALUE_USHORT_NOTSET); } -bool Helpers::hasValue(const uint32_t v) { +bool Helpers::hasValue(const uint32_t &v) { return (v != EMS_VALUE_ULONG_NOTSET); } diff --git a/src/helpers.h b/src/helpers.h index 963c2735f..3f32f1b21 100644 --- a/src/helpers.h +++ b/src/helpers.h @@ -50,11 +50,11 @@ class Helpers { static char * ultostr(char * ptr, uint32_t value, const uint8_t base); #endif - static bool hasValue(const uint8_t v, const uint8_t isBool = 0); - static bool hasValue(const int8_t v); - static bool hasValue(const int16_t v); - static bool hasValue(const uint16_t v); - static bool hasValue(const uint32_t v); + static bool hasValue(const uint8_t &v, const uint8_t isBool = 0); + static bool hasValue(const int8_t &v); + static bool hasValue(const int16_t &v); + static bool hasValue(const uint16_t &v); + static bool hasValue(const uint32_t &v); static std::string toLower(std::string const & s);