Skip to content

Commit

Permalink
Update casts for latest Zig (#19)
Browse files Browse the repository at this point in the history
* `@enumToInt` => `@intFromEnum`

The `@enumToInt` built-in was just renamed to `@intFromEnum`.

ref: ziglang/zig@a6c8ee5

* `@bitCast` no longer needs the type parameter

`@bitCast` and other casts no longer need
the destination type as an argument.

ref: ziglang/zig#16163
  • Loading branch information
abhinav authored Jun 27, 2023
1 parent 1bc351a commit 5d2e8ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cursor.zig
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub const CursorMode = enum(u8) {
};

pub fn setCursorMode(writer: anytype, mode: CursorMode) !void {
const modeNumber = @enumToInt(mode);
const modeNumber = @intFromEnum(mode);
try writer.print(csi ++ "{d} q", .{modeNumber});
}

Expand Down
4 changes: 2 additions & 2 deletions src/style.zig
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ pub const FontStyle = packed struct {
};

pub fn toU11(self: Self) u11 {
return @bitCast(u11, self);
return @bitCast(self);
}

pub fn fromU11(bits: u11) Self {
return @bitCast(Self, bits);
return @bitCast(bits);
}

/// Returns true iff this font style contains no attributes
Expand Down

0 comments on commit 5d2e8ca

Please sign in to comment.