mirror of
https://github.com/fraillt/bitsery.git
synced 2026-06-08 00:03:54 +00:00
fix integer cast warnings. (#38)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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()));
|
||||
|
||||
Reference in New Issue
Block a user