diff --git a/std/io.zig b/std/io.zig index 815aa21616..63809c99c9 100644 --- a/std/io.zig +++ b/std/io.zig @@ -232,9 +232,9 @@ pub fn OutStream(comptime WriteError: type) type { return self.writeFn(self, slice); } - pub fn writeByteNTimes(self: *Self, byte: u8, n: u64) Error!void { + pub fn writeByteNTimes(self: *Self, byte: u8, n: usize) Error!void { const slice = (*const [1]u8)(&byte)[0..]; - var i: u64 = 0; + var i: usize = 0; while (i < n) : (i += 1) { try self.writeFn(self, slice); } diff --git a/std/os/file.zig b/std/os/file.zig index 4f7bda0837..814e5e318c 100644 --- a/std/os/file.zig +++ b/std/os/file.zig @@ -301,7 +301,6 @@ pub const File = struct { } pub const GetSeekPosError = error{ - Overflow, SystemResources, Unseekable, Unexpected, @@ -324,7 +323,7 @@ pub const File = struct { else => os.unexpectedErrorPosix(err), }; } - return @intCast(u64, result); + return u64(result); }, Os.windows => { var pos: windows.LARGE_INTEGER = undefined; @@ -336,8 +335,7 @@ pub const File = struct { }; } - assert(pos >= 0); - return math.cast(u64, pos); + return @intCast(u64, pos); }, else => @compileError("unsupported OS"), } @@ -355,8 +353,6 @@ pub const File = struct { else => os.unexpectedErrorWindows(err), }; } - if (file_size < 0) - return error.Overflow; return @intCast(u64, file_size); } else { @compileError("TODO support getEndPos on this OS");