usize might be same size as LARGE_INTEGER. If that's the case, then we don't want to compare pos to @maxValue(usize).

This commit is contained in:
Jimmi Holst Christensen 2018-01-19 22:08:44 +01:00
parent a1a69f24c8
commit d8469e3c7c

View File

@ -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);