From d47ee834e44f612067fcb1c3ad05f66be5c19315 Mon Sep 17 00:00:00 2001 From: tower120 Date: Wed, 15 Apr 2020 13:17:44 +0300 Subject: [PATCH] fix integer cast warnings. (#38) --- include/bitsery/details/adapter_common.h | 2 +- include/bitsery/traits/core/std_defaults.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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()));