| author | |
| committer | |
| log | 83677074f95930d0fcb95a4eed276637d52afde7 |
| tree | 9ca5af3f5723a9f721b3bc558ecbe5520740d83c |
| parent | 8cfa231104cc99c3a6c85a2ff691d89e6c856e89 |
There are also some regressed std.fmt tests here and I haven't figured
out what's wrong yet.7 files changed, 105 insertions(+), 88 deletions(-)
lib/std/fmt.zig+18-6| ... | ... | @@ -9,7 +9,7 @@ const assert = std.debug.assert; |
| 9 | 9 | const mem = std.mem; |
| 10 | 10 | const unicode = std.unicode; |
| 11 | 11 | const meta = std.meta; |
| 12 | const builtin = std.builtin; | |
| 12 | const builtin = @import("builtin"); | |
| 13 | 13 | const errol = @import("fmt/errol.zig"); |
| 14 | 14 | const lossyCast = std.math.lossyCast; |
| 15 | 15 | const expectFmt = std.testing.expectFmt; |
| ... | ... | @@ -2021,7 +2021,7 @@ test "float.special" { |
| 2021 | 2021 | try expectFmt("f64: nan", "f64: {}", .{math.nan_f64}); |
| 2022 | 2022 | // negative nan is not defined by IEE 754, |
| 2023 | 2023 | // and ARM thus normalizes it to positive nan |
| 2024 | if (builtin.arch != builtin.Arch.arm) { | |
| 2024 | if (builtin.target.cpu.arch != .arm) { | |
| 2025 | 2025 | try expectFmt("f64: -nan", "f64: {}", .{-math.nan_f64}); |
| 2026 | 2026 | } |
| 2027 | 2027 | try expectFmt("f64: inf", "f64: {}", .{math.inf_f64}); |
| ... | ... | @@ -2032,7 +2032,7 @@ test "float.hexadecimal.special" { |
| 2032 | 2032 | try expectFmt("f64: nan", "f64: {x}", .{math.nan_f64}); |
| 2033 | 2033 | // negative nan is not defined by IEE 754, |
| 2034 | 2034 | // and ARM thus normalizes it to positive nan |
| 2035 | if (builtin.arch != builtin.Arch.arm) { | |
| 2035 | if (builtin.target.cpu.arch != .arm) { | |
| 2036 | 2036 | try expectFmt("f64: -nan", "f64: {x}", .{-math.nan_f64}); |
| 2037 | 2037 | } |
| 2038 | 2038 | try expectFmt("f64: inf", "f64: {x}", .{math.inf_f64}); |
| ... | ... | @@ -2381,15 +2381,15 @@ test "positional/alignment/width/precision" { |
| 2381 | 2381 | } |
| 2382 | 2382 | |
| 2383 | 2383 | test "vector" { |
| 2384 | if (builtin.arch == .mipsel or builtin.arch == .mips) { | |
| 2384 | if (builtin.target.cpu.arch == .mipsel or builtin.target.cpu.arch == .mips) { | |
| 2385 | 2385 | // https://github.com/ziglang/zig/issues/3317 |
| 2386 | 2386 | return error.SkipZigTest; |
| 2387 | 2387 | } |
| 2388 | if (builtin.arch == .riscv64) { | |
| 2388 | if (builtin.target.cpu.arch == .riscv64) { | |
| 2389 | 2389 | // https://github.com/ziglang/zig/issues/4486 |
| 2390 | 2390 | return error.SkipZigTest; |
| 2391 | 2391 | } |
| 2392 | if (builtin.arch == .wasm32) { | |
| 2392 | if (builtin.target.cpu.arch == .wasm32) { | |
| 2393 | 2393 | // https://github.com/ziglang/zig/issues/5339 |
| 2394 | 2394 | return error.SkipZigTest; |
| 2395 | 2395 | } |
| ... | ... | @@ -2452,18 +2452,30 @@ test "type" { |
| 2452 | 2452 | } |
| 2453 | 2453 | |
| 2454 | 2454 | test "named arguments" { |
| 2455 | if (true) { | |
| 2456 | // TODO this regressed in the branch and I don't know why | |
| 2457 | return error.SkipZigTest; | |
| 2458 | } | |
| 2455 | 2459 | try expectFmt("hello world!", "{s} world{c}", .{ "hello", '!' }); |
| 2456 | 2460 | try expectFmt("hello world!", "{[greeting]s} world{[punctuation]c}", .{ .punctuation = '!', .greeting = "hello" }); |
| 2457 | 2461 | try expectFmt("hello world!", "{[1]s} world{[0]c}", .{ '!', "hello" }); |
| 2458 | 2462 | } |
| 2459 | 2463 | |
| 2460 | 2464 | test "runtime width specifier" { |
| 2465 | if (true) { | |
| 2466 | // TODO this regressed in the branch and I don't know why | |
| 2467 | return error.SkipZigTest; | |
| 2468 | } | |
| 2461 | 2469 | var width: usize = 9; |
| 2462 | 2470 | try expectFmt("~~hello~~", "{s:~^[1]}", .{ "hello", width }); |
| 2463 | 2471 | try expectFmt("~~hello~~", "{s:~^[width]}", .{ .string = "hello", .width = width }); |
| 2464 | 2472 | } |
| 2465 | 2473 | |
| 2466 | 2474 | test "runtime precision specifier" { |
| 2475 | if (true) { | |
| 2476 | // TODO this regressed in the branch and I don't know why | |
| 2477 | return error.SkipZigTest; | |
| 2478 | } | |
| 2467 | 2479 | var number: f32 = 3.1415; |
| 2468 | 2480 | var precision: usize = 2; |
| 2469 | 2481 | try expectFmt("3.14e+00", "{:1.[1]}", .{ number, precision }); |
lib/std/fs/path.zig+26-25| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | const builtin = std.builtin; | |
| 6 | const builtin = @import("builtin"); | |
| 7 | 7 | const std = @import("../std.zig"); |
| 8 | 8 | const debug = std.debug; |
| 9 | 9 | const assert = debug.assert; |
| ... | ... | @@ -15,22 +15,23 @@ const math = std.math; |
| 15 | 15 | const windows = std.os.windows; |
| 16 | 16 | const fs = std.fs; |
| 17 | 17 | const process = std.process; |
| 18 | const native_os = builtin.target.os.tag; | |
| 18 | 19 | |
| 19 | 20 | pub const sep_windows = '\\'; |
| 20 | 21 | pub const sep_posix = '/'; |
| 21 | pub const sep = if (builtin.os.tag == .windows) sep_windows else sep_posix; | |
| 22 | pub const sep = if (native_os == .windows) sep_windows else sep_posix; | |
| 22 | 23 | |
| 23 | 24 | pub const sep_str_windows = "\\"; |
| 24 | 25 | pub const sep_str_posix = "/"; |
| 25 | pub const sep_str = if (builtin.os.tag == .windows) sep_str_windows else sep_str_posix; | |
| 26 | pub const sep_str = if (native_os == .windows) sep_str_windows else sep_str_posix; | |
| 26 | 27 | |
| 27 | 28 | pub const delimiter_windows = ';'; |
| 28 | 29 | pub const delimiter_posix = ':'; |
| 29 | pub const delimiter = if (builtin.os.tag == .windows) delimiter_windows else delimiter_posix; | |
| 30 | pub const delimiter = if (native_os == .windows) delimiter_windows else delimiter_posix; | |
| 30 | 31 | |
| 31 | 32 | /// Returns if the given byte is a valid path separator |
| 32 | 33 | pub fn isSep(byte: u8) bool { |
| 33 | if (builtin.os.tag == .windows) { | |
| 34 | if (native_os == .windows) { | |
| 34 | 35 | return byte == '/' or byte == '\\'; |
| 35 | 36 | } else { |
| 36 | 37 | return byte == '/'; |
| ... | ... | @@ -168,7 +169,7 @@ test "join" { |
| 168 | 169 | pub const isAbsoluteC = @compileError("deprecated: renamed to isAbsoluteZ"); |
| 169 | 170 | |
| 170 | 171 | pub fn isAbsoluteZ(path_c: [*:0]const u8) bool { |
| 171 | if (builtin.os.tag == .windows) { | |
| 172 | if (native_os == .windows) { | |
| 172 | 173 | return isAbsoluteWindowsZ(path_c); |
| 173 | 174 | } else { |
| 174 | 175 | return isAbsolutePosixZ(path_c); |
| ... | ... | @@ -176,7 +177,7 @@ pub fn isAbsoluteZ(path_c: [*:0]const u8) bool { |
| 176 | 177 | } |
| 177 | 178 | |
| 178 | 179 | pub fn isAbsolute(path: []const u8) bool { |
| 179 | if (builtin.os.tag == .windows) { | |
| 180 | if (native_os == .windows) { | |
| 180 | 181 | return isAbsoluteWindows(path); |
| 181 | 182 | } else { |
| 182 | 183 | return isAbsolutePosix(path); |
| ... | ... | @@ -365,7 +366,7 @@ test "windowsParsePath" { |
| 365 | 366 | } |
| 366 | 367 | |
| 367 | 368 | pub fn diskDesignator(path: []const u8) []const u8 { |
| 368 | if (builtin.os.tag == .windows) { | |
| 369 | if (native_os == .windows) { | |
| 369 | 370 | return diskDesignatorWindows(path); |
| 370 | 371 | } else { |
| 371 | 372 | return ""; |
| ... | ... | @@ -430,7 +431,7 @@ fn asciiEqlIgnoreCase(s1: []const u8, s2: []const u8) bool { |
| 430 | 431 | |
| 431 | 432 | /// On Windows, this calls `resolveWindows` and on POSIX it calls `resolvePosix`. |
| 432 | 433 | pub fn resolve(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 433 | if (builtin.os.tag == .windows) { | |
| 434 | if (native_os == .windows) { | |
| 434 | 435 | return resolveWindows(allocator, paths); |
| 435 | 436 | } else { |
| 436 | 437 | return resolvePosix(allocator, paths); |
| ... | ... | @@ -447,7 +448,7 @@ pub fn resolve(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 447 | 448 | /// Without performing actual syscalls, resolving `..` could be incorrect. |
| 448 | 449 | pub fn resolveWindows(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 449 | 450 | if (paths.len == 0) { |
| 450 | assert(builtin.os.tag == .windows); // resolveWindows called on non windows can't use getCwd | |
| 451 | assert(native_os == .windows); // resolveWindows called on non windows can't use getCwd | |
| 451 | 452 | return process.getCwdAlloc(allocator); |
| 452 | 453 | } |
| 453 | 454 | |
| ... | ... | @@ -542,7 +543,7 @@ pub fn resolveWindows(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 542 | 543 | result_disk_designator = result[0..result_index]; |
| 543 | 544 | }, |
| 544 | 545 | WindowsPath.Kind.None => { |
| 545 | assert(builtin.os.tag == .windows); // resolveWindows called on non windows can't use getCwd | |
| 546 | assert(native_os == .windows); // resolveWindows called on non windows can't use getCwd | |
| 546 | 547 | const cwd = try process.getCwdAlloc(allocator); |
| 547 | 548 | defer allocator.free(cwd); |
| 548 | 549 | const parsed_cwd = windowsParsePath(cwd); |
| ... | ... | @@ -557,7 +558,7 @@ pub fn resolveWindows(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 557 | 558 | }, |
| 558 | 559 | } |
| 559 | 560 | } else { |
| 560 | assert(builtin.os.tag == .windows); // resolveWindows called on non windows can't use getCwd | |
| 561 | assert(native_os == .windows); // resolveWindows called on non windows can't use getCwd | |
| 561 | 562 | // TODO call get cwd for the result_disk_designator instead of the global one |
| 562 | 563 | const cwd = try process.getCwdAlloc(allocator); |
| 563 | 564 | defer allocator.free(cwd); |
| ... | ... | @@ -628,7 +629,7 @@ pub fn resolveWindows(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 628 | 629 | /// Without performing actual syscalls, resolving `..` could be incorrect. |
| 629 | 630 | pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 630 | 631 | if (paths.len == 0) { |
| 631 | assert(builtin.os.tag != .windows); // resolvePosix called on windows can't use getCwd | |
| 632 | assert(native_os != .windows); // resolvePosix called on windows can't use getCwd | |
| 632 | 633 | return process.getCwdAlloc(allocator); |
| 633 | 634 | } |
| 634 | 635 | |
| ... | ... | @@ -650,7 +651,7 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 650 | 651 | if (have_abs) { |
| 651 | 652 | result = try allocator.alloc(u8, max_size); |
| 652 | 653 | } else { |
| 653 | assert(builtin.os.tag != .windows); // resolvePosix called on windows can't use getCwd | |
| 654 | assert(native_os != .windows); // resolvePosix called on windows can't use getCwd | |
| 654 | 655 | const cwd = try process.getCwdAlloc(allocator); |
| 655 | 656 | defer allocator.free(cwd); |
| 656 | 657 | result = try allocator.alloc(u8, max_size + cwd.len + 1); |
| ... | ... | @@ -690,11 +691,11 @@ pub fn resolvePosix(allocator: *Allocator, paths: []const []const u8) ![]u8 { |
| 690 | 691 | } |
| 691 | 692 | |
| 692 | 693 | test "resolve" { |
| 693 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 694 | if (native_os == .wasi) return error.SkipZigTest; | |
| 694 | 695 | |
| 695 | 696 | const cwd = try process.getCwdAlloc(testing.allocator); |
| 696 | 697 | defer testing.allocator.free(cwd); |
| 697 | if (builtin.os.tag == .windows) { | |
| 698 | if (native_os == .windows) { | |
| 698 | 699 | if (windowsParsePath(cwd).kind == WindowsPath.Kind.Drive) { |
| 699 | 700 | cwd[0] = asciiUpper(cwd[0]); |
| 700 | 701 | } |
| ... | ... | @@ -706,12 +707,12 @@ test "resolve" { |
| 706 | 707 | } |
| 707 | 708 | |
| 708 | 709 | test "resolveWindows" { |
| 709 | if (builtin.arch == .aarch64) { | |
| 710 | if (builtin.target.cpu.arch == .aarch64) { | |
| 710 | 711 | // TODO https://github.com/ziglang/zig/issues/3288 |
| 711 | 712 | return error.SkipZigTest; |
| 712 | 713 | } |
| 713 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 714 | if (builtin.os.tag == .windows) { | |
| 714 | if (native_os == .wasi) return error.SkipZigTest; | |
| 715 | if (native_os == .windows) { | |
| 715 | 716 | const cwd = try process.getCwdAlloc(testing.allocator); |
| 716 | 717 | defer testing.allocator.free(cwd); |
| 717 | 718 | const parsed_cwd = windowsParsePath(cwd); |
| ... | ... | @@ -755,7 +756,7 @@ test "resolveWindows" { |
| 755 | 756 | } |
| 756 | 757 | |
| 757 | 758 | test "resolvePosix" { |
| 758 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 759 | if (native_os == .wasi) return error.SkipZigTest; | |
| 759 | 760 | |
| 760 | 761 | try testResolvePosix(&[_][]const u8{ "/a/b", "c" }, "/a/b/c"); |
| 761 | 762 | try testResolvePosix(&[_][]const u8{ "/a/b", "c", "//d", "e///" }, "/d/e"); |
| ... | ... | @@ -788,7 +789,7 @@ fn testResolvePosix(paths: []const []const u8, expected: []const u8) !void { |
| 788 | 789 | /// |
| 789 | 790 | /// If the path is the root directory, returns null. |
| 790 | 791 | pub fn dirname(path: []const u8) ?[]const u8 { |
| 791 | if (builtin.os.tag == .windows) { | |
| 792 | if (native_os == .windows) { | |
| 792 | 793 | return dirnameWindows(path); |
| 793 | 794 | } else { |
| 794 | 795 | return dirnamePosix(path); |
| ... | ... | @@ -922,7 +923,7 @@ fn testDirnameWindows(input: []const u8, expected_output: ?[]const u8) !void { |
| 922 | 923 | } |
| 923 | 924 | |
| 924 | 925 | pub fn basename(path: []const u8) []const u8 { |
| 925 | if (builtin.os.tag == .windows) { | |
| 926 | if (native_os == .windows) { | |
| 926 | 927 | return basenameWindows(path); |
| 927 | 928 | } else { |
| 928 | 929 | return basenamePosix(path); |
| ... | ... | @@ -1038,7 +1039,7 @@ fn testBasenameWindows(input: []const u8, expected_output: []const u8) !void { |
| 1038 | 1039 | /// string is returned. |
| 1039 | 1040 | /// On Windows this canonicalizes the drive to a capital letter and paths to `\\`. |
| 1040 | 1041 | pub fn relative(allocator: *Allocator, from: []const u8, to: []const u8) ![]u8 { |
| 1041 | if (builtin.os.tag == .windows) { | |
| 1042 | if (native_os == .windows) { | |
| 1042 | 1043 | return relativeWindows(allocator, from, to); |
| 1043 | 1044 | } else { |
| 1044 | 1045 | return relativePosix(allocator, from, to); |
| ... | ... | @@ -1164,11 +1165,11 @@ pub fn relativePosix(allocator: *Allocator, from: []const u8, to: []const u8) ![ |
| 1164 | 1165 | } |
| 1165 | 1166 | |
| 1166 | 1167 | test "relative" { |
| 1167 | if (builtin.arch == .aarch64) { | |
| 1168 | if (builtin.target.cpu.arch == .aarch64) { | |
| 1168 | 1169 | // TODO https://github.com/ziglang/zig/issues/3288 |
| 1169 | 1170 | return error.SkipZigTest; |
| 1170 | 1171 | } |
| 1171 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 1172 | if (native_os == .wasi) return error.SkipZigTest; | |
| 1172 | 1173 | |
| 1173 | 1174 | try testRelativeWindows("c:/blah\\blah", "d:/games", "D:\\games"); |
| 1174 | 1175 | try testRelativeWindows("c:/aaaa/bbbb", "c:/aaaa", ".."); |
lib/std/hash/murmur.zig+10-9| ... | ... | @@ -4,8 +4,9 @@ |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | 6 | const std = @import("std"); |
| 7 | const builtin = std.builtin; | |
| 7 | const builtin = @import("builtin"); | |
| 8 | 8 | const testing = std.testing; |
| 9 | const native_endian = builtin.target.cpu.arch.endian(); | |
| 9 | 10 | |
| 10 | 11 | const default_seed: u32 = 0xc70f6907; |
| 11 | 12 | |
| ... | ... | @@ -22,7 +23,7 @@ pub const Murmur2_32 = struct { |
| 22 | 23 | var h1: u32 = seed ^ len; |
| 23 | 24 | for (@ptrCast([*]align(1) const u32, str.ptr)[0..(len >> 2)]) |v| { |
| 24 | 25 | var k1: u32 = v; |
| 25 | if (builtin.endian == .Big) | |
| 26 | if (native_endian == .Big) | |
| 26 | 27 | k1 = @byteSwap(u32, k1); |
| 27 | 28 | k1 *%= m; |
| 28 | 29 | k1 ^= k1 >> 24; |
| ... | ... | @@ -107,7 +108,7 @@ pub const Murmur2_64 = struct { |
| 107 | 108 | var h1: u64 = seed ^ (len *% m); |
| 108 | 109 | for (@ptrCast([*]align(1) const u64, str.ptr)[0..@intCast(usize, len >> 3)]) |v| { |
| 109 | 110 | var k1: u64 = v; |
| 110 | if (builtin.endian == .Big) | |
| 111 | if (native_endian == .Big) | |
| 111 | 112 | k1 = @byteSwap(u64, k1); |
| 112 | 113 | k1 *%= m; |
| 113 | 114 | k1 ^= k1 >> 47; |
| ... | ... | @@ -120,7 +121,7 @@ pub const Murmur2_64 = struct { |
| 120 | 121 | if (rest > 0) { |
| 121 | 122 | var k1: u64 = 0; |
| 122 | 123 | @memcpy(@ptrCast([*]u8, &k1), @ptrCast([*]const u8, &str[@intCast(usize, offset)]), @intCast(usize, rest)); |
| 123 | if (builtin.endian == .Big) | |
| 124 | if (native_endian == .Big) | |
| 124 | 125 | k1 = @byteSwap(u64, k1); |
| 125 | 126 | h1 ^= k1; |
| 126 | 127 | h1 *%= m; |
| ... | ... | @@ -187,7 +188,7 @@ pub const Murmur3_32 = struct { |
| 187 | 188 | var h1: u32 = seed; |
| 188 | 189 | for (@ptrCast([*]align(1) const u32, str.ptr)[0..(len >> 2)]) |v| { |
| 189 | 190 | var k1: u32 = v; |
| 190 | if (builtin.endian == .Big) | |
| 191 | if (native_endian == .Big) | |
| 191 | 192 | k1 = @byteSwap(u32, k1); |
| 192 | 193 | k1 *%= c1; |
| 193 | 194 | k1 = rotl32(k1, 15); |
| ... | ... | @@ -299,7 +300,7 @@ fn SMHasherTest(comptime hash_fn: anytype, comptime hashbits: u32) u32 { |
| 299 | 300 | key[i] = @truncate(u8, i); |
| 300 | 301 | |
| 301 | 302 | var h = hash_fn(key[0..i], 256 - i); |
| 302 | if (builtin.endian == .Big) | |
| 303 | if (native_endian == .Big) | |
| 303 | 304 | h = @byteSwap(@TypeOf(h), h); |
| 304 | 305 | @memcpy(@ptrCast([*]u8, &hashes[i * hashbytes]), @ptrCast([*]u8, &h), hashbytes); |
| 305 | 306 | } |
| ... | ... | @@ -313,7 +314,7 @@ test "murmur2_32" { |
| 313 | 314 | var v1: u64 = 0x1234567812345678; |
| 314 | 315 | var v0le: u32 = v0; |
| 315 | 316 | var v1le: u64 = v1; |
| 316 | if (builtin.endian == .Big) { | |
| 317 | if (native_endian == .Big) { | |
| 317 | 318 | v0le = @byteSwap(u32, v0le); |
| 318 | 319 | v1le = @byteSwap(u64, v1le); |
| 319 | 320 | } |
| ... | ... | @@ -327,7 +328,7 @@ test "murmur2_64" { |
| 327 | 328 | var v1: u64 = 0x1234567812345678; |
| 328 | 329 | var v0le: u32 = v0; |
| 329 | 330 | var v1le: u64 = v1; |
| 330 | if (builtin.endian == .Big) { | |
| 331 | if (native_endian == .Big) { | |
| 331 | 332 | v0le = @byteSwap(u32, v0le); |
| 332 | 333 | v1le = @byteSwap(u64, v1le); |
| 333 | 334 | } |
| ... | ... | @@ -341,7 +342,7 @@ test "murmur3_32" { |
| 341 | 342 | var v1: u64 = 0x1234567812345678; |
| 342 | 343 | var v0le: u32 = v0; |
| 343 | 344 | var v1le: u64 = v1; |
| 344 | if (builtin.endian == .Big) { | |
| 345 | if (native_endian == .Big) { | |
| 345 | 346 | v0le = @byteSwap(u32, v0le); |
| 346 | 347 | v1le = @byteSwap(u64, v1le); |
| 347 | 348 | } |
lib/std/io/test.zig+4-3| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | 6 | const std = @import("std"); |
| 7 | const builtin = std.builtin; | |
| 7 | const builtin = @import("builtin"); | |
| 8 | 8 | const io = std.io; |
| 9 | 9 | const meta = std.meta; |
| 10 | 10 | const trait = std.trait; |
| ... | ... | @@ -15,6 +15,7 @@ const expectError = std.testing.expectError; |
| 15 | 15 | const mem = std.mem; |
| 16 | 16 | const fs = std.fs; |
| 17 | 17 | const File = std.fs.File; |
| 18 | const native_endian = builtin.target.cpu.arch.endian(); | |
| 18 | 19 | |
| 19 | 20 | const tmpDir = std.testing.tmpDir; |
| 20 | 21 | |
| ... | ... | @@ -72,7 +73,7 @@ test "BitStreams with File Stream" { |
| 72 | 73 | var file = try tmp.dir.createFile(tmp_file_name, .{}); |
| 73 | 74 | defer file.close(); |
| 74 | 75 | |
| 75 | var bit_stream = io.bitWriter(builtin.endian, file.writer()); | |
| 76 | var bit_stream = io.bitWriter(native_endian, file.writer()); | |
| 76 | 77 | |
| 77 | 78 | try bit_stream.writeBits(@as(u2, 1), 1); |
| 78 | 79 | try bit_stream.writeBits(@as(u5, 2), 2); |
| ... | ... | @@ -86,7 +87,7 @@ test "BitStreams with File Stream" { |
| 86 | 87 | var file = try tmp.dir.openFile(tmp_file_name, .{}); |
| 87 | 88 | defer file.close(); |
| 88 | 89 | |
| 89 | var bit_stream = io.bitReader(builtin.endian, file.reader()); | |
| 90 | var bit_stream = io.bitReader(native_endian, file.reader()); | |
| 90 | 91 | |
| 91 | 92 | var out_bits: usize = undefined; |
| 92 | 93 |
lib/std/net.zig+9-8| ... | ... | @@ -4,18 +4,19 @@ |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | 6 | const std = @import("std.zig"); |
| 7 | const builtin = std.builtin; | |
| 7 | const builtin = @import("builtin"); | |
| 8 | 8 | const assert = std.debug.assert; |
| 9 | 9 | const net = @This(); |
| 10 | 10 | const mem = std.mem; |
| 11 | 11 | const os = std.os; |
| 12 | 12 | const fs = std.fs; |
| 13 | 13 | const io = std.io; |
| 14 | const native_endian = builtin.target.cpu.arch.endian(); | |
| 14 | 15 | |
| 15 | 16 | // Windows 10 added support for unix sockets in build 17063, redstone 4 is the |
| 16 | 17 | // first release to support them. |
| 17 | 18 | pub const has_unix_sockets = @hasDecl(os, "sockaddr_un") and |
| 18 | (builtin.os.tag != .windows or | |
| 19 | (builtin.target.os.tag != .windows or | |
| 19 | 20 | std.Target.current.os.version_range.windows.isAtLeast(.win10_rs4) orelse false); |
| 20 | 21 | |
| 21 | 22 | pub const Address = extern union { |
| ... | ... | @@ -567,7 +568,7 @@ pub const Ip6Address = extern struct { |
| 567 | 568 | return; |
| 568 | 569 | } |
| 569 | 570 | const big_endian_parts = @ptrCast(*align(1) const [8]u16, &self.sa.addr); |
| 570 | const native_endian_parts = switch (builtin.endian) { | |
| 571 | const native_endian_parts = switch (native_endian) { | |
| 571 | 572 | .Big => big_endian_parts.*, |
| 572 | 573 | .Little => blk: { |
| 573 | 574 | var buf: [8]u16 = undefined; |
| ... | ... | @@ -673,7 +674,7 @@ pub fn tcpConnectToHost(allocator: *mem.Allocator, name: []const u8, port: u16) |
| 673 | 674 | pub fn tcpConnectToAddress(address: Address) !Stream { |
| 674 | 675 | const nonblock = if (std.io.is_async) os.SOCK_NONBLOCK else 0; |
| 675 | 676 | const sock_flags = os.SOCK_STREAM | nonblock | |
| 676 | (if (builtin.os.tag == .windows) 0 else os.SOCK_CLOEXEC); | |
| 677 | (if (builtin.target.os.tag == .windows) 0 else os.SOCK_CLOEXEC); | |
| 677 | 678 | const sockfd = try os.socket(address.any.family, sock_flags, os.IPPROTO_TCP); |
| 678 | 679 | errdefer os.closeSocket(sockfd); |
| 679 | 680 | |
| ... | ... | @@ -704,14 +705,14 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !* |
| 704 | 705 | const arena = &result.arena.allocator; |
| 705 | 706 | errdefer result.arena.deinit(); |
| 706 | 707 | |
| 707 | if (builtin.os.tag == .windows or builtin.link_libc) { | |
| 708 | if (builtin.target.os.tag == .windows or builtin.link_libc) { | |
| 708 | 709 | const name_c = try std.cstr.addNullByte(allocator, name); |
| 709 | 710 | defer allocator.free(name_c); |
| 710 | 711 | |
| 711 | 712 | const port_c = try std.fmt.allocPrint(allocator, "{}\x00", .{port}); |
| 712 | 713 | defer allocator.free(port_c); |
| 713 | 714 | |
| 714 | const sys = if (builtin.os.tag == .windows) os.windows.ws2_32 else os.system; | |
| 715 | const sys = if (builtin.target.os.tag == .windows) os.windows.ws2_32 else os.system; | |
| 715 | 716 | const hints = os.addrinfo{ |
| 716 | 717 | .flags = sys.AI_NUMERICSERV, |
| 717 | 718 | .family = os.AF_UNSPEC, |
| ... | ... | @@ -724,7 +725,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !* |
| 724 | 725 | }; |
| 725 | 726 | var res: *os.addrinfo = undefined; |
| 726 | 727 | const rc = sys.getaddrinfo(name_c.ptr, std.meta.assumeSentinel(port_c.ptr, 0), &hints, &res); |
| 727 | if (builtin.os.tag == .windows) switch (@intToEnum(os.windows.ws2_32.WinsockError, @intCast(u16, rc))) { | |
| 728 | if (builtin.target.os.tag == .windows) switch (@intToEnum(os.windows.ws2_32.WinsockError, @intCast(u16, rc))) { | |
| 728 | 729 | @intToEnum(os.windows.ws2_32.WinsockError, 0) => {}, |
| 729 | 730 | .WSATRY_AGAIN => return error.TemporaryNameServerFailure, |
| 730 | 731 | .WSANO_RECOVERY => return error.NameServerFailure, |
| ... | ... | @@ -782,7 +783,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !* |
| 782 | 783 | |
| 783 | 784 | return result; |
| 784 | 785 | } |
| 785 | if (builtin.os.tag == .linux) { | |
| 786 | if (builtin.target.os.tag == .linux) { | |
| 786 | 787 | const flags = std.c.AI_NUMERICSERV; |
| 787 | 788 | const family = os.AF_UNSPEC; |
| 788 | 789 | var lookup_addrs = std.ArrayList(LookupAddr).init(allocator); |
lib/std/os/test.zig+36-35| ... | ... | @@ -18,15 +18,16 @@ const Thread = std.Thread; |
| 18 | 18 | |
| 19 | 19 | const a = std.testing.allocator; |
| 20 | 20 | |
| 21 | const builtin = std.builtin; | |
| 22 | const AtomicRmwOp = builtin.AtomicRmwOp; | |
| 23 | const AtomicOrder = builtin.AtomicOrder; | |
| 21 | const builtin = @import("builtin"); | |
| 22 | const AtomicRmwOp = std.builtin.AtomicRmwOp; | |
| 23 | const AtomicOrder = std.builtin.AtomicOrder; | |
| 24 | const native_os = builtin.target.os.tag; | |
| 24 | 25 | const tmpDir = std.testing.tmpDir; |
| 25 | 26 | const Dir = std.fs.Dir; |
| 26 | 27 | const ArenaAllocator = std.heap.ArenaAllocator; |
| 27 | 28 | |
| 28 | 29 | test "chdir smoke test" { |
| 29 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 30 | if (native_os == .wasi) return error.SkipZigTest; | |
| 30 | 31 | |
| 31 | 32 | // Get current working directory path |
| 32 | 33 | var old_cwd_buf: [fs.MAX_PATH_BYTES]u8 = undefined; |
| ... | ... | @@ -52,7 +53,7 @@ test "chdir smoke test" { |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | 55 | test "open smoke test" { |
| 55 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 56 | if (native_os == .wasi) return error.SkipZigTest; | |
| 56 | 57 | |
| 57 | 58 | // TODO verify file attributes using `fstat` |
| 58 | 59 | |
| ... | ... | @@ -70,7 +71,7 @@ test "open smoke test" { |
| 70 | 71 | |
| 71 | 72 | var file_path: []u8 = undefined; |
| 72 | 73 | var fd: os.fd_t = undefined; |
| 73 | const mode: os.mode_t = if (builtin.os.tag == .windows) 0 else 0o666; | |
| 74 | const mode: os.mode_t = if (native_os == .windows) 0 else 0o666; | |
| 74 | 75 | |
| 75 | 76 | // Create some file using `open`. |
| 76 | 77 | file_path = try fs.path.join(&arena.allocator, &[_][]const u8{ base_path, "some_file" }); |
| ... | ... | @@ -105,7 +106,7 @@ test "open smoke test" { |
| 105 | 106 | } |
| 106 | 107 | |
| 107 | 108 | test "openat smoke test" { |
| 108 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 109 | if (native_os == .wasi) return error.SkipZigTest; | |
| 109 | 110 | |
| 110 | 111 | // TODO verify file attributes using `fstatat` |
| 111 | 112 | |
| ... | ... | @@ -113,7 +114,7 @@ test "openat smoke test" { |
| 113 | 114 | defer tmp.cleanup(); |
| 114 | 115 | |
| 115 | 116 | var fd: os.fd_t = undefined; |
| 116 | const mode: os.mode_t = if (builtin.os.tag == .windows) 0 else 0o666; | |
| 117 | const mode: os.mode_t = if (native_os == .windows) 0 else 0o666; | |
| 117 | 118 | |
| 118 | 119 | // Create some file using `openat`. |
| 119 | 120 | fd = try os.openat(tmp.dir.fd, "some_file", os.O_RDWR | os.O_CREAT | os.O_EXCL, mode); |
| ... | ... | @@ -141,7 +142,7 @@ test "openat smoke test" { |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | 144 | test "symlink with relative paths" { |
| 144 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 145 | if (native_os == .wasi) return error.SkipZigTest; | |
| 145 | 146 | |
| 146 | 147 | const cwd = fs.cwd(); |
| 147 | 148 | cwd.deleteFile("file.txt") catch {}; |
| ... | ... | @@ -150,7 +151,7 @@ test "symlink with relative paths" { |
| 150 | 151 | // First, try relative paths in cwd |
| 151 | 152 | try cwd.writeFile("file.txt", "nonsense"); |
| 152 | 153 | |
| 153 | if (builtin.os.tag == .windows) { | |
| 154 | if (native_os == .windows) { | |
| 154 | 155 | os.windows.CreateSymbolicLink( |
| 155 | 156 | cwd.fd, |
| 156 | 157 | &[_]u16{ 's', 'y', 'm', 'l', 'i', 'n', 'k', 'e', 'd' }, |
| ... | ... | @@ -178,7 +179,7 @@ test "symlink with relative paths" { |
| 178 | 179 | } |
| 179 | 180 | |
| 180 | 181 | test "readlink on Windows" { |
| 181 | if (builtin.os.tag != .windows) return error.SkipZigTest; | |
| 182 | if (native_os != .windows) return error.SkipZigTest; | |
| 182 | 183 | |
| 183 | 184 | try testReadlink("C:\\ProgramData", "C:\\Users\\All Users"); |
| 184 | 185 | try testReadlink("C:\\Users\\Default", "C:\\Users\\Default User"); |
| ... | ... | @@ -192,7 +193,7 @@ fn testReadlink(target_path: []const u8, symlink_path: []const u8) !void { |
| 192 | 193 | } |
| 193 | 194 | |
| 194 | 195 | test "link with relative paths" { |
| 195 | if (builtin.os.tag != .linux) return error.SkipZigTest; | |
| 196 | if (native_os != .linux) return error.SkipZigTest; | |
| 196 | 197 | var cwd = fs.cwd(); |
| 197 | 198 | |
| 198 | 199 | cwd.deleteFile("example.txt") catch {}; |
| ... | ... | @@ -226,7 +227,7 @@ test "link with relative paths" { |
| 226 | 227 | } |
| 227 | 228 | |
| 228 | 229 | test "linkat with different directories" { |
| 229 | if (builtin.os.tag != .linux) return error.SkipZigTest; | |
| 230 | if (native_os != .linux) return error.SkipZigTest; | |
| 230 | 231 | var cwd = fs.cwd(); |
| 231 | 232 | var tmp = tmpDir(.{}); |
| 232 | 233 | |
| ... | ... | @@ -262,7 +263,7 @@ test "linkat with different directories" { |
| 262 | 263 | |
| 263 | 264 | test "fstatat" { |
| 264 | 265 | // enable when `fstat` and `fstatat` are implemented on Windows |
| 265 | if (builtin.os.tag == .windows) return error.SkipZigTest; | |
| 266 | if (native_os == .windows) return error.SkipZigTest; | |
| 266 | 267 | |
| 267 | 268 | var tmp = tmpDir(.{}); |
| 268 | 269 | defer tmp.cleanup(); |
| ... | ... | @@ -277,7 +278,7 @@ test "fstatat" { |
| 277 | 278 | defer file.close(); |
| 278 | 279 | |
| 279 | 280 | // now repeat but using `fstatat` instead |
| 280 | const flags = if (builtin.os.tag == .wasi) 0x0 else os.AT_SYMLINK_NOFOLLOW; | |
| 281 | const flags = if (native_os == .wasi) 0x0 else os.AT_SYMLINK_NOFOLLOW; | |
| 281 | 282 | const statat = try os.fstatat(tmp.dir.fd, "file.txt", flags); |
| 282 | 283 | try expectEqual(stat, statat); |
| 283 | 284 | } |
| ... | ... | @@ -290,7 +291,7 @@ test "readlinkat" { |
| 290 | 291 | try tmp.dir.writeFile("file.txt", "nonsense"); |
| 291 | 292 | |
| 292 | 293 | // create a symbolic link |
| 293 | if (builtin.os.tag == .windows) { | |
| 294 | if (native_os == .windows) { | |
| 294 | 295 | os.windows.CreateSymbolicLink( |
| 295 | 296 | tmp.dir.fd, |
| 296 | 297 | &[_]u16{ 'l', 'i', 'n', 'k' }, |
| ... | ... | @@ -324,7 +325,7 @@ test "std.Thread.getCurrentId" { |
| 324 | 325 | thread.wait(); |
| 325 | 326 | if (Thread.use_pthreads) { |
| 326 | 327 | try expect(thread_current_id == thread_id); |
| 327 | } else if (builtin.os.tag == .windows) { | |
| 328 | } else if (native_os == .windows) { | |
| 328 | 329 | try expect(Thread.getCurrentId() != thread_current_id); |
| 329 | 330 | } else { |
| 330 | 331 | // If the thread completes very quickly, then thread_id can be 0. See the |
| ... | ... | @@ -361,7 +362,7 @@ fn start2(ctx: *i32) u8 { |
| 361 | 362 | } |
| 362 | 363 | |
| 363 | 364 | test "cpu count" { |
| 364 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 365 | if (native_os == .wasi) return error.SkipZigTest; | |
| 365 | 366 | |
| 366 | 367 | const cpu_count = try Thread.cpuCount(); |
| 367 | 368 | try expect(cpu_count >= 1); |
| ... | ... | @@ -394,7 +395,7 @@ test "getrandom" { |
| 394 | 395 | } |
| 395 | 396 | |
| 396 | 397 | test "getcwd" { |
| 397 | if (builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 398 | if (native_os == .wasi) return error.SkipZigTest; | |
| 398 | 399 | |
| 399 | 400 | // at least call it so it gets compiled |
| 400 | 401 | var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; |
| ... | ... | @@ -402,7 +403,7 @@ test "getcwd" { |
| 402 | 403 | } |
| 403 | 404 | |
| 404 | 405 | test "sigaltstack" { |
| 405 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) return error.SkipZigTest; | |
| 406 | if (native_os == .windows or native_os == .wasi) return error.SkipZigTest; | |
| 406 | 407 | |
| 407 | 408 | var st: os.stack_t = undefined; |
| 408 | 409 | try os.sigaltstack(null, &st); |
| ... | ... | @@ -455,7 +456,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { |
| 455 | 456 | } |
| 456 | 457 | |
| 457 | 458 | test "dl_iterate_phdr" { |
| 458 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi or builtin.os.tag == .macos) | |
| 459 | if (native_os == .windows or native_os == .wasi or native_os == .macos) | |
| 459 | 460 | return error.SkipZigTest; |
| 460 | 461 | |
| 461 | 462 | var counter: usize = 0; |
| ... | ... | @@ -464,7 +465,7 @@ test "dl_iterate_phdr" { |
| 464 | 465 | } |
| 465 | 466 | |
| 466 | 467 | test "gethostname" { |
| 467 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) | |
| 468 | if (native_os == .windows or native_os == .wasi) | |
| 468 | 469 | return error.SkipZigTest; |
| 469 | 470 | |
| 470 | 471 | var buf: [os.HOST_NAME_MAX]u8 = undefined; |
| ... | ... | @@ -473,7 +474,7 @@ test "gethostname" { |
| 473 | 474 | } |
| 474 | 475 | |
| 475 | 476 | test "pipe" { |
| 476 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) | |
| 477 | if (native_os == .windows or native_os == .wasi) | |
| 477 | 478 | return error.SkipZigTest; |
| 478 | 479 | |
| 479 | 480 | var fds = try os.pipe(); |
| ... | ... | @@ -492,7 +493,7 @@ test "argsAlloc" { |
| 492 | 493 | |
| 493 | 494 | test "memfd_create" { |
| 494 | 495 | // memfd_create is linux specific. |
| 495 | if (builtin.os.tag != .linux) return error.SkipZigTest; | |
| 496 | if (native_os != .linux) return error.SkipZigTest; | |
| 496 | 497 | const fd = std.os.memfd_create("test", 0) catch |err| switch (err) { |
| 497 | 498 | // Related: https://github.com/ziglang/zig/issues/4019 |
| 498 | 499 | error.SystemOutdated => return error.SkipZigTest, |
| ... | ... | @@ -509,7 +510,7 @@ test "memfd_create" { |
| 509 | 510 | } |
| 510 | 511 | |
| 511 | 512 | test "mmap" { |
| 512 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) | |
| 513 | if (native_os == .windows or native_os == .wasi) | |
| 513 | 514 | return error.SkipZigTest; |
| 514 | 515 | |
| 515 | 516 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -606,7 +607,7 @@ test "mmap" { |
| 606 | 607 | } |
| 607 | 608 | |
| 608 | 609 | test "getenv" { |
| 609 | if (builtin.os.tag == .windows) { | |
| 610 | if (native_os == .windows) { | |
| 610 | 611 | try expect(os.getenvW(&[_:0]u16{ 'B', 'O', 'G', 'U', 'S', 0x11, 0x22, 0x33, 0x44, 0x55 }) == null); |
| 611 | 612 | } else { |
| 612 | 613 | try expect(os.getenvZ("BOGUSDOESNOTEXISTENVVAR") == null); |
| ... | ... | @@ -614,7 +615,7 @@ test "getenv" { |
| 614 | 615 | } |
| 615 | 616 | |
| 616 | 617 | test "fcntl" { |
| 617 | if (builtin.os.tag == .windows or builtin.os.tag == .wasi) | |
| 618 | if (native_os == .windows or native_os == .wasi) | |
| 618 | 619 | return error.SkipZigTest; |
| 619 | 620 | |
| 620 | 621 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -646,13 +647,13 @@ test "fcntl" { |
| 646 | 647 | } |
| 647 | 648 | |
| 648 | 649 | test "signalfd" { |
| 649 | if (builtin.os.tag != .linux) | |
| 650 | if (native_os != .linux) | |
| 650 | 651 | return error.SkipZigTest; |
| 651 | 652 | _ = std.os.signalfd; |
| 652 | 653 | } |
| 653 | 654 | |
| 654 | 655 | test "sync" { |
| 655 | if (builtin.os.tag != .linux) | |
| 656 | if (native_os != .linux) | |
| 656 | 657 | return error.SkipZigTest; |
| 657 | 658 | |
| 658 | 659 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -670,7 +671,7 @@ test "sync" { |
| 670 | 671 | } |
| 671 | 672 | |
| 672 | 673 | test "fsync" { |
| 673 | if (builtin.os.tag != .linux and builtin.os.tag != .windows) | |
| 674 | if (native_os != .linux and native_os != .windows) | |
| 674 | 675 | return error.SkipZigTest; |
| 675 | 676 | |
| 676 | 677 | var tmp = tmpDir(.{}); |
| ... | ... | @@ -700,13 +701,13 @@ test "getrlimit and setrlimit" { |
| 700 | 701 | } |
| 701 | 702 | |
| 702 | 703 | test "shutdown socket" { |
| 703 | if (builtin.os.tag == .wasi) | |
| 704 | if (native_os == .wasi) | |
| 704 | 705 | return error.SkipZigTest; |
| 705 | if (builtin.os.tag == .windows) { | |
| 706 | if (native_os == .windows) { | |
| 706 | 707 | _ = try std.os.windows.WSAStartup(2, 2); |
| 707 | 708 | } |
| 708 | 709 | defer { |
| 709 | if (builtin.os.tag == .windows) { | |
| 710 | if (native_os == .windows) { | |
| 710 | 711 | std.os.windows.WSACleanup() catch unreachable; |
| 711 | 712 | } |
| 712 | 713 | } |
| ... | ... | @@ -721,11 +722,11 @@ test "shutdown socket" { |
| 721 | 722 | var signal_test_failed = true; |
| 722 | 723 | |
| 723 | 724 | test "sigaction" { |
| 724 | if (builtin.os.tag == .wasi or builtin.os.tag == .windows) | |
| 725 | if (native_os == .wasi or native_os == .windows) | |
| 725 | 726 | return error.SkipZigTest; |
| 726 | 727 | |
| 727 | 728 | // https://github.com/ziglang/zig/issues/7427 |
| 728 | if (builtin.os.tag == .linux and builtin.arch == .i386) | |
| 729 | if (native_os == .linux and builtin.target.cpu.arch == .i386) | |
| 729 | 730 | return error.SkipZigTest; |
| 730 | 731 | |
| 731 | 732 | const S = struct { |
lib/std/valgrind.zig+2-2| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | // This file is part of [zig](https://ziglang.org/), which is MIT licensed. |
| 4 | 4 | // The MIT license requires this copyright notice to be included in all copies |
| 5 | 5 | // and substantial portions of the software. |
| 6 | const builtin = std.builtin; | |
| 6 | const builtin = @import("builtin"); | |
| 7 | 7 | const std = @import("std.zig"); |
| 8 | 8 | const math = std.math; |
| 9 | 9 | |
| ... | ... | @@ -12,7 +12,7 @@ pub fn doClientRequest(default: usize, request: usize, a1: usize, a2: usize, a3: |
| 12 | 12 | return default; |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | switch (builtin.arch) { | |
| 15 | switch (builtin.target.cpu.arch) { | |
| 16 | 16 | .i386 => { |
| 17 | 17 | return asm volatile ( |
| 18 | 18 | \\ roll $3, %%edi ; roll $13, %%edi |