authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 23:52:52-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-22 23:52:52-07:00
log0262dda9b82ab75c7f35908456e82545a5781b99
treece2d3b5715517209990259e6be89ebccc048022e
parent715abe8ebeebb6d49db1e265748554404c3aab98

std: remove `comptime const`


2 files changed, 12 insertions(+), 12 deletions(-)

lib/std/enums.zig+6-6
......@@ -283,8 +283,8 @@ pub fn EnumSet(comptime E: type) type {
283283 var result = Self{};
284284 comptime var i: usize = 0;
285285 inline while (i < Self.len) : (i += 1) {
286 comptime const key = Indexer.keyForIndex(i);
287 comptime const tag = @tagName(key);
286 const key = comptime Indexer.keyForIndex(i);
287 const tag = comptime @tagName(key);
288288 if (@field(init_values, tag)) {
289289 result.bits.set(i);
290290 }
......@@ -311,8 +311,8 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
311311 var result = Self{};
312312 comptime var i: usize = 0;
313313 inline while (i < Self.len) : (i += 1) {
314 comptime const key = Indexer.keyForIndex(i);
315 comptime const tag = @tagName(key);
314 const key = comptime Indexer.keyForIndex(i);
315 const tag = comptime @tagName(key);
316316 if (@field(init_values, tag)) |*v| {
317317 result.bits.set(i);
318318 result.values[i] = v.*;
......@@ -344,8 +344,8 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
344344 };
345345 comptime var i: usize = 0;
346346 inline while (i < Self.len) : (i += 1) {
347 comptime const key = Indexer.keyForIndex(i);
348 comptime const tag = @tagName(key);
347 const key = comptime Indexer.keyForIndex(i);
348 const tag = comptime @tagName(key);
349349 result.values[i] = @field(init_values, tag);
350350 }
351351 return result;
lib/std/math.zig+6-6
......@@ -986,9 +986,9 @@ pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(
986986 comptime assert(@typeInfo(T) == .Int);
987987 comptime assert(@typeInfo(T).Int.signedness == .unsigned);
988988 assert(value != 0);
989 comptime const PromotedType = std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1);
990 comptime const shiftType = std.math.Log2Int(PromotedType);
991 return @as(PromotedType, 1) << @intCast(shiftType, @typeInfo(T).Int.bits - @clz(T, value - 1));
989 const PromotedType = std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1);
990 const ShiftType = std.math.Log2Int(PromotedType);
991 return @as(PromotedType, 1) << @intCast(ShiftType, @typeInfo(T).Int.bits - @clz(T, value - 1));
992992}
993993
994994/// Returns the next power of two (if the value is not already a power of two).
......@@ -998,8 +998,8 @@ pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
998998 comptime assert(@typeInfo(T) == .Int);
999999 const info = @typeInfo(T).Int;
10001000 comptime assert(info.signedness == .unsigned);
1001 comptime const PromotedType = std.meta.Int(info.signedness, info.bits + 1);
1002 comptime const overflowBit = @as(PromotedType, 1) << info.bits;
1001 const PromotedType = std.meta.Int(info.signedness, info.bits + 1);
1002 const overflowBit = @as(PromotedType, 1) << info.bits;
10031003 var x = ceilPowerOfTwoPromote(T, value);
10041004 if (overflowBit & x != 0) {
10051005 return error.Overflow;
......@@ -1327,7 +1327,7 @@ test "order.compare" {
13271327}
13281328
13291329test "math.comptime" {
1330 comptime const v = sin(@as(f32, 1)) + ln(@as(f32, 5));
1330 const v = comptime (sin(@as(f32, 1)) + ln(@as(f32, 5)));
13311331 testing.expect(v == sin(@as(f32, 1)) + ln(@as(f32, 5)));
13321332}
13331333