Skip to content

Commit

Permalink
Compile with the new builtin syntax
Browse files Browse the repository at this point in the history
The relevant changes are in these two PRs: ziglang/zig#16046 and
ziglang/zig#16163. They change the cast builtins to infer the result
type and change the order of the conversion builtins to `@xFromY`
instead of `@yToX`.
  • Loading branch information
Spadi0 committed Jul 3, 2023
1 parent 7b582ee commit 425cc74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/struct_mapping.zig
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ fn setValue(ctx: *Context, comptime T: type, dest: *T, value: *const Value) !voi
.Int => {
switch (value.*) {
.integer => |x| {
dest.* = @intCast(@TypeOf(dest.*), x);
dest.* = @intCast(x);
},
else => return error.InvalidValueType,
}
},
.Float => {
switch (value.*) {
.float => |x| {
dest.* = @floatCast(@TypeOf(dest.*), x);
dest.* = @floatCast(x);
},
.integer => |x| {
dest.* = @intToFloat(@TypeOf(dest.*), x);
dest.* = @floatFromInt(x);
},
else => return error.InvalidValueType,
}
Expand Down

0 comments on commit 425cc74

Please sign in to comment.