| author | |
| committer | |
| log | 061ff11b2b8aca33fec0d5d381855d5bd3aa6ff9 |
| tree | 43488e010c69f136e7d7a91535ad477ecafcc6fb |
| parent | ecdd6366052ec815466db0c64b2a5abe59267393 |
| parent | dc872a221d8301cfac4b9ead09196c5b18cf63b2 |
| signature |
Fixes for stdlib for mips BE targets7 files changed, 77 insertions(+), 122 deletions(-)
lib/std/array_hash_map.zig-3| ... | @@ -930,9 +930,6 @@ test "basic hash map usage" { | ... | @@ -930,9 +930,6 @@ test "basic hash map usage" { |
| 930 | } | 930 | } |
| 931 | 931 | ||
| 932 | test "iterator hash map" { | 932 | test "iterator hash map" { |
| 933 | // https://github.com/ziglang/zig/issues/5127 | ||
| 934 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 935 | |||
| 936 | var reset_map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); | 933 | var reset_map = AutoArrayHashMap(i32, i32).init(std.testing.allocator); |
| 937 | defer reset_map.deinit(); | 934 | defer reset_map.deinit(); |
| 938 | 935 |
lib/std/io/test.zig-3| ... | @@ -140,9 +140,6 @@ test "File seek ops" { | ... | @@ -140,9 +140,6 @@ test "File seek ops" { |
| 140 | } | 140 | } |
| 141 | 141 | ||
| 142 | test "setEndPos" { | 142 | test "setEndPos" { |
| 143 | // https://github.com/ziglang/zig/issues/5127 | ||
| 144 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 145 | |||
| 146 | var tmp = tmpDir(.{}); | 143 | var tmp = tmpDir(.{}); |
| 147 | defer tmp.cleanup(); | 144 | defer tmp.cleanup(); |
| 148 | 145 |
lib/std/json.zig+11-13| ... | @@ -2125,7 +2125,11 @@ fn unescapeString(output: []u8, input: []const u8) !void { | ... | @@ -2125,7 +2125,11 @@ fn unescapeString(output: []u8, input: []const u8) !void { |
| 2125 | 2125 | ||
| 2126 | const secondCodeUnit = std.fmt.parseInt(u16, input[inIndex + 8 .. inIndex + 12], 16) catch unreachable; | 2126 | const secondCodeUnit = std.fmt.parseInt(u16, input[inIndex + 8 .. inIndex + 12], 16) catch unreachable; |
| 2127 | 2127 | ||
| 2128 | if (std.unicode.utf16leToUtf8(output[outIndex..], &[2]u16{ firstCodeUnit, secondCodeUnit })) |byteCount| { | 2128 | const utf16le_seq = [2]u16{ |
| 2129 | mem.littleToNative(u16, firstCodeUnit), | ||
| 2130 | mem.littleToNative(u16, secondCodeUnit), | ||
| 2131 | }; | ||
| 2132 | if (std.unicode.utf16leToUtf8(output[outIndex..], &utf16le_seq)) |byteCount| { | ||
| 2129 | outIndex += byteCount; | 2133 | outIndex += byteCount; |
| 2130 | inIndex += 12; | 2134 | inIndex += 12; |
| 2131 | } else |_| { | 2135 | } else |_| { |
| ... | @@ -2265,9 +2269,6 @@ test "integer after float has proper type" { | ... | @@ -2265,9 +2269,6 @@ test "integer after float has proper type" { |
| 2265 | } | 2269 | } |
| 2266 | 2270 | ||
| 2267 | test "escaped characters" { | 2271 | test "escaped characters" { |
| 2268 | // https://github.com/ziglang/zig/issues/5127 | ||
| 2269 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 2270 | |||
| 2271 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); | 2272 | var arena_allocator = std.heap.ArenaAllocator.init(std.testing.allocator); |
| 2272 | defer arena_allocator.deinit(); | 2273 | defer arena_allocator.deinit(); |
| 2273 | const input = | 2274 | const input = |
| ... | @@ -2300,9 +2301,6 @@ test "escaped characters" { | ... | @@ -2300,9 +2301,6 @@ test "escaped characters" { |
| 2300 | } | 2301 | } |
| 2301 | 2302 | ||
| 2302 | test "string copy option" { | 2303 | test "string copy option" { |
| 2303 | // https://github.com/ziglang/zig/issues/5127 | ||
| 2304 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 2305 | |||
| 2306 | const input = | 2304 | const input = |
| 2307 | \\{ | 2305 | \\{ |
| 2308 | \\ "noescape": "aą😂", | 2306 | \\ "noescape": "aą😂", |
| ... | @@ -2721,9 +2719,9 @@ test "stringify struct with indentation" { | ... | @@ -2721,9 +2719,9 @@ test "stringify struct with indentation" { |
| 2721 | \\} | 2719 | \\} |
| 2722 | , | 2720 | , |
| 2723 | struct { | 2721 | struct { |
| 2724 | foo: u32, | 2722 | foo: u32, |
| 2725 | bar: [3]u32, | 2723 | bar: [3]u32, |
| 2726 | }{ | 2724 | }{ |
| 2727 | .foo = 42, | 2725 | .foo = 42, |
| 2728 | .bar = .{ 1, 2, 3 }, | 2726 | .bar = .{ 1, 2, 3 }, |
| 2729 | }, | 2727 | }, |
| ... | @@ -2734,9 +2732,9 @@ test "stringify struct with indentation" { | ... | @@ -2734,9 +2732,9 @@ test "stringify struct with indentation" { |
| 2734 | try teststringify( | 2732 | try teststringify( |
| 2735 | "{\n\t\"foo\":42,\n\t\"bar\":[\n\t\t1,\n\t\t2,\n\t\t3\n\t]\n}", | 2733 | "{\n\t\"foo\":42,\n\t\"bar\":[\n\t\t1,\n\t\t2,\n\t\t3\n\t]\n}", |
| 2736 | struct { | 2734 | struct { |
| 2737 | foo: u32, | 2735 | foo: u32, |
| 2738 | bar: [3]u32, | 2736 | bar: [3]u32, |
| 2739 | }{ | 2737 | }{ |
| 2740 | .foo = 42, | 2738 | .foo = 42, |
| 2741 | .bar = .{ 1, 2, 3 }, | 2739 | .bar = .{ 1, 2, 3 }, |
| 2742 | }, | 2740 | }, |
lib/std/json/test.zig-69| ... | @@ -337,18 +337,12 @@ test "y_string_1_2_3_bytes_UTF-8_sequences" { | ... | @@ -337,18 +337,12 @@ test "y_string_1_2_3_bytes_UTF-8_sequences" { |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | test "y_string_accepted_surrogate_pair" { | 339 | test "y_string_accepted_surrogate_pair" { |
| 340 | // https://github.com/ziglang/zig/issues/5127 | ||
| 341 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 342 | |||
| 343 | ok( | 340 | ok( |
| 344 | \\["\uD801\udc37"] | 341 | \\["\uD801\udc37"] |
| 345 | ); | 342 | ); |
| 346 | } | 343 | } |
| 347 | 344 | ||
| 348 | test "y_string_accepted_surrogate_pairs" { | 345 | test "y_string_accepted_surrogate_pairs" { |
| 349 | // https://github.com/ziglang/zig/issues/5127 | ||
| 350 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 351 | |||
| 352 | ok( | 346 | ok( |
| 353 | \\["\ud83d\ude39\ud83d\udc8d"] | 347 | \\["\ud83d\ude39\ud83d\udc8d"] |
| 354 | ); | 348 | ); |
| ... | @@ -415,9 +409,6 @@ test "y_string_in_array_with_leading_space" { | ... | @@ -415,9 +409,6 @@ test "y_string_in_array_with_leading_space" { |
| 415 | } | 409 | } |
| 416 | 410 | ||
| 417 | test "y_string_last_surrogates_1_and_2" { | 411 | test "y_string_last_surrogates_1_and_2" { |
| 418 | // https://github.com/ziglang/zig/issues/5127 | ||
| 419 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 420 | |||
| 421 | ok( | 412 | ok( |
| 422 | \\["\uDBFF\uDFFF"] | 413 | \\["\uDBFF\uDFFF"] |
| 423 | ); | 414 | ); |
| ... | @@ -478,9 +469,6 @@ test "y_string_space" { | ... | @@ -478,9 +469,6 @@ test "y_string_space" { |
| 478 | } | 469 | } |
| 479 | 470 | ||
| 480 | test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" { | 471 | test "y_string_surrogates_U+1D11E_MUSICAL_SYMBOL_G_CLEF" { |
| 481 | // https://github.com/ziglang/zig/issues/5127 | ||
| 482 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 483 | |||
| 484 | ok( | 472 | ok( |
| 485 | \\["\uD834\uDd1e"] | 473 | \\["\uD834\uDd1e"] |
| 486 | ); | 474 | ); |
| ... | @@ -523,90 +511,60 @@ test "y_string_unescaped_char_delete" { | ... | @@ -523,90 +511,60 @@ test "y_string_unescaped_char_delete" { |
| 523 | } | 511 | } |
| 524 | 512 | ||
| 525 | test "y_string_unicode_2" { | 513 | test "y_string_unicode_2" { |
| 526 | // https://github.com/ziglang/zig/issues/5127 | ||
| 527 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 528 | |||
| 529 | ok( | 514 | ok( |
| 530 | \\["⍂㈴⍂"] | 515 | \\["⍂㈴⍂"] |
| 531 | ); | 516 | ); |
| 532 | } | 517 | } |
| 533 | 518 | ||
| 534 | test "y_string_unicodeEscapedBackslash" { | 519 | test "y_string_unicodeEscapedBackslash" { |
| 535 | // https://github.com/ziglang/zig/issues/5127 | ||
| 536 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 537 | |||
| 538 | ok( | 520 | ok( |
| 539 | \\["\u005C"] | 521 | \\["\u005C"] |
| 540 | ); | 522 | ); |
| 541 | } | 523 | } |
| 542 | 524 | ||
| 543 | test "y_string_unicode_escaped_double_quote" { | 525 | test "y_string_unicode_escaped_double_quote" { |
| 544 | // https://github.com/ziglang/zig/issues/5127 | ||
| 545 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 546 | |||
| 547 | ok( | 526 | ok( |
| 548 | \\["\u0022"] | 527 | \\["\u0022"] |
| 549 | ); | 528 | ); |
| 550 | } | 529 | } |
| 551 | 530 | ||
| 552 | test "y_string_unicode" { | 531 | test "y_string_unicode" { |
| 553 | // https://github.com/ziglang/zig/issues/5127 | ||
| 554 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 555 | |||
| 556 | ok( | 532 | ok( |
| 557 | \\["\uA66D"] | 533 | \\["\uA66D"] |
| 558 | ); | 534 | ); |
| 559 | } | 535 | } |
| 560 | 536 | ||
| 561 | test "y_string_unicode_U+10FFFE_nonchar" { | 537 | test "y_string_unicode_U+10FFFE_nonchar" { |
| 562 | // https://github.com/ziglang/zig/issues/5127 | ||
| 563 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 564 | |||
| 565 | ok( | 538 | ok( |
| 566 | \\["\uDBFF\uDFFE"] | 539 | \\["\uDBFF\uDFFE"] |
| 567 | ); | 540 | ); |
| 568 | } | 541 | } |
| 569 | 542 | ||
| 570 | test "y_string_unicode_U+1FFFE_nonchar" { | 543 | test "y_string_unicode_U+1FFFE_nonchar" { |
| 571 | // https://github.com/ziglang/zig/issues/5127 | ||
| 572 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 573 | |||
| 574 | ok( | 544 | ok( |
| 575 | \\["\uD83F\uDFFE"] | 545 | \\["\uD83F\uDFFE"] |
| 576 | ); | 546 | ); |
| 577 | } | 547 | } |
| 578 | 548 | ||
| 579 | test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" { | 549 | test "y_string_unicode_U+200B_ZERO_WIDTH_SPACE" { |
| 580 | // https://github.com/ziglang/zig/issues/5127 | ||
| 581 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 582 | |||
| 583 | ok( | 550 | ok( |
| 584 | \\["\u200B"] | 551 | \\["\u200B"] |
| 585 | ); | 552 | ); |
| 586 | } | 553 | } |
| 587 | 554 | ||
| 588 | test "y_string_unicode_U+2064_invisible_plus" { | 555 | test "y_string_unicode_U+2064_invisible_plus" { |
| 589 | // https://github.com/ziglang/zig/issues/5127 | ||
| 590 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 591 | |||
| 592 | ok( | 556 | ok( |
| 593 | \\["\u2064"] | 557 | \\["\u2064"] |
| 594 | ); | 558 | ); |
| 595 | } | 559 | } |
| 596 | 560 | ||
| 597 | test "y_string_unicode_U+FDD0_nonchar" { | 561 | test "y_string_unicode_U+FDD0_nonchar" { |
| 598 | // https://github.com/ziglang/zig/issues/5127 | ||
| 599 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 600 | |||
| 601 | ok( | 562 | ok( |
| 602 | \\["\uFDD0"] | 563 | \\["\uFDD0"] |
| 603 | ); | 564 | ); |
| 604 | } | 565 | } |
| 605 | 566 | ||
| 606 | test "y_string_unicode_U+FFFE_nonchar" { | 567 | test "y_string_unicode_U+FFFE_nonchar" { |
| 607 | // https://github.com/ziglang/zig/issues/5127 | ||
| 608 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 609 | |||
| 610 | ok( | 568 | ok( |
| 611 | \\["\uFFFE"] | 569 | \\["\uFFFE"] |
| 612 | ); | 570 | ); |
| ... | @@ -1858,63 +1816,42 @@ test "i_object_key_lone_2nd_surrogate" { | ... | @@ -1858,63 +1816,42 @@ test "i_object_key_lone_2nd_surrogate" { |
| 1858 | } | 1816 | } |
| 1859 | 1817 | ||
| 1860 | test "i_string_1st_surrogate_but_2nd_missing" { | 1818 | test "i_string_1st_surrogate_but_2nd_missing" { |
| 1861 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1862 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1863 | |||
| 1864 | anyStreamingErrNonStreaming( | 1819 | anyStreamingErrNonStreaming( |
| 1865 | \\["\uDADA"] | 1820 | \\["\uDADA"] |
| 1866 | ); | 1821 | ); |
| 1867 | } | 1822 | } |
| 1868 | 1823 | ||
| 1869 | test "i_string_1st_valid_surrogate_2nd_invalid" { | 1824 | test "i_string_1st_valid_surrogate_2nd_invalid" { |
| 1870 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1871 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1872 | |||
| 1873 | anyStreamingErrNonStreaming( | 1825 | anyStreamingErrNonStreaming( |
| 1874 | \\["\uD888\u1234"] | 1826 | \\["\uD888\u1234"] |
| 1875 | ); | 1827 | ); |
| 1876 | } | 1828 | } |
| 1877 | 1829 | ||
| 1878 | test "i_string_incomplete_surrogate_and_escape_valid" { | 1830 | test "i_string_incomplete_surrogate_and_escape_valid" { |
| 1879 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1880 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1881 | |||
| 1882 | anyStreamingErrNonStreaming( | 1831 | anyStreamingErrNonStreaming( |
| 1883 | \\["\uD800\n"] | 1832 | \\["\uD800\n"] |
| 1884 | ); | 1833 | ); |
| 1885 | } | 1834 | } |
| 1886 | 1835 | ||
| 1887 | test "i_string_incomplete_surrogate_pair" { | 1836 | test "i_string_incomplete_surrogate_pair" { |
| 1888 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1889 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1890 | |||
| 1891 | anyStreamingErrNonStreaming( | 1837 | anyStreamingErrNonStreaming( |
| 1892 | \\["\uDd1ea"] | 1838 | \\["\uDd1ea"] |
| 1893 | ); | 1839 | ); |
| 1894 | } | 1840 | } |
| 1895 | 1841 | ||
| 1896 | test "i_string_incomplete_surrogates_escape_valid" { | 1842 | test "i_string_incomplete_surrogates_escape_valid" { |
| 1897 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1898 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1899 | |||
| 1900 | anyStreamingErrNonStreaming( | 1843 | anyStreamingErrNonStreaming( |
| 1901 | \\["\uD800\uD800\n"] | 1844 | \\["\uD800\uD800\n"] |
| 1902 | ); | 1845 | ); |
| 1903 | } | 1846 | } |
| 1904 | 1847 | ||
| 1905 | test "i_string_invalid_lonely_surrogate" { | 1848 | test "i_string_invalid_lonely_surrogate" { |
| 1906 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1907 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1908 | |||
| 1909 | anyStreamingErrNonStreaming( | 1849 | anyStreamingErrNonStreaming( |
| 1910 | \\["\ud800"] | 1850 | \\["\ud800"] |
| 1911 | ); | 1851 | ); |
| 1912 | } | 1852 | } |
| 1913 | 1853 | ||
| 1914 | test "i_string_invalid_surrogate" { | 1854 | test "i_string_invalid_surrogate" { |
| 1915 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1916 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1917 | |||
| 1918 | anyStreamingErrNonStreaming( | 1855 | anyStreamingErrNonStreaming( |
| 1919 | \\["\ud800abc"] | 1856 | \\["\ud800abc"] |
| 1920 | ); | 1857 | ); |
| ... | @@ -1927,9 +1864,6 @@ test "i_string_invalid_utf-8" { | ... | @@ -1927,9 +1864,6 @@ test "i_string_invalid_utf-8" { |
| 1927 | } | 1864 | } |
| 1928 | 1865 | ||
| 1929 | test "i_string_inverted_surrogates_U+1D11E" { | 1866 | test "i_string_inverted_surrogates_U+1D11E" { |
| 1930 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1931 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1932 | |||
| 1933 | anyStreamingErrNonStreaming( | 1867 | anyStreamingErrNonStreaming( |
| 1934 | \\["\uDd1e\uD834"] | 1868 | \\["\uDd1e\uD834"] |
| 1935 | ); | 1869 | ); |
| ... | @@ -1942,9 +1876,6 @@ test "i_string_iso_latin_1" { | ... | @@ -1942,9 +1876,6 @@ test "i_string_iso_latin_1" { |
| 1942 | } | 1876 | } |
| 1943 | 1877 | ||
| 1944 | test "i_string_lone_second_surrogate" { | 1878 | test "i_string_lone_second_surrogate" { |
| 1945 | // https://github.com/ziglang/zig/issues/5127 | ||
| 1946 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 1947 | |||
| 1948 | anyStreamingErrNonStreaming( | 1879 | anyStreamingErrNonStreaming( |
| 1949 | \\["\uDFAA"] | 1880 | \\["\uDFAA"] |
| 1950 | ); | 1881 | ); |
lib/std/os/linux.zig+46-22| ... | @@ -48,13 +48,27 @@ pub fn getauxval(index: usize) usize { | ... | @@ -48,13 +48,27 @@ pub fn getauxval(index: usize) usize { |
| 48 | return 0; | 48 | return 0; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | // Some architectures require 64bit parameters for some syscalls to be passed in | 51 | // Some architectures (and some syscalls) require 64bit parameters to be passed |
| 52 | // even-aligned register pair | 52 | // in a even-aligned register pair. |
| 53 | const require_aligned_register_pair = // | 53 | const require_aligned_register_pair = // |
| 54 | std.Target.current.cpu.arch.isMIPS() or | 54 | std.Target.current.cpu.arch.isMIPS() or |
| 55 | std.Target.current.cpu.arch.isARM() or | 55 | std.Target.current.cpu.arch.isARM() or |
| 56 | std.Target.current.cpu.arch.isThumb(); | 56 | std.Target.current.cpu.arch.isThumb(); |
| 57 | 57 | ||
| 58 | // Split a 64bit value into a {LSB,MSB} pair. | ||
| 59 | fn splitValue64(val: u64) [2]u32 { | ||
| 60 | switch (builtin.endian) { | ||
| 61 | .Little => return [2]u32{ | ||
| 62 | @truncate(u32, val), | ||
| 63 | @truncate(u32, val >> 32), | ||
| 64 | }, | ||
| 65 | .Big => return [2]u32{ | ||
| 66 | @truncate(u32, val >> 32), | ||
| 67 | @truncate(u32, val), | ||
| 68 | }, | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 58 | /// Get the errno from a syscall return value, or 0 for no error. | 72 | /// Get the errno from a syscall return value, or 0 for no error. |
| 59 | pub fn getErrno(r: usize) u12 { | 73 | pub fn getErrno(r: usize) u12 { |
| 60 | const signed_r = @bitCast(isize, r); | 74 | const signed_r = @bitCast(isize, r); |
| ... | @@ -263,24 +277,26 @@ pub fn read(fd: i32, buf: [*]u8, count: usize) usize { | ... | @@ -263,24 +277,26 @@ pub fn read(fd: i32, buf: [*]u8, count: usize) usize { |
| 263 | } | 277 | } |
| 264 | 278 | ||
| 265 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: u64) usize { | 279 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: u64) usize { |
| 280 | const offset_halves = splitValue64(offset); | ||
| 266 | return syscall5( | 281 | return syscall5( |
| 267 | .preadv, | 282 | .preadv, |
| 268 | @bitCast(usize, @as(isize, fd)), | 283 | @bitCast(usize, @as(isize, fd)), |
| 269 | @ptrToInt(iov), | 284 | @ptrToInt(iov), |
| 270 | count, | 285 | count, |
| 271 | @truncate(usize, offset), | 286 | offset_halves[0], |
| 272 | @truncate(usize, offset >> 32), | 287 | offset_halves[1], |
| 273 | ); | 288 | ); |
| 274 | } | 289 | } |
| 275 | 290 | ||
| 276 | pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: u64, flags: kernel_rwf) usize { | 291 | pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: u64, flags: kernel_rwf) usize { |
| 292 | const offset_halves = splitValue64(offset); | ||
| 277 | return syscall6( | 293 | return syscall6( |
| 278 | .preadv2, | 294 | .preadv2, |
| 279 | @bitCast(usize, @as(isize, fd)), | 295 | @bitCast(usize, @as(isize, fd)), |
| 280 | @ptrToInt(iov), | 296 | @ptrToInt(iov), |
| 281 | count, | 297 | count, |
| 282 | @truncate(usize, offset), | 298 | offset_halves[0], |
| 283 | @truncate(usize, offset >> 32), | 299 | offset_halves[1], |
| 284 | flags, | 300 | flags, |
| 285 | ); | 301 | ); |
| 286 | } | 302 | } |
| ... | @@ -294,24 +310,26 @@ pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { | ... | @@ -294,24 +310,26 @@ pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { |
| 294 | } | 310 | } |
| 295 | 311 | ||
| 296 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64) usize { | 312 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64) usize { |
| 313 | const offset_halves = splitValue64(offset); | ||
| 297 | return syscall5( | 314 | return syscall5( |
| 298 | .pwritev, | 315 | .pwritev, |
| 299 | @bitCast(usize, @as(isize, fd)), | 316 | @bitCast(usize, @as(isize, fd)), |
| 300 | @ptrToInt(iov), | 317 | @ptrToInt(iov), |
| 301 | count, | 318 | count, |
| 302 | @truncate(usize, offset), | 319 | offset_halves[0], |
| 303 | @truncate(usize, offset >> 32), | 320 | offset_halves[1], |
| 304 | ); | 321 | ); |
| 305 | } | 322 | } |
| 306 | 323 | ||
| 307 | pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64, flags: kernel_rwf) usize { | 324 | pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: u64, flags: kernel_rwf) usize { |
| 325 | const offset_halves = splitValue64(offset); | ||
| 308 | return syscall6( | 326 | return syscall6( |
| 309 | .pwritev2, | 327 | .pwritev2, |
| 310 | @bitCast(usize, @as(isize, fd)), | 328 | @bitCast(usize, @as(isize, fd)), |
| 311 | @ptrToInt(iov), | 329 | @ptrToInt(iov), |
| 312 | count, | 330 | count, |
| 313 | @truncate(usize, offset), | 331 | offset_halves[0], |
| 314 | @truncate(usize, offset >> 32), | 332 | offset_halves[1], |
| 315 | flags, | 333 | flags, |
| 316 | ); | 334 | ); |
| 317 | } | 335 | } |
| ... | @@ -338,6 +356,7 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us | ... | @@ -338,6 +356,7 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us |
| 338 | 356 | ||
| 339 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { | 357 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 340 | if (@hasField(SYS, "pread64")) { | 358 | if (@hasField(SYS, "pread64")) { |
| 359 | const offset_halves = splitValue64(offset); | ||
| 341 | if (require_aligned_register_pair) { | 360 | if (require_aligned_register_pair) { |
| 342 | return syscall6( | 361 | return syscall6( |
| 343 | .pread64, | 362 | .pread64, |
| ... | @@ -345,8 +364,8 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { | ... | @@ -345,8 +364,8 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 345 | @ptrToInt(buf), | 364 | @ptrToInt(buf), |
| 346 | count, | 365 | count, |
| 347 | 0, | 366 | 0, |
| 348 | @truncate(usize, offset), | 367 | offset_halves[0], |
| 349 | @truncate(usize, offset >> 32), | 368 | offset_halves[1], |
| 350 | ); | 369 | ); |
| 351 | } else { | 370 | } else { |
| 352 | return syscall5( | 371 | return syscall5( |
| ... | @@ -354,8 +373,8 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { | ... | @@ -354,8 +373,8 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize { |
| 354 | @bitCast(usize, @as(isize, fd)), | 373 | @bitCast(usize, @as(isize, fd)), |
| 355 | @ptrToInt(buf), | 374 | @ptrToInt(buf), |
| 356 | count, | 375 | count, |
| 357 | @truncate(usize, offset), | 376 | offset_halves[0], |
| 358 | @truncate(usize, offset >> 32), | 377 | offset_halves[1], |
| 359 | ); | 378 | ); |
| 360 | } | 379 | } |
| 361 | } else { | 380 | } else { |
| ... | @@ -401,20 +420,21 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { | ... | @@ -401,20 +420,21 @@ pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { |
| 401 | 420 | ||
| 402 | pub fn ftruncate(fd: i32, length: u64) usize { | 421 | pub fn ftruncate(fd: i32, length: u64) usize { |
| 403 | if (@hasField(SYS, "ftruncate64")) { | 422 | if (@hasField(SYS, "ftruncate64")) { |
| 423 | const length_halves = splitValue64(length); | ||
| 404 | if (require_aligned_register_pair) { | 424 | if (require_aligned_register_pair) { |
| 405 | return syscall4( | 425 | return syscall4( |
| 406 | .ftruncate64, | 426 | .ftruncate64, |
| 407 | @bitCast(usize, @as(isize, fd)), | 427 | @bitCast(usize, @as(isize, fd)), |
| 408 | 0, | 428 | 0, |
| 409 | @truncate(usize, length), | 429 | length_halves[0], |
| 410 | @truncate(usize, length >> 32), | 430 | length_halves[1], |
| 411 | ); | 431 | ); |
| 412 | } else { | 432 | } else { |
| 413 | return syscall3( | 433 | return syscall3( |
| 414 | .ftruncate64, | 434 | .ftruncate64, |
| 415 | @bitCast(usize, @as(isize, fd)), | 435 | @bitCast(usize, @as(isize, fd)), |
| 416 | @truncate(usize, length), | 436 | length_halves[0], |
| 417 | @truncate(usize, length >> 32), | 437 | length_halves[1], |
| 418 | ); | 438 | ); |
| 419 | } | 439 | } |
| 420 | } else { | 440 | } else { |
| ... | @@ -428,6 +448,8 @@ pub fn ftruncate(fd: i32, length: u64) usize { | ... | @@ -428,6 +448,8 @@ pub fn ftruncate(fd: i32, length: u64) usize { |
| 428 | 448 | ||
| 429 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { | 449 | pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { |
| 430 | if (@hasField(SYS, "pwrite64")) { | 450 | if (@hasField(SYS, "pwrite64")) { |
| 451 | const offset_halves = splitValue64(offset); | ||
| 452 | |||
| 431 | if (require_aligned_register_pair) { | 453 | if (require_aligned_register_pair) { |
| 432 | return syscall6( | 454 | return syscall6( |
| 433 | .pwrite64, | 455 | .pwrite64, |
| ... | @@ -435,8 +457,8 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { | ... | @@ -435,8 +457,8 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { |
| 435 | @ptrToInt(buf), | 457 | @ptrToInt(buf), |
| 436 | count, | 458 | count, |
| 437 | 0, | 459 | 0, |
| 438 | @truncate(usize, offset), | 460 | offset_halves[0], |
| 439 | @truncate(usize, offset >> 32), | 461 | offset_halves[1], |
| 440 | ); | 462 | ); |
| 441 | } else { | 463 | } else { |
| 442 | return syscall5( | 464 | return syscall5( |
| ... | @@ -444,8 +466,8 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { | ... | @@ -444,8 +466,8 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: u64) usize { |
| 444 | @bitCast(usize, @as(isize, fd)), | 466 | @bitCast(usize, @as(isize, fd)), |
| 445 | @ptrToInt(buf), | 467 | @ptrToInt(buf), |
| 446 | count, | 468 | count, |
| 447 | @truncate(usize, offset), | 469 | offset_halves[0], |
| 448 | @truncate(usize, offset >> 32), | 470 | offset_halves[1], |
| 449 | ); | 471 | ); |
| 450 | } | 472 | } |
| 451 | } else { | 473 | } else { |
| ... | @@ -540,6 +562,8 @@ pub fn close(fd: i32) usize { | ... | @@ -540,6 +562,8 @@ pub fn close(fd: i32) usize { |
| 540 | 562 | ||
| 541 | /// Can only be called on 32 bit systems. For 64 bit see `lseek`. | 563 | /// Can only be called on 32 bit systems. For 64 bit see `lseek`. |
| 542 | pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize { | 564 | pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize { |
| 565 | // NOTE: The offset parameter splitting is independent from the target | ||
| 566 | // endianness. | ||
| 543 | return syscall5( | 567 | return syscall5( |
| 544 | ._llseek, | 568 | ._llseek, |
| 545 | @bitCast(usize, @as(isize, fd)), | 569 | @bitCast(usize, @as(isize, fd)), |
lib/std/unicode.zig+20-9| ... | @@ -706,41 +706,52 @@ fn calcUtf16LeLen(utf8: []const u8) usize { | ... | @@ -706,41 +706,52 @@ fn calcUtf16LeLen(utf8: []const u8) usize { |
| 706 | } | 706 | } |
| 707 | 707 | ||
| 708 | test "utf8ToUtf16LeStringLiteral" { | 708 | test "utf8ToUtf16LeStringLiteral" { |
| 709 | // https://github.com/ziglang/zig/issues/5127 | ||
| 710 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 711 | |||
| 712 | { | 709 | { |
| 713 | const bytes = [_:0]u16{0x41}; | 710 | const bytes = [_:0]u16{ |
| 711 | mem.nativeToLittle(u16, 0x41), | ||
| 712 | }; | ||
| 714 | const utf16 = utf8ToUtf16LeStringLiteral("A"); | 713 | const utf16 = utf8ToUtf16LeStringLiteral("A"); |
| 715 | testing.expectEqualSlices(u16, &bytes, utf16); | 714 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 716 | testing.expect(utf16[1] == 0); | 715 | testing.expect(utf16[1] == 0); |
| 717 | } | 716 | } |
| 718 | { | 717 | { |
| 719 | const bytes = [_:0]u16{ 0xD801, 0xDC37 }; | 718 | const bytes = [_:0]u16{ |
| 719 | mem.nativeToLittle(u16, 0xD801), | ||
| 720 | mem.nativeToLittle(u16, 0xDC37), | ||
| 721 | }; | ||
| 720 | const utf16 = utf8ToUtf16LeStringLiteral("𐐷"); | 722 | const utf16 = utf8ToUtf16LeStringLiteral("𐐷"); |
| 721 | testing.expectEqualSlices(u16, &bytes, utf16); | 723 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 722 | testing.expect(utf16[2] == 0); | 724 | testing.expect(utf16[2] == 0); |
| 723 | } | 725 | } |
| 724 | { | 726 | { |
| 725 | const bytes = [_:0]u16{0x02FF}; | 727 | const bytes = [_:0]u16{ |
| 728 | mem.nativeToLittle(u16, 0x02FF), | ||
| 729 | }; | ||
| 726 | const utf16 = utf8ToUtf16LeStringLiteral("\u{02FF}"); | 730 | const utf16 = utf8ToUtf16LeStringLiteral("\u{02FF}"); |
| 727 | testing.expectEqualSlices(u16, &bytes, utf16); | 731 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 728 | testing.expect(utf16[1] == 0); | 732 | testing.expect(utf16[1] == 0); |
| 729 | } | 733 | } |
| 730 | { | 734 | { |
| 731 | const bytes = [_:0]u16{0x7FF}; | 735 | const bytes = [_:0]u16{ |
| 736 | mem.nativeToLittle(u16, 0x7FF), | ||
| 737 | }; | ||
| 732 | const utf16 = utf8ToUtf16LeStringLiteral("\u{7FF}"); | 738 | const utf16 = utf8ToUtf16LeStringLiteral("\u{7FF}"); |
| 733 | testing.expectEqualSlices(u16, &bytes, utf16); | 739 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 734 | testing.expect(utf16[1] == 0); | 740 | testing.expect(utf16[1] == 0); |
| 735 | } | 741 | } |
| 736 | { | 742 | { |
| 737 | const bytes = [_:0]u16{0x801}; | 743 | const bytes = [_:0]u16{ |
| 744 | mem.nativeToLittle(u16, 0x801), | ||
| 745 | }; | ||
| 738 | const utf16 = utf8ToUtf16LeStringLiteral("\u{801}"); | 746 | const utf16 = utf8ToUtf16LeStringLiteral("\u{801}"); |
| 739 | testing.expectEqualSlices(u16, &bytes, utf16); | 747 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 740 | testing.expect(utf16[1] == 0); | 748 | testing.expect(utf16[1] == 0); |
| 741 | } | 749 | } |
| 742 | { | 750 | { |
| 743 | const bytes = [_:0]u16{ 0xDBFF, 0xDFFF }; | 751 | const bytes = [_:0]u16{ |
| 752 | mem.nativeToLittle(u16, 0xDBFF), | ||
| 753 | mem.nativeToLittle(u16, 0xDFFF), | ||
| 754 | }; | ||
| 744 | const utf16 = utf8ToUtf16LeStringLiteral("\u{10FFFF}"); | 755 | const utf16 = utf8ToUtf16LeStringLiteral("\u{10FFFF}"); |
| 745 | testing.expectEqualSlices(u16, &bytes, utf16); | 756 | testing.expectEqualSlices(u16, &bytes, utf16); |
| 746 | testing.expect(utf16[2] == 0); | 757 | testing.expect(utf16[2] == 0); |
test/stage1/behavior/union.zig-3| ... | @@ -623,9 +623,6 @@ test "0-sized extern union definition" { | ... | @@ -623,9 +623,6 @@ test "0-sized extern union definition" { |
| 623 | } | 623 | } |
| 624 | 624 | ||
| 625 | test "union initializer generates padding only if needed" { | 625 | test "union initializer generates padding only if needed" { |
| 626 | // https://github.com/ziglang/zig/issues/5127 | ||
| 627 | if (std.Target.current.cpu.arch == .mips) return error.SkipZigTest; | ||
| 628 | |||
| 629 | const U = union(enum) { | 626 | const U = union(enum) { |
| 630 | A: u24, | 627 | A: u24, |
| 631 | }; | 628 | }; |