diff --git a/std/io.zig b/std/io.zig index 2d20e17168..cfde7c6013 100644 --- a/std/io.zig +++ b/std/io.zig @@ -277,8 +277,10 @@ pub const File = struct { } assert(pos >= 0); - if (pos > @maxValue(usize)) { - return error.FilePosLargerThanPointerRange; + if (@sizeOf(@typeOf(pos)) > @sizeOf(usize)) { + if (pos > @maxValue(usize)) { + return error.FilePosLargerThanPointerRange; + } } return usize(pos);