diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-08-24 15:57:44 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-24 15:57:44 -0400 |
| commit | 2a96209c4060bbf8a41fbe34e687a7a4741d2fe1 (patch) | |
| tree | 11594b42c723162c304f5cbce7259c856718458b /lib/std/math.zig | |
| parent | 80b8294bccdbdf3bc0dd9248676e5c9718354125 (diff) | |
| parent | 7b14d614d91df7b9b5d802f34bf628293fc714f0 (diff) | |
| download | zig-2a96209c4060bbf8a41fbe34e687a7a4741d2fe1.tar.gz zig-2a96209c4060bbf8a41fbe34e687a7a4741d2fe1.zip | |
Merge pull request #12574 from Vexu/remove-bit-op-type-param
stage2+stage1: remove type parameter from bit builtins
Diffstat (limited to 'lib/std/math.zig')
| -rw-r--r-- | lib/std/math.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig index 1ed9604612..d1c9326ae2 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -1146,7 +1146,7 @@ pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo( assert(value != 0); const PromotedType = std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1); const ShiftType = std.math.Log2Int(PromotedType); - return @as(PromotedType, 1) << @intCast(ShiftType, @typeInfo(T).Int.bits - @clz(T, value - 1)); + return @as(PromotedType, 1) << @intCast(ShiftType, @typeInfo(T).Int.bits - @clz(value - 1)); } /// Returns the next power of two (if the value is not already a power of two). @@ -1212,7 +1212,7 @@ pub fn log2_int(comptime T: type, x: T) Log2Int(T) { if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned) @compileError("log2_int requires an unsigned integer, found " ++ @typeName(T)); assert(x != 0); - return @intCast(Log2Int(T), @typeInfo(T).Int.bits - 1 - @clz(T, x)); + return @intCast(Log2Int(T), @typeInfo(T).Int.bits - 1 - @clz(x)); } /// Return the log base 2 of integer value x, rounding up to the |
