diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp index 43bc8da26c9..a5c0ec589d0 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convert.hpp @@ -19,8 +19,8 @@ namespace ngraph { inline void set_u1(uint8_t* buf, size_t idx, uint8_t val) { - const int byte_idx = idx / 8; - const int bit_idx = 7 - (idx % 8); + const size_t byte_idx = idx / 8; + const uint8_t bit_idx = 7 - (idx % 8); if (val) { buf[byte_idx] |= (1 << bit_idx); @@ -33,38 +33,38 @@ namespace ngraph inline uint8_t get_u1(const uint8_t* buf, size_t idx) { - const int byte_idx = idx / 8; - const int bit_idx = 7 - (idx % 8); + const size_t byte_idx = idx / 8; + const uint8_t bit_idx = 7 - (idx % 8); return (buf[byte_idx] & (1 << bit_idx)) ? 1 : 0; } inline void set_u4(uint8_t* buf, size_t idx, uint8_t val) { - const int byte_idx = idx / 2; - const int bit_shift = 4 * (++idx % 2); + const size_t byte_idx = idx / 2; + const uint8_t bit_shift = 4 * (++idx % 2); buf[byte_idx] &= ~(0xF << bit_shift); // half byte zeroed buf[byte_idx] |= (val << bit_shift); // set 1's } inline uint8_t get_u4(const uint8_t* buf, size_t idx) { - const int byte_idx = idx / 2; - const int bit_shift = 4 * (++idx % 2); + const size_t byte_idx = idx / 2; + const uint8_t bit_shift = 4 * (++idx % 2); return (buf[byte_idx] >> bit_shift) & 0xF; } inline void set_i4(uint8_t* buf, size_t idx, int8_t val) { - const int byte_idx = idx / 2; - const int bit_shift = 4 * (++idx % 2); + const size_t byte_idx = idx / 2; + const uint8_t bit_shift = 4 * (++idx % 2); buf[byte_idx] &= ~(0xF << bit_shift); // half byte zeroed buf[byte_idx] |= (val << bit_shift); // set 1's } inline int8_t get_i4(const uint8_t* buf, size_t idx) { - const int byte_idx = idx / 2; - const int bit_shift = 4 * (++idx % 2); + const size_t byte_idx = idx / 2; + const uint8_t bit_shift = 4 * (++idx % 2); uint8_t val = (buf[byte_idx] >> bit_shift) & 0xF; if (val & 0x08) { // negative number