authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-01 13:33:46-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-01 13:33:46-04:00
logec6ef86219578822fd32bbe2e5eb83b24ddfdca6
tree1f8453776bdba39c87be0526d809baca6761b71f
parent4044a77621f8104801304e3ffe74b55d17e6cbc2

fix off-by-one error in sizeInBaseUpperBound


1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/math/big/int.zig+1-1
...@@ -995,7 +995,7 @@ pub const Const = struct {...@@ -995,7 +995,7 @@ pub const Const = struct {
995 /// TODO See if we can make this exact.995 /// TODO See if we can make this exact.
996 pub fn sizeInBaseUpperBound(self: Const, base: usize) usize {996 pub fn sizeInBaseUpperBound(self: Const, base: usize) usize {
997 const bit_count = @as(usize, @boolToInt(!self.positive)) + self.bitCountAbs();997 const bit_count = @as(usize, @boolToInt(!self.positive)) + self.bitCountAbs();
998 return (bit_count / math.log2(base)) + 1;998 return (bit_count / math.log2(base)) + 2;
999 }999 }
10001000
1001 pub const ConvertError = error{1001 pub const ConvertError = error{