aboutsummaryrefslogtreecommitdiff
path: root/std/io.zig
diff options
context:
space:
mode:
Diffstat (limited to 'std/io.zig')
-rw-r--r--std/io.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/std/io.zig b/std/io.zig
index 64946b28b4..d570927488 100644
--- a/std/io.zig
+++ b/std/io.zig
@@ -273,7 +273,9 @@ pub const File = struct {
else => os.unexpectedErrorWindows(err),
};
}
- return @bitCast(usize, file_size);
+ if (file_size < 0)
+ return error.Overflow;
+ return math.cast(usize, u64(file_size));
} else {
unreachable;
}