diff --git a/include/bitsery/details/adapter_common.h b/include/bitsery/details/adapter_common.h index 2297840..153631b 100644 --- a/include/bitsery/details/adapter_common.h +++ b/include/bitsery/details/adapter_common.h @@ -125,7 +125,7 @@ namespace bitsery { } static uint16_t exec(uint16_t value) { - return (value & 0x00ff) << 8 | (value & 0xff00) >> 8; + return static_cast((value & 0x00ff) << 8 | (value & 0xff00) >> 8); } static uint8_t exec(uint8_t value) { diff --git a/include/bitsery/traits/core/std_defaults.h b/include/bitsery/traits/core/std_defaults.h index dade1f4..b6111b1 100644 --- a/include/bitsery/traits/core/std_defaults.h +++ b/include/bitsery/traits/core/std_defaults.h @@ -85,7 +85,7 @@ namespace bitsery { static void increaseBufferSize(T& container) { //since we're writing to buffer use different resize strategy than default implementation //when small size grow faster, to avoid thouse 2/4/8/16... byte allocations - auto newSize = static_cast(container.size() * 1.5 + 128); + auto newSize = static_cast(static_cast(container.size()) * 1.5) + 128; //make data cache friendly newSize -= newSize % 64;//64 is cache line size container.resize((std::max)(newSize, container.capacity()));