Commit 5ace587f authored by aligungr's avatar aligungr

Support for 32-bit architectures

parent 9d3f49f3
......@@ -88,7 +88,7 @@ inline void SetBitStringInt(int value, BIT_STRING_t &target)
if (target.buf != nullptr)
free(target.buf);
target.size = bits::NearDiv(BitCount, 8) / 8;
target.size = bits::NearDiv(static_cast<int>(BitCount), 8) / 8;
target.buf = static_cast<uint8_t *>(calloc(1, target.size));
target.bits_unused = (8 - (static_cast<int>(BitCount) % 8)) % 8;
BitBuffer{target.buf}.writeBits(value, BitCount);
......@@ -101,7 +101,7 @@ inline void SetBitStringLong(int64_t value, BIT_STRING_t &target)
if (target.buf != nullptr)
free(target.buf);
target.size = bits::NearDiv(BitCount, 8) / 8;
target.size = bits::NearDiv(static_cast<int>(BitCount), 8) / 8;
target.buf = static_cast<uint8_t *>(calloc(1, target.size));
target.bits_unused = (8 - (static_cast<int>(BitCount) % 8)) % 8;
BitBuffer{target.buf}.writeBits(value, BitCount);
......
......@@ -112,11 +112,6 @@ inline uint8_t Consequential8(bool b7, bool b6, bool b5, bool b4, bool b3, bool
return Ranged8({{1, b7}, {1, b6}, {1, b5}, {1, b4}, {1, b3}, {1, b2}, {1, b1}, {1, b0}});
}
inline unsigned NearDiv(unsigned val, unsigned div)
{
return (div) * ((val + (div - 1u)) / (div));
}
inline int NearDiv(int val, int div)
{
return (div) * ((val + (div - 1)) / (div));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment