diff --git a/std/io.zig b/std/io.zig index 63809c99c97d225761e960fa3f38ecd91ce173d2..1f363b47b15ee11a516c573583ded8c92e91f52c 100644 --- a/std/io.zig +++ b/std/io.zig @@ -290,7 +290,7 @@ pub fn readFileAllocAligned(allocator: *mem.Allocator, path: []const u8, comptim var file = try File.openRead(path); defer file.close(); - const size = try file.getEndPos(); + const size = try math.cast(usize, try file.getEndPos()); const buf = try allocator.alignedAlloc(u8, A, size); errdefer allocator.free(buf); diff --git a/std/os/linux.zig b/std/os/linux.zig index 4a3e53176fef15bcc1145b6d4fd1ef811e07a5de..17af4b9ccd962d070dafe8ff272169a1015cabe2 100644 --- a/std/os/linux.zig +++ b/std/os/linux.zig @@ -1392,17 +1392,19 @@ pub fn sched_getaffinity(pid: i32, set: []usize) usize { return syscall3(SYS_sched_getaffinity, @bitCast(usize, isize(pid)), set.len * @sizeOf(usize), @ptrToInt(set.ptr)); } -pub const epoll_data = packed union { +pub const epoll_data = extern union { ptr: usize, fd: i32, @"u32": u32, @"u64": u64, }; -pub const epoll_event = packed struct { - events: u32, - data: epoll_data, -}; +// On x86_64 the structure is packed so that it matches the definition of its +// 32bit counterpart +pub const epoll_event = if (builtin.arch != .x86_64) + extern struct { events: u32, data: epoll_data } + else + packed struct { events: u32, data: epoll_data }; pub fn epoll_create() usize { return epoll_create1(0); diff --git a/std/special/compiler_rt/addXf3.zig b/std/special/compiler_rt/addXf3.zig index 3a70461ecaf4dba03b14e05b31b92954a1497b9d..5852f3e50d3e3814b8902e1971b7e661d9b7f27f 100644 --- a/std/special/compiler_rt/addXf3.zig +++ b/std/special/compiler_rt/addXf3.zig @@ -78,8 +78,8 @@ fn addXf3(comptime T: type, a: T, b: T) T { const infRep = @bitCast(Z, std.math.inf(T)); // Detect if a or b is zero, infinity, or NaN. - if (aAbs - Z(1) >= infRep - Z(1) or - bAbs - Z(1) >= infRep - Z(1)) + if (aAbs -% Z(1) >= infRep - Z(1) or + bAbs -% Z(1) >= infRep - Z(1)) { // NaN + anything = qNaN if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit); diff --git a/std/special/compiler_rt/arm/aeabi_dcmp.zig b/std/special/compiler_rt/arm/aeabi_dcmp.zig index bf2e51b21e599da42934bffb67b9dcd3418f7337..a51d9854cea0d50fb2b35219eb3cd00d36ef663e 100644 --- a/std/special/compiler_rt/arm/aeabi_dcmp.zig +++ b/std/special/compiler_rt/arm/aeabi_dcmp.zig @@ -87,7 +87,7 @@ inline fn aeabi_dcmp(comptime cond: ConditionalOperator) void { .Ge => asm volatile ( \\ bl __ltdf2 \\ cmp r0, #0 - \\ blt 1f + \\ bge 1f \\ movs r0, #0 \\ pop { r4, pc } \\ 1: diff --git a/std/special/compiler_rt/arm/aeabi_fcmp.zig b/std/special/compiler_rt/arm/aeabi_fcmp.zig index 192f7485f34290d92eca157f85b8164e7db06fae..f82dd25270cf748d722c59446c2d04ccd787d583 100644 --- a/std/special/compiler_rt/arm/aeabi_fcmp.zig +++ b/std/special/compiler_rt/arm/aeabi_fcmp.zig @@ -87,7 +87,7 @@ inline fn aeabi_fcmp(comptime cond: ConditionalOperator) void { .Ge => asm volatile ( \\ bl __ltsf2 \\ cmp r0, #0 - \\ blt 1f + \\ bge 1f \\ movs r0, #0 \\ pop { r4, pc } \\ 1: diff --git a/std/special/compiler_rt/extendXfYf2.zig b/std/special/compiler_rt/extendXfYf2.zig index 099e27b74a5d58ce1360bc18fb7c613989fbeab7..953072b9e3f9a58d32b81b414c5993ec5d5e28ee 100644 --- a/std/special/compiler_rt/extendXfYf2.zig +++ b/std/special/compiler_rt/extendXfYf2.zig @@ -3,20 +3,20 @@ const builtin = @import("builtin"); const is_test = builtin.is_test; pub extern fn __extenddftf2(a: f64) f128 { - return extendXfYf2(f128, f64, a); + return extendXfYf2(f128, f64, @bitCast(u64, a)); } pub extern fn __extendsftf2(a: f32) f128 { - return extendXfYf2(f128, f32, a); + return extendXfYf2(f128, f32, @bitCast(u32, a)); } pub extern fn __extendhfsf2(a: u16) f32 { - return extendXfYf2(f32, f16, @bitCast(f16, a)); + return extendXfYf2(f32, f16, a); } const CHAR_BIT = 8; -inline fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { +inline fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @typeInfo(src_t).Float.bits)) dst_t { const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits); const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits); const srcSigBits = std.math.floatMantissaBits(src_t); diff --git a/std/zig/render.zig b/std/zig/render.zig index 74c1e2acfc208a8e9b591e40eb2b09af1c113647..cabc4ea9efb17985d1ca217cb3ed804cd88ca663 100644 --- a/std/zig/render.zig +++ b/std/zig/render.zig @@ -748,7 +748,7 @@ fn renderExpression( counting_stream.bytes_written = 0; var dummy_col: usize = 0; try renderExpression(allocator, &counting_stream.stream, tree, 0, &dummy_col, expr.*, Space.None); - const width = counting_stream.bytes_written; + const width = @intCast(usize, counting_stream.bytes_written); const col = i % row_size; column_widths[col] = std.math.max(column_widths[col], width); expr_widths[i] = width;