zig

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

commit 61497893d312e9e9bf5dd0c3d6fe232091ce8045 (tree)
parent 8be606ec80b347e2c7af157854cd6fcd5d512026
Author: Jimmi Holst Christensen <rainbowhejsil@gmail.com>
Date:   Fri, 19 Jan 2018 21:57:13 +0100

Removed bitcast from usize to isize in seekTo

Diffstat:
Mstd/io.zig | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/std/io.zig b/std/io.zig @@ -220,7 +220,8 @@ pub const File = struct { pub fn seekTo(self: &File, pos: usize) -> %void { switch (builtin.os) { Os.linux, Os.macosx, Os.ios => { - const result = system.lseek(self.handle, @bitCast(isize, pos), system.SEEK_SET); + const ipos = try math.cast(isize, pos); + const result = system.lseek(self.handle, ipos, system.SEEK_SET); const err = system.getErrno(result); if (err > 0) { return switch (err) { @@ -234,7 +235,8 @@ pub const File = struct { } }, Os.windows => { - if (system.SetFilePointerEx(self.handle, @bitCast(isize, pos), null, system.FILE_BEGIN) == 0) { + const ipos = try math.cast(isize, pos); + if (system.SetFilePointerEx(self.handle, ipos, null, system.FILE_BEGIN) == 0) { const err = system.GetLastError(); return switch (err) { system.ERROR.INVALID_PARAMETER => error.BadFd,