zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit d8469e3c7ce9c0627aba65075ae85b98d2b60cbc (tree)
parent a1a69f24c846fdd8a7682216c383df53963b5b3b
Author: Jimmi Holst Christensen <rainbowhejsil@gmail.com>
Date:   Fri, 19 Jan 2018 22:08:44 +0100

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:
Mstd/io.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 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);