mirror of
https://github.com/ziglang/zig.git
synced 2025-02-14 08:30:21 +00:00
fix off-by-one error in sizeInBaseUpperBound
This commit is contained in:
parent
4044a77621
commit
ec6ef86219
@ -995,7 +995,7 @@ pub const Const = struct {
|
||||
/// TODO See if we can make this exact.
|
||||
pub fn sizeInBaseUpperBound(self: Const, base: usize) usize {
|
||||
const bit_count = @as(usize, @boolToInt(!self.positive)) + self.bitCountAbs();
|
||||
return (bit_count / math.log2(base)) + 1;
|
||||
return (bit_count / math.log2(base)) + 2;
|
||||
}
|
||||
|
||||
pub const ConvertError = error{
|
||||
|
Loading…
Reference in New Issue
Block a user