all: migrate code to new cast builtin syntax
Most of this migration was performed automatically with `zig fmt`. There were a few exceptions which I had to manually fix: * `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten * `@truncate`'s fixup is incorrect for vectors * Test cases are not formatted, and their error locations change
This commit is contained in:
@@ -451,8 +451,8 @@ pub fn constInt(self: *Module, ty_ref: CacheRef, value: anytype) !IdRef {
|
||||
return try self.resolveId(.{ .int = .{
|
||||
.ty = ty_ref,
|
||||
.value = switch (ty.signedness) {
|
||||
.signed => Value{ .int64 = @intCast(i64, value) },
|
||||
.unsigned => Value{ .uint64 = @intCast(u64, value) },
|
||||
.signed => Value{ .int64 = @as(i64, @intCast(value)) },
|
||||
.unsigned => Value{ .uint64 = @as(u64, @intCast(value)) },
|
||||
},
|
||||
} });
|
||||
}
|
||||
@@ -516,7 +516,7 @@ pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index {
|
||||
.begin_dep = undefined,
|
||||
.end_dep = undefined,
|
||||
});
|
||||
const index = @enumFromInt(Decl.Index, @intCast(u32, self.decls.items.len - 1));
|
||||
const index = @as(Decl.Index, @enumFromInt(@as(u32, @intCast(self.decls.items.len - 1))));
|
||||
switch (kind) {
|
||||
.func => {},
|
||||
// If the decl represents a global, also allocate a global node.
|
||||
@@ -540,9 +540,9 @@ pub fn globalPtr(self: *Module, index: Decl.Index) ?*Global {
|
||||
|
||||
/// Declare ALL dependencies for a decl.
|
||||
pub fn declareDeclDeps(self: *Module, decl_index: Decl.Index, deps: []const Decl.Index) !void {
|
||||
const begin_dep = @intCast(u32, self.decl_deps.items.len);
|
||||
const begin_dep = @as(u32, @intCast(self.decl_deps.items.len));
|
||||
try self.decl_deps.appendSlice(self.gpa, deps);
|
||||
const end_dep = @intCast(u32, self.decl_deps.items.len);
|
||||
const end_dep = @as(u32, @intCast(self.decl_deps.items.len));
|
||||
|
||||
const decl = self.declPtr(decl_index);
|
||||
decl.begin_dep = begin_dep;
|
||||
@@ -550,13 +550,13 @@ pub fn declareDeclDeps(self: *Module, decl_index: Decl.Index, deps: []const Decl
|
||||
}
|
||||
|
||||
pub fn beginGlobal(self: *Module) u32 {
|
||||
return @intCast(u32, self.globals.section.instructions.items.len);
|
||||
return @as(u32, @intCast(self.globals.section.instructions.items.len));
|
||||
}
|
||||
|
||||
pub fn endGlobal(self: *Module, global_index: Decl.Index, begin_inst: u32) void {
|
||||
const global = self.globalPtr(global_index).?;
|
||||
global.begin_inst = begin_inst;
|
||||
global.end_inst = @intCast(u32, self.globals.section.instructions.items.len);
|
||||
global.end_inst = @as(u32, @intCast(self.globals.section.instructions.items.len));
|
||||
}
|
||||
|
||||
pub fn declareEntryPoint(self: *Module, decl_index: Decl.Index, name: []const u8) !void {
|
||||
|
||||
Reference in New Issue
Block a user