| author | |
| committer | |
| log | 097a62555e39e44ed403b73350c87e20c9753532 |
| tree | a048e330f3559acead465c520be7ea14afae16c5 |
| parent | 7432fb04d6e3c52b40e81911d6c608e4d17317df |
| parent | 4ab7b459dfea45d1dbdfe301eeb840eaa796a4e7 |
| signature |
A batch of miscellaneous fixes7 files changed, 17 insertions(+), 15 deletions(-)
std/io.zig+1-1| ... | @@ -290,7 +290,7 @@ pub fn readFileAllocAligned(allocator: *mem.Allocator, path: []const u8, comptim | ... | @@ -290,7 +290,7 @@ pub fn readFileAllocAligned(allocator: *mem.Allocator, path: []const u8, comptim |
| 290 | var file = try File.openRead(path); | 290 | var file = try File.openRead(path); |
| 291 | defer file.close(); | 291 | defer file.close(); |
| 292 | 292 | ||
| 293 | const size = try file.getEndPos(); | 293 | const size = try math.cast(usize, try file.getEndPos()); |
| 294 | const buf = try allocator.alignedAlloc(u8, A, size); | 294 | const buf = try allocator.alignedAlloc(u8, A, size); |
| 295 | errdefer allocator.free(buf); | 295 | errdefer allocator.free(buf); |
| 296 | 296 |
std/os/linux.zig+7-5| ... | @@ -1392,17 +1392,19 @@ pub fn sched_getaffinity(pid: i32, set: []usize) usize { | ... | @@ -1392,17 +1392,19 @@ pub fn sched_getaffinity(pid: i32, set: []usize) usize { |
| 1392 | return syscall3(SYS_sched_getaffinity, @bitCast(usize, isize(pid)), set.len * @sizeOf(usize), @ptrToInt(set.ptr)); | 1392 | return syscall3(SYS_sched_getaffinity, @bitCast(usize, isize(pid)), set.len * @sizeOf(usize), @ptrToInt(set.ptr)); |
| 1393 | } | 1393 | } |
| 1394 | 1394 | ||
| 1395 | pub const epoll_data = packed union { | 1395 | pub const epoll_data = extern union { |
| 1396 | ptr: usize, | 1396 | ptr: usize, |
| 1397 | fd: i32, | 1397 | fd: i32, |
| 1398 | @"u32": u32, | 1398 | @"u32": u32, |
| 1399 | @"u64": u64, | 1399 | @"u64": u64, |
| 1400 | }; | 1400 | }; |
| 1401 | 1401 | ||
| 1402 | pub const epoll_event = packed struct { | 1402 | // On x86_64 the structure is packed so that it matches the definition of its |
| 1403 | events: u32, | 1403 | // 32bit counterpart |
| 1404 | data: epoll_data, | 1404 | pub const epoll_event = if (builtin.arch != .x86_64) |
| 1405 | }; | 1405 | extern struct { events: u32, data: epoll_data } |
| 1406 | else | ||
| 1407 | packed struct { events: u32, data: epoll_data }; | ||
| 1406 | 1408 | ||
| 1407 | pub fn epoll_create() usize { | 1409 | pub fn epoll_create() usize { |
| 1408 | return epoll_create1(0); | 1410 | return epoll_create1(0); |
std/special/compiler_rt/addXf3.zig+2-2| ... | @@ -78,8 +78,8 @@ fn addXf3(comptime T: type, a: T, b: T) T { | ... | @@ -78,8 +78,8 @@ fn addXf3(comptime T: type, a: T, b: T) T { |
| 78 | const infRep = @bitCast(Z, std.math.inf(T)); | 78 | const infRep = @bitCast(Z, std.math.inf(T)); |
| 79 | 79 | ||
| 80 | // Detect if a or b is zero, infinity, or NaN. | 80 | // Detect if a or b is zero, infinity, or NaN. |
| 81 | if (aAbs - Z(1) >= infRep - Z(1) or | 81 | if (aAbs -% Z(1) >= infRep - Z(1) or |
| 82 | bAbs - Z(1) >= infRep - Z(1)) | 82 | bAbs -% Z(1) >= infRep - Z(1)) |
| 83 | { | 83 | { |
| 84 | // NaN + anything = qNaN | 84 | // NaN + anything = qNaN |
| 85 | if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit); | 85 | if (aAbs > infRep) return @bitCast(T, @bitCast(Z, a) | quietBit); |
std/special/compiler_rt/arm/aeabi_dcmp.zig+1-1| ... | @@ -87,7 +87,7 @@ inline fn aeabi_dcmp(comptime cond: ConditionalOperator) void { | ... | @@ -87,7 +87,7 @@ inline fn aeabi_dcmp(comptime cond: ConditionalOperator) void { |
| 87 | .Ge => asm volatile ( | 87 | .Ge => asm volatile ( |
| 88 | \\ bl __ltdf2 | 88 | \\ bl __ltdf2 |
| 89 | \\ cmp r0, #0 | 89 | \\ cmp r0, #0 |
| 90 | \\ blt 1f | 90 | \\ bge 1f |
| 91 | \\ movs r0, #0 | 91 | \\ movs r0, #0 |
| 92 | \\ pop { r4, pc } | 92 | \\ pop { r4, pc } |
| 93 | \\ 1: | 93 | \\ 1: |
std/special/compiler_rt/arm/aeabi_fcmp.zig+1-1| ... | @@ -87,7 +87,7 @@ inline fn aeabi_fcmp(comptime cond: ConditionalOperator) void { | ... | @@ -87,7 +87,7 @@ inline fn aeabi_fcmp(comptime cond: ConditionalOperator) void { |
| 87 | .Ge => asm volatile ( | 87 | .Ge => asm volatile ( |
| 88 | \\ bl __ltsf2 | 88 | \\ bl __ltsf2 |
| 89 | \\ cmp r0, #0 | 89 | \\ cmp r0, #0 |
| 90 | \\ blt 1f | 90 | \\ bge 1f |
| 91 | \\ movs r0, #0 | 91 | \\ movs r0, #0 |
| 92 | \\ pop { r4, pc } | 92 | \\ pop { r4, pc } |
| 93 | \\ 1: | 93 | \\ 1: |
std/special/compiler_rt/extendXfYf2.zig+4-4| ... | @@ -3,20 +3,20 @@ const builtin = @import("builtin"); | ... | @@ -3,20 +3,20 @@ const builtin = @import("builtin"); |
| 3 | const is_test = builtin.is_test; | 3 | const is_test = builtin.is_test; |
| 4 | 4 | ||
| 5 | pub extern fn __extenddftf2(a: f64) f128 { | 5 | pub extern fn __extenddftf2(a: f64) f128 { |
| 6 | return extendXfYf2(f128, f64, a); | 6 | return extendXfYf2(f128, f64, @bitCast(u64, a)); |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | pub extern fn __extendsftf2(a: f32) f128 { | 9 | pub extern fn __extendsftf2(a: f32) f128 { |
| 10 | return extendXfYf2(f128, f32, a); | 10 | return extendXfYf2(f128, f32, @bitCast(u32, a)); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | pub extern fn __extendhfsf2(a: u16) f32 { | 13 | pub extern fn __extendhfsf2(a: u16) f32 { |
| 14 | return extendXfYf2(f32, f16, @bitCast(f16, a)); | 14 | return extendXfYf2(f32, f16, a); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | const CHAR_BIT = 8; | 17 | const CHAR_BIT = 8; |
| 18 | 18 | ||
| 19 | inline fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t { | 19 | inline fn extendXfYf2(comptime dst_t: type, comptime src_t: type, a: @IntType(false, @typeInfo(src_t).Float.bits)) dst_t { |
| 20 | const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits); | 20 | const src_rep_t = @IntType(false, @typeInfo(src_t).Float.bits); |
| 21 | const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits); | 21 | const dst_rep_t = @IntType(false, @typeInfo(dst_t).Float.bits); |
| 22 | const srcSigBits = std.math.floatMantissaBits(src_t); | 22 | const srcSigBits = std.math.floatMantissaBits(src_t); |
std/zig/render.zig+1-1| ... | @@ -748,7 +748,7 @@ fn renderExpression( | ... | @@ -748,7 +748,7 @@ fn renderExpression( |
| 748 | counting_stream.bytes_written = 0; | 748 | counting_stream.bytes_written = 0; |
| 749 | var dummy_col: usize = 0; | 749 | var dummy_col: usize = 0; |
| 750 | try renderExpression(allocator, &counting_stream.stream, tree, 0, &dummy_col, expr.*, Space.None); | 750 | try renderExpression(allocator, &counting_stream.stream, tree, 0, &dummy_col, expr.*, Space.None); |
| 751 | const width = counting_stream.bytes_written; | 751 | const width = @intCast(usize, counting_stream.bytes_written); |
| 752 | const col = i % row_size; | 752 | const col = i % row_size; |
| 753 | column_widths[col] = std.math.max(column_widths[col], width); | 753 | column_widths[col] = std.math.max(column_widths[col], width); |
| 754 | expr_widths[i] = width; | 754 | expr_widths[i] = width; |