From 341dbf14ae824270019375f2b1740ce198b27413 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 16 Mar 2019 23:52:30 -0500 Subject: [PATCH] [ox/mc] Fix VLI encoding not to chop off ends of >24 bit integers --- deps/ox/src/ox/mc/intops.hpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deps/ox/src/ox/mc/intops.hpp b/deps/ox/src/ox/mc/intops.hpp index 5d37b7ab..9c068549 100644 --- a/deps/ox/src/ox/mc/intops.hpp +++ b/deps/ox/src/ox/mc/intops.hpp @@ -58,7 +58,7 @@ template McInt out; // move input to uint64_t to allow consistent bit manipulation, and to avoid // overflow concerns - uint64_t val = *reinterpret_cast>*>(&input); + uint64_t val = *reinterpret_cast*>(&input); if (val) { // bits needed to represent number factoring in space possibly // needed for signed bit @@ -85,9 +85,11 @@ template LittleEndian leVal = val; if (bytes == 9) { out.data[0] = bytesIndicator; - *reinterpret_cast(&out.data[1]) = *reinterpret_cast(&leVal); + *reinterpret_cast(&out.data[1]) = leVal.raw(); } else { - *reinterpret_cast(&out.data[0]) = (leVal << bytes) | bytesIndicator; + *reinterpret_cast(&out.data[0]) = + static_cast(leVal.raw()) << bytes | + static_cast(bytesIndicator); } out.length = bytes; }