fix integer cast warnings. (#38)

This commit is contained in:
tower120
2020-04-15 13:17:44 +03:00
committed by GitHub
parent c556c75100
commit d47ee834e4
2 changed files with 2 additions and 2 deletions

View File

@@ -125,7 +125,7 @@ namespace bitsery {
}
static uint16_t exec(uint16_t value) {
return (value & 0x00ff) << 8 | (value & 0xff00) >> 8;
return static_cast<uint16_t>((value & 0x00ff) << 8 | (value & 0xff00) >> 8);
}
static uint8_t exec(uint8_t value) {

View File

@@ -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<size_t>(container.size() * 1.5 + 128);
auto newSize = static_cast<size_t>(static_cast<double>(container.size()) * 1.5) + 128;
//make data cache friendly
newSize -= newSize % 64;//64 is cache line size
container.resize((std::max)(newSize, container.capacity()));