aboutsummaryrefslogtreecommitdiff
path: root/std/io.zig
diff options
context:
space:
mode:
authorJimmi Holst Christensen <rainbowhejsil@gmail.com>2018-01-19 22:08:44 +0100
committerJimmi Holst Christensen <rainbowhejsil@gmail.com>2018-01-19 22:08:44 +0100
commitd8469e3c7ce9c0627aba65075ae85b98d2b60cbc (patch)
treebb1d74fcd78f2b4305f43fb87f096df1619e473c /std/io.zig
parenta1a69f24c846fdd8a7682216c383df53963b5b3b (diff)
downloadzig-d8469e3c7ce9c0627aba65075ae85b98d2b60cbc.tar.gz
zig-d8469e3c7ce9c0627aba65075ae85b98d2b60cbc.zip
usize might be same size as LARGE_INTEGER. If that's the case, then we don't want to compare pos to @maxValue(usize).
Diffstat (limited to 'std/io.zig')
-rw-r--r--std/io.zig6
1 files changed, 4 insertions, 2 deletions
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);