aboutsummaryrefslogtreecommitdiff
path: root/src/codegen/spirv/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2023-06-22 18:46:56 +0100
committerAndrew Kelley <andrew@ziglang.org>2023-06-24 16:56:39 -0700
commitf26dda21171e26f44aeec8c59a75bbb3331eeb2e (patch)
treec935248861ae2693b314f2c8bc78fe38d9961b6d /src/codegen/spirv/Module.zig
parent447ca4e3fff021f471b748187b53f0a4744ad0bc (diff)
downloadzig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.tar.gz
zig-f26dda21171e26f44aeec8c59a75bbb3331eeb2e.zip
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
Diffstat (limited to 'src/codegen/spirv/Module.zig')
-rw-r--r--src/codegen/spirv/Module.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen/spirv/Module.zig b/src/codegen/spirv/Module.zig
index 9d8cca9445..e61ac754ee 100644
--- a/src/codegen/spirv/Module.zig
+++ b/src/codegen/spirv/Module.zig
@@ -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 {