Fixed and updated C++ code regarding integer overflow checks.

This commit is contained in:
Project Nayuki
2017-08-18 00:09:51 +00:00
parent 2794dbc179
commit 777a9365f1
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ BitBuffer::BitBuffer()
std::vector<std::uint8_t> BitBuffer::getBytes() const {
std::vector<std::uint8_t> result((size() + 7) / 8);
std::vector<std::uint8_t> result(size() / 8 + (size() % 8 == 0 ? 0 : 1));
for (std::size_t i = 0; i < size(); i++)
result[i >> 3] |= (*this)[i] ? 1 << (7 - (i & 7)) : 0;
return result;