Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Commit c09c980

Browse files
committed
Fixed compiler errors when compiling using Zig version 0.9.0-dev.689+507dc1f2e
1 parent 02b9e47 commit c09c980

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

dots.zig

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ pub const Buffer = struct {
106106
const _y = @intCast(u8, y);
107107
// Get the index of the correct byte, and a bitmask to extract a single dot.
108108
const i = self.index(_x, _y);
109-
const current = self.buffer[i];
110109
const m = mask(_x, _y);
111110
// Depending on the value of the bit, set the byte without the rest of the bytes data.
112111
var byte : u8 = self.buffer[i];
@@ -137,10 +136,8 @@ pub const Buffer = struct {
137136
const _x = @intCast(u8, x);
138137
const _y = @intCast(u8, y);
139138
const i = self.index(_x, _y);
140-
const current = self.buffer[i];
141139
const m = mask(_x, _y);
142-
var new : u8 = 0;
143-
return @boolToInt((current & m) > 0);
140+
return @boolToInt((self.buffer[i] & m) > 0);
144141
}
145142
else return 0;
146143
}
@@ -152,7 +149,7 @@ pub const Buffer = struct {
152149
/// Calculate total memory cost for a dots buffer.
153150
/// This calculates the total size of the buffer, including possible allocated space.
154151
/// It guarantees enough memory is available for any operation.
155-
pub fn calculateSize(width : comptime u8, height : comptime u8) comptime usize {
152+
pub fn calculateSize(width : u8, height : u8) usize {
156153
const cols : u16 = @divFloor(@as(u16, width), 2) + @as(u16, if (@mod(@as(u16, width), 2) > 0) 1 else 0);
157154
const rows : u16 = @divFloor(@as(u16, height), 4) + @as(u16, if (@mod(@as(u16, height), 4) > 0) 1 else 0);
158155
return cols * rows + @sizeOf(@TypeOf(Buffer));
@@ -261,7 +258,7 @@ pub const Display = struct {
261258
/// This calculates the requirements with the purpose of displaying to the terminal.
262259
/// This cost is slightly higher than the cost of generating it as a string.
263260
/// But it guarantees enough memory is available for any operation.
264-
pub fn calculateSize(width : comptime u8, height : comptime u8) comptime usize {
261+
pub fn calculateSize(width : u8, height : u8) usize {
265262
const cols : u16 = @divFloor(@as(u16, width), 2) + @as(u16, if (@mod(@as(u16, width), 2) > 0) 1 else 0);
266263
const rows : u16 = @divFloor(@as(u16, height), 4) + @as(u16, if (@mod(@as(u16, height), 4) > 0) 1 else 0);
267264
const clen : u16 = switch (cols) {

0 commit comments

Comments
 (0)