diff --git a/communication/decoder.cpp b/communication/decoder.cpp index bead06c..cd9b5cd 100644 --- a/communication/decoder.cpp +++ b/communication/decoder.cpp @@ -13,10 +13,10 @@ using namespace icsneo; -uint64_t Decoder::GetUInt64FromLEBytes(uint8_t* bytes) { +uint64_t Decoder::GetUInt64FromLEBytes(const uint8_t* bytes) { uint64_t ret = 0; for(int i = 0; i < 8; i++) - ret |= (bytes[i] << (i * 8)); + ret |= (uint64_t(bytes[i]) << (i * 8)); return ret; } diff --git a/include/icsneo/communication/decoder.h b/include/icsneo/communication/decoder.h index ca5a651..dd5792e 100644 --- a/include/icsneo/communication/decoder.h +++ b/include/icsneo/communication/decoder.h @@ -16,7 +16,7 @@ namespace icsneo { class Decoder { public: - static uint64_t GetUInt64FromLEBytes(uint8_t* bytes); + static uint64_t GetUInt64FromLEBytes(const uint8_t* bytes); Decoder(device_eventhandler_t report) : report(report) {} bool decode(std::shared_ptr& result, const std::shared_ptr& packet);