Closed einiemand closed 1 week ago
return static_cast<size_type>(std::ceil(static_cast<double>(num_bits) / bits_per_block));
While unlikely to overflow, it is still possible. If the overflow situation can be tested for and faster logic used, that seems fine. Otherwise the proposed change is not safe in all situations, despite being an extreme outlier, as the original code is. Given this, I am closing this PR since it has not had an update for years.
num_bits + bits_per_block - 1
is unlikely to overflow. After the change, it could be a little faster.