| author | |
| committer | |
| log | 50339f595aa6ec96760b1cd9f8d0e0bfc3f167fc |
| tree | 9e2b95d8e111e905e00511962dfd32c8e5bb3245 |
| parent | a6c8ee5231230947c928bbe1c6a39eb6e1bb9c5b |
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>679 files changed, 8274 insertions(+), 7959 deletions(-)
CMakeLists.txt+2-2| ... | @@ -376,7 +376,7 @@ set(ZIG_STAGE2_SOURCES | ... | @@ -376,7 +376,7 @@ set(ZIG_STAGE2_SOURCES |
| 376 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfdi.zig" | 376 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfdi.zig" |
| 377 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfsi.zig" | 377 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfsi.zig" |
| 378 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfti.zig" | 378 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/fixxfti.zig" |
| 379 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/float_to_int.zig" | 379 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int_from_float.zig" |
| 380 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdidf.zig" | 380 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdidf.zig" |
| 381 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdihf.zig" | 381 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdihf.zig" |
| 382 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdisf.zig" | 382 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/floatdisf.zig" |
| ... | @@ -417,7 +417,7 @@ set(ZIG_STAGE2_SOURCES | ... | @@ -417,7 +417,7 @@ set(ZIG_STAGE2_SOURCES |
| 417 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/getf2.zig" | 417 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/getf2.zig" |
| 418 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/gexf2.zig" | 418 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/gexf2.zig" |
| 419 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int.zig" | 419 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int.zig" |
| 420 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/int_to_float.zig" | 420 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/float_from_int.zig" |
| 421 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log.zig" | 421 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log.zig" |
| 422 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log10.zig" | 422 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log10.zig" |
| 423 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log2.zig" | 423 | "${CMAKE_SOURCE_DIR}/lib/compiler_rt/log2.zig" |
build.zig+1-1| ... | @@ -487,7 +487,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { | ... | @@ -487,7 +487,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void { |
| 487 | .cpu_arch = .wasm32, | 487 | .cpu_arch = .wasm32, |
| 488 | .os_tag = .wasi, | 488 | .os_tag = .wasi, |
| 489 | }; | 489 | }; |
| 490 | target.cpu_features_add.addFeature(@enumToInt(std.Target.wasm.Feature.bulk_memory)); | 490 | target.cpu_features_add.addFeature(@intFromEnum(std.Target.wasm.Feature.bulk_memory)); |
| 491 | 491 | ||
| 492 | const exe = addCompilerStep(b, .ReleaseSmall, target); | 492 | const exe = addCompilerStep(b, .ReleaseSmall, target); |
| 493 | 493 |
doc/langref.html.in+75-75| ... | @@ -2763,14 +2763,14 @@ test "comptime pointers" { | ... | @@ -2763,14 +2763,14 @@ test "comptime pointers" { |
| 2763 | } | 2763 | } |
| 2764 | } | 2764 | } |
| 2765 | {#code_end#} | 2765 | {#code_end#} |
| 2766 | <p>To convert an integer address into a pointer, use {#syntax#}@intToPtr{#endsyntax#}. | 2766 | <p>To convert an integer address into a pointer, use {#syntax#}@ptrFromInt{#endsyntax#}. |
| 2767 | To convert a pointer to an integer, use {#syntax#}@ptrToInt{#endsyntax#}:</p> | 2767 | To convert a pointer to an integer, use {#syntax#}@intFromPtr{#endsyntax#}:</p> |
| 2768 | {#code_begin|test|test_integer_pointer_conversion#} | 2768 | {#code_begin|test|test_integer_pointer_conversion#} |
| 2769 | const expect = @import("std").testing.expect; | 2769 | const expect = @import("std").testing.expect; |
| 2770 | 2770 | ||
| 2771 | test "@ptrToInt and @intToPtr" { | 2771 | test "@intFromPtr and @ptrFromInt" { |
| 2772 | const ptr = @intToPtr(*i32, 0xdeadbee0); | 2772 | const ptr = @ptrFromInt(*i32, 0xdeadbee0); |
| 2773 | const addr = @ptrToInt(ptr); | 2773 | const addr = @intFromPtr(ptr); |
| 2774 | try expect(@TypeOf(addr) == usize); | 2774 | try expect(@TypeOf(addr) == usize); |
| 2775 | try expect(addr == 0xdeadbee0); | 2775 | try expect(addr == 0xdeadbee0); |
| 2776 | } | 2776 | } |
| ... | @@ -2780,18 +2780,18 @@ test "@ptrToInt and @intToPtr" { | ... | @@ -2780,18 +2780,18 @@ test "@ptrToInt and @intToPtr" { |
| 2780 | {#code_begin|test|test_comptime_pointer_conversion#} | 2780 | {#code_begin|test|test_comptime_pointer_conversion#} |
| 2781 | const expect = @import("std").testing.expect; | 2781 | const expect = @import("std").testing.expect; |
| 2782 | 2782 | ||
| 2783 | test "comptime @intToPtr" { | 2783 | test "comptime @ptrFromInt" { |
| 2784 | comptime { | 2784 | comptime { |
| 2785 | // Zig is able to do this at compile-time, as long as | 2785 | // Zig is able to do this at compile-time, as long as |
| 2786 | // ptr is never dereferenced. | 2786 | // ptr is never dereferenced. |
| 2787 | const ptr = @intToPtr(*i32, 0xdeadbee0); | 2787 | const ptr = @ptrFromInt(*i32, 0xdeadbee0); |
| 2788 | const addr = @ptrToInt(ptr); | 2788 | const addr = @intFromPtr(ptr); |
| 2789 | try expect(@TypeOf(addr) == usize); | 2789 | try expect(@TypeOf(addr) == usize); |
| 2790 | try expect(addr == 0xdeadbee0); | 2790 | try expect(addr == 0xdeadbee0); |
| 2791 | } | 2791 | } |
| 2792 | } | 2792 | } |
| 2793 | {#code_end#} | 2793 | {#code_end#} |
| 2794 | {#see_also|Optional Pointers|@intToPtr|@ptrToInt|C Pointers#} | 2794 | {#see_also|Optional Pointers|@ptrFromInt|@intFromPtr|C Pointers#} |
| 2795 | {#header_open|volatile#} | 2795 | {#header_open|volatile#} |
| 2796 | <p>Loads and stores are assumed to not have side effects. If a given load or store | 2796 | <p>Loads and stores are assumed to not have side effects. If a given load or store |
| 2797 | should have side effects, such as Memory Mapped Input/Output (MMIO), use {#syntax#}volatile{#endsyntax#}. | 2797 | should have side effects, such as Memory Mapped Input/Output (MMIO), use {#syntax#}volatile{#endsyntax#}. |
| ... | @@ -2801,7 +2801,7 @@ test "comptime @intToPtr" { | ... | @@ -2801,7 +2801,7 @@ test "comptime @intToPtr" { |
| 2801 | const expect = @import("std").testing.expect; | 2801 | const expect = @import("std").testing.expect; |
| 2802 | 2802 | ||
| 2803 | test "volatile" { | 2803 | test "volatile" { |
| 2804 | const mmio_ptr = @intToPtr(*volatile u8, 0x12345678); | 2804 | const mmio_ptr = @ptrFromInt(*volatile u8, 0x12345678); |
| 2805 | try expect(@TypeOf(mmio_ptr) == *volatile u8); | 2805 | try expect(@TypeOf(mmio_ptr) == *volatile u8); |
| 2806 | } | 2806 | } |
| 2807 | {#code_end#} | 2807 | {#code_end#} |
| ... | @@ -2942,8 +2942,8 @@ const expect = std.testing.expect; | ... | @@ -2942,8 +2942,8 @@ const expect = std.testing.expect; |
| 2942 | 2942 | ||
| 2943 | test "allowzero" { | 2943 | test "allowzero" { |
| 2944 | var zero: usize = 0; | 2944 | var zero: usize = 0; |
| 2945 | var ptr = @intToPtr(*allowzero i32, zero); | 2945 | var ptr = @ptrFromInt(*allowzero i32, zero); |
| 2946 | try expect(@ptrToInt(ptr) == 0); | 2946 | try expect(@intFromPtr(ptr) == 0); |
| 2947 | } | 2947 | } |
| 2948 | {#code_end#} | 2948 | {#code_end#} |
| 2949 | {#header_close#} | 2949 | {#header_close#} |
| ... | @@ -3006,7 +3006,7 @@ test "basic slices" { | ... | @@ -3006,7 +3006,7 @@ test "basic slices" { |
| 3006 | // while using the `ptr` field gives a many-item pointer. | 3006 | // while using the `ptr` field gives a many-item pointer. |
| 3007 | try expect(@TypeOf(slice.ptr) == [*]i32); | 3007 | try expect(@TypeOf(slice.ptr) == [*]i32); |
| 3008 | try expect(@TypeOf(&slice[0]) == *i32); | 3008 | try expect(@TypeOf(&slice[0]) == *i32); |
| 3009 | try expect(@ptrToInt(slice.ptr) == @ptrToInt(&slice[0])); | 3009 | try expect(@intFromPtr(slice.ptr) == @intFromPtr(&slice[0])); |
| 3010 | 3010 | ||
| 3011 | // Slices have array bounds checking. If you try to access something out | 3011 | // Slices have array bounds checking. If you try to access something out |
| 3012 | // of bounds, you'll get a safety check failure: | 3012 | // of bounds, you'll get a safety check failure: |
| ... | @@ -3448,8 +3448,8 @@ var bit_field = BitField{ | ... | @@ -3448,8 +3448,8 @@ var bit_field = BitField{ |
| 3448 | }; | 3448 | }; |
| 3449 | 3449 | ||
| 3450 | test "pointers of sub-byte-aligned fields share addresses" { | 3450 | test "pointers of sub-byte-aligned fields share addresses" { |
| 3451 | try expect(@ptrToInt(&bit_field.a) == @ptrToInt(&bit_field.b)); | 3451 | try expect(@intFromPtr(&bit_field.a) == @intFromPtr(&bit_field.b)); |
| 3452 | try expect(@ptrToInt(&bit_field.a) == @ptrToInt(&bit_field.c)); | 3452 | try expect(@intFromPtr(&bit_field.a) == @intFromPtr(&bit_field.c)); |
| 3453 | } | 3453 | } |
| 3454 | {#code_end#} | 3454 | {#code_end#} |
| 3455 | <p> | 3455 | <p> |
| ... | @@ -3664,9 +3664,9 @@ const Value = enum(u2) { | ... | @@ -3664,9 +3664,9 @@ const Value = enum(u2) { |
| 3664 | // Now you can cast between u2 and Value. | 3664 | // Now you can cast between u2 and Value. |
| 3665 | // The ordinal value starts from 0, counting up by 1 from the previous member. | 3665 | // The ordinal value starts from 0, counting up by 1 from the previous member. |
| 3666 | test "enum ordinal value" { | 3666 | test "enum ordinal value" { |
| 3667 | try expect(@enumToInt(Value.zero) == 0); | 3667 | try expect(@intFromEnum(Value.zero) == 0); |
| 3668 | try expect(@enumToInt(Value.one) == 1); | 3668 | try expect(@intFromEnum(Value.one) == 1); |
| 3669 | try expect(@enumToInt(Value.two) == 2); | 3669 | try expect(@intFromEnum(Value.two) == 2); |
| 3670 | } | 3670 | } |
| 3671 | 3671 | ||
| 3672 | // You can override the ordinal value for an enum. | 3672 | // You can override the ordinal value for an enum. |
| ... | @@ -3676,9 +3676,9 @@ const Value2 = enum(u32) { | ... | @@ -3676,9 +3676,9 @@ const Value2 = enum(u32) { |
| 3676 | million = 1000000, | 3676 | million = 1000000, |
| 3677 | }; | 3677 | }; |
| 3678 | test "set enum ordinal value" { | 3678 | test "set enum ordinal value" { |
| 3679 | try expect(@enumToInt(Value2.hundred) == 100); | 3679 | try expect(@intFromEnum(Value2.hundred) == 100); |
| 3680 | try expect(@enumToInt(Value2.thousand) == 1000); | 3680 | try expect(@intFromEnum(Value2.thousand) == 1000); |
| 3681 | try expect(@enumToInt(Value2.million) == 1000000); | 3681 | try expect(@intFromEnum(Value2.million) == 1000000); |
| 3682 | } | 3682 | } |
| 3683 | 3683 | ||
| 3684 | // You can also override only some values. | 3684 | // You can also override only some values. |
| ... | @@ -3690,11 +3690,11 @@ const Value3 = enum(u4) { | ... | @@ -3690,11 +3690,11 @@ const Value3 = enum(u4) { |
| 3690 | e, | 3690 | e, |
| 3691 | }; | 3691 | }; |
| 3692 | test "enum implicit ordinal values and overridden values" { | 3692 | test "enum implicit ordinal values and overridden values" { |
| 3693 | try expect(@enumToInt(Value3.a) == 0); | 3693 | try expect(@intFromEnum(Value3.a) == 0); |
| 3694 | try expect(@enumToInt(Value3.b) == 8); | 3694 | try expect(@intFromEnum(Value3.b) == 8); |
| 3695 | try expect(@enumToInt(Value3.c) == 9); | 3695 | try expect(@intFromEnum(Value3.c) == 9); |
| 3696 | try expect(@enumToInt(Value3.d) == 4); | 3696 | try expect(@intFromEnum(Value3.d) == 4); |
| 3697 | try expect(@enumToInt(Value3.e) == 5); | 3697 | try expect(@intFromEnum(Value3.e) == 5); |
| 3698 | } | 3698 | } |
| 3699 | 3699 | ||
| 3700 | // Enums can have methods, the same as structs and unions. | 3700 | // Enums can have methods, the same as structs and unions. |
| ... | @@ -3811,7 +3811,7 @@ test "switch using enum literals" { | ... | @@ -3811,7 +3811,7 @@ test "switch using enum literals" { |
| 3811 | It must specify a tag type and cannot consume every enumeration value. | 3811 | It must specify a tag type and cannot consume every enumeration value. |
| 3812 | </p> | 3812 | </p> |
| 3813 | <p> | 3813 | <p> |
| 3814 | {#link|@intToEnum#} on a non-exhaustive enum involves the safety semantics | 3814 | {#link|@enumFromInt#} on a non-exhaustive enum involves the safety semantics |
| 3815 | of {#link|@intCast#} to the integer tag type, but beyond that always results in | 3815 | of {#link|@intCast#} to the integer tag type, but beyond that always results in |
| 3816 | a well-defined enum value. | 3816 | a well-defined enum value. |
| 3817 | </p> | 3817 | </p> |
| ... | @@ -4385,7 +4385,7 @@ fn withFor(any: AnySlice) usize { | ... | @@ -4385,7 +4385,7 @@ fn withFor(any: AnySlice) usize { |
| 4385 | // With `inline for` the function gets generated as | 4385 | // With `inline for` the function gets generated as |
| 4386 | // a series of `if` statements relying on the optimizer | 4386 | // a series of `if` statements relying on the optimizer |
| 4387 | // to convert it to a switch. | 4387 | // to convert it to a switch. |
| 4388 | if (field.value == @enumToInt(any)) { | 4388 | if (field.value == @intFromEnum(any)) { |
| 4389 | return @field(any, field.name).len; | 4389 | return @field(any, field.name).len; |
| 4390 | } | 4390 | } |
| 4391 | } | 4391 | } |
| ... | @@ -4428,7 +4428,7 @@ fn getNum(u: U) u32 { | ... | @@ -4428,7 +4428,7 @@ fn getNum(u: U) u32 { |
| 4428 | // `u.a` or `u.b` and `tag` is `u`'s comptime-known tag value. | 4428 | // `u.a` or `u.b` and `tag` is `u`'s comptime-known tag value. |
| 4429 | inline else => |num, tag| { | 4429 | inline else => |num, tag| { |
| 4430 | if (tag == .b) { | 4430 | if (tag == .b) { |
| 4431 | return @floatToInt(u32, num); | 4431 | return @intFromFloat(u32, num); |
| 4432 | } | 4432 | } |
| 4433 | return num; | 4433 | return num; |
| 4434 | } | 4434 | } |
| ... | @@ -6625,19 +6625,19 @@ test "coercion from homogenous tuple to array" { | ... | @@ -6625,19 +6625,19 @@ test "coercion from homogenous tuple to array" { |
| 6625 | <ul> | 6625 | <ul> |
| 6626 | <li>{#link|@bitCast#} - change type but maintain bit representation</li> | 6626 | <li>{#link|@bitCast#} - change type but maintain bit representation</li> |
| 6627 | <li>{#link|@alignCast#} - make a pointer have more alignment</li> | 6627 | <li>{#link|@alignCast#} - make a pointer have more alignment</li> |
| 6628 | <li>{#link|@boolToInt#} - convert true to 1 and false to 0</li> | 6628 | <li>{#link|@intFromBool#} - convert true to 1 and false to 0</li> |
| 6629 | <li>{#link|@enumToInt#} - obtain the integer tag value of an enum or tagged union</li> | 6629 | <li>{#link|@intFromEnum#} - obtain the integer tag value of an enum or tagged union</li> |
| 6630 | <li>{#link|@errSetCast#} - convert to a smaller error set</li> | 6630 | <li>{#link|@errSetCast#} - convert to a smaller error set</li> |
| 6631 | <li>{#link|@errorToInt#} - obtain the integer value of an error code</li> | 6631 | <li>{#link|@intFromError#} - obtain the integer value of an error code</li> |
| 6632 | <li>{#link|@floatCast#} - convert a larger float to a smaller float</li> | 6632 | <li>{#link|@floatCast#} - convert a larger float to a smaller float</li> |
| 6633 | <li>{#link|@floatToInt#} - obtain the integer part of a float value</li> | 6633 | <li>{#link|@intFromFloat#} - obtain the integer part of a float value</li> |
| 6634 | <li>{#link|@intCast#} - convert between integer types</li> | 6634 | <li>{#link|@intCast#} - convert between integer types</li> |
| 6635 | <li>{#link|@intToEnum#} - obtain an enum value based on its integer tag value</li> | 6635 | <li>{#link|@enumFromInt#} - obtain an enum value based on its integer tag value</li> |
| 6636 | <li>{#link|@intToError#} - obtain an error code based on its integer value</li> | 6636 | <li>{#link|@errorFromInt#} - obtain an error code based on its integer value</li> |
| 6637 | <li>{#link|@intToFloat#} - convert an integer to a float value</li> | 6637 | <li>{#link|@floatFromInt#} - convert an integer to a float value</li> |
| 6638 | <li>{#link|@intToPtr#} - convert an address to a pointer</li> | 6638 | <li>{#link|@ptrFromInt#} - convert an address to a pointer</li> |
| 6639 | <li>{#link|@ptrCast#} - convert between pointer types</li> | 6639 | <li>{#link|@ptrCast#} - convert between pointer types</li> |
| 6640 | <li>{#link|@ptrToInt#} - obtain the address of a pointer</li> | 6640 | <li>{#link|@intFromPtr#} - obtain the address of a pointer</li> |
| 6641 | <li>{#link|@truncate#} - convert between integer types, chopping off bits</li> | 6641 | <li>{#link|@truncate#} - convert between integer types, chopping off bits</li> |
| 6642 | </ul> | 6642 | </ul> |
| 6643 | {#header_close#} | 6643 | {#header_close#} |
| ... | @@ -6744,8 +6744,8 @@ fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 { | ... | @@ -6744,8 +6744,8 @@ fn peerTypeEmptyArrayAndSliceAndError(a: bool, slice: []u8) anyerror![]u8 { |
| 6744 | } | 6744 | } |
| 6745 | 6745 | ||
| 6746 | test "peer type resolution: *const T and ?*T" { | 6746 | test "peer type resolution: *const T and ?*T" { |
| 6747 | const a = @intToPtr(*const usize, 0x123456780); | 6747 | const a = @ptrFromInt(*const usize, 0x123456780); |
| 6748 | const b = @intToPtr(?*usize, 0x123456780); | 6748 | const b = @ptrFromInt(?*usize, 0x123456780); |
| 6749 | try expect(a == b); | 6749 | try expect(a == b); |
| 6750 | try expect(b == a); | 6750 | try expect(b == a); |
| 6751 | } | 6751 | } |
| ... | @@ -7542,7 +7542,7 @@ pub fn main() void { | ... | @@ -7542,7 +7542,7 @@ pub fn main() void { |
| 7542 | {#target_linux_x86_64#} | 7542 | {#target_linux_x86_64#} |
| 7543 | pub fn main() noreturn { | 7543 | pub fn main() noreturn { |
| 7544 | const msg = "hello world\n"; | 7544 | const msg = "hello world\n"; |
| 7545 | _ = syscall3(SYS_write, STDOUT_FILENO, @ptrToInt(msg), msg.len); | 7545 | _ = syscall3(SYS_write, STDOUT_FILENO, @intFromPtr(msg), msg.len); |
| 7546 | _ = syscall1(SYS_exit, 0); | 7546 | _ = syscall1(SYS_exit, 0); |
| 7547 | unreachable; | 7547 | unreachable; |
| 7548 | } | 7548 | } |
| ... | @@ -7857,7 +7857,7 @@ comptime { | ... | @@ -7857,7 +7857,7 @@ comptime { |
| 7857 | Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}. | 7857 | Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}. |
| 7858 | </p> | 7858 | </p> |
| 7859 | <p> | 7859 | <p> |
| 7860 | Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@intToPtr{#endsyntax#} if you need this. | 7860 | Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this. |
| 7861 | </p> | 7861 | </p> |
| 7862 | <p> | 7862 | <p> |
| 7863 | Can be used for these things for example: | 7863 | Can be used for these things for example: |
| ... | @@ -7884,8 +7884,8 @@ comptime { | ... | @@ -7884,8 +7884,8 @@ comptime { |
| 7884 | {#see_also|@offsetOf#} | 7884 | {#see_also|@offsetOf#} |
| 7885 | {#header_close#} | 7885 | {#header_close#} |
| 7886 | 7886 | ||
| 7887 | {#header_open|@boolToInt#} | 7887 | {#header_open|@intFromBool#} |
| 7888 | <pre>{#syntax#}@boolToInt(value: bool) u1{#endsyntax#}</pre> | 7888 | <pre>{#syntax#}@intFromBool(value: bool) u1{#endsyntax#}</pre> |
| 7889 | <p> | 7889 | <p> |
| 7890 | Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to | 7890 | Converts {#syntax#}true{#endsyntax#} to {#syntax#}@as(u1, 1){#endsyntax#} and {#syntax#}false{#endsyntax#} to |
| 7891 | {#syntax#}@as(u1, 0){#endsyntax#}. | 7891 | {#syntax#}@as(u1, 0){#endsyntax#}. |
| ... | @@ -8348,8 +8348,8 @@ test "main" { | ... | @@ -8348,8 +8348,8 @@ test "main" { |
| 8348 | {#see_also|@import#} | 8348 | {#see_also|@import#} |
| 8349 | {#header_close#} | 8349 | {#header_close#} |
| 8350 | 8350 | ||
| 8351 | {#header_open|@enumToInt#} | 8351 | {#header_open|@intFromEnum#} |
| 8352 | <pre>{#syntax#}@enumToInt(enum_or_tagged_union: anytype) anytype{#endsyntax#}</pre> | 8352 | <pre>{#syntax#}@intFromEnum(enum_or_tagged_union: anytype) anytype{#endsyntax#}</pre> |
| 8353 | <p> | 8353 | <p> |
| 8354 | Converts an enumeration value into its integer tag type. When a tagged union is passed, | 8354 | Converts an enumeration value into its integer tag type. When a tagged union is passed, |
| 8355 | the tag value is used as the enumeration value. | 8355 | the tag value is used as the enumeration value. |
| ... | @@ -8358,7 +8358,7 @@ test "main" { | ... | @@ -8358,7 +8358,7 @@ test "main" { |
| 8358 | If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#} | 8358 | If there is only one possible enum value, the result is a {#syntax#}comptime_int{#endsyntax#} |
| 8359 | known at {#link|comptime#}. | 8359 | known at {#link|comptime#}. |
| 8360 | </p> | 8360 | </p> |
| 8361 | {#see_also|@intToEnum#} | 8361 | {#see_also|@enumFromInt#} |
| 8362 | {#header_close#} | 8362 | {#header_close#} |
| 8363 | 8363 | ||
| 8364 | {#header_open|@errorName#} | 8364 | {#header_open|@errorName#} |
| ... | @@ -8383,8 +8383,8 @@ test "main" { | ... | @@ -8383,8 +8383,8 @@ test "main" { |
| 8383 | </p> | 8383 | </p> |
| 8384 | {#header_close#} | 8384 | {#header_close#} |
| 8385 | 8385 | ||
| 8386 | {#header_open|@errorToInt#} | 8386 | {#header_open|@intFromError#} |
| 8387 | <pre>{#syntax#}@errorToInt(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8){#endsyntax#}</pre> | 8387 | <pre>{#syntax#}@intFromError(err: anytype) std.meta.Int(.unsigned, @sizeOf(anyerror) * 8){#endsyntax#}</pre> |
| 8388 | <p> | 8388 | <p> |
| 8389 | Supports the following types: | 8389 | Supports the following types: |
| 8390 | </p> | 8390 | </p> |
| ... | @@ -8400,7 +8400,7 @@ test "main" { | ... | @@ -8400,7 +8400,7 @@ test "main" { |
| 8400 | It is generally recommended to avoid this | 8400 | It is generally recommended to avoid this |
| 8401 | cast, as the integer representation of an error is not stable across source code changes. | 8401 | cast, as the integer representation of an error is not stable across source code changes. |
| 8402 | </p> | 8402 | </p> |
| 8403 | {#see_also|@intToError#} | 8403 | {#see_also|@errorFromInt#} |
| 8404 | {#header_close#} | 8404 | {#header_close#} |
| 8405 | 8405 | ||
| 8406 | {#header_open|@errSetCast#} | 8406 | {#header_open|@errSetCast#} |
| ... | @@ -8526,8 +8526,8 @@ test "decl access by string" { | ... | @@ -8526,8 +8526,8 @@ test "decl access by string" { |
| 8526 | </p> | 8526 | </p> |
| 8527 | {#header_close#} | 8527 | {#header_close#} |
| 8528 | 8528 | ||
| 8529 | {#header_open|@floatToInt#} | 8529 | {#header_open|@intFromFloat#} |
| 8530 | <pre>{#syntax#}@floatToInt(comptime DestType: type, float: anytype) DestType{#endsyntax#}</pre> | 8530 | <pre>{#syntax#}@intFromFloat(comptime DestType: type, float: anytype) DestType{#endsyntax#}</pre> |
| 8531 | <p> | 8531 | <p> |
| 8532 | Converts the integer part of a floating point number to the destination type. | 8532 | Converts the integer part of a floating point number to the destination type. |
| 8533 | </p> | 8533 | </p> |
| ... | @@ -8535,7 +8535,7 @@ test "decl access by string" { | ... | @@ -8535,7 +8535,7 @@ test "decl access by string" { |
| 8535 | If the integer part of the floating point number cannot fit in the destination type, | 8535 | If the integer part of the floating point number cannot fit in the destination type, |
| 8536 | it invokes safety-checked {#link|Undefined Behavior#}. | 8536 | it invokes safety-checked {#link|Undefined Behavior#}. |
| 8537 | </p> | 8537 | </p> |
| 8538 | {#see_also|@intToFloat#} | 8538 | {#see_also|@floatFromInt#} |
| 8539 | {#header_close#} | 8539 | {#header_close#} |
| 8540 | 8540 | ||
| 8541 | {#header_open|@frameAddress#} | 8541 | {#header_open|@frameAddress#} |
| ... | @@ -8666,8 +8666,8 @@ test "integer cast panic" { | ... | @@ -8666,8 +8666,8 @@ test "integer cast panic" { |
| 8666 | </p> | 8666 | </p> |
| 8667 | {#header_close#} | 8667 | {#header_close#} |
| 8668 | 8668 | ||
| 8669 | {#header_open|@intToEnum#} | 8669 | {#header_open|@enumFromInt#} |
| 8670 | <pre>{#syntax#}@intToEnum(comptime DestType: type, integer: anytype) DestType{#endsyntax#}</pre> | 8670 | <pre>{#syntax#}@enumFromInt(comptime DestType: type, integer: anytype) DestType{#endsyntax#}</pre> |
| 8671 | <p> | 8671 | <p> |
| 8672 | Converts an integer into an {#link|enum#} value. | 8672 | Converts an integer into an {#link|enum#} value. |
| 8673 | </p> | 8673 | </p> |
| ... | @@ -8675,11 +8675,11 @@ test "integer cast panic" { | ... | @@ -8675,11 +8675,11 @@ test "integer cast panic" { |
| 8675 | Attempting to convert an integer which represents no value in the chosen enum type invokes | 8675 | Attempting to convert an integer which represents no value in the chosen enum type invokes |
| 8676 | safety-checked {#link|Undefined Behavior#}. | 8676 | safety-checked {#link|Undefined Behavior#}. |
| 8677 | </p> | 8677 | </p> |
| 8678 | {#see_also|@enumToInt#} | 8678 | {#see_also|@intFromEnum#} |
| 8679 | {#header_close#} | 8679 | {#header_close#} |
| 8680 | 8680 | ||
| 8681 | {#header_open|@intToError#} | 8681 | {#header_open|@errorFromInt#} |
| 8682 | <pre>{#syntax#}@intToError(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror{#endsyntax#}</pre> | 8682 | <pre>{#syntax#}@errorFromInt(value: std.meta.Int(.unsigned, @sizeOf(anyerror) * 8)) anyerror{#endsyntax#}</pre> |
| 8683 | <p> | 8683 | <p> |
| 8684 | Converts from the integer representation of an error into {#link|The Global Error Set#} type. | 8684 | Converts from the integer representation of an error into {#link|The Global Error Set#} type. |
| 8685 | </p> | 8685 | </p> |
| ... | @@ -8691,20 +8691,20 @@ test "integer cast panic" { | ... | @@ -8691,20 +8691,20 @@ test "integer cast panic" { |
| 8691 | Attempting to convert an integer that does not correspond to any error results in | 8691 | Attempting to convert an integer that does not correspond to any error results in |
| 8692 | safety-protected {#link|Undefined Behavior#}. | 8692 | safety-protected {#link|Undefined Behavior#}. |
| 8693 | </p> | 8693 | </p> |
| 8694 | {#see_also|@errorToInt#} | 8694 | {#see_also|@intFromError#} |
| 8695 | {#header_close#} | 8695 | {#header_close#} |
| 8696 | 8696 | ||
| 8697 | {#header_open|@intToFloat#} | 8697 | {#header_open|@floatFromInt#} |
| 8698 | <pre>{#syntax#}@intToFloat(comptime DestType: type, int: anytype) DestType{#endsyntax#}</pre> | 8698 | <pre>{#syntax#}@floatFromInt(comptime DestType: type, int: anytype) DestType{#endsyntax#}</pre> |
| 8699 | <p> | 8699 | <p> |
| 8700 | Converts an integer to the closest floating point representation. To convert the other way, use {#link|@floatToInt#}. This cast is always safe. | 8700 | Converts an integer to the closest floating point representation. To convert the other way, use {#link|@intFromFloat#}. This cast is always safe. |
| 8701 | </p> | 8701 | </p> |
| 8702 | {#header_close#} | 8702 | {#header_close#} |
| 8703 | 8703 | ||
| 8704 | {#header_open|@intToPtr#} | 8704 | {#header_open|@ptrFromInt#} |
| 8705 | <pre>{#syntax#}@intToPtr(comptime DestType: type, address: usize) DestType{#endsyntax#}</pre> | 8705 | <pre>{#syntax#}@ptrFromInt(comptime DestType: type, address: usize) DestType{#endsyntax#}</pre> |
| 8706 | <p> | 8706 | <p> |
| 8707 | Converts an integer to a {#link|pointer|Pointers#}. To convert the other way, use {#link|@ptrToInt#}. Casting an address of 0 to a destination type | 8707 | Converts an integer to a {#link|pointer|Pointers#}. To convert the other way, use {#link|@intFromPtr#}. Casting an address of 0 to a destination type |
| 8708 | which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a | 8708 | which in not {#link|optional|Optional Pointers#} and does not have the {#syntax#}allowzero{#endsyntax#} attribute will result in a |
| 8709 | {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled. | 8709 | {#link|Pointer Cast Invalid Null#} panic when runtime safety checks are enabled. |
| 8710 | </p> | 8710 | </p> |
| ... | @@ -8928,13 +8928,13 @@ pub const PrefetchOptions = struct { | ... | @@ -8928,13 +8928,13 @@ pub const PrefetchOptions = struct { |
| 8928 | </ul> | 8928 | </ul> |
| 8929 | {#header_close#} | 8929 | {#header_close#} |
| 8930 | 8930 | ||
| 8931 | {#header_open|@ptrToInt#} | 8931 | {#header_open|@intFromPtr#} |
| 8932 | <pre>{#syntax#}@ptrToInt(value: anytype) usize{#endsyntax#}</pre> | 8932 | <pre>{#syntax#}@intFromPtr(value: anytype) usize{#endsyntax#}</pre> |
| 8933 | <p> | 8933 | <p> |
| 8934 | Converts {#syntax#}value{#endsyntax#} to a {#syntax#}usize{#endsyntax#} which is the address of the pointer. | 8934 | Converts {#syntax#}value{#endsyntax#} to a {#syntax#}usize{#endsyntax#} which is the address of the pointer. |
| 8935 | {#syntax#}value{#endsyntax#} can be {#syntax#}*T{#endsyntax#} or {#syntax#}?*T{#endsyntax#}. | 8935 | {#syntax#}value{#endsyntax#} can be {#syntax#}*T{#endsyntax#} or {#syntax#}?*T{#endsyntax#}. |
| 8936 | </p> | 8936 | </p> |
| 8937 | <p>To convert the other way, use {#link|@intToPtr#}</p> | 8937 | <p>To convert the other way, use {#link|@ptrFromInt#}</p> |
| 8938 | 8938 | ||
| 8939 | {#header_close#} | 8939 | {#header_close#} |
| 8940 | 8940 | ||
| ... | @@ -10165,8 +10165,8 @@ fn getNumberOrFail() !i32 { | ... | @@ -10165,8 +10165,8 @@ fn getNumberOrFail() !i32 { |
| 10165 | {#code_begin|test_err|test_comptime_invalid_error_code|integer value '11' represents no error#} | 10165 | {#code_begin|test_err|test_comptime_invalid_error_code|integer value '11' represents no error#} |
| 10166 | comptime { | 10166 | comptime { |
| 10167 | const err = error.AnError; | 10167 | const err = error.AnError; |
| 10168 | const number = @errorToInt(err) + 10; | 10168 | const number = @intFromError(err) + 10; |
| 10169 | const invalid_err = @intToError(number); | 10169 | const invalid_err = @errorFromInt(number); |
| 10170 | _ = invalid_err; | 10170 | _ = invalid_err; |
| 10171 | } | 10171 | } |
| 10172 | {#code_end#} | 10172 | {#code_end#} |
| ... | @@ -10176,8 +10176,8 @@ const std = @import("std"); | ... | @@ -10176,8 +10176,8 @@ const std = @import("std"); |
| 10176 | 10176 | ||
| 10177 | pub fn main() void { | 10177 | pub fn main() void { |
| 10178 | var err = error.AnError; | 10178 | var err = error.AnError; |
| 10179 | var number = @errorToInt(err) + 500; | 10179 | var number = @intFromError(err) + 500; |
| 10180 | var invalid_err = @intToError(number); | 10180 | var invalid_err = @errorFromInt(number); |
| 10181 | std.debug.print("value: {}\n", .{invalid_err}); | 10181 | std.debug.print("value: {}\n", .{invalid_err}); |
| 10182 | } | 10182 | } |
| 10183 | {#code_end#} | 10183 | {#code_end#} |
| ... | @@ -10192,7 +10192,7 @@ const Foo = enum { | ... | @@ -10192,7 +10192,7 @@ const Foo = enum { |
| 10192 | }; | 10192 | }; |
| 10193 | comptime { | 10193 | comptime { |
| 10194 | const a: u2 = 3; | 10194 | const a: u2 = 3; |
| 10195 | const b = @intToEnum(Foo, a); | 10195 | const b = @enumFromInt(Foo, a); |
| 10196 | _ = b; | 10196 | _ = b; |
| 10197 | } | 10197 | } |
| 10198 | {#code_end#} | 10198 | {#code_end#} |
| ... | @@ -10208,7 +10208,7 @@ const Foo = enum { | ... | @@ -10208,7 +10208,7 @@ const Foo = enum { |
| 10208 | 10208 | ||
| 10209 | pub fn main() void { | 10209 | pub fn main() void { |
| 10210 | var a: u2 = 3; | 10210 | var a: u2 = 3; |
| 10211 | var b = @intToEnum(Foo, a); | 10211 | var b = @enumFromInt(Foo, a); |
| 10212 | std.debug.print("value: {s}\n", .{@tagName(b)}); | 10212 | std.debug.print("value: {s}\n", .{@tagName(b)}); |
| 10213 | } | 10213 | } |
| 10214 | {#code_end#} | 10214 | {#code_end#} |
| ... | @@ -10255,7 +10255,7 @@ fn foo(set1: Set1) void { | ... | @@ -10255,7 +10255,7 @@ fn foo(set1: Set1) void { |
| 10255 | <p>At compile-time:</p> | 10255 | <p>At compile-time:</p> |
| 10256 | {#code_begin|test_err|test_comptime_incorrect_pointer_alignment|pointer address 0x1 is not aligned to 4 bytes#} | 10256 | {#code_begin|test_err|test_comptime_incorrect_pointer_alignment|pointer address 0x1 is not aligned to 4 bytes#} |
| 10257 | comptime { | 10257 | comptime { |
| 10258 | const ptr = @intToPtr(*align(1) i32, 0x1); | 10258 | const ptr = @ptrFromInt(*align(1) i32, 0x1); |
| 10259 | const aligned = @alignCast(4, ptr); | 10259 | const aligned = @alignCast(4, ptr); |
| 10260 | _ = aligned; | 10260 | _ = aligned; |
| 10261 | } | 10261 | } |
lib/compiler_rt.zig+2-2| ... | @@ -55,7 +55,7 @@ comptime { | ... | @@ -55,7 +55,7 @@ comptime { |
| 55 | _ = @import("compiler_rt/trunctfdf2.zig"); | 55 | _ = @import("compiler_rt/trunctfdf2.zig"); |
| 56 | _ = @import("compiler_rt/trunctfxf2.zig"); | 56 | _ = @import("compiler_rt/trunctfxf2.zig"); |
| 57 | 57 | ||
| 58 | _ = @import("compiler_rt/float_to_int.zig"); | 58 | _ = @import("compiler_rt/int_from_float.zig"); |
| 59 | _ = @import("compiler_rt/fixhfsi.zig"); | 59 | _ = @import("compiler_rt/fixhfsi.zig"); |
| 60 | _ = @import("compiler_rt/fixhfdi.zig"); | 60 | _ = @import("compiler_rt/fixhfdi.zig"); |
| 61 | _ = @import("compiler_rt/fixhfti.zig"); | 61 | _ = @import("compiler_rt/fixhfti.zig"); |
| ... | @@ -87,7 +87,7 @@ comptime { | ... | @@ -87,7 +87,7 @@ comptime { |
| 87 | _ = @import("compiler_rt/fixunsxfdi.zig"); | 87 | _ = @import("compiler_rt/fixunsxfdi.zig"); |
| 88 | _ = @import("compiler_rt/fixunsxfti.zig"); | 88 | _ = @import("compiler_rt/fixunsxfti.zig"); |
| 89 | 89 | ||
| 90 | _ = @import("compiler_rt/int_to_float.zig"); | 90 | _ = @import("compiler_rt/float_from_int.zig"); |
| 91 | _ = @import("compiler_rt/floatsihf.zig"); | 91 | _ = @import("compiler_rt/floatsihf.zig"); |
| 92 | _ = @import("compiler_rt/floatsisf.zig"); | 92 | _ = @import("compiler_rt/floatsisf.zig"); |
| 93 | _ = @import("compiler_rt/floatsidf.zig"); | 93 | _ = @import("compiler_rt/floatsidf.zig"); |
lib/compiler_rt/aarch64_outline_atomics.zig+1-1| ... | @@ -8,7 +8,7 @@ const always_has_lse = std.Target.aarch64.featureSetHas(builtin.cpu.features, .l | ... | @@ -8,7 +8,7 @@ const always_has_lse = std.Target.aarch64.featureSetHas(builtin.cpu.features, .l |
| 8 | /// It is intentionally not exported in order to make the machine code that | 8 | /// It is intentionally not exported in order to make the machine code that |
| 9 | /// uses it a statically predicted direct branch rather than using the PLT, | 9 | /// uses it a statically predicted direct branch rather than using the PLT, |
| 10 | /// which ARM is concerned would have too much overhead. | 10 | /// which ARM is concerned would have too much overhead. |
| 11 | var __aarch64_have_lse_atomics: u8 = @boolToInt(always_has_lse); | 11 | var __aarch64_have_lse_atomics: u8 = @intFromBool(always_has_lse); |
| 12 | 12 | ||
| 13 | fn __aarch64_cas1_relax() align(16) callconv(.Naked) void { | 13 | fn __aarch64_cas1_relax() align(16) callconv(.Naked) void { |
| 14 | @setRuntimeSafety(false); | 14 | @setRuntimeSafety(false); |
lib/compiler_rt/atomics.zig+11-11| ... | @@ -119,21 +119,21 @@ var spinlocks: SpinlockTable = SpinlockTable{}; | ... | @@ -119,21 +119,21 @@ var spinlocks: SpinlockTable = SpinlockTable{}; |
| 119 | 119 | ||
| 120 | fn __atomic_load(size: u32, src: [*]u8, dest: [*]u8, model: i32) callconv(.C) void { | 120 | fn __atomic_load(size: u32, src: [*]u8, dest: [*]u8, model: i32) callconv(.C) void { |
| 121 | _ = model; | 121 | _ = model; |
| 122 | var sl = spinlocks.get(@ptrToInt(src)); | 122 | var sl = spinlocks.get(@intFromPtr(src)); |
| 123 | defer sl.release(); | 123 | defer sl.release(); |
| 124 | @memcpy(dest[0..size], src); | 124 | @memcpy(dest[0..size], src); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | fn __atomic_store(size: u32, dest: [*]u8, src: [*]u8, model: i32) callconv(.C) void { | 127 | fn __atomic_store(size: u32, dest: [*]u8, src: [*]u8, model: i32) callconv(.C) void { |
| 128 | _ = model; | 128 | _ = model; |
| 129 | var sl = spinlocks.get(@ptrToInt(dest)); | 129 | var sl = spinlocks.get(@intFromPtr(dest)); |
| 130 | defer sl.release(); | 130 | defer sl.release(); |
| 131 | @memcpy(dest[0..size], src); | 131 | @memcpy(dest[0..size], src); |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | fn __atomic_exchange(size: u32, ptr: [*]u8, val: [*]u8, old: [*]u8, model: i32) callconv(.C) void { | 134 | fn __atomic_exchange(size: u32, ptr: [*]u8, val: [*]u8, old: [*]u8, model: i32) callconv(.C) void { |
| 135 | _ = model; | 135 | _ = model; |
| 136 | var sl = spinlocks.get(@ptrToInt(ptr)); | 136 | var sl = spinlocks.get(@intFromPtr(ptr)); |
| 137 | defer sl.release(); | 137 | defer sl.release(); |
| 138 | @memcpy(old[0..size], ptr); | 138 | @memcpy(old[0..size], ptr); |
| 139 | @memcpy(ptr[0..size], val); | 139 | @memcpy(ptr[0..size], val); |
| ... | @@ -149,7 +149,7 @@ fn __atomic_compare_exchange( | ... | @@ -149,7 +149,7 @@ fn __atomic_compare_exchange( |
| 149 | ) callconv(.C) i32 { | 149 | ) callconv(.C) i32 { |
| 150 | _ = success; | 150 | _ = success; |
| 151 | _ = failure; | 151 | _ = failure; |
| 152 | var sl = spinlocks.get(@ptrToInt(ptr)); | 152 | var sl = spinlocks.get(@intFromPtr(ptr)); |
| 153 | defer sl.release(); | 153 | defer sl.release(); |
| 154 | for (ptr[0..size], 0..) |b, i| { | 154 | for (ptr[0..size], 0..) |b, i| { |
| 155 | if (expected[i] != b) break; | 155 | if (expected[i] != b) break; |
| ... | @@ -168,7 +168,7 @@ fn __atomic_compare_exchange( | ... | @@ -168,7 +168,7 @@ fn __atomic_compare_exchange( |
| 168 | inline fn atomic_load_N(comptime T: type, src: *T, model: i32) T { | 168 | inline fn atomic_load_N(comptime T: type, src: *T, model: i32) T { |
| 169 | _ = model; | 169 | _ = model; |
| 170 | if (@sizeOf(T) > largest_atomic_size) { | 170 | if (@sizeOf(T) > largest_atomic_size) { |
| 171 | var sl = spinlocks.get(@ptrToInt(src)); | 171 | var sl = spinlocks.get(@intFromPtr(src)); |
| 172 | defer sl.release(); | 172 | defer sl.release(); |
| 173 | return src.*; | 173 | return src.*; |
| 174 | } else { | 174 | } else { |
| ... | @@ -199,7 +199,7 @@ fn __atomic_load_16(src: *u128, model: i32) callconv(.C) u128 { | ... | @@ -199,7 +199,7 @@ fn __atomic_load_16(src: *u128, model: i32) callconv(.C) u128 { |
| 199 | inline fn atomic_store_N(comptime T: type, dst: *T, value: T, model: i32) void { | 199 | inline fn atomic_store_N(comptime T: type, dst: *T, value: T, model: i32) void { |
| 200 | _ = model; | 200 | _ = model; |
| 201 | if (@sizeOf(T) > largest_atomic_size) { | 201 | if (@sizeOf(T) > largest_atomic_size) { |
| 202 | var sl = spinlocks.get(@ptrToInt(dst)); | 202 | var sl = spinlocks.get(@intFromPtr(dst)); |
| 203 | defer sl.release(); | 203 | defer sl.release(); |
| 204 | dst.* = value; | 204 | dst.* = value; |
| 205 | } else { | 205 | } else { |
| ... | @@ -230,9 +230,9 @@ fn __atomic_store_16(dst: *u128, value: u128, model: i32) callconv(.C) void { | ... | @@ -230,9 +230,9 @@ fn __atomic_store_16(dst: *u128, value: u128, model: i32) callconv(.C) void { |
| 230 | fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T { | 230 | fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T { |
| 231 | const WideAtomic = std.meta.Int(.unsigned, smallest_atomic_fetch_exch_size * 8); | 231 | const WideAtomic = std.meta.Int(.unsigned, smallest_atomic_fetch_exch_size * 8); |
| 232 | 232 | ||
| 233 | const addr = @ptrToInt(ptr); | 233 | const addr = @intFromPtr(ptr); |
| 234 | const wide_addr = addr & ~(@as(T, smallest_atomic_fetch_exch_size) - 1); | 234 | const wide_addr = addr & ~(@as(T, smallest_atomic_fetch_exch_size) - 1); |
| 235 | const wide_ptr = @alignCast(smallest_atomic_fetch_exch_size, @intToPtr(*WideAtomic, wide_addr)); | 235 | const wide_ptr = @alignCast(smallest_atomic_fetch_exch_size, @ptrFromInt(*WideAtomic, wide_addr)); |
| 236 | 236 | ||
| 237 | const inner_offset = addr & (@as(T, smallest_atomic_fetch_exch_size) - 1); | 237 | const inner_offset = addr & (@as(T, smallest_atomic_fetch_exch_size) - 1); |
| 238 | const inner_shift = @intCast(std.math.Log2Int(T), inner_offset * 8); | 238 | const inner_shift = @intCast(std.math.Log2Int(T), inner_offset * 8); |
| ... | @@ -255,7 +255,7 @@ fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T { | ... | @@ -255,7 +255,7 @@ fn wideUpdate(comptime T: type, ptr: *T, val: T, update: anytype) T { |
| 255 | inline fn atomic_exchange_N(comptime T: type, ptr: *T, val: T, model: i32) T { | 255 | inline fn atomic_exchange_N(comptime T: type, ptr: *T, val: T, model: i32) T { |
| 256 | _ = model; | 256 | _ = model; |
| 257 | if (@sizeOf(T) > largest_atomic_size) { | 257 | if (@sizeOf(T) > largest_atomic_size) { |
| 258 | var sl = spinlocks.get(@ptrToInt(ptr)); | 258 | var sl = spinlocks.get(@intFromPtr(ptr)); |
| 259 | defer sl.release(); | 259 | defer sl.release(); |
| 260 | const value = ptr.*; | 260 | const value = ptr.*; |
| 261 | ptr.* = val; | 261 | ptr.* = val; |
| ... | @@ -305,7 +305,7 @@ inline fn atomic_compare_exchange_N( | ... | @@ -305,7 +305,7 @@ inline fn atomic_compare_exchange_N( |
| 305 | _ = success; | 305 | _ = success; |
| 306 | _ = failure; | 306 | _ = failure; |
| 307 | if (@sizeOf(T) > largest_atomic_size) { | 307 | if (@sizeOf(T) > largest_atomic_size) { |
| 308 | var sl = spinlocks.get(@ptrToInt(ptr)); | 308 | var sl = spinlocks.get(@intFromPtr(ptr)); |
| 309 | defer sl.release(); | 309 | defer sl.release(); |
| 310 | const value = ptr.*; | 310 | const value = ptr.*; |
| 311 | if (value == expected.*) { | 311 | if (value == expected.*) { |
| ... | @@ -362,7 +362,7 @@ inline fn fetch_op_N(comptime T: type, comptime op: std.builtin.AtomicRmwOp, ptr | ... | @@ -362,7 +362,7 @@ inline fn fetch_op_N(comptime T: type, comptime op: std.builtin.AtomicRmwOp, ptr |
| 362 | }; | 362 | }; |
| 363 | 363 | ||
| 364 | if (@sizeOf(T) > largest_atomic_size) { | 364 | if (@sizeOf(T) > largest_atomic_size) { |
| 365 | var sl = spinlocks.get(@ptrToInt(ptr)); | 365 | var sl = spinlocks.get(@intFromPtr(ptr)); |
| 366 | defer sl.release(); | 366 | defer sl.release(); |
| 367 | 367 | ||
| 368 | const value = ptr.*; | 368 | const value = ptr.*; |
lib/compiler_rt/clear_cache.zig+1-1| ... | @@ -63,7 +63,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void { | ... | @@ -63,7 +63,7 @@ fn clear_cache(start: usize, end: usize) callconv(.C) void { |
| 63 | .addr = start, | 63 | .addr = start, |
| 64 | .len = end - start, | 64 | .len = end - start, |
| 65 | }; | 65 | }; |
| 66 | const result = sysarch(ARM_SYNC_ICACHE, @ptrToInt(&arg)); | 66 | const result = sysarch(ARM_SYNC_ICACHE, @intFromPtr(&arg)); |
| 67 | std.debug.assert(result == 0); | 67 | std.debug.assert(result == 0); |
| 68 | exportIt(); | 68 | exportIt(); |
| 69 | }, | 69 | }, |
lib/compiler_rt/cmpdf2.zig+4-4| ... | @@ -26,7 +26,7 @@ comptime { | ... | @@ -26,7 +26,7 @@ comptime { |
| 26 | /// Note that this matches the definition of `__ledf2`, `__eqdf2`, `__nedf2`, `__cmpdf2`, | 26 | /// Note that this matches the definition of `__ledf2`, `__eqdf2`, `__nedf2`, `__cmpdf2`, |
| 27 | /// and `__ltdf2`. | 27 | /// and `__ltdf2`. |
| 28 | fn __cmpdf2(a: f64, b: f64) callconv(.C) i32 { | 28 | fn __cmpdf2(a: f64, b: f64) callconv(.C) i32 { |
| 29 | return @enumToInt(comparef.cmpf2(f64, comparef.LE, a, b)); | 29 | return @intFromEnum(comparef.cmpf2(f64, comparef.LE, a, b)); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 32 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
| ... | @@ -56,13 +56,13 @@ pub fn __ltdf2(a: f64, b: f64) callconv(.C) i32 { | ... | @@ -56,13 +56,13 @@ pub fn __ltdf2(a: f64, b: f64) callconv(.C) i32 { |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | fn __aeabi_dcmpeq(a: f64, b: f64) callconv(.AAPCS) i32 { | 58 | fn __aeabi_dcmpeq(a: f64, b: f64) callconv(.AAPCS) i32 { |
| 59 | return @boolToInt(comparef.cmpf2(f64, comparef.LE, a, b) == .Equal); | 59 | return @intFromBool(comparef.cmpf2(f64, comparef.LE, a, b) == .Equal); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | fn __aeabi_dcmplt(a: f64, b: f64) callconv(.AAPCS) i32 { | 62 | fn __aeabi_dcmplt(a: f64, b: f64) callconv(.AAPCS) i32 { |
| 63 | return @boolToInt(comparef.cmpf2(f64, comparef.LE, a, b) == .Less); | 63 | return @intFromBool(comparef.cmpf2(f64, comparef.LE, a, b) == .Less); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | fn __aeabi_dcmple(a: f64, b: f64) callconv(.AAPCS) i32 { | 66 | fn __aeabi_dcmple(a: f64, b: f64) callconv(.AAPCS) i32 { |
| 67 | return @boolToInt(comparef.cmpf2(f64, comparef.LE, a, b) != .Greater); | 67 | return @intFromBool(comparef.cmpf2(f64, comparef.LE, a, b) != .Greater); |
| 68 | } | 68 | } |
lib/compiler_rt/cmphf2.zig+1-1| ... | @@ -20,7 +20,7 @@ comptime { | ... | @@ -20,7 +20,7 @@ comptime { |
| 20 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, | 20 | /// Note that this matches the definition of `__lehf2`, `__eqhf2`, `__nehf2`, `__cmphf2`, |
| 21 | /// and `__lthf2`. | 21 | /// and `__lthf2`. |
| 22 | fn __cmphf2(a: f16, b: f16) callconv(.C) i32 { | 22 | fn __cmphf2(a: f16, b: f16) callconv(.C) i32 { |
| 23 | return @enumToInt(comparef.cmpf2(f16, comparef.LE, a, b)); | 23 | return @intFromEnum(comparef.cmpf2(f16, comparef.LE, a, b)); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 26 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
lib/compiler_rt/cmpsf2.zig+4-4| ... | @@ -26,7 +26,7 @@ comptime { | ... | @@ -26,7 +26,7 @@ comptime { |
| 26 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, | 26 | /// Note that this matches the definition of `__lesf2`, `__eqsf2`, `__nesf2`, `__cmpsf2`, |
| 27 | /// and `__ltsf2`. | 27 | /// and `__ltsf2`. |
| 28 | fn __cmpsf2(a: f32, b: f32) callconv(.C) i32 { | 28 | fn __cmpsf2(a: f32, b: f32) callconv(.C) i32 { |
| 29 | return @enumToInt(comparef.cmpf2(f32, comparef.LE, a, b)); | 29 | return @intFromEnum(comparef.cmpf2(f32, comparef.LE, a, b)); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 32 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
| ... | @@ -56,13 +56,13 @@ pub fn __ltsf2(a: f32, b: f32) callconv(.C) i32 { | ... | @@ -56,13 +56,13 @@ pub fn __ltsf2(a: f32, b: f32) callconv(.C) i32 { |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.AAPCS) i32 { | 58 | fn __aeabi_fcmpeq(a: f32, b: f32) callconv(.AAPCS) i32 { |
| 59 | return @boolToInt(comparef.cmpf2(f32, comparef.LE, a, b) == .Equal); | 59 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Equal); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | fn __aeabi_fcmplt(a: f32, b: f32) callconv(.AAPCS) i32 { | 62 | fn __aeabi_fcmplt(a: f32, b: f32) callconv(.AAPCS) i32 { |
| 63 | return @boolToInt(comparef.cmpf2(f32, comparef.LE, a, b) == .Less); | 63 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Less); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | fn __aeabi_fcmple(a: f32, b: f32) callconv(.AAPCS) i32 { | 66 | fn __aeabi_fcmple(a: f32, b: f32) callconv(.AAPCS) i32 { |
| 67 | return @boolToInt(comparef.cmpf2(f32, comparef.LE, a, b) != .Greater); | 67 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) != .Greater); |
| 68 | } | 68 | } |
lib/compiler_rt/cmptf2.zig+8-8| ... | @@ -34,7 +34,7 @@ comptime { | ... | @@ -34,7 +34,7 @@ comptime { |
| 34 | /// Note that this matches the definition of `__letf2`, `__eqtf2`, `__netf2`, `__cmptf2`, | 34 | /// Note that this matches the definition of `__letf2`, `__eqtf2`, `__netf2`, `__cmptf2`, |
| 35 | /// and `__lttf2`. | 35 | /// and `__lttf2`. |
| 36 | fn __cmptf2(a: f128, b: f128) callconv(.C) i32 { | 36 | fn __cmptf2(a: f128, b: f128) callconv(.C) i32 { |
| 37 | return @enumToInt(comparef.cmpf2(f128, comparef.LE, a, b)); | 37 | return @intFromEnum(comparef.cmpf2(f128, comparef.LE, a, b)); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 40 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
| ... | @@ -71,34 +71,34 @@ const SparcFCMP = enum(i32) { | ... | @@ -71,34 +71,34 @@ const SparcFCMP = enum(i32) { |
| 71 | }; | 71 | }; |
| 72 | 72 | ||
| 73 | fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.C) i32 { | 73 | fn _Qp_cmp(a: *const f128, b: *const f128) callconv(.C) i32 { |
| 74 | return @enumToInt(comparef.cmpf2(f128, SparcFCMP, a.*, b.*)); | 74 | return @intFromEnum(comparef.cmpf2(f128, SparcFCMP, a.*, b.*)); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | fn _Qp_feq(a: *const f128, b: *const f128) callconv(.C) bool { | 77 | fn _Qp_feq(a: *const f128, b: *const f128) callconv(.C) bool { |
| 78 | return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Equal; | 78 | return @enumFromInt(SparcFCMP, _Qp_cmp(a, b)) == .Equal; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | fn _Qp_fne(a: *const f128, b: *const f128) callconv(.C) bool { | 81 | fn _Qp_fne(a: *const f128, b: *const f128) callconv(.C) bool { |
| 82 | return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) != .Equal; | 82 | return @enumFromInt(SparcFCMP, _Qp_cmp(a, b)) != .Equal; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | fn _Qp_flt(a: *const f128, b: *const f128) callconv(.C) bool { | 85 | fn _Qp_flt(a: *const f128, b: *const f128) callconv(.C) bool { |
| 86 | return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Less; | 86 | return @enumFromInt(SparcFCMP, _Qp_cmp(a, b)) == .Less; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.C) bool { | 89 | fn _Qp_fgt(a: *const f128, b: *const f128) callconv(.C) bool { |
| 90 | return @intToEnum(SparcFCMP, _Qp_cmp(a, b)) == .Greater; | 90 | return @enumFromInt(SparcFCMP, _Qp_cmp(a, b)) == .Greater; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | fn _Qp_fge(a: *const f128, b: *const f128) callconv(.C) bool { | 93 | fn _Qp_fge(a: *const f128, b: *const f128) callconv(.C) bool { |
| 94 | return switch (@intToEnum(SparcFCMP, _Qp_cmp(a, b))) { | 94 | return switch (@enumFromInt(SparcFCMP, _Qp_cmp(a, b))) { |
| 95 | .Equal, .Greater => true, | 95 | .Equal, .Greater => true, |
| 96 | .Less, .Unordered => false, | 96 | .Less, .Unordered => false, |
| 97 | }; | 97 | }; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | fn _Qp_fle(a: *const f128, b: *const f128) callconv(.C) bool { | 100 | fn _Qp_fle(a: *const f128, b: *const f128) callconv(.C) bool { |
| 101 | return switch (@intToEnum(SparcFCMP, _Qp_cmp(a, b))) { | 101 | return switch (@enumFromInt(SparcFCMP, _Qp_cmp(a, b))) { |
| 102 | .Equal, .Less => true, | 102 | .Equal, .Less => true, |
| 103 | .Greater, .Unordered => false, | 103 | .Greater, .Unordered => false, |
| 104 | }; | 104 | }; |
lib/compiler_rt/cmpxf2.zig+1-1| ... | @@ -20,7 +20,7 @@ comptime { | ... | @@ -20,7 +20,7 @@ comptime { |
| 20 | /// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`, | 20 | /// Note that this matches the definition of `__lexf2`, `__eqxf2`, `__nexf2`, `__cmpxf2`, |
| 21 | /// and `__ltxf2`. | 21 | /// and `__ltxf2`. |
| 22 | fn __cmpxf2(a: f80, b: f80) callconv(.C) i32 { | 22 | fn __cmpxf2(a: f80, b: f80) callconv(.C) i32 { |
| 23 | return @enumToInt(comparef.cmp_f80(comparef.LE, a, b)); | 23 | return @intFromEnum(comparef.cmp_f80(comparef.LE, a, b)); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /// "These functions return a value less than or equal to zero if neither argument is NaN, | 26 | /// "These functions return a value less than or equal to zero if neither argument is NaN, |
lib/compiler_rt/comparef.zig+2-2| ... | @@ -77,7 +77,7 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT { | ... | @@ -77,7 +77,7 @@ pub inline fn cmp_f80(comptime RT: type, a: f80, b: f80) RT { |
| 77 | if ((a_rep.fraction | b_rep.fraction) | ((a_rep.exp | b_rep.exp) & special_exp) == 0) | 77 | if ((a_rep.fraction | b_rep.fraction) | ((a_rep.exp | b_rep.exp) & special_exp) == 0) |
| 78 | return .Equal; | 78 | return .Equal; |
| 79 | 79 | ||
| 80 | if (@boolToInt(a_rep.exp == b_rep.exp) & @boolToInt(a_rep.fraction == b_rep.fraction) != 0) { | 80 | if (@intFromBool(a_rep.exp == b_rep.exp) & @intFromBool(a_rep.fraction == b_rep.fraction) != 0) { |
| 81 | return .Equal; | 81 | return .Equal; |
| 82 | } else if (a_rep.exp & sign_bit != b_rep.exp & sign_bit) { | 82 | } else if (a_rep.exp & sign_bit != b_rep.exp & sign_bit) { |
| 83 | // signs are different | 83 | // signs are different |
| ... | @@ -109,7 +109,7 @@ pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 { | ... | @@ -109,7 +109,7 @@ pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 { |
| 109 | const aAbs: rep_t = @bitCast(rep_t, a) & absMask; | 109 | const aAbs: rep_t = @bitCast(rep_t, a) & absMask; |
| 110 | const bAbs: rep_t = @bitCast(rep_t, b) & absMask; | 110 | const bAbs: rep_t = @bitCast(rep_t, b) & absMask; |
| 111 | 111 | ||
| 112 | return @boolToInt(aAbs > infRep or bAbs > infRep); | 112 | return @intFromBool(aAbs > infRep or bAbs > infRep); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | test { | 115 | test { |
lib/compiler_rt/divdf3.zig+2-2| ... | @@ -199,7 +199,7 @@ inline fn div(a: f64, b: f64) f64 { | ... | @@ -199,7 +199,7 @@ inline fn div(a: f64, b: f64) f64 { |
| 199 | } else if (writtenExponent < 1) { | 199 | } else if (writtenExponent < 1) { |
| 200 | if (writtenExponent == 0) { | 200 | if (writtenExponent == 0) { |
| 201 | // Check whether the rounded result is normal. | 201 | // Check whether the rounded result is normal. |
| 202 | const round = @boolToInt((residual << 1) > bSignificand); | 202 | const round = @intFromBool((residual << 1) > bSignificand); |
| 203 | // Clear the implicit bit. | 203 | // Clear the implicit bit. |
| 204 | var absResult = quotient & significandMask; | 204 | var absResult = quotient & significandMask; |
| 205 | // Round. | 205 | // Round. |
| ... | @@ -213,7 +213,7 @@ inline fn div(a: f64, b: f64) f64 { | ... | @@ -213,7 +213,7 @@ inline fn div(a: f64, b: f64) f64 { |
| 213 | // code to round them correctly. | 213 | // code to round them correctly. |
| 214 | return @bitCast(f64, quotientSign); | 214 | return @bitCast(f64, quotientSign); |
| 215 | } else { | 215 | } else { |
| 216 | const round = @boolToInt((residual << 1) > bSignificand); | 216 | const round = @intFromBool((residual << 1) > bSignificand); |
| 217 | // Clear the implicit bit | 217 | // Clear the implicit bit |
| 218 | var absResult = quotient & significandMask; | 218 | var absResult = quotient & significandMask; |
| 219 | // Insert the exponent | 219 | // Insert the exponent |
lib/compiler_rt/divsf3.zig+2-2| ... | @@ -179,7 +179,7 @@ inline fn div(a: f32, b: f32) f32 { | ... | @@ -179,7 +179,7 @@ inline fn div(a: f32, b: f32) f32 { |
| 179 | } else if (writtenExponent < 1) { | 179 | } else if (writtenExponent < 1) { |
| 180 | if (writtenExponent == 0) { | 180 | if (writtenExponent == 0) { |
| 181 | // Check whether the rounded result is normal. | 181 | // Check whether the rounded result is normal. |
| 182 | const round = @boolToInt((residual << 1) > bSignificand); | 182 | const round = @intFromBool((residual << 1) > bSignificand); |
| 183 | // Clear the implicit bit. | 183 | // Clear the implicit bit. |
| 184 | var absResult = quotient & significandMask; | 184 | var absResult = quotient & significandMask; |
| 185 | // Round. | 185 | // Round. |
| ... | @@ -193,7 +193,7 @@ inline fn div(a: f32, b: f32) f32 { | ... | @@ -193,7 +193,7 @@ inline fn div(a: f32, b: f32) f32 { |
| 193 | // code to round them correctly. | 193 | // code to round them correctly. |
| 194 | return @bitCast(f32, quotientSign); | 194 | return @bitCast(f32, quotientSign); |
| 195 | } else { | 195 | } else { |
| 196 | const round = @boolToInt((residual << 1) > bSignificand); | 196 | const round = @intFromBool((residual << 1) > bSignificand); |
| 197 | // Clear the implicit bit | 197 | // Clear the implicit bit |
| 198 | var absResult = quotient & significandMask; | 198 | var absResult = quotient & significandMask; |
| 199 | // Insert the exponent | 199 | // Insert the exponent |
lib/compiler_rt/divtf3.zig+2-2| ... | @@ -214,7 +214,7 @@ inline fn div(a: f128, b: f128) f128 { | ... | @@ -214,7 +214,7 @@ inline fn div(a: f128, b: f128) f128 { |
| 214 | } else if (writtenExponent < 1) { | 214 | } else if (writtenExponent < 1) { |
| 215 | if (writtenExponent == 0) { | 215 | if (writtenExponent == 0) { |
| 216 | // Check whether the rounded result is normal. | 216 | // Check whether the rounded result is normal. |
| 217 | const round = @boolToInt((residual << 1) > bSignificand); | 217 | const round = @intFromBool((residual << 1) > bSignificand); |
| 218 | // Clear the implicit bit. | 218 | // Clear the implicit bit. |
| 219 | var absResult = quotient & significandMask; | 219 | var absResult = quotient & significandMask; |
| 220 | // Round. | 220 | // Round. |
| ... | @@ -228,7 +228,7 @@ inline fn div(a: f128, b: f128) f128 { | ... | @@ -228,7 +228,7 @@ inline fn div(a: f128, b: f128) f128 { |
| 228 | // code to round them correctly. | 228 | // code to round them correctly. |
| 229 | return @bitCast(f128, quotientSign); | 229 | return @bitCast(f128, quotientSign); |
| 230 | } else { | 230 | } else { |
| 231 | const round = @boolToInt((residual << 1) >= bSignificand); | 231 | const round = @intFromBool((residual << 1) >= bSignificand); |
| 232 | // Clear the implicit bit | 232 | // Clear the implicit bit |
| 233 | var absResult = quotient & significandMask; | 233 | var absResult = quotient & significandMask; |
| 234 | // Insert the exponent | 234 | // Insert the exponent |
lib/compiler_rt/divxf3.zig+1-1| ... | @@ -195,7 +195,7 @@ pub fn __divxf3(a: f80, b: f80) callconv(.C) f80 { | ... | @@ -195,7 +195,7 @@ pub fn __divxf3(a: f80, b: f80) callconv(.C) f80 { |
| 195 | // code to round them correctly. | 195 | // code to round them correctly. |
| 196 | return @bitCast(T, quotientSign); | 196 | return @bitCast(T, quotientSign); |
| 197 | } else { | 197 | } else { |
| 198 | const round = @boolToInt(residual > (bSignificand >> 1)); | 198 | const round = @intFromBool(residual > (bSignificand >> 1)); |
| 199 | // Insert the exponent | 199 | // Insert the exponent |
| 200 | var absResult = quotient | (@intCast(Z, writtenExponent) << significandBits); | 200 | var absResult = quotient | (@intCast(Z, writtenExponent) << significandBits); |
| 201 | // Round | 201 | // Round |
lib/compiler_rt/exp.zig+4-4| ... | @@ -74,12 +74,12 @@ pub fn expf(x_: f32) callconv(.C) f32 { | ... | @@ -74,12 +74,12 @@ pub fn expf(x_: f32) callconv(.C) f32 { |
| 74 | if (hx > 0x3EB17218) { | 74 | if (hx > 0x3EB17218) { |
| 75 | // |x| > 1.5 * ln2 | 75 | // |x| > 1.5 * ln2 |
| 76 | if (hx > 0x3F851592) { | 76 | if (hx > 0x3F851592) { |
| 77 | k = @floatToInt(i32, invln2 * x + half[@intCast(usize, sign)]); | 77 | k = @intFromFloat(i32, invln2 * x + half[@intCast(usize, sign)]); |
| 78 | } else { | 78 | } else { |
| 79 | k = 1 - sign - sign; | 79 | k = 1 - sign - sign; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | const fk = @intToFloat(f32, k); | 82 | const fk = @floatFromInt(f32, k); |
| 83 | hi = x - fk * ln2hi; | 83 | hi = x - fk * ln2hi; |
| 84 | lo = fk * ln2lo; | 84 | lo = fk * ln2lo; |
| 85 | x = hi - lo; | 85 | x = hi - lo; |
| ... | @@ -157,12 +157,12 @@ pub fn exp(x_: f64) callconv(.C) f64 { | ... | @@ -157,12 +157,12 @@ pub fn exp(x_: f64) callconv(.C) f64 { |
| 157 | if (hx > 0x3FD62E42) { | 157 | if (hx > 0x3FD62E42) { |
| 158 | // |x| >= 1.5 * ln2 | 158 | // |x| >= 1.5 * ln2 |
| 159 | if (hx > 0x3FF0A2B2) { | 159 | if (hx > 0x3FF0A2B2) { |
| 160 | k = @floatToInt(i32, invln2 * x + half[@intCast(usize, sign)]); | 160 | k = @intFromFloat(i32, invln2 * x + half[@intCast(usize, sign)]); |
| 161 | } else { | 161 | } else { |
| 162 | k = 1 - sign - sign; | 162 | k = 1 - sign - sign; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | const dk = @intToFloat(f64, k); | 165 | const dk = @floatFromInt(f64, k); |
| 166 | hi = x - dk * ln2hi; | 166 | hi = x - dk * ln2hi; |
| 167 | lo = dk * ln2lo; | 167 | lo = dk * ln2lo; |
| 168 | x = hi - lo; | 168 | x = hi - lo; |
lib/compiler_rt/exp2.zig+2-2| ... | @@ -32,7 +32,7 @@ pub fn __exp2h(x: f16) callconv(.C) f16 { | ... | @@ -32,7 +32,7 @@ pub fn __exp2h(x: f16) callconv(.C) f16 { |
| 32 | 32 | ||
| 33 | pub fn exp2f(x: f32) callconv(.C) f32 { | 33 | pub fn exp2f(x: f32) callconv(.C) f32 { |
| 34 | const tblsiz = @intCast(u32, exp2ft.len); | 34 | const tblsiz = @intCast(u32, exp2ft.len); |
| 35 | const redux: f32 = 0x1.8p23 / @intToFloat(f32, tblsiz); | 35 | const redux: f32 = 0x1.8p23 / @floatFromInt(f32, tblsiz); |
| 36 | const P1: f32 = 0x1.62e430p-1; | 36 | const P1: f32 = 0x1.62e430p-1; |
| 37 | const P2: f32 = 0x1.ebfbe0p-3; | 37 | const P2: f32 = 0x1.ebfbe0p-3; |
| 38 | const P3: f32 = 0x1.c6b348p-5; | 38 | const P3: f32 = 0x1.c6b348p-5; |
| ... | @@ -89,7 +89,7 @@ pub fn exp2f(x: f32) callconv(.C) f32 { | ... | @@ -89,7 +89,7 @@ pub fn exp2f(x: f32) callconv(.C) f32 { |
| 89 | 89 | ||
| 90 | pub fn exp2(x: f64) callconv(.C) f64 { | 90 | pub fn exp2(x: f64) callconv(.C) f64 { |
| 91 | const tblsiz: u32 = @intCast(u32, exp2dt.len / 2); | 91 | const tblsiz: u32 = @intCast(u32, exp2dt.len / 2); |
| 92 | const redux: f64 = 0x1.8p52 / @intToFloat(f64, tblsiz); | 92 | const redux: f64 = 0x1.8p52 / @floatFromInt(f64, tblsiz); |
| 93 | const P1: f64 = 0x1.62e42fefa39efp-1; | 93 | const P1: f64 = 0x1.62e42fefa39efp-1; |
| 94 | const P2: f64 = 0x1.ebfbdff82c575p-3; | 94 | const P2: f64 = 0x1.ebfbdff82c575p-3; |
| 95 | const P3: f64 = 0x1.c6b08d704a0a6p-5; | 95 | const P3: f64 = 0x1.c6b08d704a0a6p-5; |
lib/compiler_rt/fixdfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixdfdi(a: f64) callconv(.C) i64 { | 14 | pub fn __fixdfdi(a: f64) callconv(.C) i64 { |
| 15 | return floatToInt(i64, a); | 15 | return intFromFloat(i64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_d2lz(a: f64) callconv(.AAPCS) i64 { | 18 | fn __aeabi_d2lz(a: f64) callconv(.AAPCS) i64 { |
| 19 | return floatToInt(i64, a); | 19 | return intFromFloat(i64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixdfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixdfsi(a: f64) callconv(.C) i32 { | 14 | pub fn __fixdfsi(a: f64) callconv(.C) i32 { |
| 15 | return floatToInt(i32, a); | 15 | return intFromFloat(i32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_d2iz(a: f64) callconv(.AAPCS) i32 { | 18 | fn __aeabi_d2iz(a: f64) callconv(.AAPCS) i32 { |
| 19 | return floatToInt(i32, a); | 19 | return intFromFloat(i32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixdfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixdfti(a: f64) callconv(.C) i128 { | 15 | pub fn __fixdfti(a: f64) callconv(.C) i128 { |
| 16 | return floatToInt(i128, a); | 16 | return intFromFloat(i128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixdfti_windows_x86_64(a: f64) callconv(.C) v2u64 { | 21 | fn __fixdfti_windows_x86_64(a: f64) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(i128, a)); | 22 | return @bitCast(v2u64, intFromFloat(i128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixhfdi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixhfdi(a: f16) callconv(.C) i64 { | 10 | fn __fixhfdi(a: f16) callconv(.C) i64 { |
| 11 | return floatToInt(i64, a); | 11 | return intFromFloat(i64, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixhfsi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixhfsi(a: f16) callconv(.C) i32 { | 10 | fn __fixhfsi(a: f16) callconv(.C) i32 { |
| 11 | return floatToInt(i32, a); | 11 | return intFromFloat(i32, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixhfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixhfti(a: f16) callconv(.C) i128 { | 15 | pub fn __fixhfti(a: f16) callconv(.C) i128 { |
| 16 | return floatToInt(i128, a); | 16 | return intFromFloat(i128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixhfti_windows_x86_64(a: f16) callconv(.C) v2u64 { | 21 | fn __fixhfti_windows_x86_64(a: f16) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(i128, a)); | 22 | return @bitCast(v2u64, intFromFloat(i128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixsfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixsfdi(a: f32) callconv(.C) i64 { | 14 | pub fn __fixsfdi(a: f32) callconv(.C) i64 { |
| 15 | return floatToInt(i64, a); | 15 | return intFromFloat(i64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_f2lz(a: f32) callconv(.AAPCS) i64 { | 18 | fn __aeabi_f2lz(a: f32) callconv(.AAPCS) i64 { |
| 19 | return floatToInt(i64, a); | 19 | return intFromFloat(i64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixsfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixsfsi(a: f32) callconv(.C) i32 { | 14 | pub fn __fixsfsi(a: f32) callconv(.C) i32 { |
| 15 | return floatToInt(i32, a); | 15 | return intFromFloat(i32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_f2iz(a: f32) callconv(.AAPCS) i32 { | 18 | fn __aeabi_f2iz(a: f32) callconv(.AAPCS) i32 { |
| 19 | return floatToInt(i32, a); | 19 | return intFromFloat(i32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixsfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixsfti(a: f32) callconv(.C) i128 { | 15 | pub fn __fixsfti(a: f32) callconv(.C) i128 { |
| 16 | return floatToInt(i128, a); | 16 | return intFromFloat(i128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v2u64 { | 21 | fn __fixsfti_windows_x86_64(a: f32) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(i128, a)); | 22 | return @bitCast(v2u64, intFromFloat(i128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixtfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixtfdi(a: f128) callconv(.C) i64 { | 15 | pub fn __fixtfdi(a: f128) callconv(.C) i64 { |
| 16 | return floatToInt(i64, a); | 16 | return intFromFloat(i64, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_qtox(a: *const f128) callconv(.C) i64 { | 19 | fn _Qp_qtox(a: *const f128) callconv(.C) i64 { |
| 20 | return floatToInt(i64, a.*); | 20 | return intFromFloat(i64, a.*); |
| 21 | } | 21 | } |
lib/compiler_rt/fixtfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixtfsi(a: f128) callconv(.C) i32 { | 15 | pub fn __fixtfsi(a: f128) callconv(.C) i32 { |
| 16 | return floatToInt(i32, a); | 16 | return intFromFloat(i32, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_qtoi(a: *const f128) callconv(.C) i32 { | 19 | fn _Qp_qtoi(a: *const f128) callconv(.C) i32 { |
| 20 | return floatToInt(i32, a.*); | 20 | return intFromFloat(i32, a.*); |
| 21 | } | 21 | } |
lib/compiler_rt/fixtfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -15,11 +15,11 @@ comptime { | ... | @@ -15,11 +15,11 @@ comptime { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn __fixtfti(a: f128) callconv(.C) i128 { | 17 | pub fn __fixtfti(a: f128) callconv(.C) i128 { |
| 18 | return floatToInt(i128, a); | 18 | return intFromFloat(i128, a); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | const v2u64 = @Vector(2, u64); | 21 | const v2u64 = @Vector(2, u64); |
| 22 | 22 | ||
| 23 | fn __fixtfti_windows_x86_64(a: f128) callconv(.C) v2u64 { | 23 | fn __fixtfti_windows_x86_64(a: f128) callconv(.C) v2u64 { |
| 24 | return @bitCast(v2u64, floatToInt(i128, a)); | 24 | return @bitCast(v2u64, intFromFloat(i128, a)); |
| 25 | } | 25 | } |
lib/compiler_rt/fixunsdfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixunsdfdi(a: f64) callconv(.C) u64 { | 14 | pub fn __fixunsdfdi(a: f64) callconv(.C) u64 { |
| 15 | return floatToInt(u64, a); | 15 | return intFromFloat(u64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_d2ulz(a: f64) callconv(.AAPCS) u64 { | 18 | fn __aeabi_d2ulz(a: f64) callconv(.AAPCS) u64 { |
| 19 | return floatToInt(u64, a); | 19 | return intFromFloat(u64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixunsdfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixunsdfsi(a: f64) callconv(.C) u32 { | 14 | pub fn __fixunsdfsi(a: f64) callconv(.C) u32 { |
| 15 | return floatToInt(u32, a); | 15 | return intFromFloat(u32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_d2uiz(a: f64) callconv(.AAPCS) u32 { | 18 | fn __aeabi_d2uiz(a: f64) callconv(.AAPCS) u32 { |
| 19 | return floatToInt(u32, a); | 19 | return intFromFloat(u32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixunsdfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunsdfti(a: f64) callconv(.C) u128 { | 15 | pub fn __fixunsdfti(a: f64) callconv(.C) u128 { |
| 16 | return floatToInt(u128, a); | 16 | return intFromFloat(u128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixunsdfti_windows_x86_64(a: f64) callconv(.C) v2u64 { | 21 | fn __fixunsdfti_windows_x86_64(a: f64) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(u128, a)); | 22 | return @bitCast(v2u64, intFromFloat(u128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixunshfdi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixunshfdi(a: f16) callconv(.C) u64 { | 10 | fn __fixunshfdi(a: f16) callconv(.C) u64 { |
| 11 | return floatToInt(u64, a); | 11 | return intFromFloat(u64, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixunshfsi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixunshfsi(a: f16) callconv(.C) u32 { | 10 | fn __fixunshfsi(a: f16) callconv(.C) u32 { |
| 11 | return floatToInt(u32, a); | 11 | return intFromFloat(u32, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixunshfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunshfti(a: f16) callconv(.C) u128 { | 15 | pub fn __fixunshfti(a: f16) callconv(.C) u128 { |
| 16 | return floatToInt(u128, a); | 16 | return intFromFloat(u128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixunshfti_windows_x86_64(a: f16) callconv(.C) v2u64 { | 21 | fn __fixunshfti_windows_x86_64(a: f16) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(u128, a)); | 22 | return @bitCast(v2u64, intFromFloat(u128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixunssfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixunssfdi(a: f32) callconv(.C) u64 { | 14 | pub fn __fixunssfdi(a: f32) callconv(.C) u64 { |
| 15 | return floatToInt(u64, a); | 15 | return intFromFloat(u64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_f2ulz(a: f32) callconv(.AAPCS) u64 { | 18 | fn __aeabi_f2ulz(a: f32) callconv(.AAPCS) u64 { |
| 19 | return floatToInt(u64, a); | 19 | return intFromFloat(u64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixunssfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __fixunssfsi(a: f32) callconv(.C) u32 { | 14 | pub fn __fixunssfsi(a: f32) callconv(.C) u32 { |
| 15 | return floatToInt(u32, a); | 15 | return intFromFloat(u32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_f2uiz(a: f32) callconv(.AAPCS) u32 { | 18 | fn __aeabi_f2uiz(a: f32) callconv(.AAPCS) u32 { |
| 19 | return floatToInt(u32, a); | 19 | return intFromFloat(u32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/fixunssfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunssfti(a: f32) callconv(.C) u128 { | 15 | pub fn __fixunssfti(a: f32) callconv(.C) u128 { |
| 16 | return floatToInt(u128, a); | 16 | return intFromFloat(u128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixunssfti_windows_x86_64(a: f32) callconv(.C) v2u64 { | 21 | fn __fixunssfti_windows_x86_64(a: f32) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(u128, a)); | 22 | return @bitCast(v2u64, intFromFloat(u128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixunstfdi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunstfdi(a: f128) callconv(.C) u64 { | 15 | pub fn __fixunstfdi(a: f128) callconv(.C) u64 { |
| 16 | return floatToInt(u64, a); | 16 | return intFromFloat(u64, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_qtoux(a: *const f128) callconv(.C) u64 { | 19 | fn _Qp_qtoux(a: *const f128) callconv(.C) u64 { |
| 20 | return floatToInt(u64, a.*); | 20 | return intFromFloat(u64, a.*); |
| 21 | } | 21 | } |
lib/compiler_rt/fixunstfsi.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunstfsi(a: f128) callconv(.C) u32 { | 15 | pub fn __fixunstfsi(a: f128) callconv(.C) u32 { |
| 16 | return floatToInt(u32, a); | 16 | return intFromFloat(u32, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_qtoui(a: *const f128) callconv(.C) u32 { | 19 | fn _Qp_qtoui(a: *const f128) callconv(.C) u32 { |
| 20 | return floatToInt(u32, a.*); | 20 | return intFromFloat(u32, a.*); |
| 21 | } | 21 | } |
lib/compiler_rt/fixunstfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -15,11 +15,11 @@ comptime { | ... | @@ -15,11 +15,11 @@ comptime { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn __fixunstfti(a: f128) callconv(.C) u128 { | 17 | pub fn __fixunstfti(a: f128) callconv(.C) u128 { |
| 18 | return floatToInt(u128, a); | 18 | return intFromFloat(u128, a); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | const v2u64 = @Vector(2, u64); | 21 | const v2u64 = @Vector(2, u64); |
| 22 | 22 | ||
| 23 | fn __fixunstfti_windows_x86_64(a: f128) callconv(.C) v2u64 { | 23 | fn __fixunstfti_windows_x86_64(a: f128) callconv(.C) v2u64 { |
| 24 | return @bitCast(v2u64, floatToInt(u128, a)); | 24 | return @bitCast(v2u64, intFromFloat(u128, a)); |
| 25 | } | 25 | } |
lib/compiler_rt/fixunsxfdi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixunsxfdi(a: f80) callconv(.C) u64 { | 10 | fn __fixunsxfdi(a: f80) callconv(.C) u64 { |
| 11 | return floatToInt(u64, a); | 11 | return intFromFloat(u64, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixunsxfsi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixunsxfsi(a: f80) callconv(.C) u32 { | 10 | fn __fixunsxfsi(a: f80) callconv(.C) u32 { |
| 11 | return floatToInt(u32, a); | 11 | return intFromFloat(u32, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixunsxfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixunsxfti(a: f80) callconv(.C) u128 { | 15 | pub fn __fixunsxfti(a: f80) callconv(.C) u128 { |
| 16 | return floatToInt(u128, a); | 16 | return intFromFloat(u128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixunsxfti_windows_x86_64(a: f80) callconv(.C) v2u64 { | 21 | fn __fixunsxfti_windows_x86_64(a: f80) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(u128, a)); | 22 | return @bitCast(v2u64, intFromFloat(u128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/fixxfdi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixxfdi(a: f80) callconv(.C) i64 { | 10 | fn __fixxfdi(a: f80) callconv(.C) i64 { |
| 11 | return floatToInt(i64, a); | 11 | return intFromFloat(i64, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixxfsi.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 2 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __fixxfsi(a: f80) callconv(.C) i32 { | 10 | fn __fixxfsi(a: f80) callconv(.C) i32 { |
| 11 | return floatToInt(i32, a); | 11 | return intFromFloat(i32, a); |
| 12 | } | 12 | } |
lib/compiler_rt/fixxfti.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const floatToInt = @import("./float_to_int.zig").floatToInt; | 3 | const intFromFloat = @import("./int_from_float.zig").intFromFloat; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,11 +13,11 @@ comptime { | ... | @@ -13,11 +13,11 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __fixxfti(a: f80) callconv(.C) i128 { | 15 | pub fn __fixxfti(a: f80) callconv(.C) i128 { |
| 16 | return floatToInt(i128, a); | 16 | return intFromFloat(i128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | const v2u64 = @Vector(2, u64); | 19 | const v2u64 = @Vector(2, u64); |
| 20 | 20 | ||
| 21 | fn __fixxfti_windows_x86_64(a: f80) callconv(.C) v2u64 { | 21 | fn __fixxfti_windows_x86_64(a: f80) callconv(.C) v2u64 { |
| 22 | return @bitCast(v2u64, floatToInt(i128, a)); | 22 | return @bitCast(v2u64, intFromFloat(i128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/float_from_int.zig created+58| ... | @@ -0,0 +1,58 @@ | ||
| 1 | const Int = @import("std").meta.Int; | ||
| 2 | const math = @import("std").math; | ||
| 3 | |||
| 4 | pub fn floatFromInt(comptime T: type, x: anytype) T { | ||
| 5 | if (x == 0) return 0; | ||
| 6 | |||
| 7 | // Various constants whose values follow from the type parameters. | ||
| 8 | // Any reasonable optimizer will fold and propagate all of these. | ||
| 9 | const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x))); | ||
| 10 | const uT = Int(.unsigned, @bitSizeOf(T)); | ||
| 11 | const inf = math.inf(T); | ||
| 12 | const float_bits = @bitSizeOf(T); | ||
| 13 | const int_bits = @bitSizeOf(@TypeOf(x)); | ||
| 14 | const exp_bits = math.floatExponentBits(T); | ||
| 15 | const fractional_bits = math.floatFractionalBits(T); | ||
| 16 | const exp_bias = math.maxInt(Int(.unsigned, exp_bits - 1)); | ||
| 17 | const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0; | ||
| 18 | const max_exp = exp_bias; | ||
| 19 | |||
| 20 | // Sign | ||
| 21 | var abs_val = math.absCast(x); | ||
| 22 | const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0; | ||
| 23 | var result: uT = sign_bit; | ||
| 24 | |||
| 25 | // Compute significand | ||
| 26 | var exp = int_bits - @clz(abs_val) - 1; | ||
| 27 | if (int_bits <= fractional_bits or exp <= fractional_bits) { | ||
| 28 | const shift_amt = fractional_bits - @intCast(math.Log2Int(uT), exp); | ||
| 29 | |||
| 30 | // Shift up result to line up with the significand - no rounding required | ||
| 31 | result = (@intCast(uT, abs_val) << shift_amt); | ||
| 32 | result ^= implicit_bit; // Remove implicit integer bit | ||
| 33 | } else { | ||
| 34 | var shift_amt = @intCast(math.Log2Int(Z), exp - fractional_bits); | ||
| 35 | const exact_tie: bool = @ctz(abs_val) == shift_amt - 1; | ||
| 36 | |||
| 37 | // Shift down result and remove implicit integer bit | ||
| 38 | result = @intCast(uT, (abs_val >> (shift_amt - 1))) ^ (implicit_bit << 1); | ||
| 39 | |||
| 40 | // Round result, including round-to-even for exact ties | ||
| 41 | result = ((result + 1) >> 1) & ~@as(uT, @intFromBool(exact_tie)); | ||
| 42 | } | ||
| 43 | |||
| 44 | // Compute exponent | ||
| 45 | if ((int_bits > max_exp) and (exp > max_exp)) // If exponent too large, overflow to infinity | ||
| 46 | return @bitCast(T, sign_bit | @bitCast(uT, inf)); | ||
| 47 | |||
| 48 | result += (@as(uT, exp) + exp_bias) << math.floatMantissaBits(T); | ||
| 49 | |||
| 50 | // If the result included a carry, we need to restore the explicit integer bit | ||
| 51 | if (T == f80) result |= 1 << fractional_bits; | ||
| 52 | |||
| 53 | return @bitCast(T, sign_bit | result); | ||
| 54 | } | ||
| 55 | |||
| 56 | test { | ||
| 57 | _ = @import("float_from_int_test.zig"); | ||
| 58 | } | ||
lib/compiler_rt/float_from_int_test.zig created+836| ... | @@ -0,0 +1,836 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const testing = std.testing; | ||
| 3 | const math = std.math; | ||
| 4 | |||
| 5 | const __floatunsihf = @import("floatunsihf.zig").__floatunsihf; | ||
| 6 | |||
| 7 | // Conversion to f32 | ||
| 8 | const __floatsisf = @import("floatsisf.zig").__floatsisf; | ||
| 9 | const __floatunsisf = @import("floatunsisf.zig").__floatunsisf; | ||
| 10 | const __floatdisf = @import("floatdisf.zig").__floatdisf; | ||
| 11 | const __floatundisf = @import("floatundisf.zig").__floatundisf; | ||
| 12 | const __floattisf = @import("floattisf.zig").__floattisf; | ||
| 13 | const __floatuntisf = @import("floatuntisf.zig").__floatuntisf; | ||
| 14 | |||
| 15 | // Conversion to f64 | ||
| 16 | const __floatsidf = @import("floatsidf.zig").__floatsidf; | ||
| 17 | const __floatunsidf = @import("floatunsidf.zig").__floatunsidf; | ||
| 18 | const __floatdidf = @import("floatdidf.zig").__floatdidf; | ||
| 19 | const __floatundidf = @import("floatundidf.zig").__floatundidf; | ||
| 20 | const __floattidf = @import("floattidf.zig").__floattidf; | ||
| 21 | const __floatuntidf = @import("floatuntidf.zig").__floatuntidf; | ||
| 22 | |||
| 23 | // Conversion to f128 | ||
| 24 | const __floatsitf = @import("floatsitf.zig").__floatsitf; | ||
| 25 | const __floatunsitf = @import("floatunsitf.zig").__floatunsitf; | ||
| 26 | const __floatditf = @import("floatditf.zig").__floatditf; | ||
| 27 | const __floatunditf = @import("floatunditf.zig").__floatunditf; | ||
| 28 | const __floattitf = @import("floattitf.zig").__floattitf; | ||
| 29 | const __floatuntitf = @import("floatuntitf.zig").__floatuntitf; | ||
| 30 | |||
| 31 | fn test__floatsisf(a: i32, expected: u32) !void { | ||
| 32 | const r = __floatsisf(a); | ||
| 33 | try std.testing.expect(@bitCast(u32, r) == expected); | ||
| 34 | } | ||
| 35 | |||
| 36 | fn test_one_floatunsisf(a: u32, expected: u32) !void { | ||
| 37 | const r = __floatunsisf(a); | ||
| 38 | try std.testing.expect(@bitCast(u32, r) == expected); | ||
| 39 | } | ||
| 40 | |||
| 41 | test "floatsisf" { | ||
| 42 | try test__floatsisf(0, 0x00000000); | ||
| 43 | try test__floatsisf(1, 0x3f800000); | ||
| 44 | try test__floatsisf(-1, 0xbf800000); | ||
| 45 | try test__floatsisf(0x7FFFFFFF, 0x4f000000); | ||
| 46 | try test__floatsisf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xcf000000); | ||
| 47 | } | ||
| 48 | |||
| 49 | test "floatunsisf" { | ||
| 50 | // Test the produced bit pattern | ||
| 51 | try test_one_floatunsisf(0, 0); | ||
| 52 | try test_one_floatunsisf(1, 0x3f800000); | ||
| 53 | try test_one_floatunsisf(0x7FFFFFFF, 0x4f000000); | ||
| 54 | try test_one_floatunsisf(0x80000000, 0x4f000000); | ||
| 55 | try test_one_floatunsisf(0xFFFFFFFF, 0x4f800000); | ||
| 56 | } | ||
| 57 | |||
| 58 | fn test__floatdisf(a: i64, expected: f32) !void { | ||
| 59 | const x = __floatdisf(a); | ||
| 60 | try testing.expect(x == expected); | ||
| 61 | } | ||
| 62 | |||
| 63 | fn test__floatundisf(a: u64, expected: f32) !void { | ||
| 64 | try std.testing.expectEqual(expected, __floatundisf(a)); | ||
| 65 | } | ||
| 66 | |||
| 67 | test "floatdisf" { | ||
| 68 | try test__floatdisf(0, 0.0); | ||
| 69 | try test__floatdisf(1, 1.0); | ||
| 70 | try test__floatdisf(2, 2.0); | ||
| 71 | try test__floatdisf(-1, -1.0); | ||
| 72 | try test__floatdisf(-2, -2.0); | ||
| 73 | try test__floatdisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 74 | try test__floatdisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 75 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); | ||
| 76 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); | ||
| 77 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000000)), -0x1.000000p+63); | ||
| 78 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000001)), -0x1.000000p+63); | ||
| 79 | try test__floatdisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 80 | try test__floatdisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 81 | try test__floatdisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 82 | try test__floatdisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 83 | try test__floatdisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 84 | try test__floatdisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 85 | try test__floatdisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 86 | try test__floatdisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 87 | try test__floatdisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 88 | try test__floatdisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 89 | try test__floatdisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 90 | } | ||
| 91 | |||
| 92 | test "floatundisf" { | ||
| 93 | try test__floatundisf(0, 0.0); | ||
| 94 | try test__floatundisf(1, 1.0); | ||
| 95 | try test__floatundisf(2, 2.0); | ||
| 96 | try test__floatundisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 97 | try test__floatundisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 98 | try test__floatundisf(0x8000008000000000, 0x1p+63); | ||
| 99 | try test__floatundisf(0x8000010000000000, 0x1.000002p+63); | ||
| 100 | try test__floatundisf(0x8000000000000000, 0x1p+63); | ||
| 101 | try test__floatundisf(0x8000000000000001, 0x1p+63); | ||
| 102 | try test__floatundisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); | ||
| 103 | try test__floatundisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); | ||
| 104 | try test__floatundisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 105 | try test__floatundisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 106 | try test__floatundisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 107 | try test__floatundisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 108 | try test__floatundisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 109 | try test__floatundisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 110 | try test__floatundisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 111 | try test__floatundisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 112 | try test__floatundisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 113 | try test__floatundisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 114 | try test__floatundisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 115 | } | ||
| 116 | |||
| 117 | fn test__floattisf(a: i128, expected: f32) !void { | ||
| 118 | const x = __floattisf(a); | ||
| 119 | try testing.expect(x == expected); | ||
| 120 | } | ||
| 121 | |||
| 122 | fn test__floatuntisf(a: u128, expected: f32) !void { | ||
| 123 | const x = __floatuntisf(a); | ||
| 124 | try testing.expect(x == expected); | ||
| 125 | } | ||
| 126 | |||
| 127 | test "floattisf" { | ||
| 128 | try test__floattisf(0, 0.0); | ||
| 129 | |||
| 130 | try test__floattisf(1, 1.0); | ||
| 131 | try test__floattisf(2, 2.0); | ||
| 132 | try test__floattisf(-1, -1.0); | ||
| 133 | try test__floattisf(-2, -2.0); | ||
| 134 | |||
| 135 | try test__floattisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 136 | try test__floattisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 137 | |||
| 138 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000008000000000), -0x1.FFFFFEp+62); | ||
| 139 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000010000000000), -0x1.FFFFFCp+62); | ||
| 140 | |||
| 141 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000000), -0x1.000000p+63); | ||
| 142 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000001), -0x1.000000p+63); | ||
| 143 | |||
| 144 | try test__floattisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 145 | |||
| 146 | try test__floattisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 147 | try test__floattisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 148 | try test__floattisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 149 | try test__floattisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 150 | try test__floattisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 151 | |||
| 152 | try test__floattisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 153 | try test__floattisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 154 | try test__floattisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 155 | try test__floattisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 156 | try test__floattisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 157 | |||
| 158 | try test__floattisf(make_ti(0x0007FB72E8000000, 0), 0x1.FEDCBAp+114); | ||
| 159 | |||
| 160 | try test__floattisf(make_ti(0x0007FB72EA000000, 0), 0x1.FEDCBAp+114); | ||
| 161 | try test__floattisf(make_ti(0x0007FB72EB000000, 0), 0x1.FEDCBAp+114); | ||
| 162 | try test__floattisf(make_ti(0x0007FB72EBFFFFFF, 0), 0x1.FEDCBAp+114); | ||
| 163 | try test__floattisf(make_ti(0x0007FB72EC000000, 0), 0x1.FEDCBCp+114); | ||
| 164 | try test__floattisf(make_ti(0x0007FB72E8000001, 0), 0x1.FEDCBAp+114); | ||
| 165 | |||
| 166 | try test__floattisf(make_ti(0x0007FB72E6000000, 0), 0x1.FEDCBAp+114); | ||
| 167 | try test__floattisf(make_ti(0x0007FB72E7000000, 0), 0x1.FEDCBAp+114); | ||
| 168 | try test__floattisf(make_ti(0x0007FB72E7FFFFFF, 0), 0x1.FEDCBAp+114); | ||
| 169 | try test__floattisf(make_ti(0x0007FB72E4000001, 0), 0x1.FEDCBAp+114); | ||
| 170 | try test__floattisf(make_ti(0x0007FB72E4000000, 0), 0x1.FEDCB8p+114); | ||
| 171 | } | ||
| 172 | |||
| 173 | test "floatuntisf" { | ||
| 174 | try test__floatuntisf(0, 0.0); | ||
| 175 | |||
| 176 | try test__floatuntisf(1, 1.0); | ||
| 177 | try test__floatuntisf(2, 2.0); | ||
| 178 | try test__floatuntisf(20, 20.0); | ||
| 179 | |||
| 180 | try test__floatuntisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 181 | try test__floatuntisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 182 | |||
| 183 | try test__floatuntisf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); | ||
| 184 | try test__floatuntisf(make_uti(0x8000000000000800, 0), 0x1.0p+127); | ||
| 185 | try test__floatuntisf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); | ||
| 186 | |||
| 187 | try test__floatuntisf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); | ||
| 188 | |||
| 189 | try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 190 | |||
| 191 | try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 192 | try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 193 | |||
| 194 | try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 195 | |||
| 196 | try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 197 | try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 198 | try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 199 | |||
| 200 | try test__floatuntisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); | ||
| 201 | try test__floatuntisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); | ||
| 202 | |||
| 203 | try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 204 | |||
| 205 | try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 206 | try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 207 | try test__floatuntisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 208 | try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 209 | try test__floatuntisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 210 | |||
| 211 | try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 212 | try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 213 | try test__floatuntisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 214 | try test__floatuntisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 215 | try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 216 | |||
| 217 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCB90000000000001), 0x1.FEDCBAp+76); | ||
| 218 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBA0000000000000), 0x1.FEDCBAp+76); | ||
| 219 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBAFFFFFFFFFFFFF), 0x1.FEDCBAp+76); | ||
| 220 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000000), 0x1.FEDCBCp+76); | ||
| 221 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000001), 0x1.FEDCBCp+76); | ||
| 222 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBBFFFFFFFFFFFFF), 0x1.FEDCBCp+76); | ||
| 223 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000000), 0x1.FEDCBCp+76); | ||
| 224 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000001), 0x1.FEDCBCp+76); | ||
| 225 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000000), 0x1.FEDCBCp+76); | ||
| 226 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000001), 0x1.FEDCBEp+76); | ||
| 227 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBDFFFFFFFFFFFFF), 0x1.FEDCBEp+76); | ||
| 228 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBE0000000000000), 0x1.FEDCBEp+76); | ||
| 229 | |||
| 230 | // Test overflow to infinity | ||
| 231 | try test__floatuntisf(@as(u128, math.maxInt(u128)), @bitCast(f32, math.inf(f32))); | ||
| 232 | } | ||
| 233 | |||
| 234 | fn test_one_floatsidf(a: i32, expected: u64) !void { | ||
| 235 | const r = __floatsidf(a); | ||
| 236 | try std.testing.expect(@bitCast(u64, r) == expected); | ||
| 237 | } | ||
| 238 | |||
| 239 | fn test_one_floatunsidf(a: u32, expected: u64) !void { | ||
| 240 | const r = __floatunsidf(a); | ||
| 241 | try std.testing.expect(@bitCast(u64, r) == expected); | ||
| 242 | } | ||
| 243 | |||
| 244 | test "floatsidf" { | ||
| 245 | try test_one_floatsidf(0, 0x0000000000000000); | ||
| 246 | try test_one_floatsidf(1, 0x3ff0000000000000); | ||
| 247 | try test_one_floatsidf(-1, 0xbff0000000000000); | ||
| 248 | try test_one_floatsidf(0x7FFFFFFF, 0x41dfffffffc00000); | ||
| 249 | try test_one_floatsidf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc1e0000000000000); | ||
| 250 | } | ||
| 251 | |||
| 252 | test "floatunsidf" { | ||
| 253 | try test_one_floatunsidf(0, 0x0000000000000000); | ||
| 254 | try test_one_floatunsidf(1, 0x3ff0000000000000); | ||
| 255 | try test_one_floatunsidf(0x7FFFFFFF, 0x41dfffffffc00000); | ||
| 256 | try test_one_floatunsidf(@intCast(u32, 0x80000000), 0x41e0000000000000); | ||
| 257 | try test_one_floatunsidf(@intCast(u32, 0xFFFFFFFF), 0x41efffffffe00000); | ||
| 258 | } | ||
| 259 | |||
| 260 | fn test__floatdidf(a: i64, expected: f64) !void { | ||
| 261 | const r = __floatdidf(a); | ||
| 262 | try testing.expect(r == expected); | ||
| 263 | } | ||
| 264 | |||
| 265 | fn test__floatundidf(a: u64, expected: f64) !void { | ||
| 266 | const r = __floatundidf(a); | ||
| 267 | try testing.expect(r == expected); | ||
| 268 | } | ||
| 269 | |||
| 270 | test "floatdidf" { | ||
| 271 | try test__floatdidf(0, 0.0); | ||
| 272 | try test__floatdidf(1, 1.0); | ||
| 273 | try test__floatdidf(2, 2.0); | ||
| 274 | try test__floatdidf(20, 20.0); | ||
| 275 | try test__floatdidf(-1, -1.0); | ||
| 276 | try test__floatdidf(-2, -2.0); | ||
| 277 | try test__floatdidf(-20, -20.0); | ||
| 278 | try test__floatdidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 279 | try test__floatdidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 280 | try test__floatdidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 281 | try test__floatdidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 282 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); | ||
| 283 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000800)), -0x1.FFFFFFFFFFFFEp+62); | ||
| 284 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); | ||
| 285 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000001000)), -0x1.FFFFFFFFFFFFCp+62); | ||
| 286 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000000)), -0x1.000000p+63); | ||
| 287 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000001)), -0x1.000000p+63); // 0x8000000000000001 | ||
| 288 | try test__floatdidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 289 | try test__floatdidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 290 | try test__floatdidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 291 | try test__floatdidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 292 | try test__floatdidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 293 | try test__floatdidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 294 | try test__floatdidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 295 | try test__floatdidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 296 | try test__floatdidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 297 | try test__floatdidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 298 | try test__floatdidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 299 | try test__floatdidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 300 | try test__floatdidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 301 | try test__floatdidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 302 | try test__floatdidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 303 | try test__floatdidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 304 | try test__floatdidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 305 | try test__floatdidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 306 | try test__floatdidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 307 | try test__floatdidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 308 | try test__floatdidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 309 | try test__floatdidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 310 | try test__floatdidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 311 | try test__floatdidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 312 | try test__floatdidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 313 | try test__floatdidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 314 | } | ||
| 315 | |||
| 316 | test "floatundidf" { | ||
| 317 | try test__floatundidf(0, 0.0); | ||
| 318 | try test__floatundidf(1, 1.0); | ||
| 319 | try test__floatundidf(2, 2.0); | ||
| 320 | try test__floatundidf(20, 20.0); | ||
| 321 | try test__floatundidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 322 | try test__floatundidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 323 | try test__floatundidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 324 | try test__floatundidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 325 | try test__floatundidf(0x8000008000000000, 0x1.000001p+63); | ||
| 326 | try test__floatundidf(0x8000000000000800, 0x1.0000000000001p+63); | ||
| 327 | try test__floatundidf(0x8000010000000000, 0x1.000002p+63); | ||
| 328 | try test__floatundidf(0x8000000000001000, 0x1.0000000000002p+63); | ||
| 329 | try test__floatundidf(0x8000000000000000, 0x1p+63); | ||
| 330 | try test__floatundidf(0x8000000000000001, 0x1p+63); | ||
| 331 | try test__floatundidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 332 | try test__floatundidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 333 | try test__floatundidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 334 | try test__floatundidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 335 | try test__floatundidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 336 | try test__floatundidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 337 | try test__floatundidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 338 | try test__floatundidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 339 | try test__floatundidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 340 | try test__floatundidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 341 | try test__floatundidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 342 | try test__floatundidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 343 | try test__floatundidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 344 | try test__floatundidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 345 | try test__floatundidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 346 | try test__floatundidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 347 | try test__floatundidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 348 | try test__floatundidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 349 | try test__floatundidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 350 | try test__floatundidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 351 | try test__floatundidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 352 | try test__floatundidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 353 | try test__floatundidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 354 | try test__floatundidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 355 | try test__floatundidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 356 | try test__floatundidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 357 | } | ||
| 358 | |||
| 359 | fn test__floattidf(a: i128, expected: f64) !void { | ||
| 360 | const x = __floattidf(a); | ||
| 361 | try testing.expect(x == expected); | ||
| 362 | } | ||
| 363 | |||
| 364 | fn test__floatuntidf(a: u128, expected: f64) !void { | ||
| 365 | const x = __floatuntidf(a); | ||
| 366 | try testing.expect(x == expected); | ||
| 367 | } | ||
| 368 | |||
| 369 | test "floattidf" { | ||
| 370 | try test__floattidf(0, 0.0); | ||
| 371 | |||
| 372 | try test__floattidf(1, 1.0); | ||
| 373 | try test__floattidf(2, 2.0); | ||
| 374 | try test__floattidf(20, 20.0); | ||
| 375 | try test__floattidf(-1, -1.0); | ||
| 376 | try test__floattidf(-2, -2.0); | ||
| 377 | try test__floattidf(-20, -20.0); | ||
| 378 | |||
| 379 | try test__floattidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 380 | try test__floattidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 381 | try test__floattidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 382 | try test__floattidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 383 | |||
| 384 | try test__floattidf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); | ||
| 385 | try test__floattidf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); | ||
| 386 | try test__floattidf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); | ||
| 387 | try test__floattidf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); | ||
| 388 | |||
| 389 | try test__floattidf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); | ||
| 390 | try test__floattidf(make_ti(0x8000000000000001, 0), -0x1.000000p+127); | ||
| 391 | |||
| 392 | try test__floattidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 393 | |||
| 394 | try test__floattidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 395 | try test__floattidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 396 | try test__floattidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 397 | try test__floattidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 398 | try test__floattidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 399 | |||
| 400 | try test__floattidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 401 | try test__floattidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 402 | try test__floattidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 403 | try test__floattidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 404 | try test__floattidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 405 | |||
| 406 | try test__floattidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 407 | try test__floattidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 408 | try test__floattidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 409 | try test__floattidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 410 | try test__floattidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 411 | try test__floattidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 412 | try test__floattidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 413 | try test__floattidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 414 | try test__floattidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 415 | try test__floattidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 416 | try test__floattidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 417 | try test__floattidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 418 | try test__floattidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 419 | try test__floattidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 420 | try test__floattidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 421 | |||
| 422 | try test__floattidf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 423 | try test__floattidf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); | ||
| 424 | try test__floattidf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); | ||
| 425 | try test__floattidf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); | ||
| 426 | try test__floattidf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); | ||
| 427 | try test__floattidf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); | ||
| 428 | try test__floattidf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); | ||
| 429 | try test__floattidf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); | ||
| 430 | try test__floattidf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); | ||
| 431 | try test__floattidf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); | ||
| 432 | try test__floattidf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 433 | try test__floattidf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); | ||
| 434 | try test__floattidf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); | ||
| 435 | try test__floattidf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); | ||
| 436 | try test__floattidf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 437 | } | ||
| 438 | |||
| 439 | test "floatuntidf" { | ||
| 440 | try test__floatuntidf(0, 0.0); | ||
| 441 | |||
| 442 | try test__floatuntidf(1, 1.0); | ||
| 443 | try test__floatuntidf(2, 2.0); | ||
| 444 | try test__floatuntidf(20, 20.0); | ||
| 445 | |||
| 446 | try test__floatuntidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 447 | try test__floatuntidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 448 | try test__floatuntidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 449 | try test__floatuntidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 450 | |||
| 451 | try test__floatuntidf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); | ||
| 452 | try test__floatuntidf(make_uti(0x8000000000000800, 0), 0x1.0000000000001p+127); | ||
| 453 | try test__floatuntidf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); | ||
| 454 | try test__floatuntidf(make_uti(0x8000000000001000, 0), 0x1.0000000000002p+127); | ||
| 455 | |||
| 456 | try test__floatuntidf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); | ||
| 457 | try test__floatuntidf(make_uti(0x8000000000000001, 0), 0x1.0000000000000002p+127); | ||
| 458 | |||
| 459 | try test__floatuntidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 460 | |||
| 461 | try test__floatuntidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 462 | try test__floatuntidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 463 | try test__floatuntidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 464 | try test__floatuntidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 465 | try test__floatuntidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 466 | |||
| 467 | try test__floatuntidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 468 | try test__floatuntidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 469 | try test__floatuntidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 470 | try test__floatuntidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 471 | try test__floatuntidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 472 | |||
| 473 | try test__floatuntidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 474 | try test__floatuntidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 475 | try test__floatuntidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 476 | try test__floatuntidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 477 | try test__floatuntidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 478 | try test__floatuntidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 479 | try test__floatuntidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 480 | try test__floatuntidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 481 | try test__floatuntidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 482 | try test__floatuntidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 483 | try test__floatuntidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 484 | try test__floatuntidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 485 | try test__floatuntidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 486 | try test__floatuntidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 487 | try test__floatuntidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 488 | |||
| 489 | try test__floatuntidf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 490 | try test__floatuntidf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); | ||
| 491 | try test__floatuntidf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); | ||
| 492 | try test__floatuntidf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); | ||
| 493 | try test__floatuntidf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); | ||
| 494 | try test__floatuntidf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); | ||
| 495 | try test__floatuntidf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); | ||
| 496 | try test__floatuntidf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); | ||
| 497 | try test__floatuntidf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); | ||
| 498 | try test__floatuntidf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); | ||
| 499 | try test__floatuntidf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 500 | try test__floatuntidf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); | ||
| 501 | try test__floatuntidf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); | ||
| 502 | try test__floatuntidf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); | ||
| 503 | try test__floatuntidf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 504 | } | ||
| 505 | |||
| 506 | fn test__floatsitf(a: i32, expected: u128) !void { | ||
| 507 | const r = __floatsitf(a); | ||
| 508 | try std.testing.expect(@bitCast(u128, r) == expected); | ||
| 509 | } | ||
| 510 | |||
| 511 | test "floatsitf" { | ||
| 512 | try test__floatsitf(0, 0); | ||
| 513 | try test__floatsitf(0x7FFFFFFF, 0x401dfffffffc00000000000000000000); | ||
| 514 | try test__floatsitf(0x12345678, 0x401b2345678000000000000000000000); | ||
| 515 | try test__floatsitf(-0x12345678, 0xc01b2345678000000000000000000000); | ||
| 516 | try test__floatsitf(@bitCast(i32, @intCast(u32, 0xffffffff)), 0xbfff0000000000000000000000000000); | ||
| 517 | try test__floatsitf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc01e0000000000000000000000000000); | ||
| 518 | } | ||
| 519 | |||
| 520 | fn test__floatunsitf(a: u32, expected_hi: u64, expected_lo: u64) !void { | ||
| 521 | const x = __floatunsitf(a); | ||
| 522 | |||
| 523 | const x_repr = @bitCast(u128, x); | ||
| 524 | const x_hi = @intCast(u64, x_repr >> 64); | ||
| 525 | const x_lo = @truncate(u64, x_repr); | ||
| 526 | |||
| 527 | if (x_hi == expected_hi and x_lo == expected_lo) { | ||
| 528 | return; | ||
| 529 | } | ||
| 530 | // nan repr | ||
| 531 | else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { | ||
| 532 | if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { | ||
| 533 | return; | ||
| 534 | } | ||
| 535 | } | ||
| 536 | |||
| 537 | @panic("__floatunsitf test failure"); | ||
| 538 | } | ||
| 539 | |||
| 540 | test "floatunsitf" { | ||
| 541 | try test__floatunsitf(0x7fffffff, 0x401dfffffffc0000, 0x0); | ||
| 542 | try test__floatunsitf(0, 0x0, 0x0); | ||
| 543 | try test__floatunsitf(0xffffffff, 0x401efffffffe0000, 0x0); | ||
| 544 | try test__floatunsitf(0x12345678, 0x401b234567800000, 0x0); | ||
| 545 | } | ||
| 546 | |||
| 547 | fn test__floatditf(a: i64, expected: f128) !void { | ||
| 548 | const x = __floatditf(a); | ||
| 549 | try testing.expect(x == expected); | ||
| 550 | } | ||
| 551 | |||
| 552 | fn test__floatunditf(a: u64, expected_hi: u64, expected_lo: u64) !void { | ||
| 553 | const x = __floatunditf(a); | ||
| 554 | |||
| 555 | const x_repr = @bitCast(u128, x); | ||
| 556 | const x_hi = @intCast(u64, x_repr >> 64); | ||
| 557 | const x_lo = @truncate(u64, x_repr); | ||
| 558 | |||
| 559 | if (x_hi == expected_hi and x_lo == expected_lo) { | ||
| 560 | return; | ||
| 561 | } | ||
| 562 | // nan repr | ||
| 563 | else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { | ||
| 564 | if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { | ||
| 565 | return; | ||
| 566 | } | ||
| 567 | } | ||
| 568 | |||
| 569 | @panic("__floatunditf test failure"); | ||
| 570 | } | ||
| 571 | |||
| 572 | test "floatditf" { | ||
| 573 | try test__floatditf(0x7fffffffffffffff, make_tf(0x403dffffffffffff, 0xfffc000000000000)); | ||
| 574 | try test__floatditf(0x123456789abcdef1, make_tf(0x403b23456789abcd, 0xef10000000000000)); | ||
| 575 | try test__floatditf(0x2, make_tf(0x4000000000000000, 0x0)); | ||
| 576 | try test__floatditf(0x1, make_tf(0x3fff000000000000, 0x0)); | ||
| 577 | try test__floatditf(0x0, make_tf(0x0, 0x0)); | ||
| 578 | try test__floatditf(@bitCast(i64, @as(u64, 0xffffffffffffffff)), make_tf(0xbfff000000000000, 0x0)); | ||
| 579 | try test__floatditf(@bitCast(i64, @as(u64, 0xfffffffffffffffe)), make_tf(0xc000000000000000, 0x0)); | ||
| 580 | try test__floatditf(-0x123456789abcdef1, make_tf(0xc03b23456789abcd, 0xef10000000000000)); | ||
| 581 | try test__floatditf(@bitCast(i64, @as(u64, 0x8000000000000000)), make_tf(0xc03e000000000000, 0x0)); | ||
| 582 | } | ||
| 583 | |||
| 584 | test "floatunditf" { | ||
| 585 | try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000); | ||
| 586 | try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000); | ||
| 587 | try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0); | ||
| 588 | try test__floatunditf(0x7fffffffffffffff, 0x403dffffffffffff, 0xfffc000000000000); | ||
| 589 | try test__floatunditf(0x123456789abcdef1, 0x403b23456789abcd, 0xef10000000000000); | ||
| 590 | try test__floatunditf(0x2, 0x4000000000000000, 0x0); | ||
| 591 | try test__floatunditf(0x1, 0x3fff000000000000, 0x0); | ||
| 592 | try test__floatunditf(0x0, 0x0, 0x0); | ||
| 593 | } | ||
| 594 | |||
| 595 | fn test__floattitf(a: i128, expected: f128) !void { | ||
| 596 | const x = __floattitf(a); | ||
| 597 | try testing.expect(x == expected); | ||
| 598 | } | ||
| 599 | |||
| 600 | fn test__floatuntitf(a: u128, expected: f128) !void { | ||
| 601 | const x = __floatuntitf(a); | ||
| 602 | try testing.expect(x == expected); | ||
| 603 | } | ||
| 604 | |||
| 605 | test "floattitf" { | ||
| 606 | try test__floattitf(0, 0.0); | ||
| 607 | |||
| 608 | try test__floattitf(1, 1.0); | ||
| 609 | try test__floattitf(2, 2.0); | ||
| 610 | try test__floattitf(20, 20.0); | ||
| 611 | try test__floattitf(-1, -1.0); | ||
| 612 | try test__floattitf(-2, -2.0); | ||
| 613 | try test__floattitf(-20, -20.0); | ||
| 614 | |||
| 615 | try test__floattitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 616 | try test__floattitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 617 | try test__floattitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 618 | try test__floattitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 619 | |||
| 620 | try test__floattitf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); | ||
| 621 | try test__floattitf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); | ||
| 622 | try test__floattitf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); | ||
| 623 | try test__floattitf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); | ||
| 624 | |||
| 625 | try test__floattitf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); | ||
| 626 | try test__floattitf(make_ti(0x8000000000000001, 0), -0x1.FFFFFFFFFFFFFFFCp+126); | ||
| 627 | |||
| 628 | try test__floattitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 629 | |||
| 630 | try test__floattitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 631 | try test__floattitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 632 | try test__floattitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 633 | try test__floattitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 634 | try test__floattitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 635 | |||
| 636 | try test__floattitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 637 | try test__floattitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 638 | try test__floattitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 639 | try test__floattitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 640 | try test__floattitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 641 | |||
| 642 | try test__floattitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 643 | try test__floattitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); | ||
| 644 | try test__floattitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); | ||
| 645 | try test__floattitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); | ||
| 646 | try test__floattitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); | ||
| 647 | try test__floattitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); | ||
| 648 | try test__floattitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); | ||
| 649 | try test__floattitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); | ||
| 650 | try test__floattitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); | ||
| 651 | try test__floattitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); | ||
| 652 | try test__floattitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); | ||
| 653 | try test__floattitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); | ||
| 654 | try test__floattitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); | ||
| 655 | try test__floattitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); | ||
| 656 | try test__floattitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 657 | |||
| 658 | try test__floattitf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 659 | try test__floattitf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); | ||
| 660 | try test__floattitf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); | ||
| 661 | try test__floattitf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); | ||
| 662 | try test__floattitf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); | ||
| 663 | try test__floattitf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); | ||
| 664 | try test__floattitf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); | ||
| 665 | try test__floattitf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); | ||
| 666 | try test__floattitf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); | ||
| 667 | try test__floattitf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); | ||
| 668 | try test__floattitf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); | ||
| 669 | try test__floattitf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); | ||
| 670 | try test__floattitf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); | ||
| 671 | try test__floattitf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); | ||
| 672 | try test__floattitf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 673 | |||
| 674 | try test__floattitf(make_ti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); | ||
| 675 | |||
| 676 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 677 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 678 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 679 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 680 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 681 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 682 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 683 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 684 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 685 | } | ||
| 686 | |||
| 687 | test "floatuntitf" { | ||
| 688 | try test__floatuntitf(0, 0.0); | ||
| 689 | |||
| 690 | try test__floatuntitf(1, 1.0); | ||
| 691 | try test__floatuntitf(2, 2.0); | ||
| 692 | try test__floatuntitf(20, 20.0); | ||
| 693 | |||
| 694 | try test__floatuntitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 695 | try test__floatuntitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 696 | try test__floatuntitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 697 | try test__floatuntitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 698 | try test__floatuntitf(0x7FFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFEp+59); | ||
| 699 | try test__floatuntitf(0xFFFFFFFFFFFFFFFE, 0xF.FFFFFFFFFFFFFFEp+60); | ||
| 700 | try test__floatuntitf(0xFFFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFFp+60); | ||
| 701 | |||
| 702 | try test__floatuntitf(0x8000008000000000, 0x8.000008p+60); | ||
| 703 | try test__floatuntitf(0x8000000000000800, 0x8.0000000000008p+60); | ||
| 704 | try test__floatuntitf(0x8000010000000000, 0x8.00001p+60); | ||
| 705 | try test__floatuntitf(0x8000000000001000, 0x8.000000000001p+60); | ||
| 706 | |||
| 707 | try test__floatuntitf(0x8000000000000000, 0x8p+60); | ||
| 708 | try test__floatuntitf(0x8000000000000001, 0x8.000000000000001p+60); | ||
| 709 | |||
| 710 | try test__floatuntitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 711 | |||
| 712 | try test__floatuntitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 713 | try test__floatuntitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 714 | try test__floatuntitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 715 | try test__floatuntitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 716 | try test__floatuntitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 717 | |||
| 718 | try test__floatuntitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 719 | try test__floatuntitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 720 | try test__floatuntitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 721 | try test__floatuntitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 722 | try test__floatuntitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 723 | |||
| 724 | try test__floatuntitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 725 | try test__floatuntitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); | ||
| 726 | try test__floatuntitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); | ||
| 727 | try test__floatuntitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); | ||
| 728 | try test__floatuntitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); | ||
| 729 | try test__floatuntitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); | ||
| 730 | try test__floatuntitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); | ||
| 731 | try test__floatuntitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); | ||
| 732 | try test__floatuntitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); | ||
| 733 | try test__floatuntitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); | ||
| 734 | try test__floatuntitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); | ||
| 735 | try test__floatuntitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); | ||
| 736 | try test__floatuntitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); | ||
| 737 | try test__floatuntitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); | ||
| 738 | try test__floatuntitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 739 | |||
| 740 | try test__floatuntitf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 741 | try test__floatuntitf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); | ||
| 742 | try test__floatuntitf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); | ||
| 743 | try test__floatuntitf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); | ||
| 744 | try test__floatuntitf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); | ||
| 745 | try test__floatuntitf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); | ||
| 746 | try test__floatuntitf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); | ||
| 747 | try test__floatuntitf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); | ||
| 748 | try test__floatuntitf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); | ||
| 749 | try test__floatuntitf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); | ||
| 750 | try test__floatuntitf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); | ||
| 751 | try test__floatuntitf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); | ||
| 752 | try test__floatuntitf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); | ||
| 753 | try test__floatuntitf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); | ||
| 754 | try test__floatuntitf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 755 | |||
| 756 | try test__floatuntitf(make_uti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); | ||
| 757 | |||
| 758 | try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0x0000000000000000), 0x1.FFFFFFFFFFFFFFFEp+127); | ||
| 759 | try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF), 0x1.0000000000000000p+128); | ||
| 760 | |||
| 761 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 762 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 763 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 764 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 765 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 766 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 767 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 768 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 769 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 770 | } | ||
| 771 | |||
| 772 | fn make_ti(high: u64, low: u64) i128 { | ||
| 773 | var result: u128 = high; | ||
| 774 | result <<= 64; | ||
| 775 | result |= low; | ||
| 776 | return @bitCast(i128, result); | ||
| 777 | } | ||
| 778 | |||
| 779 | fn make_uti(high: u64, low: u64) u128 { | ||
| 780 | var result: u128 = high; | ||
| 781 | result <<= 64; | ||
| 782 | result |= low; | ||
| 783 | return result; | ||
| 784 | } | ||
| 785 | |||
| 786 | fn make_tf(high: u64, low: u64) f128 { | ||
| 787 | var result: u128 = high; | ||
| 788 | result <<= 64; | ||
| 789 | result |= low; | ||
| 790 | return @bitCast(f128, result); | ||
| 791 | } | ||
| 792 | |||
| 793 | test "conversion to f16" { | ||
| 794 | try testing.expect(__floatunsihf(@as(u32, 0)) == 0.0); | ||
| 795 | try testing.expect(__floatunsihf(@as(u32, 1)) == 1.0); | ||
| 796 | try testing.expect(__floatunsihf(@as(u32, 65504)) == 65504); | ||
| 797 | try testing.expect(__floatunsihf(@as(u32, 65504 + (1 << 4))) == math.inf(f16)); | ||
| 798 | } | ||
| 799 | |||
| 800 | test "conversion to f32" { | ||
| 801 | try testing.expect(__floatunsisf(@as(u32, 0)) == 0.0); | ||
| 802 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u32))) != 1.0); | ||
| 803 | try testing.expect(__floatsisf(@as(i32, math.minInt(i32))) != 1.0); | ||
| 804 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24))) == math.maxInt(u24)); | ||
| 805 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 1) == math.maxInt(u24) + 1); // 0x100_0000 - Exact | ||
| 806 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 2) == math.maxInt(u24) + 1); // 0x100_0001 - Tie: Rounds down to even | ||
| 807 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 3) == math.maxInt(u24) + 3); // 0x100_0002 - Exact | ||
| 808 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 4) == math.maxInt(u24) + 5); // 0x100_0003 - Tie: Rounds up to even | ||
| 809 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 5) == math.maxInt(u24) + 5); // 0x100_0004 - Exact | ||
| 810 | } | ||
| 811 | |||
| 812 | test "conversion to f80" { | ||
| 813 | if (std.debug.runtime_safety) return error.SkipZigTest; | ||
| 814 | |||
| 815 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; | ||
| 816 | |||
| 817 | try testing.expect(floatFromInt(f80, @as(i80, -12)) == -12); | ||
| 818 | try testing.expect(@intFromFloat(u80, floatFromInt(f80, @as(u64, math.maxInt(u64)) + 0)) == math.maxInt(u64) + 0); | ||
| 819 | try testing.expect(@intFromFloat(u80, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); | ||
| 820 | |||
| 821 | try testing.expect(floatFromInt(f80, @as(u32, 0)) == 0.0); | ||
| 822 | try testing.expect(floatFromInt(f80, @as(u32, 1)) == 1.0); | ||
| 823 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u32, math.maxInt(u24)) + 0)) == math.maxInt(u24)); | ||
| 824 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 0)) == math.maxInt(u64)); | ||
| 825 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); // Exact | ||
| 826 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 2)) == math.maxInt(u64) + 1); // Rounds down | ||
| 827 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 3)) == math.maxInt(u64) + 3); // Tie - Exact | ||
| 828 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u64)) + 4)) == math.maxInt(u64) + 5); // Rounds up | ||
| 829 | |||
| 830 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 0)) == math.maxInt(u65) + 1); // Rounds up | ||
| 831 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 1)) == math.maxInt(u65) + 1); // Exact | ||
| 832 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 2)) == math.maxInt(u65) + 1); // Rounds down | ||
| 833 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 3)) == math.maxInt(u65) + 1); // Tie - Rounds down | ||
| 834 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 4)) == math.maxInt(u65) + 5); // Rounds up | ||
| 835 | try testing.expect(@intFromFloat(u128, floatFromInt(f80, @as(u80, math.maxInt(u65)) + 5)) == math.maxInt(u65) + 5); // Exact | ||
| 836 | } | ||
lib/compiler_rt/float_to_int.zig deleted-55| ... | @@ -1,55 +0,0 @@ | ||
| 1 | const Int = @import("std").meta.Int; | ||
| 2 | const math = @import("std").math; | ||
| 3 | const Log2Int = math.Log2Int; | ||
| 4 | |||
| 5 | pub inline fn floatToInt(comptime I: type, a: anytype) I { | ||
| 6 | const F = @TypeOf(a); | ||
| 7 | const float_bits = @typeInfo(F).Float.bits; | ||
| 8 | const int_bits = @typeInfo(I).Int.bits; | ||
| 9 | const rep_t = Int(.unsigned, float_bits); | ||
| 10 | const sig_bits = math.floatMantissaBits(F); | ||
| 11 | const exp_bits = math.floatExponentBits(F); | ||
| 12 | const fractional_bits = math.floatFractionalBits(F); | ||
| 13 | |||
| 14 | const implicit_bit = if (F != f80) (@as(rep_t, 1) << sig_bits) else 0; | ||
| 15 | const max_exp = (1 << (exp_bits - 1)); | ||
| 16 | const exp_bias = max_exp - 1; | ||
| 17 | const sig_mask = (@as(rep_t, 1) << sig_bits) - 1; | ||
| 18 | |||
| 19 | // Break a into sign, exponent, significand | ||
| 20 | const a_rep: rep_t = @bitCast(rep_t, a); | ||
| 21 | const negative = (a_rep >> (float_bits - 1)) != 0; | ||
| 22 | const exponent = @intCast(i32, (a_rep << 1) >> (sig_bits + 1)) - exp_bias; | ||
| 23 | const significand: rep_t = (a_rep & sig_mask) | implicit_bit; | ||
| 24 | |||
| 25 | // If the exponent is negative, the result rounds to zero. | ||
| 26 | if (exponent < 0) return 0; | ||
| 27 | |||
| 28 | // If the value is too large for the integer type, saturate. | ||
| 29 | switch (@typeInfo(I).Int.signedness) { | ||
| 30 | .unsigned => { | ||
| 31 | if (negative) return 0; | ||
| 32 | if (@intCast(c_uint, exponent) >= @min(int_bits, max_exp)) return math.maxInt(I); | ||
| 33 | }, | ||
| 34 | .signed => if (@intCast(c_uint, exponent) >= @min(int_bits - 1, max_exp)) { | ||
| 35 | return if (negative) math.minInt(I) else math.maxInt(I); | ||
| 36 | }, | ||
| 37 | } | ||
| 38 | |||
| 39 | // If 0 <= exponent < sig_bits, right shift to get the result. | ||
| 40 | // Otherwise, shift left. | ||
| 41 | var result: I = undefined; | ||
| 42 | if (exponent < fractional_bits) { | ||
| 43 | result = @intCast(I, significand >> @intCast(Log2Int(rep_t), fractional_bits - exponent)); | ||
| 44 | } else { | ||
| 45 | result = @intCast(I, significand) << @intCast(Log2Int(I), exponent - fractional_bits); | ||
| 46 | } | ||
| 47 | |||
| 48 | if ((@typeInfo(I).Int.signedness == .signed) and negative) | ||
| 49 | return ~result +% 1; | ||
| 50 | return result; | ||
| 51 | } | ||
| 52 | |||
| 53 | test { | ||
| 54 | _ = @import("float_to_int_test.zig"); | ||
| 55 | } | ||
lib/compiler_rt/float_to_int_test.zig deleted-950| ... | @@ -1,950 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const testing = std.testing; | ||
| 3 | const math = std.math; | ||
| 4 | |||
| 5 | const __fixunshfti = @import("fixunshfti.zig").__fixunshfti; | ||
| 6 | const __fixunsxfti = @import("fixunsxfti.zig").__fixunsxfti; | ||
| 7 | |||
| 8 | // Conversion from f32 | ||
| 9 | const __fixsfsi = @import("fixsfsi.zig").__fixsfsi; | ||
| 10 | const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi; | ||
| 11 | const __fixsfdi = @import("fixsfdi.zig").__fixsfdi; | ||
| 12 | const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi; | ||
| 13 | const __fixsfti = @import("fixsfti.zig").__fixsfti; | ||
| 14 | const __fixunssfti = @import("fixunssfti.zig").__fixunssfti; | ||
| 15 | |||
| 16 | // Conversion from f64 | ||
| 17 | const __fixdfsi = @import("fixdfsi.zig").__fixdfsi; | ||
| 18 | const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi; | ||
| 19 | const __fixdfdi = @import("fixdfdi.zig").__fixdfdi; | ||
| 20 | const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi; | ||
| 21 | const __fixdfti = @import("fixdfti.zig").__fixdfti; | ||
| 22 | const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti; | ||
| 23 | |||
| 24 | // Conversion from f128 | ||
| 25 | const __fixtfsi = @import("fixtfsi.zig").__fixtfsi; | ||
| 26 | const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi; | ||
| 27 | const __fixtfdi = @import("fixtfdi.zig").__fixtfdi; | ||
| 28 | const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi; | ||
| 29 | const __fixtfti = @import("fixtfti.zig").__fixtfti; | ||
| 30 | const __fixunstfti = @import("fixunstfti.zig").__fixunstfti; | ||
| 31 | |||
| 32 | fn test__fixsfsi(a: f32, expected: i32) !void { | ||
| 33 | const x = __fixsfsi(a); | ||
| 34 | try testing.expect(x == expected); | ||
| 35 | } | ||
| 36 | |||
| 37 | fn test__fixunssfsi(a: f32, expected: u32) !void { | ||
| 38 | const x = __fixunssfsi(a); | ||
| 39 | try testing.expect(x == expected); | ||
| 40 | } | ||
| 41 | |||
| 42 | test "fixsfsi" { | ||
| 43 | try test__fixsfsi(-math.floatMax(f32), math.minInt(i32)); | ||
| 44 | |||
| 45 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 46 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 47 | |||
| 48 | try test__fixsfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 49 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 50 | try test__fixsfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 51 | |||
| 52 | try test__fixsfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 53 | try test__fixsfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 54 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 55 | try test__fixsfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 56 | |||
| 57 | try test__fixsfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 58 | try test__fixsfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 59 | |||
| 60 | try test__fixsfsi(-0x1.000000p+31, -0x80000000); | ||
| 61 | try test__fixsfsi(-0x1.FFFFFFp+30, -0x80000000); | ||
| 62 | try test__fixsfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 63 | try test__fixsfsi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 64 | |||
| 65 | try test__fixsfsi(-2.01, -2); | ||
| 66 | try test__fixsfsi(-2.0, -2); | ||
| 67 | try test__fixsfsi(-1.99, -1); | ||
| 68 | try test__fixsfsi(-1.0, -1); | ||
| 69 | try test__fixsfsi(-0.99, 0); | ||
| 70 | try test__fixsfsi(-0.5, 0); | ||
| 71 | try test__fixsfsi(-math.floatMin(f32), 0); | ||
| 72 | try test__fixsfsi(0.0, 0); | ||
| 73 | try test__fixsfsi(math.floatMin(f32), 0); | ||
| 74 | try test__fixsfsi(0.5, 0); | ||
| 75 | try test__fixsfsi(0.99, 0); | ||
| 76 | try test__fixsfsi(1.0, 1); | ||
| 77 | try test__fixsfsi(1.5, 1); | ||
| 78 | try test__fixsfsi(1.99, 1); | ||
| 79 | try test__fixsfsi(2.0, 2); | ||
| 80 | try test__fixsfsi(2.01, 2); | ||
| 81 | |||
| 82 | try test__fixsfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 83 | try test__fixsfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 84 | try test__fixsfsi(0x1.FFFFFFp+30, 0x7FFFFFFF); | ||
| 85 | try test__fixsfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 86 | |||
| 87 | try test__fixsfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 88 | try test__fixsfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 89 | |||
| 90 | try test__fixsfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 91 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 92 | try test__fixsfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 93 | try test__fixsfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 94 | |||
| 95 | try test__fixsfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 96 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 97 | try test__fixsfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 98 | |||
| 99 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 100 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 101 | |||
| 102 | try test__fixsfsi(math.floatMax(f32), math.maxInt(i32)); | ||
| 103 | } | ||
| 104 | |||
| 105 | test "fixunssfsi" { | ||
| 106 | try test__fixunssfsi(0.0, 0); | ||
| 107 | |||
| 108 | try test__fixunssfsi(0.5, 0); | ||
| 109 | try test__fixunssfsi(0.99, 0); | ||
| 110 | try test__fixunssfsi(1.0, 1); | ||
| 111 | try test__fixunssfsi(1.5, 1); | ||
| 112 | try test__fixunssfsi(1.99, 1); | ||
| 113 | try test__fixunssfsi(2.0, 2); | ||
| 114 | try test__fixunssfsi(2.01, 2); | ||
| 115 | try test__fixunssfsi(-0.5, 0); | ||
| 116 | try test__fixunssfsi(-0.99, 0); | ||
| 117 | |||
| 118 | try test__fixunssfsi(-1.0, 0); | ||
| 119 | try test__fixunssfsi(-1.5, 0); | ||
| 120 | try test__fixunssfsi(-1.99, 0); | ||
| 121 | try test__fixunssfsi(-2.0, 0); | ||
| 122 | try test__fixunssfsi(-2.01, 0); | ||
| 123 | |||
| 124 | try test__fixunssfsi(0x1.000000p+31, 0x80000000); | ||
| 125 | try test__fixunssfsi(0x1.000000p+32, 0xFFFFFFFF); | ||
| 126 | try test__fixunssfsi(0x1.FFFFFEp+31, 0xFFFFFF00); | ||
| 127 | try test__fixunssfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 128 | try test__fixunssfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 129 | |||
| 130 | try test__fixunssfsi(-0x1.FFFFFEp+30, 0); | ||
| 131 | try test__fixunssfsi(-0x1.FFFFFCp+30, 0); | ||
| 132 | } | ||
| 133 | |||
| 134 | fn test__fixsfdi(a: f32, expected: i64) !void { | ||
| 135 | const x = __fixsfdi(a); | ||
| 136 | try testing.expect(x == expected); | ||
| 137 | } | ||
| 138 | |||
| 139 | fn test__fixunssfdi(a: f32, expected: u64) !void { | ||
| 140 | const x = __fixunssfdi(a); | ||
| 141 | try testing.expect(x == expected); | ||
| 142 | } | ||
| 143 | |||
| 144 | test "fixsfdi" { | ||
| 145 | try test__fixsfdi(-math.floatMax(f32), math.minInt(i64)); | ||
| 146 | |||
| 147 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 148 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 149 | |||
| 150 | try test__fixsfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 151 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 152 | try test__fixsfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 153 | |||
| 154 | try test__fixsfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 155 | try test__fixsfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 156 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+62, -0x8000000000000000); | ||
| 157 | try test__fixsfdi(-0x1.FFFFFFFFFFFFEp+62, -0x8000000000000000); | ||
| 158 | |||
| 159 | try test__fixsfdi(-0x1.FFFFFFp+62, -0x8000000000000000); | ||
| 160 | try test__fixsfdi(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 161 | try test__fixsfdi(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 162 | |||
| 163 | try test__fixsfdi(-2.01, -2); | ||
| 164 | try test__fixsfdi(-2.0, -2); | ||
| 165 | try test__fixsfdi(-1.99, -1); | ||
| 166 | try test__fixsfdi(-1.0, -1); | ||
| 167 | try test__fixsfdi(-0.99, 0); | ||
| 168 | try test__fixsfdi(-0.5, 0); | ||
| 169 | try test__fixsfdi(-math.floatMin(f32), 0); | ||
| 170 | try test__fixsfdi(0.0, 0); | ||
| 171 | try test__fixsfdi(math.floatMin(f32), 0); | ||
| 172 | try test__fixsfdi(0.5, 0); | ||
| 173 | try test__fixsfdi(0.99, 0); | ||
| 174 | try test__fixsfdi(1.0, 1); | ||
| 175 | try test__fixsfdi(1.5, 1); | ||
| 176 | try test__fixsfdi(1.99, 1); | ||
| 177 | try test__fixsfdi(2.0, 2); | ||
| 178 | try test__fixsfdi(2.01, 2); | ||
| 179 | |||
| 180 | try test__fixsfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 181 | try test__fixsfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 182 | try test__fixsfdi(0x1.FFFFFFp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 183 | |||
| 184 | try test__fixsfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 185 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 186 | try test__fixsfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 187 | try test__fixsfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 188 | |||
| 189 | try test__fixsfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 190 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 191 | try test__fixsfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 192 | |||
| 193 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 194 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 195 | |||
| 196 | try test__fixsfdi(math.floatMax(f32), math.maxInt(i64)); | ||
| 197 | } | ||
| 198 | |||
| 199 | test "fixunssfdi" { | ||
| 200 | try test__fixunssfdi(0.0, 0); | ||
| 201 | |||
| 202 | try test__fixunssfdi(0.5, 0); | ||
| 203 | try test__fixunssfdi(0.99, 0); | ||
| 204 | try test__fixunssfdi(1.0, 1); | ||
| 205 | try test__fixunssfdi(1.5, 1); | ||
| 206 | try test__fixunssfdi(1.99, 1); | ||
| 207 | try test__fixunssfdi(2.0, 2); | ||
| 208 | try test__fixunssfdi(2.01, 2); | ||
| 209 | try test__fixunssfdi(-0.5, 0); | ||
| 210 | try test__fixunssfdi(-0.99, 0); | ||
| 211 | |||
| 212 | try test__fixunssfdi(-1.0, 0); | ||
| 213 | try test__fixunssfdi(-1.5, 0); | ||
| 214 | try test__fixunssfdi(-1.99, 0); | ||
| 215 | try test__fixunssfdi(-2.0, 0); | ||
| 216 | try test__fixunssfdi(-2.01, 0); | ||
| 217 | |||
| 218 | try test__fixunssfdi(0x1.FFFFFEp+63, 0xFFFFFF0000000000); | ||
| 219 | try test__fixunssfdi(0x1.000000p+63, 0x8000000000000000); | ||
| 220 | try test__fixunssfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 221 | try test__fixunssfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 222 | |||
| 223 | try test__fixunssfdi(-0x1.FFFFFEp+62, 0x0000000000000000); | ||
| 224 | try test__fixunssfdi(-0x1.FFFFFCp+62, 0x0000000000000000); | ||
| 225 | } | ||
| 226 | |||
| 227 | fn test__fixsfti(a: f32, expected: i128) !void { | ||
| 228 | const x = __fixsfti(a); | ||
| 229 | try testing.expect(x == expected); | ||
| 230 | } | ||
| 231 | |||
| 232 | fn test__fixunssfti(a: f32, expected: u128) !void { | ||
| 233 | const x = __fixunssfti(a); | ||
| 234 | try testing.expect(x == expected); | ||
| 235 | } | ||
| 236 | |||
| 237 | test "fixsfti" { | ||
| 238 | try test__fixsfti(-math.floatMax(f32), math.minInt(i128)); | ||
| 239 | |||
| 240 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 241 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 242 | |||
| 243 | try test__fixsfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 244 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+126, -0x80000000000000000000000000000000); | ||
| 245 | try test__fixsfti(-0x1.FFFFFFFFFFFFEp+126, -0x80000000000000000000000000000000); | ||
| 246 | try test__fixsfti(-0x1.FFFFFF0000000p+126, -0x80000000000000000000000000000000); | ||
| 247 | try test__fixsfti(-0x1.FFFFFE0000000p+126, -0x7FFFFF80000000000000000000000000); | ||
| 248 | try test__fixsfti(-0x1.FFFFFC0000000p+126, -0x7FFFFF00000000000000000000000000); | ||
| 249 | |||
| 250 | try test__fixsfti(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 251 | try test__fixsfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 252 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+62, -0x8000000000000000); | ||
| 253 | try test__fixsfti(-0x1.FFFFFFFFFFFFEp+62, -0x8000000000000000); | ||
| 254 | |||
| 255 | try test__fixsfti(-0x1.FFFFFFp+62, -0x8000000000000000); | ||
| 256 | try test__fixsfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 257 | try test__fixsfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 258 | |||
| 259 | try test__fixsfti(-0x1.000000p+31, -0x80000000); | ||
| 260 | try test__fixsfti(-0x1.FFFFFFp+30, -0x80000000); | ||
| 261 | try test__fixsfti(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 262 | try test__fixsfti(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 263 | |||
| 264 | try test__fixsfti(-2.01, -2); | ||
| 265 | try test__fixsfti(-2.0, -2); | ||
| 266 | try test__fixsfti(-1.99, -1); | ||
| 267 | try test__fixsfti(-1.0, -1); | ||
| 268 | try test__fixsfti(-0.99, 0); | ||
| 269 | try test__fixsfti(-0.5, 0); | ||
| 270 | try test__fixsfti(-math.floatMin(f32), 0); | ||
| 271 | try test__fixsfti(0.0, 0); | ||
| 272 | try test__fixsfti(math.floatMin(f32), 0); | ||
| 273 | try test__fixsfti(0.5, 0); | ||
| 274 | try test__fixsfti(0.99, 0); | ||
| 275 | try test__fixsfti(1.0, 1); | ||
| 276 | try test__fixsfti(1.5, 1); | ||
| 277 | try test__fixsfti(1.99, 1); | ||
| 278 | try test__fixsfti(2.0, 2); | ||
| 279 | try test__fixsfti(2.01, 2); | ||
| 280 | |||
| 281 | try test__fixsfti(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 282 | try test__fixsfti(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 283 | try test__fixsfti(0x1.FFFFFFp+30, 0x80000000); | ||
| 284 | try test__fixsfti(0x1.000000p+31, 0x80000000); | ||
| 285 | |||
| 286 | try test__fixsfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 287 | try test__fixsfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 288 | try test__fixsfti(0x1.FFFFFFp+62, 0x8000000000000000); | ||
| 289 | |||
| 290 | try test__fixsfti(0x1.FFFFFFFFFFFFEp+62, 0x8000000000000000); | ||
| 291 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+62, 0x8000000000000000); | ||
| 292 | try test__fixsfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 293 | try test__fixsfti(0x1.0000000000001p+63, 0x8000000000000000); | ||
| 294 | |||
| 295 | try test__fixsfti(0x1.FFFFFC0000000p+126, 0x7FFFFF00000000000000000000000000); | ||
| 296 | try test__fixsfti(0x1.FFFFFE0000000p+126, 0x7FFFFF80000000000000000000000000); | ||
| 297 | try test__fixsfti(0x1.FFFFFF0000000p+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 298 | try test__fixsfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 299 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 300 | try test__fixsfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 301 | |||
| 302 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 303 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 304 | |||
| 305 | try test__fixsfti(math.floatMax(f32), math.maxInt(i128)); | ||
| 306 | } | ||
| 307 | |||
| 308 | test "fixunssfti" { | ||
| 309 | try test__fixunssfti(0.0, 0); | ||
| 310 | |||
| 311 | try test__fixunssfti(0.5, 0); | ||
| 312 | try test__fixunssfti(0.99, 0); | ||
| 313 | try test__fixunssfti(1.0, 1); | ||
| 314 | try test__fixunssfti(1.5, 1); | ||
| 315 | try test__fixunssfti(1.99, 1); | ||
| 316 | try test__fixunssfti(2.0, 2); | ||
| 317 | try test__fixunssfti(2.01, 2); | ||
| 318 | try test__fixunssfti(-0.5, 0); | ||
| 319 | try test__fixunssfti(-0.99, 0); | ||
| 320 | |||
| 321 | try test__fixunssfti(-1.0, 0); | ||
| 322 | try test__fixunssfti(-1.5, 0); | ||
| 323 | try test__fixunssfti(-1.99, 0); | ||
| 324 | try test__fixunssfti(-2.0, 0); | ||
| 325 | try test__fixunssfti(-2.01, 0); | ||
| 326 | |||
| 327 | try test__fixunssfti(0x1.FFFFFEp+63, 0xFFFFFF0000000000); | ||
| 328 | try test__fixunssfti(0x1.000000p+63, 0x8000000000000000); | ||
| 329 | try test__fixunssfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 330 | try test__fixunssfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 331 | try test__fixunssfti(0x1.FFFFFEp+127, 0xFFFFFF00000000000000000000000000); | ||
| 332 | try test__fixunssfti(0x1.000000p+127, 0x80000000000000000000000000000000); | ||
| 333 | try test__fixunssfti(0x1.FFFFFEp+126, 0x7FFFFF80000000000000000000000000); | ||
| 334 | try test__fixunssfti(0x1.FFFFFCp+126, 0x7FFFFF00000000000000000000000000); | ||
| 335 | |||
| 336 | try test__fixunssfti(-0x1.FFFFFEp+62, 0x0000000000000000); | ||
| 337 | try test__fixunssfti(-0x1.FFFFFCp+62, 0x0000000000000000); | ||
| 338 | try test__fixunssfti(-0x1.FFFFFEp+126, 0x0000000000000000); | ||
| 339 | try test__fixunssfti(-0x1.FFFFFCp+126, 0x0000000000000000); | ||
| 340 | try test__fixunssfti(math.floatMax(f32), 0xffffff00000000000000000000000000); | ||
| 341 | try test__fixunssfti(math.inf(f32), math.maxInt(u128)); | ||
| 342 | } | ||
| 343 | |||
| 344 | fn test__fixdfsi(a: f64, expected: i32) !void { | ||
| 345 | const x = __fixdfsi(a); | ||
| 346 | try testing.expect(x == expected); | ||
| 347 | } | ||
| 348 | |||
| 349 | fn test__fixunsdfsi(a: f64, expected: u32) !void { | ||
| 350 | const x = __fixunsdfsi(a); | ||
| 351 | try testing.expect(x == expected); | ||
| 352 | } | ||
| 353 | |||
| 354 | test "fixdfsi" { | ||
| 355 | try test__fixdfsi(-math.floatMax(f64), math.minInt(i32)); | ||
| 356 | |||
| 357 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 358 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 359 | |||
| 360 | try test__fixdfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 361 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 362 | try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 363 | |||
| 364 | try test__fixdfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 365 | try test__fixdfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 366 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 367 | try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 368 | |||
| 369 | try test__fixdfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 370 | try test__fixdfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 371 | |||
| 372 | try test__fixdfsi(-0x1.000000p+31, -0x80000000); | ||
| 373 | try test__fixdfsi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 374 | try test__fixdfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 375 | |||
| 376 | try test__fixdfsi(-2.01, -2); | ||
| 377 | try test__fixdfsi(-2.0, -2); | ||
| 378 | try test__fixdfsi(-1.99, -1); | ||
| 379 | try test__fixdfsi(-1.0, -1); | ||
| 380 | try test__fixdfsi(-0.99, 0); | ||
| 381 | try test__fixdfsi(-0.5, 0); | ||
| 382 | try test__fixdfsi(-math.floatMin(f64), 0); | ||
| 383 | try test__fixdfsi(0.0, 0); | ||
| 384 | try test__fixdfsi(math.floatMin(f64), 0); | ||
| 385 | try test__fixdfsi(0.5, 0); | ||
| 386 | try test__fixdfsi(0.99, 0); | ||
| 387 | try test__fixdfsi(1.0, 1); | ||
| 388 | try test__fixdfsi(1.5, 1); | ||
| 389 | try test__fixdfsi(1.99, 1); | ||
| 390 | try test__fixdfsi(2.0, 2); | ||
| 391 | try test__fixdfsi(2.01, 2); | ||
| 392 | |||
| 393 | try test__fixdfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 394 | try test__fixdfsi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 395 | try test__fixdfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 396 | |||
| 397 | try test__fixdfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 398 | try test__fixdfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 399 | |||
| 400 | try test__fixdfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 401 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 402 | try test__fixdfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 403 | try test__fixdfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 404 | |||
| 405 | try test__fixdfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 406 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 407 | try test__fixdfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 408 | |||
| 409 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 410 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 411 | |||
| 412 | try test__fixdfsi(math.floatMax(f64), math.maxInt(i32)); | ||
| 413 | } | ||
| 414 | |||
| 415 | test "fixunsdfsi" { | ||
| 416 | try test__fixunsdfsi(0.0, 0); | ||
| 417 | |||
| 418 | try test__fixunsdfsi(0.5, 0); | ||
| 419 | try test__fixunsdfsi(0.99, 0); | ||
| 420 | try test__fixunsdfsi(1.0, 1); | ||
| 421 | try test__fixunsdfsi(1.5, 1); | ||
| 422 | try test__fixunsdfsi(1.99, 1); | ||
| 423 | try test__fixunsdfsi(2.0, 2); | ||
| 424 | try test__fixunsdfsi(2.01, 2); | ||
| 425 | try test__fixunsdfsi(-0.5, 0); | ||
| 426 | try test__fixunsdfsi(-0.99, 0); | ||
| 427 | try test__fixunsdfsi(-1.0, 0); | ||
| 428 | try test__fixunsdfsi(-1.5, 0); | ||
| 429 | try test__fixunsdfsi(-1.99, 0); | ||
| 430 | try test__fixunsdfsi(-2.0, 0); | ||
| 431 | try test__fixunsdfsi(-2.01, 0); | ||
| 432 | |||
| 433 | try test__fixunsdfsi(0x1.000000p+31, 0x80000000); | ||
| 434 | try test__fixunsdfsi(0x1.000000p+32, 0xFFFFFFFF); | ||
| 435 | try test__fixunsdfsi(0x1.FFFFFEp+31, 0xFFFFFF00); | ||
| 436 | try test__fixunsdfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 437 | try test__fixunsdfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 438 | |||
| 439 | try test__fixunsdfsi(-0x1.FFFFFEp+30, 0); | ||
| 440 | try test__fixunsdfsi(-0x1.FFFFFCp+30, 0); | ||
| 441 | |||
| 442 | try test__fixunsdfsi(0x1.FFFFFFFEp+31, 0xFFFFFFFF); | ||
| 443 | try test__fixunsdfsi(0x1.FFFFFFFC00000p+30, 0x7FFFFFFF); | ||
| 444 | try test__fixunsdfsi(0x1.FFFFFFF800000p+30, 0x7FFFFFFE); | ||
| 445 | } | ||
| 446 | |||
| 447 | fn test__fixdfdi(a: f64, expected: i64) !void { | ||
| 448 | const x = __fixdfdi(a); | ||
| 449 | try testing.expect(x == expected); | ||
| 450 | } | ||
| 451 | |||
| 452 | fn test__fixunsdfdi(a: f64, expected: u64) !void { | ||
| 453 | const x = __fixunsdfdi(a); | ||
| 454 | try testing.expect(x == expected); | ||
| 455 | } | ||
| 456 | |||
| 457 | test "fixdfdi" { | ||
| 458 | try test__fixdfdi(-math.floatMax(f64), math.minInt(i64)); | ||
| 459 | |||
| 460 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 461 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 462 | |||
| 463 | try test__fixdfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 464 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 465 | try test__fixdfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 466 | |||
| 467 | try test__fixdfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 468 | try test__fixdfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 469 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 470 | try test__fixdfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 471 | |||
| 472 | try test__fixdfdi(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 473 | try test__fixdfdi(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 474 | |||
| 475 | try test__fixdfdi(-2.01, -2); | ||
| 476 | try test__fixdfdi(-2.0, -2); | ||
| 477 | try test__fixdfdi(-1.99, -1); | ||
| 478 | try test__fixdfdi(-1.0, -1); | ||
| 479 | try test__fixdfdi(-0.99, 0); | ||
| 480 | try test__fixdfdi(-0.5, 0); | ||
| 481 | try test__fixdfdi(-math.floatMin(f64), 0); | ||
| 482 | try test__fixdfdi(0.0, 0); | ||
| 483 | try test__fixdfdi(math.floatMin(f64), 0); | ||
| 484 | try test__fixdfdi(0.5, 0); | ||
| 485 | try test__fixdfdi(0.99, 0); | ||
| 486 | try test__fixdfdi(1.0, 1); | ||
| 487 | try test__fixdfdi(1.5, 1); | ||
| 488 | try test__fixdfdi(1.99, 1); | ||
| 489 | try test__fixdfdi(2.0, 2); | ||
| 490 | try test__fixdfdi(2.01, 2); | ||
| 491 | |||
| 492 | try test__fixdfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 493 | try test__fixdfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 494 | |||
| 495 | try test__fixdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 496 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 497 | try test__fixdfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 498 | try test__fixdfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 499 | |||
| 500 | try test__fixdfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 501 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 502 | try test__fixdfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 503 | |||
| 504 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 505 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 506 | |||
| 507 | try test__fixdfdi(math.floatMax(f64), math.maxInt(i64)); | ||
| 508 | } | ||
| 509 | |||
| 510 | test "fixunsdfdi" { | ||
| 511 | try test__fixunsdfdi(0.0, 0); | ||
| 512 | try test__fixunsdfdi(0.5, 0); | ||
| 513 | try test__fixunsdfdi(0.99, 0); | ||
| 514 | try test__fixunsdfdi(1.0, 1); | ||
| 515 | try test__fixunsdfdi(1.5, 1); | ||
| 516 | try test__fixunsdfdi(1.99, 1); | ||
| 517 | try test__fixunsdfdi(2.0, 2); | ||
| 518 | try test__fixunsdfdi(2.01, 2); | ||
| 519 | try test__fixunsdfdi(-0.5, 0); | ||
| 520 | try test__fixunsdfdi(-0.99, 0); | ||
| 521 | try test__fixunsdfdi(-1.0, 0); | ||
| 522 | try test__fixunsdfdi(-1.5, 0); | ||
| 523 | try test__fixunsdfdi(-1.99, 0); | ||
| 524 | try test__fixunsdfdi(-2.0, 0); | ||
| 525 | try test__fixunsdfdi(-2.01, 0); | ||
| 526 | |||
| 527 | try test__fixunsdfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 528 | try test__fixunsdfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 529 | |||
| 530 | try test__fixunsdfdi(-0x1.FFFFFEp+62, 0); | ||
| 531 | try test__fixunsdfdi(-0x1.FFFFFCp+62, 0); | ||
| 532 | |||
| 533 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFFp+63, 0xFFFFFFFFFFFFF800); | ||
| 534 | try test__fixunsdfdi(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 535 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 536 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 537 | |||
| 538 | try test__fixunsdfdi(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 539 | try test__fixunsdfdi(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 540 | } | ||
| 541 | |||
| 542 | fn test__fixdfti(a: f64, expected: i128) !void { | ||
| 543 | const x = __fixdfti(a); | ||
| 544 | try testing.expect(x == expected); | ||
| 545 | } | ||
| 546 | |||
| 547 | fn test__fixunsdfti(a: f64, expected: u128) !void { | ||
| 548 | const x = __fixunsdfti(a); | ||
| 549 | try testing.expect(x == expected); | ||
| 550 | } | ||
| 551 | |||
| 552 | test "fixdfti" { | ||
| 553 | try test__fixdfti(-math.floatMax(f64), math.minInt(i128)); | ||
| 554 | |||
| 555 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 556 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 557 | |||
| 558 | try test__fixdfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 559 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+126, -0x7FFFFFFFFFFFFC000000000000000000); | ||
| 560 | try test__fixdfti(-0x1.FFFFFFFFFFFFEp+126, -0x7FFFFFFFFFFFF8000000000000000000); | ||
| 561 | |||
| 562 | try test__fixdfti(-0x1.0000000000001p+63, -0x8000000000000800); | ||
| 563 | try test__fixdfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 564 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 565 | try test__fixdfti(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 566 | |||
| 567 | try test__fixdfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 568 | try test__fixdfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 569 | |||
| 570 | try test__fixdfti(-2.01, -2); | ||
| 571 | try test__fixdfti(-2.0, -2); | ||
| 572 | try test__fixdfti(-1.99, -1); | ||
| 573 | try test__fixdfti(-1.0, -1); | ||
| 574 | try test__fixdfti(-0.99, 0); | ||
| 575 | try test__fixdfti(-0.5, 0); | ||
| 576 | try test__fixdfti(-math.floatMin(f64), 0); | ||
| 577 | try test__fixdfti(0.0, 0); | ||
| 578 | try test__fixdfti(math.floatMin(f64), 0); | ||
| 579 | try test__fixdfti(0.5, 0); | ||
| 580 | try test__fixdfti(0.99, 0); | ||
| 581 | try test__fixdfti(1.0, 1); | ||
| 582 | try test__fixdfti(1.5, 1); | ||
| 583 | try test__fixdfti(1.99, 1); | ||
| 584 | try test__fixdfti(2.0, 2); | ||
| 585 | try test__fixdfti(2.01, 2); | ||
| 586 | |||
| 587 | try test__fixdfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 588 | try test__fixdfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 589 | |||
| 590 | try test__fixdfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 591 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 592 | try test__fixdfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 593 | try test__fixdfti(0x1.0000000000001p+63, 0x8000000000000800); | ||
| 594 | |||
| 595 | try test__fixdfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 596 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 597 | try test__fixdfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 598 | |||
| 599 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 600 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 601 | |||
| 602 | try test__fixdfti(math.floatMax(f64), math.maxInt(i128)); | ||
| 603 | } | ||
| 604 | |||
| 605 | test "fixunsdfti" { | ||
| 606 | try test__fixunsdfti(0.0, 0); | ||
| 607 | |||
| 608 | try test__fixunsdfti(0.5, 0); | ||
| 609 | try test__fixunsdfti(0.99, 0); | ||
| 610 | try test__fixunsdfti(1.0, 1); | ||
| 611 | try test__fixunsdfti(1.5, 1); | ||
| 612 | try test__fixunsdfti(1.99, 1); | ||
| 613 | try test__fixunsdfti(2.0, 2); | ||
| 614 | try test__fixunsdfti(2.01, 2); | ||
| 615 | try test__fixunsdfti(-0.5, 0); | ||
| 616 | try test__fixunsdfti(-0.99, 0); | ||
| 617 | try test__fixunsdfti(-1.0, 0); | ||
| 618 | try test__fixunsdfti(-1.5, 0); | ||
| 619 | try test__fixunsdfti(-1.99, 0); | ||
| 620 | try test__fixunsdfti(-2.0, 0); | ||
| 621 | try test__fixunsdfti(-2.01, 0); | ||
| 622 | |||
| 623 | try test__fixunsdfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 624 | try test__fixunsdfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 625 | |||
| 626 | try test__fixunsdfti(-0x1.FFFFFEp+62, 0); | ||
| 627 | try test__fixunsdfti(-0x1.FFFFFCp+62, 0); | ||
| 628 | |||
| 629 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+63, 0xFFFFFFFFFFFFF800); | ||
| 630 | try test__fixunsdfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 631 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 632 | try test__fixunsdfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 633 | |||
| 634 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+127, 0xFFFFFFFFFFFFF8000000000000000000); | ||
| 635 | try test__fixunsdfti(0x1.0000000000000p+127, 0x80000000000000000000000000000000); | ||
| 636 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 637 | try test__fixunsdfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 638 | try test__fixunsdfti(0x1.0000000000000p+128, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 639 | |||
| 640 | try test__fixunsdfti(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 641 | try test__fixunsdfti(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 642 | } | ||
| 643 | |||
| 644 | fn test__fixtfsi(a: f128, expected: i32) !void { | ||
| 645 | const x = __fixtfsi(a); | ||
| 646 | try testing.expect(x == expected); | ||
| 647 | } | ||
| 648 | |||
| 649 | fn test__fixunstfsi(a: f128, expected: u32) !void { | ||
| 650 | const x = __fixunstfsi(a); | ||
| 651 | try testing.expect(x == expected); | ||
| 652 | } | ||
| 653 | |||
| 654 | test "fixtfsi" { | ||
| 655 | try test__fixtfsi(-math.floatMax(f128), math.minInt(i32)); | ||
| 656 | |||
| 657 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 658 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 659 | |||
| 660 | try test__fixtfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 661 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 662 | try test__fixtfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 663 | |||
| 664 | try test__fixtfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 665 | try test__fixtfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 666 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 667 | try test__fixtfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 668 | |||
| 669 | try test__fixtfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 670 | try test__fixtfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 671 | |||
| 672 | try test__fixtfsi(-0x1.000000p+31, -0x80000000); | ||
| 673 | try test__fixtfsi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 674 | try test__fixtfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 675 | try test__fixtfsi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 676 | |||
| 677 | try test__fixtfsi(-2.01, -2); | ||
| 678 | try test__fixtfsi(-2.0, -2); | ||
| 679 | try test__fixtfsi(-1.99, -1); | ||
| 680 | try test__fixtfsi(-1.0, -1); | ||
| 681 | try test__fixtfsi(-0.99, 0); | ||
| 682 | try test__fixtfsi(-0.5, 0); | ||
| 683 | try test__fixtfsi(-math.floatMin(f32), 0); | ||
| 684 | try test__fixtfsi(0.0, 0); | ||
| 685 | try test__fixtfsi(math.floatMin(f32), 0); | ||
| 686 | try test__fixtfsi(0.5, 0); | ||
| 687 | try test__fixtfsi(0.99, 0); | ||
| 688 | try test__fixtfsi(1.0, 1); | ||
| 689 | try test__fixtfsi(1.5, 1); | ||
| 690 | try test__fixtfsi(1.99, 1); | ||
| 691 | try test__fixtfsi(2.0, 2); | ||
| 692 | try test__fixtfsi(2.01, 2); | ||
| 693 | |||
| 694 | try test__fixtfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 695 | try test__fixtfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 696 | try test__fixtfsi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 697 | try test__fixtfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 698 | |||
| 699 | try test__fixtfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 700 | try test__fixtfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 701 | |||
| 702 | try test__fixtfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 703 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 704 | try test__fixtfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 705 | try test__fixtfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 706 | |||
| 707 | try test__fixtfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 708 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 709 | try test__fixtfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 710 | |||
| 711 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 712 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 713 | |||
| 714 | try test__fixtfsi(math.floatMax(f128), math.maxInt(i32)); | ||
| 715 | } | ||
| 716 | |||
| 717 | test "fixunstfsi" { | ||
| 718 | try test__fixunstfsi(math.inf(f128), 0xffffffff); | ||
| 719 | try test__fixunstfsi(0, 0x0); | ||
| 720 | try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); | ||
| 721 | try test__fixunstfsi(0x1.23456789abcdefp-3, 0x0); | ||
| 722 | try test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456); | ||
| 723 | try test__fixunstfsi(0x1.23456789abcdefp+40, 0xffffffff); | ||
| 724 | try test__fixunstfsi(0x1.23456789abcdefp+256, 0xffffffff); | ||
| 725 | try test__fixunstfsi(-0x1.23456789abcdefp+3, 0x0); | ||
| 726 | |||
| 727 | try test__fixunstfsi(0x1p+32, 0xFFFFFFFF); | ||
| 728 | } | ||
| 729 | |||
| 730 | fn test__fixtfdi(a: f128, expected: i64) !void { | ||
| 731 | const x = __fixtfdi(a); | ||
| 732 | try testing.expect(x == expected); | ||
| 733 | } | ||
| 734 | |||
| 735 | fn test__fixunstfdi(a: f128, expected: u64) !void { | ||
| 736 | const x = __fixunstfdi(a); | ||
| 737 | try testing.expect(x == expected); | ||
| 738 | } | ||
| 739 | |||
| 740 | test "fixtfdi" { | ||
| 741 | try test__fixtfdi(-math.floatMax(f128), math.minInt(i64)); | ||
| 742 | |||
| 743 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 744 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 745 | |||
| 746 | try test__fixtfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 747 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 748 | try test__fixtfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 749 | |||
| 750 | try test__fixtfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 751 | try test__fixtfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 752 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 753 | try test__fixtfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 754 | |||
| 755 | try test__fixtfdi(-0x1.FFFFFEp+62, -0x7FFFFF8000000000); | ||
| 756 | try test__fixtfdi(-0x1.FFFFFCp+62, -0x7FFFFF0000000000); | ||
| 757 | |||
| 758 | try test__fixtfdi(-0x1.000000p+31, -0x80000000); | ||
| 759 | try test__fixtfdi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 760 | try test__fixtfdi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 761 | try test__fixtfdi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 762 | |||
| 763 | try test__fixtfdi(-2.01, -2); | ||
| 764 | try test__fixtfdi(-2.0, -2); | ||
| 765 | try test__fixtfdi(-1.99, -1); | ||
| 766 | try test__fixtfdi(-1.0, -1); | ||
| 767 | try test__fixtfdi(-0.99, 0); | ||
| 768 | try test__fixtfdi(-0.5, 0); | ||
| 769 | try test__fixtfdi(-math.floatMin(f64), 0); | ||
| 770 | try test__fixtfdi(0.0, 0); | ||
| 771 | try test__fixtfdi(math.floatMin(f64), 0); | ||
| 772 | try test__fixtfdi(0.5, 0); | ||
| 773 | try test__fixtfdi(0.99, 0); | ||
| 774 | try test__fixtfdi(1.0, 1); | ||
| 775 | try test__fixtfdi(1.5, 1); | ||
| 776 | try test__fixtfdi(1.99, 1); | ||
| 777 | try test__fixtfdi(2.0, 2); | ||
| 778 | try test__fixtfdi(2.01, 2); | ||
| 779 | |||
| 780 | try test__fixtfdi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 781 | try test__fixtfdi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 782 | try test__fixtfdi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 783 | try test__fixtfdi(0x1.000000p+31, 0x80000000); | ||
| 784 | |||
| 785 | try test__fixtfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 786 | try test__fixtfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 787 | |||
| 788 | try test__fixtfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 789 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 790 | try test__fixtfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 791 | try test__fixtfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 792 | |||
| 793 | try test__fixtfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 794 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 795 | try test__fixtfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 796 | |||
| 797 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 798 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 799 | |||
| 800 | try test__fixtfdi(math.floatMax(f128), math.maxInt(i64)); | ||
| 801 | } | ||
| 802 | |||
| 803 | test "fixunstfdi" { | ||
| 804 | try test__fixunstfdi(0.0, 0); | ||
| 805 | |||
| 806 | try test__fixunstfdi(0.5, 0); | ||
| 807 | try test__fixunstfdi(0.99, 0); | ||
| 808 | try test__fixunstfdi(1.0, 1); | ||
| 809 | try test__fixunstfdi(1.5, 1); | ||
| 810 | try test__fixunstfdi(1.99, 1); | ||
| 811 | try test__fixunstfdi(2.0, 2); | ||
| 812 | try test__fixunstfdi(2.01, 2); | ||
| 813 | try test__fixunstfdi(-0.5, 0); | ||
| 814 | try test__fixunstfdi(-0.99, 0); | ||
| 815 | try test__fixunstfdi(-1.0, 0); | ||
| 816 | try test__fixunstfdi(-1.5, 0); | ||
| 817 | try test__fixunstfdi(-1.99, 0); | ||
| 818 | try test__fixunstfdi(-2.0, 0); | ||
| 819 | try test__fixunstfdi(-2.01, 0); | ||
| 820 | |||
| 821 | try test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 822 | try test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 823 | |||
| 824 | try test__fixunstfdi(-0x1.FFFFFEp+62, 0); | ||
| 825 | try test__fixunstfdi(-0x1.FFFFFCp+62, 0); | ||
| 826 | |||
| 827 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 828 | try test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 829 | |||
| 830 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 831 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 832 | |||
| 833 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF); | ||
| 834 | try test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001); | ||
| 835 | try test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000); | ||
| 836 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 837 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE); | ||
| 838 | try test__fixunstfdi(0x1p+64, 0xFFFFFFFFFFFFFFFF); | ||
| 839 | |||
| 840 | try test__fixunstfdi(-0x1.0000000000000000p+63, 0); | ||
| 841 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0); | ||
| 842 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0); | ||
| 843 | } | ||
| 844 | |||
| 845 | fn test__fixtfti(a: f128, expected: i128) !void { | ||
| 846 | const x = __fixtfti(a); | ||
| 847 | try testing.expect(x == expected); | ||
| 848 | } | ||
| 849 | |||
| 850 | fn test__fixunstfti(a: f128, expected: u128) !void { | ||
| 851 | const x = __fixunstfti(a); | ||
| 852 | try testing.expect(x == expected); | ||
| 853 | } | ||
| 854 | |||
| 855 | test "fixtfti" { | ||
| 856 | try test__fixtfti(-math.floatMax(f128), math.minInt(i128)); | ||
| 857 | |||
| 858 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 859 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 860 | |||
| 861 | try test__fixtfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 862 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+126, -0x7FFFFFFFFFFFFC000000000000000000); | ||
| 863 | try test__fixtfti(-0x1.FFFFFFFFFFFFEp+126, -0x7FFFFFFFFFFFF8000000000000000000); | ||
| 864 | |||
| 865 | try test__fixtfti(-0x1.0000000000001p+63, -0x8000000000000800); | ||
| 866 | try test__fixtfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 867 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 868 | try test__fixtfti(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 869 | |||
| 870 | try test__fixtfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 871 | try test__fixtfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 872 | |||
| 873 | try test__fixtfti(-2.01, -2); | ||
| 874 | try test__fixtfti(-2.0, -2); | ||
| 875 | try test__fixtfti(-1.99, -1); | ||
| 876 | try test__fixtfti(-1.0, -1); | ||
| 877 | try test__fixtfti(-0.99, 0); | ||
| 878 | try test__fixtfti(-0.5, 0); | ||
| 879 | try test__fixtfti(-math.floatMin(f128), 0); | ||
| 880 | try test__fixtfti(0.0, 0); | ||
| 881 | try test__fixtfti(math.floatMin(f128), 0); | ||
| 882 | try test__fixtfti(0.5, 0); | ||
| 883 | try test__fixtfti(0.99, 0); | ||
| 884 | try test__fixtfti(1.0, 1); | ||
| 885 | try test__fixtfti(1.5, 1); | ||
| 886 | try test__fixtfti(1.99, 1); | ||
| 887 | try test__fixtfti(2.0, 2); | ||
| 888 | try test__fixtfti(2.01, 2); | ||
| 889 | |||
| 890 | try test__fixtfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 891 | try test__fixtfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 892 | |||
| 893 | try test__fixtfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 894 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 895 | try test__fixtfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 896 | try test__fixtfti(0x1.0000000000001p+63, 0x8000000000000800); | ||
| 897 | |||
| 898 | try test__fixtfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 899 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 900 | try test__fixtfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 901 | |||
| 902 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 903 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 904 | |||
| 905 | try test__fixtfti(math.floatMax(f128), math.maxInt(i128)); | ||
| 906 | } | ||
| 907 | |||
| 908 | test "fixunstfti" { | ||
| 909 | try test__fixunstfti(math.inf(f128), 0xffffffffffffffffffffffffffffffff); | ||
| 910 | |||
| 911 | try test__fixunstfti(0.0, 0); | ||
| 912 | |||
| 913 | try test__fixunstfti(0.5, 0); | ||
| 914 | try test__fixunstfti(0.99, 0); | ||
| 915 | try test__fixunstfti(1.0, 1); | ||
| 916 | try test__fixunstfti(1.5, 1); | ||
| 917 | try test__fixunstfti(1.99, 1); | ||
| 918 | try test__fixunstfti(2.0, 2); | ||
| 919 | try test__fixunstfti(2.01, 2); | ||
| 920 | try test__fixunstfti(-0.01, 0); | ||
| 921 | try test__fixunstfti(-0.99, 0); | ||
| 922 | |||
| 923 | try test__fixunstfti(0x1p+128, 0xffffffffffffffffffffffffffffffff); | ||
| 924 | |||
| 925 | try test__fixunstfti(0x1.FFFFFEp+126, 0x7fffff80000000000000000000000000); | ||
| 926 | try test__fixunstfti(0x1.FFFFFEp+127, 0xffffff00000000000000000000000000); | ||
| 927 | try test__fixunstfti(0x1.FFFFFEp+128, 0xffffffffffffffffffffffffffffffff); | ||
| 928 | try test__fixunstfti(0x1.FFFFFEp+129, 0xffffffffffffffffffffffffffffffff); | ||
| 929 | } | ||
| 930 | |||
| 931 | fn test__fixunshfti(a: f16, expected: u128) !void { | ||
| 932 | const x = __fixunshfti(a); | ||
| 933 | try testing.expect(x == expected); | ||
| 934 | } | ||
| 935 | |||
| 936 | test "fixunshfti for f16" { | ||
| 937 | try test__fixunshfti(math.inf(f16), math.maxInt(u128)); | ||
| 938 | try test__fixunshfti(math.floatMax(f16), 65504); | ||
| 939 | } | ||
| 940 | |||
| 941 | fn test__fixunsxfti(a: f80, expected: u128) !void { | ||
| 942 | const x = __fixunsxfti(a); | ||
| 943 | try testing.expect(x == expected); | ||
| 944 | } | ||
| 945 | |||
| 946 | test "fixunsxfti for f80" { | ||
| 947 | try test__fixunsxfti(math.inf(f80), math.maxInt(u128)); | ||
| 948 | try test__fixunsxfti(math.floatMax(f80), math.maxInt(u128)); | ||
| 949 | try test__fixunsxfti(math.maxInt(u64), math.maxInt(u64)); | ||
| 950 | } | ||
lib/compiler_rt/floatdidf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatdidf(a: i64) callconv(.C) f64 { | 14 | pub fn __floatdidf(a: i64) callconv(.C) f64 { |
| 15 | return intToFloat(f64, a); | 15 | return floatFromInt(f64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_l2d(a: i64) callconv(.AAPCS) f64 { | 18 | fn __aeabi_l2d(a: i64) callconv(.AAPCS) f64 { |
| 19 | return intToFloat(f64, a); | 19 | return floatFromInt(f64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatdihf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatdihf(a: i64) callconv(.C) f16 { | 10 | fn __floatdihf(a: i64) callconv(.C) f16 { |
| 11 | return intToFloat(f16, a); | 11 | return floatFromInt(f16, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatdisf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatdisf(a: i64) callconv(.C) f32 { | 14 | pub fn __floatdisf(a: i64) callconv(.C) f32 { |
| 15 | return intToFloat(f32, a); | 15 | return floatFromInt(f32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_l2f(a: i64) callconv(.AAPCS) f32 { | 18 | fn __aeabi_l2f(a: i64) callconv(.AAPCS) f32 { |
| 19 | return intToFloat(f32, a); | 19 | return floatFromInt(f32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatditf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatditf(a: i64) callconv(.C) f128 { | 15 | pub fn __floatditf(a: i64) callconv(.C) f128 { |
| 16 | return intToFloat(f128, a); | 16 | return floatFromInt(f128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void { | 19 | fn _Qp_xtoq(c: *f128, a: i64) callconv(.C) void { |
| 20 | c.* = intToFloat(f128, a); | 20 | c.* = floatFromInt(f128, a); |
| 21 | } | 21 | } |
lib/compiler_rt/floatdixf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatdixf(a: i64) callconv(.C) f80 { | 10 | fn __floatdixf(a: i64) callconv(.C) f80 { |
| 11 | return intToFloat(f80, a); | 11 | return floatFromInt(f80, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatsidf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatsidf(a: i32) callconv(.C) f64 { | 14 | pub fn __floatsidf(a: i32) callconv(.C) f64 { |
| 15 | return intToFloat(f64, a); | 15 | return floatFromInt(f64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_i2d(a: i32) callconv(.AAPCS) f64 { | 18 | fn __aeabi_i2d(a: i32) callconv(.AAPCS) f64 { |
| 19 | return intToFloat(f64, a); | 19 | return floatFromInt(f64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatsihf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatsihf(a: i32) callconv(.C) f16 { | 10 | fn __floatsihf(a: i32) callconv(.C) f16 { |
| 11 | return intToFloat(f16, a); | 11 | return floatFromInt(f16, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatsisf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatsisf(a: i32) callconv(.C) f32 { | 14 | pub fn __floatsisf(a: i32) callconv(.C) f32 { |
| 15 | return intToFloat(f32, a); | 15 | return floatFromInt(f32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_i2f(a: i32) callconv(.AAPCS) f32 { | 18 | fn __aeabi_i2f(a: i32) callconv(.AAPCS) f32 { |
| 19 | return intToFloat(f32, a); | 19 | return floatFromInt(f32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatsitf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatsitf(a: i32) callconv(.C) f128 { | 15 | pub fn __floatsitf(a: i32) callconv(.C) f128 { |
| 16 | return intToFloat(f128, a); | 16 | return floatFromInt(f128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void { | 19 | fn _Qp_itoq(c: *f128, a: i32) callconv(.C) void { |
| 20 | c.* = intToFloat(f128, a); | 20 | c.* = floatFromInt(f128, a); |
| 21 | } | 21 | } |
lib/compiler_rt/floatsixf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatsixf(a: i32) callconv(.C) f80 { | 10 | fn __floatsixf(a: i32) callconv(.C) f80 { |
| 11 | return intToFloat(f80, a); | 11 | return floatFromInt(f80, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floattidf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floattidf(a: i128) callconv(.C) f64 { | 15 | pub fn __floattidf(a: i128) callconv(.C) f64 { |
| 16 | return intToFloat(f64, a); | 16 | return floatFromInt(f64, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floattidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 { | 19 | fn __floattidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 { |
| 20 | return intToFloat(f64, @bitCast(i128, a)); | 20 | return floatFromInt(f64, @bitCast(i128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floattihf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floattihf(a: i128) callconv(.C) f16 { | 15 | pub fn __floattihf(a: i128) callconv(.C) f16 { |
| 16 | return intToFloat(f16, a); | 16 | return floatFromInt(f16, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floattihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 { | 19 | fn __floattihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 { |
| 20 | return intToFloat(f16, @bitCast(i128, a)); | 20 | return floatFromInt(f16, @bitCast(i128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floattisf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floattisf(a: i128) callconv(.C) f32 { | 15 | pub fn __floattisf(a: i128) callconv(.C) f32 { |
| 16 | return intToFloat(f32, a); | 16 | return floatFromInt(f32, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floattisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 { | 19 | fn __floattisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 { |
| 20 | return intToFloat(f32, @bitCast(i128, a)); | 20 | return floatFromInt(f32, @bitCast(i128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floattitf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -15,9 +15,9 @@ comptime { | ... | @@ -15,9 +15,9 @@ comptime { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn __floattitf(a: i128) callconv(.C) f128 { | 17 | pub fn __floattitf(a: i128) callconv(.C) f128 { |
| 18 | return intToFloat(f128, a); | 18 | return floatFromInt(f128, a); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | fn __floattitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 { | 21 | fn __floattitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 { |
| 22 | return intToFloat(f128, @bitCast(i128, a)); | 22 | return floatFromInt(f128, @bitCast(i128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/floattixf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floattixf(a: i128) callconv(.C) f80 { | 15 | pub fn __floattixf(a: i128) callconv(.C) f80 { |
| 16 | return intToFloat(f80, a); | 16 | return floatFromInt(f80, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floattixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 { | 19 | fn __floattixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 { |
| 20 | return intToFloat(f80, @bitCast(i128, a)); | 20 | return floatFromInt(f80, @bitCast(i128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floatundidf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatundidf(a: u64) callconv(.C) f64 { | 14 | pub fn __floatundidf(a: u64) callconv(.C) f64 { |
| 15 | return intToFloat(f64, a); | 15 | return floatFromInt(f64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_ul2d(a: u64) callconv(.AAPCS) f64 { | 18 | fn __aeabi_ul2d(a: u64) callconv(.AAPCS) f64 { |
| 19 | return intToFloat(f64, a); | 19 | return floatFromInt(f64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatundihf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatundihf(a: u64) callconv(.C) f16 { | 10 | fn __floatundihf(a: u64) callconv(.C) f16 { |
| 11 | return intToFloat(f16, a); | 11 | return floatFromInt(f16, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatundisf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatundisf(a: u64) callconv(.C) f32 { | 14 | pub fn __floatundisf(a: u64) callconv(.C) f32 { |
| 15 | return intToFloat(f32, a); | 15 | return floatFromInt(f32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_ul2f(a: u64) callconv(.AAPCS) f32 { | 18 | fn __aeabi_ul2f(a: u64) callconv(.AAPCS) f32 { |
| 19 | return intToFloat(f32, a); | 19 | return floatFromInt(f32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatunditf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatunditf(a: u64) callconv(.C) f128 { | 15 | pub fn __floatunditf(a: u64) callconv(.C) f128 { |
| 16 | return intToFloat(f128, a); | 16 | return floatFromInt(f128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void { | 19 | fn _Qp_uxtoq(c: *f128, a: u64) callconv(.C) void { |
| 20 | c.* = intToFloat(f128, a); | 20 | c.* = floatFromInt(f128, a); |
| 21 | } | 21 | } |
lib/compiler_rt/floatundixf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatundixf(a: u64) callconv(.C) f80 { | 10 | fn __floatundixf(a: u64) callconv(.C) f80 { |
| 11 | return intToFloat(f80, a); | 11 | return floatFromInt(f80, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatunsidf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatunsidf(a: u32) callconv(.C) f64 { | 14 | pub fn __floatunsidf(a: u32) callconv(.C) f64 { |
| 15 | return intToFloat(f64, a); | 15 | return floatFromInt(f64, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_ui2d(a: u32) callconv(.AAPCS) f64 { | 18 | fn __aeabi_ui2d(a: u32) callconv(.AAPCS) f64 { |
| 19 | return intToFloat(f64, a); | 19 | return floatFromInt(f64, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatunsihf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | pub fn __floatunsihf(a: u32) callconv(.C) f16 { | 10 | pub fn __floatunsihf(a: u32) callconv(.C) f16 { |
| 11 | return intToFloat(f16, a); | 11 | return floatFromInt(f16, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatunsisf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -12,9 +12,9 @@ comptime { | ... | @@ -12,9 +12,9 @@ comptime { |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn __floatunsisf(a: u32) callconv(.C) f32 { | 14 | pub fn __floatunsisf(a: u32) callconv(.C) f32 { |
| 15 | return intToFloat(f32, a); | 15 | return floatFromInt(f32, a); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | fn __aeabi_ui2f(a: u32) callconv(.AAPCS) f32 { | 18 | fn __aeabi_ui2f(a: u32) callconv(.AAPCS) f32 { |
| 19 | return intToFloat(f32, a); | 19 | return floatFromInt(f32, a); |
| 20 | } | 20 | } |
lib/compiler_rt/floatunsitf.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatunsitf(a: u32) callconv(.C) f128 { | 15 | pub fn __floatunsitf(a: u32) callconv(.C) f128 { |
| 16 | return intToFloat(f128, a); | 16 | return floatFromInt(f128, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void { | 19 | fn _Qp_uitoq(c: *f128, a: u32) callconv(.C) void { |
| 20 | c.* = intToFloat(f128, a); | 20 | c.* = floatFromInt(f128, a); |
| 21 | } | 21 | } |
lib/compiler_rt/floatunsixf.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const common = @import("./common.zig"); | 1 | const common = @import("./common.zig"); |
| 2 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 2 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 3 | 3 | ||
| 4 | pub const panic = common.panic; | 4 | pub const panic = common.panic; |
| 5 | 5 | ||
| ... | @@ -8,5 +8,5 @@ comptime { | ... | @@ -8,5 +8,5 @@ comptime { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn __floatunsixf(a: u32) callconv(.C) f80 { | 10 | fn __floatunsixf(a: u32) callconv(.C) f80 { |
| 11 | return intToFloat(f80, a); | 11 | return floatFromInt(f80, a); |
| 12 | } | 12 | } |
lib/compiler_rt/floatuntidf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatuntidf(a: u128) callconv(.C) f64 { | 15 | pub fn __floatuntidf(a: u128) callconv(.C) f64 { |
| 16 | return intToFloat(f64, a); | 16 | return floatFromInt(f64, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floatuntidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 { | 19 | fn __floatuntidf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f64 { |
| 20 | return intToFloat(f64, @bitCast(u128, a)); | 20 | return floatFromInt(f64, @bitCast(u128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floatuntihf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatuntihf(a: u128) callconv(.C) f16 { | 15 | pub fn __floatuntihf(a: u128) callconv(.C) f16 { |
| 16 | return intToFloat(f16, a); | 16 | return floatFromInt(f16, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floatuntihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 { | 19 | fn __floatuntihf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f16 { |
| 20 | return intToFloat(f16, @bitCast(u128, a)); | 20 | return floatFromInt(f16, @bitCast(u128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floatuntisf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatuntisf(a: u128) callconv(.C) f32 { | 15 | pub fn __floatuntisf(a: u128) callconv(.C) f32 { |
| 16 | return intToFloat(f32, a); | 16 | return floatFromInt(f32, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floatuntisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 { | 19 | fn __floatuntisf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f32 { |
| 20 | return intToFloat(f32, @bitCast(u128, a)); | 20 | return floatFromInt(f32, @bitCast(u128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/floatuntitf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -15,9 +15,9 @@ comptime { | ... | @@ -15,9 +15,9 @@ comptime { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | pub fn __floatuntitf(a: u128) callconv(.C) f128 { | 17 | pub fn __floatuntitf(a: u128) callconv(.C) f128 { |
| 18 | return intToFloat(f128, a); | 18 | return floatFromInt(f128, a); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | fn __floatuntitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 { | 21 | fn __floatuntitf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f128 { |
| 22 | return intToFloat(f128, @bitCast(u128, a)); | 22 | return floatFromInt(f128, @bitCast(u128, a)); |
| 23 | } | 23 | } |
lib/compiler_rt/floatuntixf.zig+3-3| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const builtin = @import("builtin"); | 1 | const builtin = @import("builtin"); |
| 2 | const common = @import("./common.zig"); | 2 | const common = @import("./common.zig"); |
| 3 | const intToFloat = @import("./int_to_float.zig").intToFloat; | 3 | const floatFromInt = @import("./float_from_int.zig").floatFromInt; |
| 4 | 4 | ||
| 5 | pub const panic = common.panic; | 5 | pub const panic = common.panic; |
| 6 | 6 | ||
| ... | @@ -13,9 +13,9 @@ comptime { | ... | @@ -13,9 +13,9 @@ comptime { |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | pub fn __floatuntixf(a: u128) callconv(.C) f80 { | 15 | pub fn __floatuntixf(a: u128) callconv(.C) f80 { |
| 16 | return intToFloat(f80, a); | 16 | return floatFromInt(f80, a); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn __floatuntixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 { | 19 | fn __floatuntixf_windows_x86_64(a: @Vector(2, u64)) callconv(.C) f80 { |
| 20 | return intToFloat(f80, @bitCast(u128, a)); | 20 | return floatFromInt(f80, @bitCast(u128, a)); |
| 21 | } | 21 | } |
lib/compiler_rt/gedf2.zig+3-3| ... | @@ -18,7 +18,7 @@ comptime { | ... | @@ -18,7 +18,7 @@ comptime { |
| 18 | /// "These functions return a value greater than or equal to zero if neither | 18 | /// "These functions return a value greater than or equal to zero if neither |
| 19 | /// argument is NaN, and a is greater than or equal to b." | 19 | /// argument is NaN, and a is greater than or equal to b." |
| 20 | pub fn __gedf2(a: f64, b: f64) callconv(.C) i32 { | 20 | pub fn __gedf2(a: f64, b: f64) callconv(.C) i32 { |
| 21 | return @enumToInt(comparef.cmpf2(f64, comparef.GE, a, b)); | 21 | return @intFromEnum(comparef.cmpf2(f64, comparef.GE, a, b)); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /// "These functions return a value greater than zero if neither argument is NaN, | 24 | /// "These functions return a value greater than zero if neither argument is NaN, |
| ... | @@ -28,9 +28,9 @@ pub fn __gtdf2(a: f64, b: f64) callconv(.C) i32 { | ... | @@ -28,9 +28,9 @@ pub fn __gtdf2(a: f64, b: f64) callconv(.C) i32 { |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | fn __aeabi_dcmpge(a: f64, b: f64) callconv(.AAPCS) i32 { | 30 | fn __aeabi_dcmpge(a: f64, b: f64) callconv(.AAPCS) i32 { |
| 31 | return @boolToInt(comparef.cmpf2(f64, comparef.GE, a, b) != .Less); | 31 | return @intFromBool(comparef.cmpf2(f64, comparef.GE, a, b) != .Less); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | fn __aeabi_dcmpgt(a: f64, b: f64) callconv(.AAPCS) i32 { | 34 | fn __aeabi_dcmpgt(a: f64, b: f64) callconv(.AAPCS) i32 { |
| 35 | return @boolToInt(comparef.cmpf2(f64, comparef.GE, a, b) == .Greater); | 35 | return @intFromBool(comparef.cmpf2(f64, comparef.GE, a, b) == .Greater); |
| 36 | } | 36 | } |
lib/compiler_rt/gehf2.zig+1-1| ... | @@ -13,7 +13,7 @@ comptime { | ... | @@ -13,7 +13,7 @@ comptime { |
| 13 | /// "These functions return a value greater than or equal to zero if neither | 13 | /// "These functions return a value greater than or equal to zero if neither |
| 14 | /// argument is NaN, and a is greater than or equal to b." | 14 | /// argument is NaN, and a is greater than or equal to b." |
| 15 | pub fn __gehf2(a: f16, b: f16) callconv(.C) i32 { | 15 | pub fn __gehf2(a: f16, b: f16) callconv(.C) i32 { |
| 16 | return @enumToInt(comparef.cmpf2(f16, comparef.GE, a, b)); | 16 | return @intFromEnum(comparef.cmpf2(f16, comparef.GE, a, b)); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | /// "These functions return a value greater than zero if neither argument is NaN, | 19 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/gesf2.zig+3-3| ... | @@ -18,7 +18,7 @@ comptime { | ... | @@ -18,7 +18,7 @@ comptime { |
| 18 | /// "These functions return a value greater than or equal to zero if neither | 18 | /// "These functions return a value greater than or equal to zero if neither |
| 19 | /// argument is NaN, and a is greater than or equal to b." | 19 | /// argument is NaN, and a is greater than or equal to b." |
| 20 | pub fn __gesf2(a: f32, b: f32) callconv(.C) i32 { | 20 | pub fn __gesf2(a: f32, b: f32) callconv(.C) i32 { |
| 21 | return @enumToInt(comparef.cmpf2(f32, comparef.GE, a, b)); | 21 | return @intFromEnum(comparef.cmpf2(f32, comparef.GE, a, b)); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | /// "These functions return a value greater than zero if neither argument is NaN, | 24 | /// "These functions return a value greater than zero if neither argument is NaN, |
| ... | @@ -28,9 +28,9 @@ pub fn __gtsf2(a: f32, b: f32) callconv(.C) i32 { | ... | @@ -28,9 +28,9 @@ pub fn __gtsf2(a: f32, b: f32) callconv(.C) i32 { |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | fn __aeabi_fcmpge(a: f32, b: f32) callconv(.AAPCS) i32 { | 30 | fn __aeabi_fcmpge(a: f32, b: f32) callconv(.AAPCS) i32 { |
| 31 | return @boolToInt(comparef.cmpf2(f32, comparef.GE, a, b) != .Less); | 31 | return @intFromBool(comparef.cmpf2(f32, comparef.GE, a, b) != .Less); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | fn __aeabi_fcmpgt(a: f32, b: f32) callconv(.AAPCS) i32 { | 34 | fn __aeabi_fcmpgt(a: f32, b: f32) callconv(.AAPCS) i32 { |
| 35 | return @boolToInt(comparef.cmpf2(f32, comparef.LE, a, b) == .Greater); | 35 | return @intFromBool(comparef.cmpf2(f32, comparef.LE, a, b) == .Greater); |
| 36 | } | 36 | } |
lib/compiler_rt/getf2.zig+1-1| ... | @@ -20,7 +20,7 @@ comptime { | ... | @@ -20,7 +20,7 @@ comptime { |
| 20 | /// "These functions return a value greater than or equal to zero if neither | 20 | /// "These functions return a value greater than or equal to zero if neither |
| 21 | /// argument is NaN, and a is greater than or equal to b." | 21 | /// argument is NaN, and a is greater than or equal to b." |
| 22 | fn __getf2(a: f128, b: f128) callconv(.C) i32 { | 22 | fn __getf2(a: f128, b: f128) callconv(.C) i32 { |
| 23 | return @enumToInt(comparef.cmpf2(f128, comparef.GE, a, b)); | 23 | return @intFromEnum(comparef.cmpf2(f128, comparef.GE, a, b)); |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /// "These functions return a value greater than zero if neither argument is NaN, | 26 | /// "These functions return a value greater than zero if neither argument is NaN, |
lib/compiler_rt/gexf2.zig+1-1| ... | @@ -9,7 +9,7 @@ comptime { | ... | @@ -9,7 +9,7 @@ comptime { |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | fn __gexf2(a: f80, b: f80) callconv(.C) i32 { | 11 | fn __gexf2(a: f80, b: f80) callconv(.C) i32 { |
| 12 | return @enumToInt(comparef.cmp_f80(comparef.GE, a, b)); | 12 | return @intFromEnum(comparef.cmp_f80(comparef.GE, a, b)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn __gtxf2(a: f80, b: f80) callconv(.C) i32 { | 15 | fn __gtxf2(a: f80, b: f80) callconv(.C) i32 { |
lib/compiler_rt/int_from_float.zig created+55| ... | @@ -0,0 +1,55 @@ | ||
| 1 | const Int = @import("std").meta.Int; | ||
| 2 | const math = @import("std").math; | ||
| 3 | const Log2Int = math.Log2Int; | ||
| 4 | |||
| 5 | pub inline fn intFromFloat(comptime I: type, a: anytype) I { | ||
| 6 | const F = @TypeOf(a); | ||
| 7 | const float_bits = @typeInfo(F).Float.bits; | ||
| 8 | const int_bits = @typeInfo(I).Int.bits; | ||
| 9 | const rep_t = Int(.unsigned, float_bits); | ||
| 10 | const sig_bits = math.floatMantissaBits(F); | ||
| 11 | const exp_bits = math.floatExponentBits(F); | ||
| 12 | const fractional_bits = math.floatFractionalBits(F); | ||
| 13 | |||
| 14 | const implicit_bit = if (F != f80) (@as(rep_t, 1) << sig_bits) else 0; | ||
| 15 | const max_exp = (1 << (exp_bits - 1)); | ||
| 16 | const exp_bias = max_exp - 1; | ||
| 17 | const sig_mask = (@as(rep_t, 1) << sig_bits) - 1; | ||
| 18 | |||
| 19 | // Break a into sign, exponent, significand | ||
| 20 | const a_rep: rep_t = @bitCast(rep_t, a); | ||
| 21 | const negative = (a_rep >> (float_bits - 1)) != 0; | ||
| 22 | const exponent = @intCast(i32, (a_rep << 1) >> (sig_bits + 1)) - exp_bias; | ||
| 23 | const significand: rep_t = (a_rep & sig_mask) | implicit_bit; | ||
| 24 | |||
| 25 | // If the exponent is negative, the result rounds to zero. | ||
| 26 | if (exponent < 0) return 0; | ||
| 27 | |||
| 28 | // If the value is too large for the integer type, saturate. | ||
| 29 | switch (@typeInfo(I).Int.signedness) { | ||
| 30 | .unsigned => { | ||
| 31 | if (negative) return 0; | ||
| 32 | if (@intCast(c_uint, exponent) >= @min(int_bits, max_exp)) return math.maxInt(I); | ||
| 33 | }, | ||
| 34 | .signed => if (@intCast(c_uint, exponent) >= @min(int_bits - 1, max_exp)) { | ||
| 35 | return if (negative) math.minInt(I) else math.maxInt(I); | ||
| 36 | }, | ||
| 37 | } | ||
| 38 | |||
| 39 | // If 0 <= exponent < sig_bits, right shift to get the result. | ||
| 40 | // Otherwise, shift left. | ||
| 41 | var result: I = undefined; | ||
| 42 | if (exponent < fractional_bits) { | ||
| 43 | result = @intCast(I, significand >> @intCast(Log2Int(rep_t), fractional_bits - exponent)); | ||
| 44 | } else { | ||
| 45 | result = @intCast(I, significand) << @intCast(Log2Int(I), exponent - fractional_bits); | ||
| 46 | } | ||
| 47 | |||
| 48 | if ((@typeInfo(I).Int.signedness == .signed) and negative) | ||
| 49 | return ~result +% 1; | ||
| 50 | return result; | ||
| 51 | } | ||
| 52 | |||
| 53 | test { | ||
| 54 | _ = @import("int_from_float_test.zig"); | ||
| 55 | } | ||
lib/compiler_rt/int_from_float_test.zig created+950| ... | @@ -0,0 +1,950 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const testing = std.testing; | ||
| 3 | const math = std.math; | ||
| 4 | |||
| 5 | const __fixunshfti = @import("fixunshfti.zig").__fixunshfti; | ||
| 6 | const __fixunsxfti = @import("fixunsxfti.zig").__fixunsxfti; | ||
| 7 | |||
| 8 | // Conversion from f32 | ||
| 9 | const __fixsfsi = @import("fixsfsi.zig").__fixsfsi; | ||
| 10 | const __fixunssfsi = @import("fixunssfsi.zig").__fixunssfsi; | ||
| 11 | const __fixsfdi = @import("fixsfdi.zig").__fixsfdi; | ||
| 12 | const __fixunssfdi = @import("fixunssfdi.zig").__fixunssfdi; | ||
| 13 | const __fixsfti = @import("fixsfti.zig").__fixsfti; | ||
| 14 | const __fixunssfti = @import("fixunssfti.zig").__fixunssfti; | ||
| 15 | |||
| 16 | // Conversion from f64 | ||
| 17 | const __fixdfsi = @import("fixdfsi.zig").__fixdfsi; | ||
| 18 | const __fixunsdfsi = @import("fixunsdfsi.zig").__fixunsdfsi; | ||
| 19 | const __fixdfdi = @import("fixdfdi.zig").__fixdfdi; | ||
| 20 | const __fixunsdfdi = @import("fixunsdfdi.zig").__fixunsdfdi; | ||
| 21 | const __fixdfti = @import("fixdfti.zig").__fixdfti; | ||
| 22 | const __fixunsdfti = @import("fixunsdfti.zig").__fixunsdfti; | ||
| 23 | |||
| 24 | // Conversion from f128 | ||
| 25 | const __fixtfsi = @import("fixtfsi.zig").__fixtfsi; | ||
| 26 | const __fixunstfsi = @import("fixunstfsi.zig").__fixunstfsi; | ||
| 27 | const __fixtfdi = @import("fixtfdi.zig").__fixtfdi; | ||
| 28 | const __fixunstfdi = @import("fixunstfdi.zig").__fixunstfdi; | ||
| 29 | const __fixtfti = @import("fixtfti.zig").__fixtfti; | ||
| 30 | const __fixunstfti = @import("fixunstfti.zig").__fixunstfti; | ||
| 31 | |||
| 32 | fn test__fixsfsi(a: f32, expected: i32) !void { | ||
| 33 | const x = __fixsfsi(a); | ||
| 34 | try testing.expect(x == expected); | ||
| 35 | } | ||
| 36 | |||
| 37 | fn test__fixunssfsi(a: f32, expected: u32) !void { | ||
| 38 | const x = __fixunssfsi(a); | ||
| 39 | try testing.expect(x == expected); | ||
| 40 | } | ||
| 41 | |||
| 42 | test "fixsfsi" { | ||
| 43 | try test__fixsfsi(-math.floatMax(f32), math.minInt(i32)); | ||
| 44 | |||
| 45 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 46 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 47 | |||
| 48 | try test__fixsfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 49 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 50 | try test__fixsfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 51 | |||
| 52 | try test__fixsfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 53 | try test__fixsfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 54 | try test__fixsfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 55 | try test__fixsfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 56 | |||
| 57 | try test__fixsfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 58 | try test__fixsfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 59 | |||
| 60 | try test__fixsfsi(-0x1.000000p+31, -0x80000000); | ||
| 61 | try test__fixsfsi(-0x1.FFFFFFp+30, -0x80000000); | ||
| 62 | try test__fixsfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 63 | try test__fixsfsi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 64 | |||
| 65 | try test__fixsfsi(-2.01, -2); | ||
| 66 | try test__fixsfsi(-2.0, -2); | ||
| 67 | try test__fixsfsi(-1.99, -1); | ||
| 68 | try test__fixsfsi(-1.0, -1); | ||
| 69 | try test__fixsfsi(-0.99, 0); | ||
| 70 | try test__fixsfsi(-0.5, 0); | ||
| 71 | try test__fixsfsi(-math.floatMin(f32), 0); | ||
| 72 | try test__fixsfsi(0.0, 0); | ||
| 73 | try test__fixsfsi(math.floatMin(f32), 0); | ||
| 74 | try test__fixsfsi(0.5, 0); | ||
| 75 | try test__fixsfsi(0.99, 0); | ||
| 76 | try test__fixsfsi(1.0, 1); | ||
| 77 | try test__fixsfsi(1.5, 1); | ||
| 78 | try test__fixsfsi(1.99, 1); | ||
| 79 | try test__fixsfsi(2.0, 2); | ||
| 80 | try test__fixsfsi(2.01, 2); | ||
| 81 | |||
| 82 | try test__fixsfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 83 | try test__fixsfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 84 | try test__fixsfsi(0x1.FFFFFFp+30, 0x7FFFFFFF); | ||
| 85 | try test__fixsfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 86 | |||
| 87 | try test__fixsfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 88 | try test__fixsfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 89 | |||
| 90 | try test__fixsfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 91 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 92 | try test__fixsfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 93 | try test__fixsfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 94 | |||
| 95 | try test__fixsfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 96 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 97 | try test__fixsfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 98 | |||
| 99 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 100 | try test__fixsfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 101 | |||
| 102 | try test__fixsfsi(math.floatMax(f32), math.maxInt(i32)); | ||
| 103 | } | ||
| 104 | |||
| 105 | test "fixunssfsi" { | ||
| 106 | try test__fixunssfsi(0.0, 0); | ||
| 107 | |||
| 108 | try test__fixunssfsi(0.5, 0); | ||
| 109 | try test__fixunssfsi(0.99, 0); | ||
| 110 | try test__fixunssfsi(1.0, 1); | ||
| 111 | try test__fixunssfsi(1.5, 1); | ||
| 112 | try test__fixunssfsi(1.99, 1); | ||
| 113 | try test__fixunssfsi(2.0, 2); | ||
| 114 | try test__fixunssfsi(2.01, 2); | ||
| 115 | try test__fixunssfsi(-0.5, 0); | ||
| 116 | try test__fixunssfsi(-0.99, 0); | ||
| 117 | |||
| 118 | try test__fixunssfsi(-1.0, 0); | ||
| 119 | try test__fixunssfsi(-1.5, 0); | ||
| 120 | try test__fixunssfsi(-1.99, 0); | ||
| 121 | try test__fixunssfsi(-2.0, 0); | ||
| 122 | try test__fixunssfsi(-2.01, 0); | ||
| 123 | |||
| 124 | try test__fixunssfsi(0x1.000000p+31, 0x80000000); | ||
| 125 | try test__fixunssfsi(0x1.000000p+32, 0xFFFFFFFF); | ||
| 126 | try test__fixunssfsi(0x1.FFFFFEp+31, 0xFFFFFF00); | ||
| 127 | try test__fixunssfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 128 | try test__fixunssfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 129 | |||
| 130 | try test__fixunssfsi(-0x1.FFFFFEp+30, 0); | ||
| 131 | try test__fixunssfsi(-0x1.FFFFFCp+30, 0); | ||
| 132 | } | ||
| 133 | |||
| 134 | fn test__fixsfdi(a: f32, expected: i64) !void { | ||
| 135 | const x = __fixsfdi(a); | ||
| 136 | try testing.expect(x == expected); | ||
| 137 | } | ||
| 138 | |||
| 139 | fn test__fixunssfdi(a: f32, expected: u64) !void { | ||
| 140 | const x = __fixunssfdi(a); | ||
| 141 | try testing.expect(x == expected); | ||
| 142 | } | ||
| 143 | |||
| 144 | test "fixsfdi" { | ||
| 145 | try test__fixsfdi(-math.floatMax(f32), math.minInt(i64)); | ||
| 146 | |||
| 147 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 148 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 149 | |||
| 150 | try test__fixsfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 151 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 152 | try test__fixsfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 153 | |||
| 154 | try test__fixsfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 155 | try test__fixsfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 156 | try test__fixsfdi(-0x1.FFFFFFFFFFFFFp+62, -0x8000000000000000); | ||
| 157 | try test__fixsfdi(-0x1.FFFFFFFFFFFFEp+62, -0x8000000000000000); | ||
| 158 | |||
| 159 | try test__fixsfdi(-0x1.FFFFFFp+62, -0x8000000000000000); | ||
| 160 | try test__fixsfdi(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 161 | try test__fixsfdi(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 162 | |||
| 163 | try test__fixsfdi(-2.01, -2); | ||
| 164 | try test__fixsfdi(-2.0, -2); | ||
| 165 | try test__fixsfdi(-1.99, -1); | ||
| 166 | try test__fixsfdi(-1.0, -1); | ||
| 167 | try test__fixsfdi(-0.99, 0); | ||
| 168 | try test__fixsfdi(-0.5, 0); | ||
| 169 | try test__fixsfdi(-math.floatMin(f32), 0); | ||
| 170 | try test__fixsfdi(0.0, 0); | ||
| 171 | try test__fixsfdi(math.floatMin(f32), 0); | ||
| 172 | try test__fixsfdi(0.5, 0); | ||
| 173 | try test__fixsfdi(0.99, 0); | ||
| 174 | try test__fixsfdi(1.0, 1); | ||
| 175 | try test__fixsfdi(1.5, 1); | ||
| 176 | try test__fixsfdi(1.99, 1); | ||
| 177 | try test__fixsfdi(2.0, 2); | ||
| 178 | try test__fixsfdi(2.01, 2); | ||
| 179 | |||
| 180 | try test__fixsfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 181 | try test__fixsfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 182 | try test__fixsfdi(0x1.FFFFFFp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 183 | |||
| 184 | try test__fixsfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 185 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 186 | try test__fixsfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 187 | try test__fixsfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 188 | |||
| 189 | try test__fixsfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 190 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 191 | try test__fixsfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 192 | |||
| 193 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 194 | try test__fixsfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 195 | |||
| 196 | try test__fixsfdi(math.floatMax(f32), math.maxInt(i64)); | ||
| 197 | } | ||
| 198 | |||
| 199 | test "fixunssfdi" { | ||
| 200 | try test__fixunssfdi(0.0, 0); | ||
| 201 | |||
| 202 | try test__fixunssfdi(0.5, 0); | ||
| 203 | try test__fixunssfdi(0.99, 0); | ||
| 204 | try test__fixunssfdi(1.0, 1); | ||
| 205 | try test__fixunssfdi(1.5, 1); | ||
| 206 | try test__fixunssfdi(1.99, 1); | ||
| 207 | try test__fixunssfdi(2.0, 2); | ||
| 208 | try test__fixunssfdi(2.01, 2); | ||
| 209 | try test__fixunssfdi(-0.5, 0); | ||
| 210 | try test__fixunssfdi(-0.99, 0); | ||
| 211 | |||
| 212 | try test__fixunssfdi(-1.0, 0); | ||
| 213 | try test__fixunssfdi(-1.5, 0); | ||
| 214 | try test__fixunssfdi(-1.99, 0); | ||
| 215 | try test__fixunssfdi(-2.0, 0); | ||
| 216 | try test__fixunssfdi(-2.01, 0); | ||
| 217 | |||
| 218 | try test__fixunssfdi(0x1.FFFFFEp+63, 0xFFFFFF0000000000); | ||
| 219 | try test__fixunssfdi(0x1.000000p+63, 0x8000000000000000); | ||
| 220 | try test__fixunssfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 221 | try test__fixunssfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 222 | |||
| 223 | try test__fixunssfdi(-0x1.FFFFFEp+62, 0x0000000000000000); | ||
| 224 | try test__fixunssfdi(-0x1.FFFFFCp+62, 0x0000000000000000); | ||
| 225 | } | ||
| 226 | |||
| 227 | fn test__fixsfti(a: f32, expected: i128) !void { | ||
| 228 | const x = __fixsfti(a); | ||
| 229 | try testing.expect(x == expected); | ||
| 230 | } | ||
| 231 | |||
| 232 | fn test__fixunssfti(a: f32, expected: u128) !void { | ||
| 233 | const x = __fixunssfti(a); | ||
| 234 | try testing.expect(x == expected); | ||
| 235 | } | ||
| 236 | |||
| 237 | test "fixsfti" { | ||
| 238 | try test__fixsfti(-math.floatMax(f32), math.minInt(i128)); | ||
| 239 | |||
| 240 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 241 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 242 | |||
| 243 | try test__fixsfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 244 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+126, -0x80000000000000000000000000000000); | ||
| 245 | try test__fixsfti(-0x1.FFFFFFFFFFFFEp+126, -0x80000000000000000000000000000000); | ||
| 246 | try test__fixsfti(-0x1.FFFFFF0000000p+126, -0x80000000000000000000000000000000); | ||
| 247 | try test__fixsfti(-0x1.FFFFFE0000000p+126, -0x7FFFFF80000000000000000000000000); | ||
| 248 | try test__fixsfti(-0x1.FFFFFC0000000p+126, -0x7FFFFF00000000000000000000000000); | ||
| 249 | |||
| 250 | try test__fixsfti(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 251 | try test__fixsfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 252 | try test__fixsfti(-0x1.FFFFFFFFFFFFFp+62, -0x8000000000000000); | ||
| 253 | try test__fixsfti(-0x1.FFFFFFFFFFFFEp+62, -0x8000000000000000); | ||
| 254 | |||
| 255 | try test__fixsfti(-0x1.FFFFFFp+62, -0x8000000000000000); | ||
| 256 | try test__fixsfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 257 | try test__fixsfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 258 | |||
| 259 | try test__fixsfti(-0x1.000000p+31, -0x80000000); | ||
| 260 | try test__fixsfti(-0x1.FFFFFFp+30, -0x80000000); | ||
| 261 | try test__fixsfti(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 262 | try test__fixsfti(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 263 | |||
| 264 | try test__fixsfti(-2.01, -2); | ||
| 265 | try test__fixsfti(-2.0, -2); | ||
| 266 | try test__fixsfti(-1.99, -1); | ||
| 267 | try test__fixsfti(-1.0, -1); | ||
| 268 | try test__fixsfti(-0.99, 0); | ||
| 269 | try test__fixsfti(-0.5, 0); | ||
| 270 | try test__fixsfti(-math.floatMin(f32), 0); | ||
| 271 | try test__fixsfti(0.0, 0); | ||
| 272 | try test__fixsfti(math.floatMin(f32), 0); | ||
| 273 | try test__fixsfti(0.5, 0); | ||
| 274 | try test__fixsfti(0.99, 0); | ||
| 275 | try test__fixsfti(1.0, 1); | ||
| 276 | try test__fixsfti(1.5, 1); | ||
| 277 | try test__fixsfti(1.99, 1); | ||
| 278 | try test__fixsfti(2.0, 2); | ||
| 279 | try test__fixsfti(2.01, 2); | ||
| 280 | |||
| 281 | try test__fixsfti(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 282 | try test__fixsfti(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 283 | try test__fixsfti(0x1.FFFFFFp+30, 0x80000000); | ||
| 284 | try test__fixsfti(0x1.000000p+31, 0x80000000); | ||
| 285 | |||
| 286 | try test__fixsfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 287 | try test__fixsfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 288 | try test__fixsfti(0x1.FFFFFFp+62, 0x8000000000000000); | ||
| 289 | |||
| 290 | try test__fixsfti(0x1.FFFFFFFFFFFFEp+62, 0x8000000000000000); | ||
| 291 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+62, 0x8000000000000000); | ||
| 292 | try test__fixsfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 293 | try test__fixsfti(0x1.0000000000001p+63, 0x8000000000000000); | ||
| 294 | |||
| 295 | try test__fixsfti(0x1.FFFFFC0000000p+126, 0x7FFFFF00000000000000000000000000); | ||
| 296 | try test__fixsfti(0x1.FFFFFE0000000p+126, 0x7FFFFF80000000000000000000000000); | ||
| 297 | try test__fixsfti(0x1.FFFFFF0000000p+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 298 | try test__fixsfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 299 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 300 | try test__fixsfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 301 | |||
| 302 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 303 | try test__fixsfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 304 | |||
| 305 | try test__fixsfti(math.floatMax(f32), math.maxInt(i128)); | ||
| 306 | } | ||
| 307 | |||
| 308 | test "fixunssfti" { | ||
| 309 | try test__fixunssfti(0.0, 0); | ||
| 310 | |||
| 311 | try test__fixunssfti(0.5, 0); | ||
| 312 | try test__fixunssfti(0.99, 0); | ||
| 313 | try test__fixunssfti(1.0, 1); | ||
| 314 | try test__fixunssfti(1.5, 1); | ||
| 315 | try test__fixunssfti(1.99, 1); | ||
| 316 | try test__fixunssfti(2.0, 2); | ||
| 317 | try test__fixunssfti(2.01, 2); | ||
| 318 | try test__fixunssfti(-0.5, 0); | ||
| 319 | try test__fixunssfti(-0.99, 0); | ||
| 320 | |||
| 321 | try test__fixunssfti(-1.0, 0); | ||
| 322 | try test__fixunssfti(-1.5, 0); | ||
| 323 | try test__fixunssfti(-1.99, 0); | ||
| 324 | try test__fixunssfti(-2.0, 0); | ||
| 325 | try test__fixunssfti(-2.01, 0); | ||
| 326 | |||
| 327 | try test__fixunssfti(0x1.FFFFFEp+63, 0xFFFFFF0000000000); | ||
| 328 | try test__fixunssfti(0x1.000000p+63, 0x8000000000000000); | ||
| 329 | try test__fixunssfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 330 | try test__fixunssfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 331 | try test__fixunssfti(0x1.FFFFFEp+127, 0xFFFFFF00000000000000000000000000); | ||
| 332 | try test__fixunssfti(0x1.000000p+127, 0x80000000000000000000000000000000); | ||
| 333 | try test__fixunssfti(0x1.FFFFFEp+126, 0x7FFFFF80000000000000000000000000); | ||
| 334 | try test__fixunssfti(0x1.FFFFFCp+126, 0x7FFFFF00000000000000000000000000); | ||
| 335 | |||
| 336 | try test__fixunssfti(-0x1.FFFFFEp+62, 0x0000000000000000); | ||
| 337 | try test__fixunssfti(-0x1.FFFFFCp+62, 0x0000000000000000); | ||
| 338 | try test__fixunssfti(-0x1.FFFFFEp+126, 0x0000000000000000); | ||
| 339 | try test__fixunssfti(-0x1.FFFFFCp+126, 0x0000000000000000); | ||
| 340 | try test__fixunssfti(math.floatMax(f32), 0xffffff00000000000000000000000000); | ||
| 341 | try test__fixunssfti(math.inf(f32), math.maxInt(u128)); | ||
| 342 | } | ||
| 343 | |||
| 344 | fn test__fixdfsi(a: f64, expected: i32) !void { | ||
| 345 | const x = __fixdfsi(a); | ||
| 346 | try testing.expect(x == expected); | ||
| 347 | } | ||
| 348 | |||
| 349 | fn test__fixunsdfsi(a: f64, expected: u32) !void { | ||
| 350 | const x = __fixunsdfsi(a); | ||
| 351 | try testing.expect(x == expected); | ||
| 352 | } | ||
| 353 | |||
| 354 | test "fixdfsi" { | ||
| 355 | try test__fixdfsi(-math.floatMax(f64), math.minInt(i32)); | ||
| 356 | |||
| 357 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 358 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 359 | |||
| 360 | try test__fixdfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 361 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 362 | try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 363 | |||
| 364 | try test__fixdfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 365 | try test__fixdfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 366 | try test__fixdfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 367 | try test__fixdfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 368 | |||
| 369 | try test__fixdfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 370 | try test__fixdfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 371 | |||
| 372 | try test__fixdfsi(-0x1.000000p+31, -0x80000000); | ||
| 373 | try test__fixdfsi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 374 | try test__fixdfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 375 | |||
| 376 | try test__fixdfsi(-2.01, -2); | ||
| 377 | try test__fixdfsi(-2.0, -2); | ||
| 378 | try test__fixdfsi(-1.99, -1); | ||
| 379 | try test__fixdfsi(-1.0, -1); | ||
| 380 | try test__fixdfsi(-0.99, 0); | ||
| 381 | try test__fixdfsi(-0.5, 0); | ||
| 382 | try test__fixdfsi(-math.floatMin(f64), 0); | ||
| 383 | try test__fixdfsi(0.0, 0); | ||
| 384 | try test__fixdfsi(math.floatMin(f64), 0); | ||
| 385 | try test__fixdfsi(0.5, 0); | ||
| 386 | try test__fixdfsi(0.99, 0); | ||
| 387 | try test__fixdfsi(1.0, 1); | ||
| 388 | try test__fixdfsi(1.5, 1); | ||
| 389 | try test__fixdfsi(1.99, 1); | ||
| 390 | try test__fixdfsi(2.0, 2); | ||
| 391 | try test__fixdfsi(2.01, 2); | ||
| 392 | |||
| 393 | try test__fixdfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 394 | try test__fixdfsi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 395 | try test__fixdfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 396 | |||
| 397 | try test__fixdfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 398 | try test__fixdfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 399 | |||
| 400 | try test__fixdfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 401 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 402 | try test__fixdfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 403 | try test__fixdfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 404 | |||
| 405 | try test__fixdfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 406 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 407 | try test__fixdfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 408 | |||
| 409 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 410 | try test__fixdfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 411 | |||
| 412 | try test__fixdfsi(math.floatMax(f64), math.maxInt(i32)); | ||
| 413 | } | ||
| 414 | |||
| 415 | test "fixunsdfsi" { | ||
| 416 | try test__fixunsdfsi(0.0, 0); | ||
| 417 | |||
| 418 | try test__fixunsdfsi(0.5, 0); | ||
| 419 | try test__fixunsdfsi(0.99, 0); | ||
| 420 | try test__fixunsdfsi(1.0, 1); | ||
| 421 | try test__fixunsdfsi(1.5, 1); | ||
| 422 | try test__fixunsdfsi(1.99, 1); | ||
| 423 | try test__fixunsdfsi(2.0, 2); | ||
| 424 | try test__fixunsdfsi(2.01, 2); | ||
| 425 | try test__fixunsdfsi(-0.5, 0); | ||
| 426 | try test__fixunsdfsi(-0.99, 0); | ||
| 427 | try test__fixunsdfsi(-1.0, 0); | ||
| 428 | try test__fixunsdfsi(-1.5, 0); | ||
| 429 | try test__fixunsdfsi(-1.99, 0); | ||
| 430 | try test__fixunsdfsi(-2.0, 0); | ||
| 431 | try test__fixunsdfsi(-2.01, 0); | ||
| 432 | |||
| 433 | try test__fixunsdfsi(0x1.000000p+31, 0x80000000); | ||
| 434 | try test__fixunsdfsi(0x1.000000p+32, 0xFFFFFFFF); | ||
| 435 | try test__fixunsdfsi(0x1.FFFFFEp+31, 0xFFFFFF00); | ||
| 436 | try test__fixunsdfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 437 | try test__fixunsdfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 438 | |||
| 439 | try test__fixunsdfsi(-0x1.FFFFFEp+30, 0); | ||
| 440 | try test__fixunsdfsi(-0x1.FFFFFCp+30, 0); | ||
| 441 | |||
| 442 | try test__fixunsdfsi(0x1.FFFFFFFEp+31, 0xFFFFFFFF); | ||
| 443 | try test__fixunsdfsi(0x1.FFFFFFFC00000p+30, 0x7FFFFFFF); | ||
| 444 | try test__fixunsdfsi(0x1.FFFFFFF800000p+30, 0x7FFFFFFE); | ||
| 445 | } | ||
| 446 | |||
| 447 | fn test__fixdfdi(a: f64, expected: i64) !void { | ||
| 448 | const x = __fixdfdi(a); | ||
| 449 | try testing.expect(x == expected); | ||
| 450 | } | ||
| 451 | |||
| 452 | fn test__fixunsdfdi(a: f64, expected: u64) !void { | ||
| 453 | const x = __fixunsdfdi(a); | ||
| 454 | try testing.expect(x == expected); | ||
| 455 | } | ||
| 456 | |||
| 457 | test "fixdfdi" { | ||
| 458 | try test__fixdfdi(-math.floatMax(f64), math.minInt(i64)); | ||
| 459 | |||
| 460 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 461 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 462 | |||
| 463 | try test__fixdfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 464 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 465 | try test__fixdfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 466 | |||
| 467 | try test__fixdfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 468 | try test__fixdfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 469 | try test__fixdfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 470 | try test__fixdfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 471 | |||
| 472 | try test__fixdfdi(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 473 | try test__fixdfdi(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 474 | |||
| 475 | try test__fixdfdi(-2.01, -2); | ||
| 476 | try test__fixdfdi(-2.0, -2); | ||
| 477 | try test__fixdfdi(-1.99, -1); | ||
| 478 | try test__fixdfdi(-1.0, -1); | ||
| 479 | try test__fixdfdi(-0.99, 0); | ||
| 480 | try test__fixdfdi(-0.5, 0); | ||
| 481 | try test__fixdfdi(-math.floatMin(f64), 0); | ||
| 482 | try test__fixdfdi(0.0, 0); | ||
| 483 | try test__fixdfdi(math.floatMin(f64), 0); | ||
| 484 | try test__fixdfdi(0.5, 0); | ||
| 485 | try test__fixdfdi(0.99, 0); | ||
| 486 | try test__fixdfdi(1.0, 1); | ||
| 487 | try test__fixdfdi(1.5, 1); | ||
| 488 | try test__fixdfdi(1.99, 1); | ||
| 489 | try test__fixdfdi(2.0, 2); | ||
| 490 | try test__fixdfdi(2.01, 2); | ||
| 491 | |||
| 492 | try test__fixdfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 493 | try test__fixdfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 494 | |||
| 495 | try test__fixdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 496 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 497 | try test__fixdfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 498 | try test__fixdfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 499 | |||
| 500 | try test__fixdfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 501 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 502 | try test__fixdfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 503 | |||
| 504 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 505 | try test__fixdfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 506 | |||
| 507 | try test__fixdfdi(math.floatMax(f64), math.maxInt(i64)); | ||
| 508 | } | ||
| 509 | |||
| 510 | test "fixunsdfdi" { | ||
| 511 | try test__fixunsdfdi(0.0, 0); | ||
| 512 | try test__fixunsdfdi(0.5, 0); | ||
| 513 | try test__fixunsdfdi(0.99, 0); | ||
| 514 | try test__fixunsdfdi(1.0, 1); | ||
| 515 | try test__fixunsdfdi(1.5, 1); | ||
| 516 | try test__fixunsdfdi(1.99, 1); | ||
| 517 | try test__fixunsdfdi(2.0, 2); | ||
| 518 | try test__fixunsdfdi(2.01, 2); | ||
| 519 | try test__fixunsdfdi(-0.5, 0); | ||
| 520 | try test__fixunsdfdi(-0.99, 0); | ||
| 521 | try test__fixunsdfdi(-1.0, 0); | ||
| 522 | try test__fixunsdfdi(-1.5, 0); | ||
| 523 | try test__fixunsdfdi(-1.99, 0); | ||
| 524 | try test__fixunsdfdi(-2.0, 0); | ||
| 525 | try test__fixunsdfdi(-2.01, 0); | ||
| 526 | |||
| 527 | try test__fixunsdfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 528 | try test__fixunsdfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 529 | |||
| 530 | try test__fixunsdfdi(-0x1.FFFFFEp+62, 0); | ||
| 531 | try test__fixunsdfdi(-0x1.FFFFFCp+62, 0); | ||
| 532 | |||
| 533 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFFp+63, 0xFFFFFFFFFFFFF800); | ||
| 534 | try test__fixunsdfdi(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 535 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 536 | try test__fixunsdfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 537 | |||
| 538 | try test__fixunsdfdi(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 539 | try test__fixunsdfdi(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 540 | } | ||
| 541 | |||
| 542 | fn test__fixdfti(a: f64, expected: i128) !void { | ||
| 543 | const x = __fixdfti(a); | ||
| 544 | try testing.expect(x == expected); | ||
| 545 | } | ||
| 546 | |||
| 547 | fn test__fixunsdfti(a: f64, expected: u128) !void { | ||
| 548 | const x = __fixunsdfti(a); | ||
| 549 | try testing.expect(x == expected); | ||
| 550 | } | ||
| 551 | |||
| 552 | test "fixdfti" { | ||
| 553 | try test__fixdfti(-math.floatMax(f64), math.minInt(i128)); | ||
| 554 | |||
| 555 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 556 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 557 | |||
| 558 | try test__fixdfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 559 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+126, -0x7FFFFFFFFFFFFC000000000000000000); | ||
| 560 | try test__fixdfti(-0x1.FFFFFFFFFFFFEp+126, -0x7FFFFFFFFFFFF8000000000000000000); | ||
| 561 | |||
| 562 | try test__fixdfti(-0x1.0000000000001p+63, -0x8000000000000800); | ||
| 563 | try test__fixdfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 564 | try test__fixdfti(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 565 | try test__fixdfti(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 566 | |||
| 567 | try test__fixdfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 568 | try test__fixdfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 569 | |||
| 570 | try test__fixdfti(-2.01, -2); | ||
| 571 | try test__fixdfti(-2.0, -2); | ||
| 572 | try test__fixdfti(-1.99, -1); | ||
| 573 | try test__fixdfti(-1.0, -1); | ||
| 574 | try test__fixdfti(-0.99, 0); | ||
| 575 | try test__fixdfti(-0.5, 0); | ||
| 576 | try test__fixdfti(-math.floatMin(f64), 0); | ||
| 577 | try test__fixdfti(0.0, 0); | ||
| 578 | try test__fixdfti(math.floatMin(f64), 0); | ||
| 579 | try test__fixdfti(0.5, 0); | ||
| 580 | try test__fixdfti(0.99, 0); | ||
| 581 | try test__fixdfti(1.0, 1); | ||
| 582 | try test__fixdfti(1.5, 1); | ||
| 583 | try test__fixdfti(1.99, 1); | ||
| 584 | try test__fixdfti(2.0, 2); | ||
| 585 | try test__fixdfti(2.01, 2); | ||
| 586 | |||
| 587 | try test__fixdfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 588 | try test__fixdfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 589 | |||
| 590 | try test__fixdfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 591 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 592 | try test__fixdfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 593 | try test__fixdfti(0x1.0000000000001p+63, 0x8000000000000800); | ||
| 594 | |||
| 595 | try test__fixdfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 596 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 597 | try test__fixdfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 598 | |||
| 599 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 600 | try test__fixdfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 601 | |||
| 602 | try test__fixdfti(math.floatMax(f64), math.maxInt(i128)); | ||
| 603 | } | ||
| 604 | |||
| 605 | test "fixunsdfti" { | ||
| 606 | try test__fixunsdfti(0.0, 0); | ||
| 607 | |||
| 608 | try test__fixunsdfti(0.5, 0); | ||
| 609 | try test__fixunsdfti(0.99, 0); | ||
| 610 | try test__fixunsdfti(1.0, 1); | ||
| 611 | try test__fixunsdfti(1.5, 1); | ||
| 612 | try test__fixunsdfti(1.99, 1); | ||
| 613 | try test__fixunsdfti(2.0, 2); | ||
| 614 | try test__fixunsdfti(2.01, 2); | ||
| 615 | try test__fixunsdfti(-0.5, 0); | ||
| 616 | try test__fixunsdfti(-0.99, 0); | ||
| 617 | try test__fixunsdfti(-1.0, 0); | ||
| 618 | try test__fixunsdfti(-1.5, 0); | ||
| 619 | try test__fixunsdfti(-1.99, 0); | ||
| 620 | try test__fixunsdfti(-2.0, 0); | ||
| 621 | try test__fixunsdfti(-2.01, 0); | ||
| 622 | |||
| 623 | try test__fixunsdfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 624 | try test__fixunsdfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 625 | |||
| 626 | try test__fixunsdfti(-0x1.FFFFFEp+62, 0); | ||
| 627 | try test__fixunsdfti(-0x1.FFFFFCp+62, 0); | ||
| 628 | |||
| 629 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+63, 0xFFFFFFFFFFFFF800); | ||
| 630 | try test__fixunsdfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 631 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 632 | try test__fixunsdfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 633 | |||
| 634 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+127, 0xFFFFFFFFFFFFF8000000000000000000); | ||
| 635 | try test__fixunsdfti(0x1.0000000000000p+127, 0x80000000000000000000000000000000); | ||
| 636 | try test__fixunsdfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 637 | try test__fixunsdfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 638 | try test__fixunsdfti(0x1.0000000000000p+128, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 639 | |||
| 640 | try test__fixunsdfti(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 641 | try test__fixunsdfti(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 642 | } | ||
| 643 | |||
| 644 | fn test__fixtfsi(a: f128, expected: i32) !void { | ||
| 645 | const x = __fixtfsi(a); | ||
| 646 | try testing.expect(x == expected); | ||
| 647 | } | ||
| 648 | |||
| 649 | fn test__fixunstfsi(a: f128, expected: u32) !void { | ||
| 650 | const x = __fixunstfsi(a); | ||
| 651 | try testing.expect(x == expected); | ||
| 652 | } | ||
| 653 | |||
| 654 | test "fixtfsi" { | ||
| 655 | try test__fixtfsi(-math.floatMax(f128), math.minInt(i32)); | ||
| 656 | |||
| 657 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i32)); | ||
| 658 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000); | ||
| 659 | |||
| 660 | try test__fixtfsi(-0x1.0000000000000p+127, -0x80000000); | ||
| 661 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+126, -0x80000000); | ||
| 662 | try test__fixtfsi(-0x1.FFFFFFFFFFFFEp+126, -0x80000000); | ||
| 663 | |||
| 664 | try test__fixtfsi(-0x1.0000000000001p+63, -0x80000000); | ||
| 665 | try test__fixtfsi(-0x1.0000000000000p+63, -0x80000000); | ||
| 666 | try test__fixtfsi(-0x1.FFFFFFFFFFFFFp+62, -0x80000000); | ||
| 667 | try test__fixtfsi(-0x1.FFFFFFFFFFFFEp+62, -0x80000000); | ||
| 668 | |||
| 669 | try test__fixtfsi(-0x1.FFFFFEp+62, -0x80000000); | ||
| 670 | try test__fixtfsi(-0x1.FFFFFCp+62, -0x80000000); | ||
| 671 | |||
| 672 | try test__fixtfsi(-0x1.000000p+31, -0x80000000); | ||
| 673 | try test__fixtfsi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 674 | try test__fixtfsi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 675 | try test__fixtfsi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 676 | |||
| 677 | try test__fixtfsi(-2.01, -2); | ||
| 678 | try test__fixtfsi(-2.0, -2); | ||
| 679 | try test__fixtfsi(-1.99, -1); | ||
| 680 | try test__fixtfsi(-1.0, -1); | ||
| 681 | try test__fixtfsi(-0.99, 0); | ||
| 682 | try test__fixtfsi(-0.5, 0); | ||
| 683 | try test__fixtfsi(-math.floatMin(f32), 0); | ||
| 684 | try test__fixtfsi(0.0, 0); | ||
| 685 | try test__fixtfsi(math.floatMin(f32), 0); | ||
| 686 | try test__fixtfsi(0.5, 0); | ||
| 687 | try test__fixtfsi(0.99, 0); | ||
| 688 | try test__fixtfsi(1.0, 1); | ||
| 689 | try test__fixtfsi(1.5, 1); | ||
| 690 | try test__fixtfsi(1.99, 1); | ||
| 691 | try test__fixtfsi(2.0, 2); | ||
| 692 | try test__fixtfsi(2.01, 2); | ||
| 693 | |||
| 694 | try test__fixtfsi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 695 | try test__fixtfsi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 696 | try test__fixtfsi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 697 | try test__fixtfsi(0x1.000000p+31, 0x7FFFFFFF); | ||
| 698 | |||
| 699 | try test__fixtfsi(0x1.FFFFFCp+62, 0x7FFFFFFF); | ||
| 700 | try test__fixtfsi(0x1.FFFFFEp+62, 0x7FFFFFFF); | ||
| 701 | |||
| 702 | try test__fixtfsi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFF); | ||
| 703 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFF); | ||
| 704 | try test__fixtfsi(0x1.0000000000000p+63, 0x7FFFFFFF); | ||
| 705 | try test__fixtfsi(0x1.0000000000001p+63, 0x7FFFFFFF); | ||
| 706 | |||
| 707 | try test__fixtfsi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFF); | ||
| 708 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFF); | ||
| 709 | try test__fixtfsi(0x1.0000000000000p+127, 0x7FFFFFFF); | ||
| 710 | |||
| 711 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFF); | ||
| 712 | try test__fixtfsi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i32)); | ||
| 713 | |||
| 714 | try test__fixtfsi(math.floatMax(f128), math.maxInt(i32)); | ||
| 715 | } | ||
| 716 | |||
| 717 | test "fixunstfsi" { | ||
| 718 | try test__fixunstfsi(math.inf(f128), 0xffffffff); | ||
| 719 | try test__fixunstfsi(0, 0x0); | ||
| 720 | try test__fixunstfsi(0x1.23456789abcdefp+5, 0x24); | ||
| 721 | try test__fixunstfsi(0x1.23456789abcdefp-3, 0x0); | ||
| 722 | try test__fixunstfsi(0x1.23456789abcdefp+20, 0x123456); | ||
| 723 | try test__fixunstfsi(0x1.23456789abcdefp+40, 0xffffffff); | ||
| 724 | try test__fixunstfsi(0x1.23456789abcdefp+256, 0xffffffff); | ||
| 725 | try test__fixunstfsi(-0x1.23456789abcdefp+3, 0x0); | ||
| 726 | |||
| 727 | try test__fixunstfsi(0x1p+32, 0xFFFFFFFF); | ||
| 728 | } | ||
| 729 | |||
| 730 | fn test__fixtfdi(a: f128, expected: i64) !void { | ||
| 731 | const x = __fixtfdi(a); | ||
| 732 | try testing.expect(x == expected); | ||
| 733 | } | ||
| 734 | |||
| 735 | fn test__fixunstfdi(a: f128, expected: u64) !void { | ||
| 736 | const x = __fixunstfdi(a); | ||
| 737 | try testing.expect(x == expected); | ||
| 738 | } | ||
| 739 | |||
| 740 | test "fixtfdi" { | ||
| 741 | try test__fixtfdi(-math.floatMax(f128), math.minInt(i64)); | ||
| 742 | |||
| 743 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i64)); | ||
| 744 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+1023, -0x8000000000000000); | ||
| 745 | |||
| 746 | try test__fixtfdi(-0x1.0000000000000p+127, -0x8000000000000000); | ||
| 747 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+126, -0x8000000000000000); | ||
| 748 | try test__fixtfdi(-0x1.FFFFFFFFFFFFEp+126, -0x8000000000000000); | ||
| 749 | |||
| 750 | try test__fixtfdi(-0x1.0000000000001p+63, -0x8000000000000000); | ||
| 751 | try test__fixtfdi(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 752 | try test__fixtfdi(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 753 | try test__fixtfdi(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 754 | |||
| 755 | try test__fixtfdi(-0x1.FFFFFEp+62, -0x7FFFFF8000000000); | ||
| 756 | try test__fixtfdi(-0x1.FFFFFCp+62, -0x7FFFFF0000000000); | ||
| 757 | |||
| 758 | try test__fixtfdi(-0x1.000000p+31, -0x80000000); | ||
| 759 | try test__fixtfdi(-0x1.FFFFFFp+30, -0x7FFFFFC0); | ||
| 760 | try test__fixtfdi(-0x1.FFFFFEp+30, -0x7FFFFF80); | ||
| 761 | try test__fixtfdi(-0x1.FFFFFCp+30, -0x7FFFFF00); | ||
| 762 | |||
| 763 | try test__fixtfdi(-2.01, -2); | ||
| 764 | try test__fixtfdi(-2.0, -2); | ||
| 765 | try test__fixtfdi(-1.99, -1); | ||
| 766 | try test__fixtfdi(-1.0, -1); | ||
| 767 | try test__fixtfdi(-0.99, 0); | ||
| 768 | try test__fixtfdi(-0.5, 0); | ||
| 769 | try test__fixtfdi(-math.floatMin(f64), 0); | ||
| 770 | try test__fixtfdi(0.0, 0); | ||
| 771 | try test__fixtfdi(math.floatMin(f64), 0); | ||
| 772 | try test__fixtfdi(0.5, 0); | ||
| 773 | try test__fixtfdi(0.99, 0); | ||
| 774 | try test__fixtfdi(1.0, 1); | ||
| 775 | try test__fixtfdi(1.5, 1); | ||
| 776 | try test__fixtfdi(1.99, 1); | ||
| 777 | try test__fixtfdi(2.0, 2); | ||
| 778 | try test__fixtfdi(2.01, 2); | ||
| 779 | |||
| 780 | try test__fixtfdi(0x1.FFFFFCp+30, 0x7FFFFF00); | ||
| 781 | try test__fixtfdi(0x1.FFFFFEp+30, 0x7FFFFF80); | ||
| 782 | try test__fixtfdi(0x1.FFFFFFp+30, 0x7FFFFFC0); | ||
| 783 | try test__fixtfdi(0x1.000000p+31, 0x80000000); | ||
| 784 | |||
| 785 | try test__fixtfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 786 | try test__fixtfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 787 | |||
| 788 | try test__fixtfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 789 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 790 | try test__fixtfdi(0x1.0000000000000p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 791 | try test__fixtfdi(0x1.0000000000001p+63, 0x7FFFFFFFFFFFFFFF); | ||
| 792 | |||
| 793 | try test__fixtfdi(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 794 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFFFF); | ||
| 795 | try test__fixtfdi(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFF); | ||
| 796 | |||
| 797 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFF); | ||
| 798 | try test__fixtfdi(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i64)); | ||
| 799 | |||
| 800 | try test__fixtfdi(math.floatMax(f128), math.maxInt(i64)); | ||
| 801 | } | ||
| 802 | |||
| 803 | test "fixunstfdi" { | ||
| 804 | try test__fixunstfdi(0.0, 0); | ||
| 805 | |||
| 806 | try test__fixunstfdi(0.5, 0); | ||
| 807 | try test__fixunstfdi(0.99, 0); | ||
| 808 | try test__fixunstfdi(1.0, 1); | ||
| 809 | try test__fixunstfdi(1.5, 1); | ||
| 810 | try test__fixunstfdi(1.99, 1); | ||
| 811 | try test__fixunstfdi(2.0, 2); | ||
| 812 | try test__fixunstfdi(2.01, 2); | ||
| 813 | try test__fixunstfdi(-0.5, 0); | ||
| 814 | try test__fixunstfdi(-0.99, 0); | ||
| 815 | try test__fixunstfdi(-1.0, 0); | ||
| 816 | try test__fixunstfdi(-1.5, 0); | ||
| 817 | try test__fixunstfdi(-1.99, 0); | ||
| 818 | try test__fixunstfdi(-2.0, 0); | ||
| 819 | try test__fixunstfdi(-2.01, 0); | ||
| 820 | |||
| 821 | try test__fixunstfdi(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 822 | try test__fixunstfdi(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 823 | |||
| 824 | try test__fixunstfdi(-0x1.FFFFFEp+62, 0); | ||
| 825 | try test__fixunstfdi(-0x1.FFFFFCp+62, 0); | ||
| 826 | |||
| 827 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 828 | try test__fixunstfdi(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 829 | |||
| 830 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFp+62, 0); | ||
| 831 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFEp+62, 0); | ||
| 832 | |||
| 833 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFFEp+63, 0xFFFFFFFFFFFFFFFF); | ||
| 834 | try test__fixunstfdi(0x1.0000000000000002p+63, 0x8000000000000001); | ||
| 835 | try test__fixunstfdi(0x1.0000000000000000p+63, 0x8000000000000000); | ||
| 836 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFFCp+62, 0x7FFFFFFFFFFFFFFF); | ||
| 837 | try test__fixunstfdi(0x1.FFFFFFFFFFFFFFF8p+62, 0x7FFFFFFFFFFFFFFE); | ||
| 838 | try test__fixunstfdi(0x1p+64, 0xFFFFFFFFFFFFFFFF); | ||
| 839 | |||
| 840 | try test__fixunstfdi(-0x1.0000000000000000p+63, 0); | ||
| 841 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFFFCp+62, 0); | ||
| 842 | try test__fixunstfdi(-0x1.FFFFFFFFFFFFFFF8p+62, 0); | ||
| 843 | } | ||
| 844 | |||
| 845 | fn test__fixtfti(a: f128, expected: i128) !void { | ||
| 846 | const x = __fixtfti(a); | ||
| 847 | try testing.expect(x == expected); | ||
| 848 | } | ||
| 849 | |||
| 850 | fn test__fixunstfti(a: f128, expected: u128) !void { | ||
| 851 | const x = __fixunstfti(a); | ||
| 852 | try testing.expect(x == expected); | ||
| 853 | } | ||
| 854 | |||
| 855 | test "fixtfti" { | ||
| 856 | try test__fixtfti(-math.floatMax(f128), math.minInt(i128)); | ||
| 857 | |||
| 858 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, math.minInt(i128)); | ||
| 859 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+1023, -0x80000000000000000000000000000000); | ||
| 860 | |||
| 861 | try test__fixtfti(-0x1.0000000000000p+127, -0x80000000000000000000000000000000); | ||
| 862 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+126, -0x7FFFFFFFFFFFFC000000000000000000); | ||
| 863 | try test__fixtfti(-0x1.FFFFFFFFFFFFEp+126, -0x7FFFFFFFFFFFF8000000000000000000); | ||
| 864 | |||
| 865 | try test__fixtfti(-0x1.0000000000001p+63, -0x8000000000000800); | ||
| 866 | try test__fixtfti(-0x1.0000000000000p+63, -0x8000000000000000); | ||
| 867 | try test__fixtfti(-0x1.FFFFFFFFFFFFFp+62, -0x7FFFFFFFFFFFFC00); | ||
| 868 | try test__fixtfti(-0x1.FFFFFFFFFFFFEp+62, -0x7FFFFFFFFFFFF800); | ||
| 869 | |||
| 870 | try test__fixtfti(-0x1.FFFFFEp+62, -0x7fffff8000000000); | ||
| 871 | try test__fixtfti(-0x1.FFFFFCp+62, -0x7fffff0000000000); | ||
| 872 | |||
| 873 | try test__fixtfti(-2.01, -2); | ||
| 874 | try test__fixtfti(-2.0, -2); | ||
| 875 | try test__fixtfti(-1.99, -1); | ||
| 876 | try test__fixtfti(-1.0, -1); | ||
| 877 | try test__fixtfti(-0.99, 0); | ||
| 878 | try test__fixtfti(-0.5, 0); | ||
| 879 | try test__fixtfti(-math.floatMin(f128), 0); | ||
| 880 | try test__fixtfti(0.0, 0); | ||
| 881 | try test__fixtfti(math.floatMin(f128), 0); | ||
| 882 | try test__fixtfti(0.5, 0); | ||
| 883 | try test__fixtfti(0.99, 0); | ||
| 884 | try test__fixtfti(1.0, 1); | ||
| 885 | try test__fixtfti(1.5, 1); | ||
| 886 | try test__fixtfti(1.99, 1); | ||
| 887 | try test__fixtfti(2.0, 2); | ||
| 888 | try test__fixtfti(2.01, 2); | ||
| 889 | |||
| 890 | try test__fixtfti(0x1.FFFFFCp+62, 0x7FFFFF0000000000); | ||
| 891 | try test__fixtfti(0x1.FFFFFEp+62, 0x7FFFFF8000000000); | ||
| 892 | |||
| 893 | try test__fixtfti(0x1.FFFFFFFFFFFFEp+62, 0x7FFFFFFFFFFFF800); | ||
| 894 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+62, 0x7FFFFFFFFFFFFC00); | ||
| 895 | try test__fixtfti(0x1.0000000000000p+63, 0x8000000000000000); | ||
| 896 | try test__fixtfti(0x1.0000000000001p+63, 0x8000000000000800); | ||
| 897 | |||
| 898 | try test__fixtfti(0x1.FFFFFFFFFFFFEp+126, 0x7FFFFFFFFFFFF8000000000000000000); | ||
| 899 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+126, 0x7FFFFFFFFFFFFC000000000000000000); | ||
| 900 | try test__fixtfti(0x1.0000000000000p+127, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 901 | |||
| 902 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+1023, 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); | ||
| 903 | try test__fixtfti(0x1.FFFFFFFFFFFFFp+1023, math.maxInt(i128)); | ||
| 904 | |||
| 905 | try test__fixtfti(math.floatMax(f128), math.maxInt(i128)); | ||
| 906 | } | ||
| 907 | |||
| 908 | test "fixunstfti" { | ||
| 909 | try test__fixunstfti(math.inf(f128), 0xffffffffffffffffffffffffffffffff); | ||
| 910 | |||
| 911 | try test__fixunstfti(0.0, 0); | ||
| 912 | |||
| 913 | try test__fixunstfti(0.5, 0); | ||
| 914 | try test__fixunstfti(0.99, 0); | ||
| 915 | try test__fixunstfti(1.0, 1); | ||
| 916 | try test__fixunstfti(1.5, 1); | ||
| 917 | try test__fixunstfti(1.99, 1); | ||
| 918 | try test__fixunstfti(2.0, 2); | ||
| 919 | try test__fixunstfti(2.01, 2); | ||
| 920 | try test__fixunstfti(-0.01, 0); | ||
| 921 | try test__fixunstfti(-0.99, 0); | ||
| 922 | |||
| 923 | try test__fixunstfti(0x1p+128, 0xffffffffffffffffffffffffffffffff); | ||
| 924 | |||
| 925 | try test__fixunstfti(0x1.FFFFFEp+126, 0x7fffff80000000000000000000000000); | ||
| 926 | try test__fixunstfti(0x1.FFFFFEp+127, 0xffffff00000000000000000000000000); | ||
| 927 | try test__fixunstfti(0x1.FFFFFEp+128, 0xffffffffffffffffffffffffffffffff); | ||
| 928 | try test__fixunstfti(0x1.FFFFFEp+129, 0xffffffffffffffffffffffffffffffff); | ||
| 929 | } | ||
| 930 | |||
| 931 | fn test__fixunshfti(a: f16, expected: u128) !void { | ||
| 932 | const x = __fixunshfti(a); | ||
| 933 | try testing.expect(x == expected); | ||
| 934 | } | ||
| 935 | |||
| 936 | test "fixunshfti for f16" { | ||
| 937 | try test__fixunshfti(math.inf(f16), math.maxInt(u128)); | ||
| 938 | try test__fixunshfti(math.floatMax(f16), 65504); | ||
| 939 | } | ||
| 940 | |||
| 941 | fn test__fixunsxfti(a: f80, expected: u128) !void { | ||
| 942 | const x = __fixunsxfti(a); | ||
| 943 | try testing.expect(x == expected); | ||
| 944 | } | ||
| 945 | |||
| 946 | test "fixunsxfti for f80" { | ||
| 947 | try test__fixunsxfti(math.inf(f80), math.maxInt(u128)); | ||
| 948 | try test__fixunsxfti(math.floatMax(f80), math.maxInt(u128)); | ||
| 949 | try test__fixunsxfti(math.maxInt(u64), math.maxInt(u64)); | ||
| 950 | } | ||
lib/compiler_rt/int_to_float.zig deleted-58| ... | @@ -1,58 +0,0 @@ | ||
| 1 | const Int = @import("std").meta.Int; | ||
| 2 | const math = @import("std").math; | ||
| 3 | |||
| 4 | pub fn intToFloat(comptime T: type, x: anytype) T { | ||
| 5 | if (x == 0) return 0; | ||
| 6 | |||
| 7 | // Various constants whose values follow from the type parameters. | ||
| 8 | // Any reasonable optimizer will fold and propagate all of these. | ||
| 9 | const Z = Int(.unsigned, @bitSizeOf(@TypeOf(x))); | ||
| 10 | const uT = Int(.unsigned, @bitSizeOf(T)); | ||
| 11 | const inf = math.inf(T); | ||
| 12 | const float_bits = @bitSizeOf(T); | ||
| 13 | const int_bits = @bitSizeOf(@TypeOf(x)); | ||
| 14 | const exp_bits = math.floatExponentBits(T); | ||
| 15 | const fractional_bits = math.floatFractionalBits(T); | ||
| 16 | const exp_bias = math.maxInt(Int(.unsigned, exp_bits - 1)); | ||
| 17 | const implicit_bit = if (T != f80) @as(uT, 1) << fractional_bits else 0; | ||
| 18 | const max_exp = exp_bias; | ||
| 19 | |||
| 20 | // Sign | ||
| 21 | var abs_val = math.absCast(x); | ||
| 22 | const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0; | ||
| 23 | var result: uT = sign_bit; | ||
| 24 | |||
| 25 | // Compute significand | ||
| 26 | var exp = int_bits - @clz(abs_val) - 1; | ||
| 27 | if (int_bits <= fractional_bits or exp <= fractional_bits) { | ||
| 28 | const shift_amt = fractional_bits - @intCast(math.Log2Int(uT), exp); | ||
| 29 | |||
| 30 | // Shift up result to line up with the significand - no rounding required | ||
| 31 | result = (@intCast(uT, abs_val) << shift_amt); | ||
| 32 | result ^= implicit_bit; // Remove implicit integer bit | ||
| 33 | } else { | ||
| 34 | var shift_amt = @intCast(math.Log2Int(Z), exp - fractional_bits); | ||
| 35 | const exact_tie: bool = @ctz(abs_val) == shift_amt - 1; | ||
| 36 | |||
| 37 | // Shift down result and remove implicit integer bit | ||
| 38 | result = @intCast(uT, (abs_val >> (shift_amt - 1))) ^ (implicit_bit << 1); | ||
| 39 | |||
| 40 | // Round result, including round-to-even for exact ties | ||
| 41 | result = ((result + 1) >> 1) & ~@as(uT, @boolToInt(exact_tie)); | ||
| 42 | } | ||
| 43 | |||
| 44 | // Compute exponent | ||
| 45 | if ((int_bits > max_exp) and (exp > max_exp)) // If exponent too large, overflow to infinity | ||
| 46 | return @bitCast(T, sign_bit | @bitCast(uT, inf)); | ||
| 47 | |||
| 48 | result += (@as(uT, exp) + exp_bias) << math.floatMantissaBits(T); | ||
| 49 | |||
| 50 | // If the result included a carry, we need to restore the explicit integer bit | ||
| 51 | if (T == f80) result |= 1 << fractional_bits; | ||
| 52 | |||
| 53 | return @bitCast(T, sign_bit | result); | ||
| 54 | } | ||
| 55 | |||
| 56 | test { | ||
| 57 | _ = @import("int_to_float_test.zig"); | ||
| 58 | } | ||
lib/compiler_rt/int_to_float_test.zig deleted-836| ... | @@ -1,836 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const testing = std.testing; | ||
| 3 | const math = std.math; | ||
| 4 | |||
| 5 | const __floatunsihf = @import("floatunsihf.zig").__floatunsihf; | ||
| 6 | |||
| 7 | // Conversion to f32 | ||
| 8 | const __floatsisf = @import("floatsisf.zig").__floatsisf; | ||
| 9 | const __floatunsisf = @import("floatunsisf.zig").__floatunsisf; | ||
| 10 | const __floatdisf = @import("floatdisf.zig").__floatdisf; | ||
| 11 | const __floatundisf = @import("floatundisf.zig").__floatundisf; | ||
| 12 | const __floattisf = @import("floattisf.zig").__floattisf; | ||
| 13 | const __floatuntisf = @import("floatuntisf.zig").__floatuntisf; | ||
| 14 | |||
| 15 | // Conversion to f64 | ||
| 16 | const __floatsidf = @import("floatsidf.zig").__floatsidf; | ||
| 17 | const __floatunsidf = @import("floatunsidf.zig").__floatunsidf; | ||
| 18 | const __floatdidf = @import("floatdidf.zig").__floatdidf; | ||
| 19 | const __floatundidf = @import("floatundidf.zig").__floatundidf; | ||
| 20 | const __floattidf = @import("floattidf.zig").__floattidf; | ||
| 21 | const __floatuntidf = @import("floatuntidf.zig").__floatuntidf; | ||
| 22 | |||
| 23 | // Conversion to f128 | ||
| 24 | const __floatsitf = @import("floatsitf.zig").__floatsitf; | ||
| 25 | const __floatunsitf = @import("floatunsitf.zig").__floatunsitf; | ||
| 26 | const __floatditf = @import("floatditf.zig").__floatditf; | ||
| 27 | const __floatunditf = @import("floatunditf.zig").__floatunditf; | ||
| 28 | const __floattitf = @import("floattitf.zig").__floattitf; | ||
| 29 | const __floatuntitf = @import("floatuntitf.zig").__floatuntitf; | ||
| 30 | |||
| 31 | fn test__floatsisf(a: i32, expected: u32) !void { | ||
| 32 | const r = __floatsisf(a); | ||
| 33 | try std.testing.expect(@bitCast(u32, r) == expected); | ||
| 34 | } | ||
| 35 | |||
| 36 | fn test_one_floatunsisf(a: u32, expected: u32) !void { | ||
| 37 | const r = __floatunsisf(a); | ||
| 38 | try std.testing.expect(@bitCast(u32, r) == expected); | ||
| 39 | } | ||
| 40 | |||
| 41 | test "floatsisf" { | ||
| 42 | try test__floatsisf(0, 0x00000000); | ||
| 43 | try test__floatsisf(1, 0x3f800000); | ||
| 44 | try test__floatsisf(-1, 0xbf800000); | ||
| 45 | try test__floatsisf(0x7FFFFFFF, 0x4f000000); | ||
| 46 | try test__floatsisf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xcf000000); | ||
| 47 | } | ||
| 48 | |||
| 49 | test "floatunsisf" { | ||
| 50 | // Test the produced bit pattern | ||
| 51 | try test_one_floatunsisf(0, 0); | ||
| 52 | try test_one_floatunsisf(1, 0x3f800000); | ||
| 53 | try test_one_floatunsisf(0x7FFFFFFF, 0x4f000000); | ||
| 54 | try test_one_floatunsisf(0x80000000, 0x4f000000); | ||
| 55 | try test_one_floatunsisf(0xFFFFFFFF, 0x4f800000); | ||
| 56 | } | ||
| 57 | |||
| 58 | fn test__floatdisf(a: i64, expected: f32) !void { | ||
| 59 | const x = __floatdisf(a); | ||
| 60 | try testing.expect(x == expected); | ||
| 61 | } | ||
| 62 | |||
| 63 | fn test__floatundisf(a: u64, expected: f32) !void { | ||
| 64 | try std.testing.expectEqual(expected, __floatundisf(a)); | ||
| 65 | } | ||
| 66 | |||
| 67 | test "floatdisf" { | ||
| 68 | try test__floatdisf(0, 0.0); | ||
| 69 | try test__floatdisf(1, 1.0); | ||
| 70 | try test__floatdisf(2, 2.0); | ||
| 71 | try test__floatdisf(-1, -1.0); | ||
| 72 | try test__floatdisf(-2, -2.0); | ||
| 73 | try test__floatdisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 74 | try test__floatdisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 75 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); | ||
| 76 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); | ||
| 77 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000000)), -0x1.000000p+63); | ||
| 78 | try test__floatdisf(@bitCast(i64, @as(u64, 0x8000000000000001)), -0x1.000000p+63); | ||
| 79 | try test__floatdisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 80 | try test__floatdisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 81 | try test__floatdisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 82 | try test__floatdisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 83 | try test__floatdisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 84 | try test__floatdisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 85 | try test__floatdisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 86 | try test__floatdisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 87 | try test__floatdisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 88 | try test__floatdisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 89 | try test__floatdisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 90 | } | ||
| 91 | |||
| 92 | test "floatundisf" { | ||
| 93 | try test__floatundisf(0, 0.0); | ||
| 94 | try test__floatundisf(1, 1.0); | ||
| 95 | try test__floatundisf(2, 2.0); | ||
| 96 | try test__floatundisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 97 | try test__floatundisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 98 | try test__floatundisf(0x8000008000000000, 0x1p+63); | ||
| 99 | try test__floatundisf(0x8000010000000000, 0x1.000002p+63); | ||
| 100 | try test__floatundisf(0x8000000000000000, 0x1p+63); | ||
| 101 | try test__floatundisf(0x8000000000000001, 0x1p+63); | ||
| 102 | try test__floatundisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); | ||
| 103 | try test__floatundisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); | ||
| 104 | try test__floatundisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 105 | try test__floatundisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 106 | try test__floatundisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 107 | try test__floatundisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 108 | try test__floatundisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 109 | try test__floatundisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 110 | try test__floatundisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 111 | try test__floatundisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 112 | try test__floatundisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 113 | try test__floatundisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 114 | try test__floatundisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 115 | } | ||
| 116 | |||
| 117 | fn test__floattisf(a: i128, expected: f32) !void { | ||
| 118 | const x = __floattisf(a); | ||
| 119 | try testing.expect(x == expected); | ||
| 120 | } | ||
| 121 | |||
| 122 | fn test__floatuntisf(a: u128, expected: f32) !void { | ||
| 123 | const x = __floatuntisf(a); | ||
| 124 | try testing.expect(x == expected); | ||
| 125 | } | ||
| 126 | |||
| 127 | test "floattisf" { | ||
| 128 | try test__floattisf(0, 0.0); | ||
| 129 | |||
| 130 | try test__floattisf(1, 1.0); | ||
| 131 | try test__floattisf(2, 2.0); | ||
| 132 | try test__floattisf(-1, -1.0); | ||
| 133 | try test__floattisf(-2, -2.0); | ||
| 134 | |||
| 135 | try test__floattisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 136 | try test__floattisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 137 | |||
| 138 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000008000000000), -0x1.FFFFFEp+62); | ||
| 139 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000010000000000), -0x1.FFFFFCp+62); | ||
| 140 | |||
| 141 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000000), -0x1.000000p+63); | ||
| 142 | try test__floattisf(make_ti(0xFFFFFFFFFFFFFFFF, 0x8000000000000001), -0x1.000000p+63); | ||
| 143 | |||
| 144 | try test__floattisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 145 | |||
| 146 | try test__floattisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 147 | try test__floattisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 148 | try test__floattisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 149 | try test__floattisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 150 | try test__floattisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 151 | |||
| 152 | try test__floattisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 153 | try test__floattisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 154 | try test__floattisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 155 | try test__floattisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 156 | try test__floattisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 157 | |||
| 158 | try test__floattisf(make_ti(0x0007FB72E8000000, 0), 0x1.FEDCBAp+114); | ||
| 159 | |||
| 160 | try test__floattisf(make_ti(0x0007FB72EA000000, 0), 0x1.FEDCBAp+114); | ||
| 161 | try test__floattisf(make_ti(0x0007FB72EB000000, 0), 0x1.FEDCBAp+114); | ||
| 162 | try test__floattisf(make_ti(0x0007FB72EBFFFFFF, 0), 0x1.FEDCBAp+114); | ||
| 163 | try test__floattisf(make_ti(0x0007FB72EC000000, 0), 0x1.FEDCBCp+114); | ||
| 164 | try test__floattisf(make_ti(0x0007FB72E8000001, 0), 0x1.FEDCBAp+114); | ||
| 165 | |||
| 166 | try test__floattisf(make_ti(0x0007FB72E6000000, 0), 0x1.FEDCBAp+114); | ||
| 167 | try test__floattisf(make_ti(0x0007FB72E7000000, 0), 0x1.FEDCBAp+114); | ||
| 168 | try test__floattisf(make_ti(0x0007FB72E7FFFFFF, 0), 0x1.FEDCBAp+114); | ||
| 169 | try test__floattisf(make_ti(0x0007FB72E4000001, 0), 0x1.FEDCBAp+114); | ||
| 170 | try test__floattisf(make_ti(0x0007FB72E4000000, 0), 0x1.FEDCB8p+114); | ||
| 171 | } | ||
| 172 | |||
| 173 | test "floatuntisf" { | ||
| 174 | try test__floatuntisf(0, 0.0); | ||
| 175 | |||
| 176 | try test__floatuntisf(1, 1.0); | ||
| 177 | try test__floatuntisf(2, 2.0); | ||
| 178 | try test__floatuntisf(20, 20.0); | ||
| 179 | |||
| 180 | try test__floatuntisf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 181 | try test__floatuntisf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 182 | |||
| 183 | try test__floatuntisf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); | ||
| 184 | try test__floatuntisf(make_uti(0x8000000000000800, 0), 0x1.0p+127); | ||
| 185 | try test__floatuntisf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); | ||
| 186 | |||
| 187 | try test__floatuntisf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); | ||
| 188 | |||
| 189 | try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 190 | |||
| 191 | try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 192 | try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 193 | |||
| 194 | try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 195 | |||
| 196 | try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 197 | try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 198 | try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 199 | |||
| 200 | try test__floatuntisf(0xFFFFFFFFFFFFFFFE, 0x1p+64); | ||
| 201 | try test__floatuntisf(0xFFFFFFFFFFFFFFFF, 0x1p+64); | ||
| 202 | |||
| 203 | try test__floatuntisf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 204 | |||
| 205 | try test__floatuntisf(0x0007FB72EA000000, 0x1.FEDCBAp+50); | ||
| 206 | try test__floatuntisf(0x0007FB72EB000000, 0x1.FEDCBAp+50); | ||
| 207 | try test__floatuntisf(0x0007FB72EBFFFFFF, 0x1.FEDCBAp+50); | ||
| 208 | try test__floatuntisf(0x0007FB72EC000000, 0x1.FEDCBCp+50); | ||
| 209 | try test__floatuntisf(0x0007FB72E8000001, 0x1.FEDCBAp+50); | ||
| 210 | |||
| 211 | try test__floatuntisf(0x0007FB72E6000000, 0x1.FEDCBAp+50); | ||
| 212 | try test__floatuntisf(0x0007FB72E7000000, 0x1.FEDCBAp+50); | ||
| 213 | try test__floatuntisf(0x0007FB72E7FFFFFF, 0x1.FEDCBAp+50); | ||
| 214 | try test__floatuntisf(0x0007FB72E4000001, 0x1.FEDCBAp+50); | ||
| 215 | try test__floatuntisf(0x0007FB72E4000000, 0x1.FEDCB8p+50); | ||
| 216 | |||
| 217 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCB90000000000001), 0x1.FEDCBAp+76); | ||
| 218 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBA0000000000000), 0x1.FEDCBAp+76); | ||
| 219 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBAFFFFFFFFFFFFF), 0x1.FEDCBAp+76); | ||
| 220 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000000), 0x1.FEDCBCp+76); | ||
| 221 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBB0000000000001), 0x1.FEDCBCp+76); | ||
| 222 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBBFFFFFFFFFFFFF), 0x1.FEDCBCp+76); | ||
| 223 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000000), 0x1.FEDCBCp+76); | ||
| 224 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBC0000000000001), 0x1.FEDCBCp+76); | ||
| 225 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000000), 0x1.FEDCBCp+76); | ||
| 226 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBD0000000000001), 0x1.FEDCBEp+76); | ||
| 227 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBDFFFFFFFFFFFFF), 0x1.FEDCBEp+76); | ||
| 228 | try test__floatuntisf(make_uti(0x0000000000001FED, 0xCBE0000000000000), 0x1.FEDCBEp+76); | ||
| 229 | |||
| 230 | // Test overflow to infinity | ||
| 231 | try test__floatuntisf(@as(u128, math.maxInt(u128)), @bitCast(f32, math.inf(f32))); | ||
| 232 | } | ||
| 233 | |||
| 234 | fn test_one_floatsidf(a: i32, expected: u64) !void { | ||
| 235 | const r = __floatsidf(a); | ||
| 236 | try std.testing.expect(@bitCast(u64, r) == expected); | ||
| 237 | } | ||
| 238 | |||
| 239 | fn test_one_floatunsidf(a: u32, expected: u64) !void { | ||
| 240 | const r = __floatunsidf(a); | ||
| 241 | try std.testing.expect(@bitCast(u64, r) == expected); | ||
| 242 | } | ||
| 243 | |||
| 244 | test "floatsidf" { | ||
| 245 | try test_one_floatsidf(0, 0x0000000000000000); | ||
| 246 | try test_one_floatsidf(1, 0x3ff0000000000000); | ||
| 247 | try test_one_floatsidf(-1, 0xbff0000000000000); | ||
| 248 | try test_one_floatsidf(0x7FFFFFFF, 0x41dfffffffc00000); | ||
| 249 | try test_one_floatsidf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc1e0000000000000); | ||
| 250 | } | ||
| 251 | |||
| 252 | test "floatunsidf" { | ||
| 253 | try test_one_floatunsidf(0, 0x0000000000000000); | ||
| 254 | try test_one_floatunsidf(1, 0x3ff0000000000000); | ||
| 255 | try test_one_floatunsidf(0x7FFFFFFF, 0x41dfffffffc00000); | ||
| 256 | try test_one_floatunsidf(@intCast(u32, 0x80000000), 0x41e0000000000000); | ||
| 257 | try test_one_floatunsidf(@intCast(u32, 0xFFFFFFFF), 0x41efffffffe00000); | ||
| 258 | } | ||
| 259 | |||
| 260 | fn test__floatdidf(a: i64, expected: f64) !void { | ||
| 261 | const r = __floatdidf(a); | ||
| 262 | try testing.expect(r == expected); | ||
| 263 | } | ||
| 264 | |||
| 265 | fn test__floatundidf(a: u64, expected: f64) !void { | ||
| 266 | const r = __floatundidf(a); | ||
| 267 | try testing.expect(r == expected); | ||
| 268 | } | ||
| 269 | |||
| 270 | test "floatdidf" { | ||
| 271 | try test__floatdidf(0, 0.0); | ||
| 272 | try test__floatdidf(1, 1.0); | ||
| 273 | try test__floatdidf(2, 2.0); | ||
| 274 | try test__floatdidf(20, 20.0); | ||
| 275 | try test__floatdidf(-1, -1.0); | ||
| 276 | try test__floatdidf(-2, -2.0); | ||
| 277 | try test__floatdidf(-20, -20.0); | ||
| 278 | try test__floatdidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 279 | try test__floatdidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 280 | try test__floatdidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 281 | try test__floatdidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 282 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000008000000000)), -0x1.FFFFFEp+62); | ||
| 283 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000800)), -0x1.FFFFFFFFFFFFEp+62); | ||
| 284 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000010000000000)), -0x1.FFFFFCp+62); | ||
| 285 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000001000)), -0x1.FFFFFFFFFFFFCp+62); | ||
| 286 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000000)), -0x1.000000p+63); | ||
| 287 | try test__floatdidf(@bitCast(i64, @intCast(u64, 0x8000000000000001)), -0x1.000000p+63); // 0x8000000000000001 | ||
| 288 | try test__floatdidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 289 | try test__floatdidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 290 | try test__floatdidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 291 | try test__floatdidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 292 | try test__floatdidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 293 | try test__floatdidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 294 | try test__floatdidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 295 | try test__floatdidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 296 | try test__floatdidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 297 | try test__floatdidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 298 | try test__floatdidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 299 | try test__floatdidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 300 | try test__floatdidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 301 | try test__floatdidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 302 | try test__floatdidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 303 | try test__floatdidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 304 | try test__floatdidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 305 | try test__floatdidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 306 | try test__floatdidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 307 | try test__floatdidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 308 | try test__floatdidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 309 | try test__floatdidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 310 | try test__floatdidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 311 | try test__floatdidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 312 | try test__floatdidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 313 | try test__floatdidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 314 | } | ||
| 315 | |||
| 316 | test "floatundidf" { | ||
| 317 | try test__floatundidf(0, 0.0); | ||
| 318 | try test__floatundidf(1, 1.0); | ||
| 319 | try test__floatundidf(2, 2.0); | ||
| 320 | try test__floatundidf(20, 20.0); | ||
| 321 | try test__floatundidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 322 | try test__floatundidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 323 | try test__floatundidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 324 | try test__floatundidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 325 | try test__floatundidf(0x8000008000000000, 0x1.000001p+63); | ||
| 326 | try test__floatundidf(0x8000000000000800, 0x1.0000000000001p+63); | ||
| 327 | try test__floatundidf(0x8000010000000000, 0x1.000002p+63); | ||
| 328 | try test__floatundidf(0x8000000000001000, 0x1.0000000000002p+63); | ||
| 329 | try test__floatundidf(0x8000000000000000, 0x1p+63); | ||
| 330 | try test__floatundidf(0x8000000000000001, 0x1p+63); | ||
| 331 | try test__floatundidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 332 | try test__floatundidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 333 | try test__floatundidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 334 | try test__floatundidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 335 | try test__floatundidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 336 | try test__floatundidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 337 | try test__floatundidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 338 | try test__floatundidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 339 | try test__floatundidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 340 | try test__floatundidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 341 | try test__floatundidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 342 | try test__floatundidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 343 | try test__floatundidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 344 | try test__floatundidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 345 | try test__floatundidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 346 | try test__floatundidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 347 | try test__floatundidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 348 | try test__floatundidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 349 | try test__floatundidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 350 | try test__floatundidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 351 | try test__floatundidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 352 | try test__floatundidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 353 | try test__floatundidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 354 | try test__floatundidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 355 | try test__floatundidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 356 | try test__floatundidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 357 | } | ||
| 358 | |||
| 359 | fn test__floattidf(a: i128, expected: f64) !void { | ||
| 360 | const x = __floattidf(a); | ||
| 361 | try testing.expect(x == expected); | ||
| 362 | } | ||
| 363 | |||
| 364 | fn test__floatuntidf(a: u128, expected: f64) !void { | ||
| 365 | const x = __floatuntidf(a); | ||
| 366 | try testing.expect(x == expected); | ||
| 367 | } | ||
| 368 | |||
| 369 | test "floattidf" { | ||
| 370 | try test__floattidf(0, 0.0); | ||
| 371 | |||
| 372 | try test__floattidf(1, 1.0); | ||
| 373 | try test__floattidf(2, 2.0); | ||
| 374 | try test__floattidf(20, 20.0); | ||
| 375 | try test__floattidf(-1, -1.0); | ||
| 376 | try test__floattidf(-2, -2.0); | ||
| 377 | try test__floattidf(-20, -20.0); | ||
| 378 | |||
| 379 | try test__floattidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 380 | try test__floattidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 381 | try test__floattidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 382 | try test__floattidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 383 | |||
| 384 | try test__floattidf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); | ||
| 385 | try test__floattidf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); | ||
| 386 | try test__floattidf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); | ||
| 387 | try test__floattidf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); | ||
| 388 | |||
| 389 | try test__floattidf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); | ||
| 390 | try test__floattidf(make_ti(0x8000000000000001, 0), -0x1.000000p+127); | ||
| 391 | |||
| 392 | try test__floattidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 393 | |||
| 394 | try test__floattidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 395 | try test__floattidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 396 | try test__floattidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 397 | try test__floattidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 398 | try test__floattidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 399 | |||
| 400 | try test__floattidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 401 | try test__floattidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 402 | try test__floattidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 403 | try test__floattidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 404 | try test__floattidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 405 | |||
| 406 | try test__floattidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 407 | try test__floattidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 408 | try test__floattidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 409 | try test__floattidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 410 | try test__floattidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 411 | try test__floattidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 412 | try test__floattidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 413 | try test__floattidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 414 | try test__floattidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 415 | try test__floattidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 416 | try test__floattidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 417 | try test__floattidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 418 | try test__floattidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 419 | try test__floattidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 420 | try test__floattidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 421 | |||
| 422 | try test__floattidf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 423 | try test__floattidf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); | ||
| 424 | try test__floattidf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); | ||
| 425 | try test__floattidf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); | ||
| 426 | try test__floattidf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); | ||
| 427 | try test__floattidf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); | ||
| 428 | try test__floattidf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); | ||
| 429 | try test__floattidf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); | ||
| 430 | try test__floattidf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); | ||
| 431 | try test__floattidf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); | ||
| 432 | try test__floattidf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 433 | try test__floattidf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); | ||
| 434 | try test__floattidf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); | ||
| 435 | try test__floattidf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); | ||
| 436 | try test__floattidf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 437 | } | ||
| 438 | |||
| 439 | test "floatuntidf" { | ||
| 440 | try test__floatuntidf(0, 0.0); | ||
| 441 | |||
| 442 | try test__floatuntidf(1, 1.0); | ||
| 443 | try test__floatuntidf(2, 2.0); | ||
| 444 | try test__floatuntidf(20, 20.0); | ||
| 445 | |||
| 446 | try test__floatuntidf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 447 | try test__floatuntidf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 448 | try test__floatuntidf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 449 | try test__floatuntidf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 450 | |||
| 451 | try test__floatuntidf(make_uti(0x8000008000000000, 0), 0x1.000001p+127); | ||
| 452 | try test__floatuntidf(make_uti(0x8000000000000800, 0), 0x1.0000000000001p+127); | ||
| 453 | try test__floatuntidf(make_uti(0x8000010000000000, 0), 0x1.000002p+127); | ||
| 454 | try test__floatuntidf(make_uti(0x8000000000001000, 0), 0x1.0000000000002p+127); | ||
| 455 | |||
| 456 | try test__floatuntidf(make_uti(0x8000000000000000, 0), 0x1.000000p+127); | ||
| 457 | try test__floatuntidf(make_uti(0x8000000000000001, 0), 0x1.0000000000000002p+127); | ||
| 458 | |||
| 459 | try test__floatuntidf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 460 | |||
| 461 | try test__floatuntidf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 462 | try test__floatuntidf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 463 | try test__floatuntidf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 464 | try test__floatuntidf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 465 | try test__floatuntidf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 466 | |||
| 467 | try test__floatuntidf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 468 | try test__floatuntidf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 469 | try test__floatuntidf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 470 | try test__floatuntidf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 471 | try test__floatuntidf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 472 | |||
| 473 | try test__floatuntidf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 474 | try test__floatuntidf(0x023479FD0E092DA1, 0x1.1A3CFE870496Dp+57); | ||
| 475 | try test__floatuntidf(0x023479FD0E092DB0, 0x1.1A3CFE870496Ep+57); | ||
| 476 | try test__floatuntidf(0x023479FD0E092DB8, 0x1.1A3CFE870496Ep+57); | ||
| 477 | try test__floatuntidf(0x023479FD0E092DB6, 0x1.1A3CFE870496Ep+57); | ||
| 478 | try test__floatuntidf(0x023479FD0E092DBF, 0x1.1A3CFE870496Ep+57); | ||
| 479 | try test__floatuntidf(0x023479FD0E092DC1, 0x1.1A3CFE870496Ep+57); | ||
| 480 | try test__floatuntidf(0x023479FD0E092DC7, 0x1.1A3CFE870496Ep+57); | ||
| 481 | try test__floatuntidf(0x023479FD0E092DC8, 0x1.1A3CFE870496Ep+57); | ||
| 482 | try test__floatuntidf(0x023479FD0E092DCF, 0x1.1A3CFE870496Ep+57); | ||
| 483 | try test__floatuntidf(0x023479FD0E092DD0, 0x1.1A3CFE870496Ep+57); | ||
| 484 | try test__floatuntidf(0x023479FD0E092DD1, 0x1.1A3CFE870496Fp+57); | ||
| 485 | try test__floatuntidf(0x023479FD0E092DD8, 0x1.1A3CFE870496Fp+57); | ||
| 486 | try test__floatuntidf(0x023479FD0E092DDF, 0x1.1A3CFE870496Fp+57); | ||
| 487 | try test__floatuntidf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 488 | |||
| 489 | try test__floatuntidf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 490 | try test__floatuntidf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496Dp+121); | ||
| 491 | try test__floatuntidf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496Ep+121); | ||
| 492 | try test__floatuntidf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496Ep+121); | ||
| 493 | try test__floatuntidf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496Ep+121); | ||
| 494 | try test__floatuntidf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496Ep+121); | ||
| 495 | try test__floatuntidf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496Ep+121); | ||
| 496 | try test__floatuntidf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496Ep+121); | ||
| 497 | try test__floatuntidf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496Ep+121); | ||
| 498 | try test__floatuntidf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496Ep+121); | ||
| 499 | try test__floatuntidf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 500 | try test__floatuntidf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496Fp+121); | ||
| 501 | try test__floatuntidf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496Fp+121); | ||
| 502 | try test__floatuntidf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496Fp+121); | ||
| 503 | try test__floatuntidf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 504 | } | ||
| 505 | |||
| 506 | fn test__floatsitf(a: i32, expected: u128) !void { | ||
| 507 | const r = __floatsitf(a); | ||
| 508 | try std.testing.expect(@bitCast(u128, r) == expected); | ||
| 509 | } | ||
| 510 | |||
| 511 | test "floatsitf" { | ||
| 512 | try test__floatsitf(0, 0); | ||
| 513 | try test__floatsitf(0x7FFFFFFF, 0x401dfffffffc00000000000000000000); | ||
| 514 | try test__floatsitf(0x12345678, 0x401b2345678000000000000000000000); | ||
| 515 | try test__floatsitf(-0x12345678, 0xc01b2345678000000000000000000000); | ||
| 516 | try test__floatsitf(@bitCast(i32, @intCast(u32, 0xffffffff)), 0xbfff0000000000000000000000000000); | ||
| 517 | try test__floatsitf(@bitCast(i32, @intCast(u32, 0x80000000)), 0xc01e0000000000000000000000000000); | ||
| 518 | } | ||
| 519 | |||
| 520 | fn test__floatunsitf(a: u32, expected_hi: u64, expected_lo: u64) !void { | ||
| 521 | const x = __floatunsitf(a); | ||
| 522 | |||
| 523 | const x_repr = @bitCast(u128, x); | ||
| 524 | const x_hi = @intCast(u64, x_repr >> 64); | ||
| 525 | const x_lo = @truncate(u64, x_repr); | ||
| 526 | |||
| 527 | if (x_hi == expected_hi and x_lo == expected_lo) { | ||
| 528 | return; | ||
| 529 | } | ||
| 530 | // nan repr | ||
| 531 | else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { | ||
| 532 | if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { | ||
| 533 | return; | ||
| 534 | } | ||
| 535 | } | ||
| 536 | |||
| 537 | @panic("__floatunsitf test failure"); | ||
| 538 | } | ||
| 539 | |||
| 540 | test "floatunsitf" { | ||
| 541 | try test__floatunsitf(0x7fffffff, 0x401dfffffffc0000, 0x0); | ||
| 542 | try test__floatunsitf(0, 0x0, 0x0); | ||
| 543 | try test__floatunsitf(0xffffffff, 0x401efffffffe0000, 0x0); | ||
| 544 | try test__floatunsitf(0x12345678, 0x401b234567800000, 0x0); | ||
| 545 | } | ||
| 546 | |||
| 547 | fn test__floatditf(a: i64, expected: f128) !void { | ||
| 548 | const x = __floatditf(a); | ||
| 549 | try testing.expect(x == expected); | ||
| 550 | } | ||
| 551 | |||
| 552 | fn test__floatunditf(a: u64, expected_hi: u64, expected_lo: u64) !void { | ||
| 553 | const x = __floatunditf(a); | ||
| 554 | |||
| 555 | const x_repr = @bitCast(u128, x); | ||
| 556 | const x_hi = @intCast(u64, x_repr >> 64); | ||
| 557 | const x_lo = @truncate(u64, x_repr); | ||
| 558 | |||
| 559 | if (x_hi == expected_hi and x_lo == expected_lo) { | ||
| 560 | return; | ||
| 561 | } | ||
| 562 | // nan repr | ||
| 563 | else if (expected_hi == 0x7fff800000000000 and expected_lo == 0x0) { | ||
| 564 | if ((x_hi & 0x7fff000000000000) == 0x7fff000000000000 and ((x_hi & 0xffffffffffff) > 0 or x_lo > 0)) { | ||
| 565 | return; | ||
| 566 | } | ||
| 567 | } | ||
| 568 | |||
| 569 | @panic("__floatunditf test failure"); | ||
| 570 | } | ||
| 571 | |||
| 572 | test "floatditf" { | ||
| 573 | try test__floatditf(0x7fffffffffffffff, make_tf(0x403dffffffffffff, 0xfffc000000000000)); | ||
| 574 | try test__floatditf(0x123456789abcdef1, make_tf(0x403b23456789abcd, 0xef10000000000000)); | ||
| 575 | try test__floatditf(0x2, make_tf(0x4000000000000000, 0x0)); | ||
| 576 | try test__floatditf(0x1, make_tf(0x3fff000000000000, 0x0)); | ||
| 577 | try test__floatditf(0x0, make_tf(0x0, 0x0)); | ||
| 578 | try test__floatditf(@bitCast(i64, @as(u64, 0xffffffffffffffff)), make_tf(0xbfff000000000000, 0x0)); | ||
| 579 | try test__floatditf(@bitCast(i64, @as(u64, 0xfffffffffffffffe)), make_tf(0xc000000000000000, 0x0)); | ||
| 580 | try test__floatditf(-0x123456789abcdef1, make_tf(0xc03b23456789abcd, 0xef10000000000000)); | ||
| 581 | try test__floatditf(@bitCast(i64, @as(u64, 0x8000000000000000)), make_tf(0xc03e000000000000, 0x0)); | ||
| 582 | } | ||
| 583 | |||
| 584 | test "floatunditf" { | ||
| 585 | try test__floatunditf(0xffffffffffffffff, 0x403effffffffffff, 0xfffe000000000000); | ||
| 586 | try test__floatunditf(0xfffffffffffffffe, 0x403effffffffffff, 0xfffc000000000000); | ||
| 587 | try test__floatunditf(0x8000000000000000, 0x403e000000000000, 0x0); | ||
| 588 | try test__floatunditf(0x7fffffffffffffff, 0x403dffffffffffff, 0xfffc000000000000); | ||
| 589 | try test__floatunditf(0x123456789abcdef1, 0x403b23456789abcd, 0xef10000000000000); | ||
| 590 | try test__floatunditf(0x2, 0x4000000000000000, 0x0); | ||
| 591 | try test__floatunditf(0x1, 0x3fff000000000000, 0x0); | ||
| 592 | try test__floatunditf(0x0, 0x0, 0x0); | ||
| 593 | } | ||
| 594 | |||
| 595 | fn test__floattitf(a: i128, expected: f128) !void { | ||
| 596 | const x = __floattitf(a); | ||
| 597 | try testing.expect(x == expected); | ||
| 598 | } | ||
| 599 | |||
| 600 | fn test__floatuntitf(a: u128, expected: f128) !void { | ||
| 601 | const x = __floatuntitf(a); | ||
| 602 | try testing.expect(x == expected); | ||
| 603 | } | ||
| 604 | |||
| 605 | test "floattitf" { | ||
| 606 | try test__floattitf(0, 0.0); | ||
| 607 | |||
| 608 | try test__floattitf(1, 1.0); | ||
| 609 | try test__floattitf(2, 2.0); | ||
| 610 | try test__floattitf(20, 20.0); | ||
| 611 | try test__floattitf(-1, -1.0); | ||
| 612 | try test__floattitf(-2, -2.0); | ||
| 613 | try test__floattitf(-20, -20.0); | ||
| 614 | |||
| 615 | try test__floattitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 616 | try test__floattitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 617 | try test__floattitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 618 | try test__floattitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 619 | |||
| 620 | try test__floattitf(make_ti(0x8000008000000000, 0), -0x1.FFFFFEp+126); | ||
| 621 | try test__floattitf(make_ti(0x8000000000000800, 0), -0x1.FFFFFFFFFFFFEp+126); | ||
| 622 | try test__floattitf(make_ti(0x8000010000000000, 0), -0x1.FFFFFCp+126); | ||
| 623 | try test__floattitf(make_ti(0x8000000000001000, 0), -0x1.FFFFFFFFFFFFCp+126); | ||
| 624 | |||
| 625 | try test__floattitf(make_ti(0x8000000000000000, 0), -0x1.000000p+127); | ||
| 626 | try test__floattitf(make_ti(0x8000000000000001, 0), -0x1.FFFFFFFFFFFFFFFCp+126); | ||
| 627 | |||
| 628 | try test__floattitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 629 | |||
| 630 | try test__floattitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 631 | try test__floattitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 632 | try test__floattitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 633 | try test__floattitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 634 | try test__floattitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 635 | |||
| 636 | try test__floattitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 637 | try test__floattitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 638 | try test__floattitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 639 | try test__floattitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 640 | try test__floattitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 641 | |||
| 642 | try test__floattitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 643 | try test__floattitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); | ||
| 644 | try test__floattitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); | ||
| 645 | try test__floattitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); | ||
| 646 | try test__floattitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); | ||
| 647 | try test__floattitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); | ||
| 648 | try test__floattitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); | ||
| 649 | try test__floattitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); | ||
| 650 | try test__floattitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); | ||
| 651 | try test__floattitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); | ||
| 652 | try test__floattitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); | ||
| 653 | try test__floattitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); | ||
| 654 | try test__floattitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); | ||
| 655 | try test__floattitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); | ||
| 656 | try test__floattitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 657 | |||
| 658 | try test__floattitf(make_ti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 659 | try test__floattitf(make_ti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); | ||
| 660 | try test__floattitf(make_ti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); | ||
| 661 | try test__floattitf(make_ti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); | ||
| 662 | try test__floattitf(make_ti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); | ||
| 663 | try test__floattitf(make_ti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); | ||
| 664 | try test__floattitf(make_ti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); | ||
| 665 | try test__floattitf(make_ti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); | ||
| 666 | try test__floattitf(make_ti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); | ||
| 667 | try test__floattitf(make_ti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); | ||
| 668 | try test__floattitf(make_ti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); | ||
| 669 | try test__floattitf(make_ti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); | ||
| 670 | try test__floattitf(make_ti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); | ||
| 671 | try test__floattitf(make_ti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); | ||
| 672 | try test__floattitf(make_ti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 673 | |||
| 674 | try test__floattitf(make_ti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); | ||
| 675 | |||
| 676 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 677 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 678 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 679 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 680 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 681 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 682 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 683 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 684 | try test__floattitf(make_ti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 685 | } | ||
| 686 | |||
| 687 | test "floatuntitf" { | ||
| 688 | try test__floatuntitf(0, 0.0); | ||
| 689 | |||
| 690 | try test__floatuntitf(1, 1.0); | ||
| 691 | try test__floatuntitf(2, 2.0); | ||
| 692 | try test__floatuntitf(20, 20.0); | ||
| 693 | |||
| 694 | try test__floatuntitf(0x7FFFFF8000000000, 0x1.FFFFFEp+62); | ||
| 695 | try test__floatuntitf(0x7FFFFFFFFFFFF800, 0x1.FFFFFFFFFFFFEp+62); | ||
| 696 | try test__floatuntitf(0x7FFFFF0000000000, 0x1.FFFFFCp+62); | ||
| 697 | try test__floatuntitf(0x7FFFFFFFFFFFF000, 0x1.FFFFFFFFFFFFCp+62); | ||
| 698 | try test__floatuntitf(0x7FFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFEp+59); | ||
| 699 | try test__floatuntitf(0xFFFFFFFFFFFFFFFE, 0xF.FFFFFFFFFFFFFFEp+60); | ||
| 700 | try test__floatuntitf(0xFFFFFFFFFFFFFFFF, 0xF.FFFFFFFFFFFFFFFp+60); | ||
| 701 | |||
| 702 | try test__floatuntitf(0x8000008000000000, 0x8.000008p+60); | ||
| 703 | try test__floatuntitf(0x8000000000000800, 0x8.0000000000008p+60); | ||
| 704 | try test__floatuntitf(0x8000010000000000, 0x8.00001p+60); | ||
| 705 | try test__floatuntitf(0x8000000000001000, 0x8.000000000001p+60); | ||
| 706 | |||
| 707 | try test__floatuntitf(0x8000000000000000, 0x8p+60); | ||
| 708 | try test__floatuntitf(0x8000000000000001, 0x8.000000000000001p+60); | ||
| 709 | |||
| 710 | try test__floatuntitf(0x0007FB72E8000000, 0x1.FEDCBAp+50); | ||
| 711 | |||
| 712 | try test__floatuntitf(0x0007FB72EA000000, 0x1.FEDCBA8p+50); | ||
| 713 | try test__floatuntitf(0x0007FB72EB000000, 0x1.FEDCBACp+50); | ||
| 714 | try test__floatuntitf(0x0007FB72EBFFFFFF, 0x1.FEDCBAFFFFFFCp+50); | ||
| 715 | try test__floatuntitf(0x0007FB72EC000000, 0x1.FEDCBBp+50); | ||
| 716 | try test__floatuntitf(0x0007FB72E8000001, 0x1.FEDCBA0000004p+50); | ||
| 717 | |||
| 718 | try test__floatuntitf(0x0007FB72E6000000, 0x1.FEDCB98p+50); | ||
| 719 | try test__floatuntitf(0x0007FB72E7000000, 0x1.FEDCB9Cp+50); | ||
| 720 | try test__floatuntitf(0x0007FB72E7FFFFFF, 0x1.FEDCB9FFFFFFCp+50); | ||
| 721 | try test__floatuntitf(0x0007FB72E4000001, 0x1.FEDCB90000004p+50); | ||
| 722 | try test__floatuntitf(0x0007FB72E4000000, 0x1.FEDCB9p+50); | ||
| 723 | |||
| 724 | try test__floatuntitf(0x023479FD0E092DC0, 0x1.1A3CFE870496Ep+57); | ||
| 725 | try test__floatuntitf(0x023479FD0E092DA1, 0x1.1A3CFE870496D08p+57); | ||
| 726 | try test__floatuntitf(0x023479FD0E092DB0, 0x1.1A3CFE870496D8p+57); | ||
| 727 | try test__floatuntitf(0x023479FD0E092DB8, 0x1.1A3CFE870496DCp+57); | ||
| 728 | try test__floatuntitf(0x023479FD0E092DB6, 0x1.1A3CFE870496DBp+57); | ||
| 729 | try test__floatuntitf(0x023479FD0E092DBF, 0x1.1A3CFE870496DF8p+57); | ||
| 730 | try test__floatuntitf(0x023479FD0E092DC1, 0x1.1A3CFE870496E08p+57); | ||
| 731 | try test__floatuntitf(0x023479FD0E092DC7, 0x1.1A3CFE870496E38p+57); | ||
| 732 | try test__floatuntitf(0x023479FD0E092DC8, 0x1.1A3CFE870496E4p+57); | ||
| 733 | try test__floatuntitf(0x023479FD0E092DCF, 0x1.1A3CFE870496E78p+57); | ||
| 734 | try test__floatuntitf(0x023479FD0E092DD0, 0x1.1A3CFE870496E8p+57); | ||
| 735 | try test__floatuntitf(0x023479FD0E092DD1, 0x1.1A3CFE870496E88p+57); | ||
| 736 | try test__floatuntitf(0x023479FD0E092DD8, 0x1.1A3CFE870496ECp+57); | ||
| 737 | try test__floatuntitf(0x023479FD0E092DDF, 0x1.1A3CFE870496EF8p+57); | ||
| 738 | try test__floatuntitf(0x023479FD0E092DE0, 0x1.1A3CFE870496Fp+57); | ||
| 739 | |||
| 740 | try test__floatuntitf(make_uti(0x023479FD0E092DC0, 0), 0x1.1A3CFE870496Ep+121); | ||
| 741 | try test__floatuntitf(make_uti(0x023479FD0E092DA1, 1), 0x1.1A3CFE870496D08p+121); | ||
| 742 | try test__floatuntitf(make_uti(0x023479FD0E092DB0, 2), 0x1.1A3CFE870496D8p+121); | ||
| 743 | try test__floatuntitf(make_uti(0x023479FD0E092DB8, 3), 0x1.1A3CFE870496DCp+121); | ||
| 744 | try test__floatuntitf(make_uti(0x023479FD0E092DB6, 4), 0x1.1A3CFE870496DBp+121); | ||
| 745 | try test__floatuntitf(make_uti(0x023479FD0E092DBF, 5), 0x1.1A3CFE870496DF8p+121); | ||
| 746 | try test__floatuntitf(make_uti(0x023479FD0E092DC1, 6), 0x1.1A3CFE870496E08p+121); | ||
| 747 | try test__floatuntitf(make_uti(0x023479FD0E092DC7, 7), 0x1.1A3CFE870496E38p+121); | ||
| 748 | try test__floatuntitf(make_uti(0x023479FD0E092DC8, 8), 0x1.1A3CFE870496E4p+121); | ||
| 749 | try test__floatuntitf(make_uti(0x023479FD0E092DCF, 9), 0x1.1A3CFE870496E78p+121); | ||
| 750 | try test__floatuntitf(make_uti(0x023479FD0E092DD0, 0), 0x1.1A3CFE870496E8p+121); | ||
| 751 | try test__floatuntitf(make_uti(0x023479FD0E092DD1, 11), 0x1.1A3CFE870496E88p+121); | ||
| 752 | try test__floatuntitf(make_uti(0x023479FD0E092DD8, 12), 0x1.1A3CFE870496ECp+121); | ||
| 753 | try test__floatuntitf(make_uti(0x023479FD0E092DDF, 13), 0x1.1A3CFE870496EF8p+121); | ||
| 754 | try test__floatuntitf(make_uti(0x023479FD0E092DE0, 14), 0x1.1A3CFE870496Fp+121); | ||
| 755 | |||
| 756 | try test__floatuntitf(make_uti(0, 0xFFFFFFFFFFFFFFFF), 0x1.FFFFFFFFFFFFFFFEp+63); | ||
| 757 | |||
| 758 | try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0x0000000000000000), 0x1.FFFFFFFFFFFFFFFEp+127); | ||
| 759 | try test__floatuntitf(make_uti(0xFFFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF), 0x1.0000000000000000p+128); | ||
| 760 | |||
| 761 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC2801), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 762 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3000), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 763 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC37FF), 0x1.23456789ABCDEF0123456789ABC3p+124); | ||
| 764 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC3800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 765 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4000), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 766 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC47FF), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 767 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4800), 0x1.23456789ABCDEF0123456789ABC4p+124); | ||
| 768 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC4801), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 769 | try test__floatuntitf(make_uti(0x123456789ABCDEF0, 0x123456789ABC57FF), 0x1.23456789ABCDEF0123456789ABC5p+124); | ||
| 770 | } | ||
| 771 | |||
| 772 | fn make_ti(high: u64, low: u64) i128 { | ||
| 773 | var result: u128 = high; | ||
| 774 | result <<= 64; | ||
| 775 | result |= low; | ||
| 776 | return @bitCast(i128, result); | ||
| 777 | } | ||
| 778 | |||
| 779 | fn make_uti(high: u64, low: u64) u128 { | ||
| 780 | var result: u128 = high; | ||
| 781 | result <<= 64; | ||
| 782 | result |= low; | ||
| 783 | return result; | ||
| 784 | } | ||
| 785 | |||
| 786 | fn make_tf(high: u64, low: u64) f128 { | ||
| 787 | var result: u128 = high; | ||
| 788 | result <<= 64; | ||
| 789 | result |= low; | ||
| 790 | return @bitCast(f128, result); | ||
| 791 | } | ||
| 792 | |||
| 793 | test "conversion to f16" { | ||
| 794 | try testing.expect(__floatunsihf(@as(u32, 0)) == 0.0); | ||
| 795 | try testing.expect(__floatunsihf(@as(u32, 1)) == 1.0); | ||
| 796 | try testing.expect(__floatunsihf(@as(u32, 65504)) == 65504); | ||
| 797 | try testing.expect(__floatunsihf(@as(u32, 65504 + (1 << 4))) == math.inf(f16)); | ||
| 798 | } | ||
| 799 | |||
| 800 | test "conversion to f32" { | ||
| 801 | try testing.expect(__floatunsisf(@as(u32, 0)) == 0.0); | ||
| 802 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u32))) != 1.0); | ||
| 803 | try testing.expect(__floatsisf(@as(i32, math.minInt(i32))) != 1.0); | ||
| 804 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24))) == math.maxInt(u24)); | ||
| 805 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 1) == math.maxInt(u24) + 1); // 0x100_0000 - Exact | ||
| 806 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 2) == math.maxInt(u24) + 1); // 0x100_0001 - Tie: Rounds down to even | ||
| 807 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 3) == math.maxInt(u24) + 3); // 0x100_0002 - Exact | ||
| 808 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 4) == math.maxInt(u24) + 5); // 0x100_0003 - Tie: Rounds up to even | ||
| 809 | try testing.expect(__floatunsisf(@as(u32, math.maxInt(u24)) + 5) == math.maxInt(u24) + 5); // 0x100_0004 - Exact | ||
| 810 | } | ||
| 811 | |||
| 812 | test "conversion to f80" { | ||
| 813 | if (std.debug.runtime_safety) return error.SkipZigTest; | ||
| 814 | |||
| 815 | const intToFloat = @import("./int_to_float.zig").intToFloat; | ||
| 816 | |||
| 817 | try testing.expect(intToFloat(f80, @as(i80, -12)) == -12); | ||
| 818 | try testing.expect(@floatToInt(u80, intToFloat(f80, @as(u64, math.maxInt(u64)) + 0)) == math.maxInt(u64) + 0); | ||
| 819 | try testing.expect(@floatToInt(u80, intToFloat(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); | ||
| 820 | |||
| 821 | try testing.expect(intToFloat(f80, @as(u32, 0)) == 0.0); | ||
| 822 | try testing.expect(intToFloat(f80, @as(u32, 1)) == 1.0); | ||
| 823 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u32, math.maxInt(u24)) + 0)) == math.maxInt(u24)); | ||
| 824 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 0)) == math.maxInt(u64)); | ||
| 825 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 1)) == math.maxInt(u64) + 1); // Exact | ||
| 826 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 2)) == math.maxInt(u64) + 1); // Rounds down | ||
| 827 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 3)) == math.maxInt(u64) + 3); // Tie - Exact | ||
| 828 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u64)) + 4)) == math.maxInt(u64) + 5); // Rounds up | ||
| 829 | |||
| 830 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 0)) == math.maxInt(u65) + 1); // Rounds up | ||
| 831 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 1)) == math.maxInt(u65) + 1); // Exact | ||
| 832 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 2)) == math.maxInt(u65) + 1); // Rounds down | ||
| 833 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 3)) == math.maxInt(u65) + 1); // Tie - Rounds down | ||
| 834 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 4)) == math.maxInt(u65) + 5); // Rounds up | ||
| 835 | try testing.expect(@floatToInt(u128, intToFloat(f80, @as(u80, math.maxInt(u65)) + 5)) == math.maxInt(u65) + 5); // Exact | ||
| 836 | } | ||
lib/compiler_rt/log.zig+2-2| ... | @@ -77,7 +77,7 @@ pub fn logf(x_: f32) callconv(.C) f32 { | ... | @@ -77,7 +77,7 @@ pub fn logf(x_: f32) callconv(.C) f32 { |
| 77 | const t2 = z * (Lg1 + w * Lg3); | 77 | const t2 = z * (Lg1 + w * Lg3); |
| 78 | const R = t2 + t1; | 78 | const R = t2 + t1; |
| 79 | const hfsq = 0.5 * f * f; | 79 | const hfsq = 0.5 * f * f; |
| 80 | const dk = @intToFloat(f32, k); | 80 | const dk = @floatFromInt(f32, k); |
| 81 | 81 | ||
| 82 | return s * (hfsq + R) + dk * ln2_lo - hfsq + f + dk * ln2_hi; | 82 | return s * (hfsq + R) + dk * ln2_lo - hfsq + f + dk * ln2_hi; |
| 83 | } | 83 | } |
| ... | @@ -133,7 +133,7 @@ pub fn log(x_: f64) callconv(.C) f64 { | ... | @@ -133,7 +133,7 @@ pub fn log(x_: f64) callconv(.C) f64 { |
| 133 | const t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); | 133 | const t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); |
| 134 | const t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); | 134 | const t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); |
| 135 | const R = t2 + t1; | 135 | const R = t2 + t1; |
| 136 | const dk = @intToFloat(f64, k); | 136 | const dk = @floatFromInt(f64, k); |
| 137 | 137 | ||
| 138 | return s * (hfsq + R) + dk * ln2_lo - hfsq + f + dk * ln2_hi; | 138 | return s * (hfsq + R) + dk * ln2_lo - hfsq + f + dk * ln2_hi; |
| 139 | } | 139 | } |
lib/compiler_rt/log10.zig+2-2| ... | @@ -86,7 +86,7 @@ pub fn log10f(x_: f32) callconv(.C) f32 { | ... | @@ -86,7 +86,7 @@ pub fn log10f(x_: f32) callconv(.C) f32 { |
| 86 | u &= 0xFFFFF000; | 86 | u &= 0xFFFFF000; |
| 87 | hi = @bitCast(f32, u); | 87 | hi = @bitCast(f32, u); |
| 88 | const lo = f - hi - hfsq + s * (hfsq + R); | 88 | const lo = f - hi - hfsq + s * (hfsq + R); |
| 89 | const dk = @intToFloat(f32, k); | 89 | const dk = @floatFromInt(f32, k); |
| 90 | 90 | ||
| 91 | return dk * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi + hi * ivln10hi + dk * log10_2hi; | 91 | return dk * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi + hi * ivln10hi + dk * log10_2hi; |
| 92 | } | 92 | } |
| ... | @@ -154,7 +154,7 @@ pub fn log10(x_: f64) callconv(.C) f64 { | ... | @@ -154,7 +154,7 @@ pub fn log10(x_: f64) callconv(.C) f64 { |
| 154 | 154 | ||
| 155 | // val_hi + val_lo ~ log10(1 + f) + k * log10(2) | 155 | // val_hi + val_lo ~ log10(1 + f) + k * log10(2) |
| 156 | var val_hi = hi * ivln10hi; | 156 | var val_hi = hi * ivln10hi; |
| 157 | const dk = @intToFloat(f64, k); | 157 | const dk = @floatFromInt(f64, k); |
| 158 | const y = dk * log10_2hi; | 158 | const y = dk * log10_2hi; |
| 159 | var val_lo = dk * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi; | 159 | var val_lo = dk * log10_2lo + (lo + hi) * ivln10lo + lo * ivln10hi; |
| 160 | 160 |
lib/compiler_rt/log2.zig+2-2| ... | @@ -84,7 +84,7 @@ pub fn log2f(x_: f32) callconv(.C) f32 { | ... | @@ -84,7 +84,7 @@ pub fn log2f(x_: f32) callconv(.C) f32 { |
| 84 | u &= 0xFFFFF000; | 84 | u &= 0xFFFFF000; |
| 85 | hi = @bitCast(f32, u); | 85 | hi = @bitCast(f32, u); |
| 86 | const lo = f - hi - hfsq + s * (hfsq + R); | 86 | const lo = f - hi - hfsq + s * (hfsq + R); |
| 87 | return (lo + hi) * ivln2lo + lo * ivln2hi + hi * ivln2hi + @intToFloat(f32, k); | 87 | return (lo + hi) * ivln2lo + lo * ivln2hi + hi * ivln2hi + @floatFromInt(f32, k); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | pub fn log2(x_: f64) callconv(.C) f64 { | 90 | pub fn log2(x_: f64) callconv(.C) f64 { |
| ... | @@ -150,7 +150,7 @@ pub fn log2(x_: f64) callconv(.C) f64 { | ... | @@ -150,7 +150,7 @@ pub fn log2(x_: f64) callconv(.C) f64 { |
| 150 | var val_lo = (lo + hi) * ivln2lo + lo * ivln2hi; | 150 | var val_lo = (lo + hi) * ivln2lo + lo * ivln2hi; |
| 151 | 151 | ||
| 152 | // spadd(val_hi, val_lo, y) | 152 | // spadd(val_hi, val_lo, y) |
| 153 | const y = @intToFloat(f64, k); | 153 | const y = @floatFromInt(f64, k); |
| 154 | const ww = y + val_hi; | 154 | const ww = y + val_hi; |
| 155 | val_lo += (y - ww) + val_hi; | 155 | val_lo += (y - ww) + val_hi; |
| 156 | val_hi = ww; | 156 | val_hi = ww; |
lib/compiler_rt/memmove.zig+1-1| ... | @@ -8,7 +8,7 @@ comptime { | ... | @@ -8,7 +8,7 @@ comptime { |
| 8 | pub fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 { | 8 | pub fn memmove(dest: ?[*]u8, src: ?[*]const u8, n: usize) callconv(.C) ?[*]u8 { |
| 9 | @setRuntimeSafety(false); | 9 | @setRuntimeSafety(false); |
| 10 | 10 | ||
| 11 | if (@ptrToInt(dest) < @ptrToInt(src)) { | 11 | if (@intFromPtr(dest) < @intFromPtr(src)) { |
| 12 | var index: usize = 0; | 12 | var index: usize = 0; |
| 13 | while (index != n) : (index += 1) { | 13 | while (index != n) : (index += 1) { |
| 14 | dest.?[index] = src.?[index]; | 14 | dest.?[index] = src.?[index]; |
lib/compiler_rt/mulf3.zig+1-1| ... | @@ -126,7 +126,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T { | ... | @@ -126,7 +126,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T { |
| 126 | // Otherwise, shift the significand of the result so that the round | 126 | // Otherwise, shift the significand of the result so that the round |
| 127 | // bit is the high bit of productLo. | 127 | // bit is the high bit of productLo. |
| 128 | const sticky = wideShrWithTruncation(ZSignificand, &productHi, &productLo, shift); | 128 | const sticky = wideShrWithTruncation(ZSignificand, &productHi, &productLo, shift); |
| 129 | productLo |= @boolToInt(sticky); | 129 | productLo |= @intFromBool(sticky); |
| 130 | result = productHi; | 130 | result = productHi; |
| 131 | 131 | ||
| 132 | // We include the integer bit so that rounding will carry to the exponent, | 132 | // We include the integer bit so that rounding will carry to the exponent, |
lib/compiler_rt/os_version_check.zig+1-1| ... | @@ -36,7 +36,7 @@ const __isPlatformVersionAtLeast = if (builtin.os.tag.isDarwin()) struct { | ... | @@ -36,7 +36,7 @@ const __isPlatformVersionAtLeast = if (builtin.os.tag.isDarwin()) struct { |
| 36 | .platform = platform, | 36 | .platform = platform, |
| 37 | .version = constructVersion(major, minor, subminor), | 37 | .version = constructVersion(major, minor, subminor), |
| 38 | }; | 38 | }; |
| 39 | return @boolToInt(_availability_version_check(1, &[_]dyld_build_version_t{build_version})); | 39 | return @intFromBool(_availability_version_check(1, &[_]dyld_build_version_t{build_version})); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | // _availability_version_check darwin API support. | 42 | // _availability_version_check darwin API support. |
lib/compiler_rt/paritydi2_test.zig+1-1| ... | @@ -9,7 +9,7 @@ fn paritydi2Naive(a: i64) i32 { | ... | @@ -9,7 +9,7 @@ fn paritydi2Naive(a: i64) i32 { |
| 9 | has_parity = !has_parity; | 9 | has_parity = !has_parity; |
| 10 | x = x & (x - 1); | 10 | x = x & (x - 1); |
| 11 | } | 11 | } |
| 12 | return @intCast(i32, @boolToInt(has_parity)); | 12 | return @intCast(i32, @intFromBool(has_parity)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn test__paritydi2(a: i64) !void { | 15 | fn test__paritydi2(a: i64) !void { |
lib/compiler_rt/paritysi2_test.zig+1-1| ... | @@ -9,7 +9,7 @@ fn paritysi2Naive(a: i32) i32 { | ... | @@ -9,7 +9,7 @@ fn paritysi2Naive(a: i32) i32 { |
| 9 | has_parity = !has_parity; | 9 | has_parity = !has_parity; |
| 10 | x = x & (x - 1); | 10 | x = x & (x - 1); |
| 11 | } | 11 | } |
| 12 | return @intCast(i32, @boolToInt(has_parity)); | 12 | return @intCast(i32, @intFromBool(has_parity)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn test__paritysi2(a: i32) !void { | 15 | fn test__paritysi2(a: i32) !void { |
lib/compiler_rt/parityti2_test.zig+1-1| ... | @@ -9,7 +9,7 @@ fn parityti2Naive(a: i128) i32 { | ... | @@ -9,7 +9,7 @@ fn parityti2Naive(a: i128) i32 { |
| 9 | has_parity = !has_parity; | 9 | has_parity = !has_parity; |
| 10 | x = x & (x - 1); | 10 | x = x & (x - 1); |
| 11 | } | 11 | } |
| 12 | return @intCast(i32, @boolToInt(has_parity)); | 12 | return @intCast(i32, @intFromBool(has_parity)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn test__parityti2(a: i128) !void { | 15 | fn test__parityti2(a: i128) !void { |
lib/compiler_rt/rem_pio2.zig+2-2| ... | @@ -41,7 +41,7 @@ fn medium(ix: u32, x: f64, y: *[2]f64) i32 { | ... | @@ -41,7 +41,7 @@ fn medium(ix: u32, x: f64, y: *[2]f64) i32 { |
| 41 | 41 | ||
| 42 | // rint(x/(pi/2)) | 42 | // rint(x/(pi/2)) |
| 43 | @"fn" = x * invpio2 + toint - toint; | 43 | @"fn" = x * invpio2 + toint - toint; |
| 44 | n = @floatToInt(i32, @"fn"); | 44 | n = @intFromFloat(i32, @"fn"); |
| 45 | r = x - @"fn" * pio2_1; | 45 | r = x - @"fn" * pio2_1; |
| 46 | w = @"fn" * pio2_1t; // 1st round, good to 85 bits | 46 | w = @"fn" * pio2_1t; // 1st round, good to 85 bits |
| 47 | // Matters with directed rounding. | 47 | // Matters with directed rounding. |
| ... | @@ -178,7 +178,7 @@ pub fn rem_pio2(x: f64, y: *[2]f64) i32 { | ... | @@ -178,7 +178,7 @@ pub fn rem_pio2(x: f64, y: *[2]f64) i32 { |
| 178 | 178 | ||
| 179 | i = 0; | 179 | i = 0; |
| 180 | while (i < 2) : (i += 1) { | 180 | while (i < 2) : (i += 1) { |
| 181 | tx[U(i)] = @intToFloat(f64, @floatToInt(i32, z)); | 181 | tx[U(i)] = @floatFromInt(f64, @intFromFloat(i32, z)); |
| 182 | z = (z - tx[U(i)]) * 0x1p24; | 182 | z = (z - tx[U(i)]) * 0x1p24; |
| 183 | } | 183 | } |
| 184 | tx[U(i)] = z; | 184 | tx[U(i)] = z; |
lib/compiler_rt/rem_pio2_large.zig+11-11| ... | @@ -295,7 +295,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { | ... | @@ -295,7 +295,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { |
| 295 | i += 1; | 295 | i += 1; |
| 296 | j += 1; | 296 | j += 1; |
| 297 | }) { | 297 | }) { |
| 298 | f[U(i)] = if (j < 0) 0.0 else @intToFloat(f64, ipio2[U(j)]); | 298 | f[U(i)] = if (j < 0) 0.0 else @floatFromInt(f64, ipio2[U(j)]); |
| 299 | } | 299 | } |
| 300 | 300 | ||
| 301 | // compute q[0],q[1],...q[jk] | 301 | // compute q[0],q[1],...q[jk] |
| ... | @@ -322,16 +322,16 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { | ... | @@ -322,16 +322,16 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { |
| 322 | i += 1; | 322 | i += 1; |
| 323 | j -= 1; | 323 | j -= 1; |
| 324 | }) { | 324 | }) { |
| 325 | fw = @intToFloat(f64, @floatToInt(i32, 0x1p-24 * z)); | 325 | fw = @floatFromInt(f64, @intFromFloat(i32, 0x1p-24 * z)); |
| 326 | iq[U(i)] = @floatToInt(i32, z - 0x1p24 * fw); | 326 | iq[U(i)] = @intFromFloat(i32, z - 0x1p24 * fw); |
| 327 | z = q[U(j - 1)] + fw; | 327 | z = q[U(j - 1)] + fw; |
| 328 | } | 328 | } |
| 329 | 329 | ||
| 330 | // compute n | 330 | // compute n |
| 331 | z = math.scalbn(z, q0); // actual value of z | 331 | z = math.scalbn(z, q0); // actual value of z |
| 332 | z -= 8.0 * @floor(z * 0.125); // trim off integer >= 8 | 332 | z -= 8.0 * @floor(z * 0.125); // trim off integer >= 8 |
| 333 | n = @floatToInt(i32, z); | 333 | n = @intFromFloat(i32, z); |
| 334 | z -= @intToFloat(f64, n); | 334 | z -= @floatFromInt(f64, n); |
| 335 | ih = 0; | 335 | ih = 0; |
| 336 | if (q0 > 0) { // need iq[jz-1] to determine n | 336 | if (q0 > 0) { // need iq[jz-1] to determine n |
| 337 | i = iq[U(jz - 1)] >> @intCast(u5, 24 - q0); | 337 | i = iq[U(jz - 1)] >> @intCast(u5, 24 - q0); |
| ... | @@ -390,7 +390,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { | ... | @@ -390,7 +390,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { |
| 390 | 390 | ||
| 391 | i = jz + 1; | 391 | i = jz + 1; |
| 392 | while (i <= jz + k) : (i += 1) { // add q[jz+1] to q[jz+k] | 392 | while (i <= jz + k) : (i += 1) { // add q[jz+1] to q[jz+k] |
| 393 | f[U(jx + i)] = @intToFloat(f64, ipio2[U(jv + i)]); | 393 | f[U(jx + i)] = @floatFromInt(f64, ipio2[U(jv + i)]); |
| 394 | j = 0; | 394 | j = 0; |
| 395 | fw = 0; | 395 | fw = 0; |
| 396 | while (j <= jx) : (j += 1) { | 396 | while (j <= jx) : (j += 1) { |
| ... | @@ -414,13 +414,13 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { | ... | @@ -414,13 +414,13 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { |
| 414 | } else { // break z into 24-bit if necessary | 414 | } else { // break z into 24-bit if necessary |
| 415 | z = math.scalbn(z, -q0); | 415 | z = math.scalbn(z, -q0); |
| 416 | if (z >= 0x1p24) { | 416 | if (z >= 0x1p24) { |
| 417 | fw = @intToFloat(f64, @floatToInt(i32, 0x1p-24 * z)); | 417 | fw = @floatFromInt(f64, @intFromFloat(i32, 0x1p-24 * z)); |
| 418 | iq[U(jz)] = @floatToInt(i32, z - 0x1p24 * fw); | 418 | iq[U(jz)] = @intFromFloat(i32, z - 0x1p24 * fw); |
| 419 | jz += 1; | 419 | jz += 1; |
| 420 | q0 += 24; | 420 | q0 += 24; |
| 421 | iq[U(jz)] = @floatToInt(i32, fw); | 421 | iq[U(jz)] = @intFromFloat(i32, fw); |
| 422 | } else { | 422 | } else { |
| 423 | iq[U(jz)] = @floatToInt(i32, z); | 423 | iq[U(jz)] = @intFromFloat(i32, z); |
| 424 | } | 424 | } |
| 425 | } | 425 | } |
| 426 | 426 | ||
| ... | @@ -428,7 +428,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { | ... | @@ -428,7 +428,7 @@ pub fn rem_pio2_large(x: []f64, y: []f64, e0: i32, nx: i32, prec: usize) i32 { |
| 428 | fw = math.scalbn(@as(f64, 1.0), q0); | 428 | fw = math.scalbn(@as(f64, 1.0), q0); |
| 429 | i = jz; | 429 | i = jz; |
| 430 | while (i >= 0) : (i -= 1) { | 430 | while (i >= 0) : (i -= 1) { |
| 431 | q[U(i)] = fw * @intToFloat(f64, iq[U(i)]); | 431 | q[U(i)] = fw * @floatFromInt(f64, iq[U(i)]); |
| 432 | fw *= 0x1p-24; | 432 | fw *= 0x1p-24; |
| 433 | } | 433 | } |
| 434 | 434 |
lib/compiler_rt/rem_pio2f.zig+1-1| ... | @@ -37,7 +37,7 @@ pub fn rem_pio2f(x: f32, y: *f64) i32 { | ... | @@ -37,7 +37,7 @@ pub fn rem_pio2f(x: f32, y: *f64) i32 { |
| 37 | if (ix < 0x4dc90fdb) { // |x| ~< 2^28*(pi/2), medium size | 37 | if (ix < 0x4dc90fdb) { // |x| ~< 2^28*(pi/2), medium size |
| 38 | // Use a specialized rint() to get fn. | 38 | // Use a specialized rint() to get fn. |
| 39 | @"fn" = @floatCast(f64, x) * invpio2 + toint - toint; | 39 | @"fn" = @floatCast(f64, x) * invpio2 + toint - toint; |
| 40 | n = @floatToInt(i32, @"fn"); | 40 | n = @intFromFloat(i32, @"fn"); |
| 41 | y.* = x - @"fn" * pio2_1 - @"fn" * pio2_1t; | 41 | y.* = x - @"fn" * pio2_1 - @"fn" * pio2_1t; |
| 42 | // Matters with directed rounding. | 42 | // Matters with directed rounding. |
| 43 | if (y.* < -pio4) { | 43 | if (y.* < -pio4) { |
lib/compiler_rt/trig.zig+1-1| ... | @@ -222,7 +222,7 @@ pub fn __tan(x_: f64, y_: f64, odd: bool) f64 { | ... | @@ -222,7 +222,7 @@ pub fn __tan(x_: f64, y_: f64, odd: bool) f64 { |
| 222 | r = y + z * (s * (r + v) + y) + s * T[0]; | 222 | r = y + z * (s * (r + v) + y) + s * T[0]; |
| 223 | w = x + r; | 223 | w = x + r; |
| 224 | if (big) { | 224 | if (big) { |
| 225 | s = 1 - 2 * @intToFloat(f64, @boolToInt(odd)); | 225 | s = 1 - 2 * @floatFromInt(f64, @intFromBool(odd)); |
| 226 | v = s - 2.0 * (x + (r - w * w / (w + s))); | 226 | v = s - 2.0 * (x + (r - w * w / (w + s))); |
| 227 | return if (sign) -v else v; | 227 | return if (sign) -v else v; |
| 228 | } | 228 | } |
lib/compiler_rt/truncf.zig+2-2| ... | @@ -81,7 +81,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t | ... | @@ -81,7 +81,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t |
| 81 | if (shift > srcSigBits) { | 81 | if (shift > srcSigBits) { |
| 82 | absResult = 0; | 82 | absResult = 0; |
| 83 | } else { | 83 | } else { |
| 84 | const sticky: src_rep_t = @boolToInt(significand << @intCast(SrcShift, srcBits - shift) != 0); | 84 | const sticky: src_rep_t = @intFromBool(significand << @intCast(SrcShift, srcBits - shift) != 0); |
| 85 | const denormalizedSignificand: src_rep_t = significand >> @intCast(SrcShift, shift) | sticky; | 85 | const denormalizedSignificand: src_rep_t = significand >> @intCast(SrcShift, shift) | sticky; |
| 86 | absResult = @intCast(dst_rep_t, denormalizedSignificand >> (srcSigBits - dstSigBits)); | 86 | absResult = @intCast(dst_rep_t, denormalizedSignificand >> (srcSigBits - dstSigBits)); |
| 87 | const roundBits: src_rep_t = denormalizedSignificand & roundMask; | 87 | const roundBits: src_rep_t = denormalizedSignificand & roundMask; |
| ... | @@ -164,7 +164,7 @@ pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t { | ... | @@ -164,7 +164,7 @@ pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t { |
| 164 | if (shift > src_sig_bits) { | 164 | if (shift > src_sig_bits) { |
| 165 | abs_result = 0; | 165 | abs_result = 0; |
| 166 | } else { | 166 | } else { |
| 167 | const sticky = @boolToInt(a_rep.fraction << @intCast(u6, shift) != 0); | 167 | const sticky = @intFromBool(a_rep.fraction << @intCast(u6, shift) != 0); |
| 168 | const denormalized_significand = a_rep.fraction >> @intCast(u6, shift) | sticky; | 168 | const denormalized_significand = a_rep.fraction >> @intCast(u6, shift) | sticky; |
| 169 | abs_result = @intCast(dst_rep_t, denormalized_significand >> (src_sig_bits - dst_sig_bits)); | 169 | abs_result = @intCast(dst_rep_t, denormalized_significand >> (src_sig_bits - dst_sig_bits)); |
| 170 | const round_bits = denormalized_significand & round_mask; | 170 | const round_bits = denormalized_significand & round_mask; |
lib/docs/main.js+19-19| ... | @@ -1234,9 +1234,9 @@ const NAV_MODES = { | ... | @@ -1234,9 +1234,9 @@ const NAV_MODES = { |
| 1234 | const name = getAstNode(field).name; | 1234 | const name = getAstNode(field).name; |
| 1235 | return name; | 1235 | return name; |
| 1236 | } | 1236 | } |
| 1237 | case "enumToInt": { | 1237 | case "intFromEnum": { |
| 1238 | const enumToInt = zigAnalysis.exprs[expr.enumToInt]; | 1238 | const intFromEnum = zigAnalysis.exprs[expr.intFromEnum]; |
| 1239 | return "@enumToInt(" + exprName(enumToInt, opts) + ")"; | 1239 | return "@intFromEnum(" + exprName(intFromEnum, opts) + ")"; |
| 1240 | } | 1240 | } |
| 1241 | case "bitSizeOf": { | 1241 | case "bitSizeOf": { |
| 1242 | const bitSizeOf = zigAnalysis.exprs[expr.bitSizeOf]; | 1242 | const bitSizeOf = zigAnalysis.exprs[expr.bitSizeOf]; |
| ... | @@ -1260,8 +1260,8 @@ const NAV_MODES = { | ... | @@ -1260,8 +1260,8 @@ const NAV_MODES = { |
| 1260 | payloadHtml += "alignOf"; | 1260 | payloadHtml += "alignOf"; |
| 1261 | break; | 1261 | break; |
| 1262 | } | 1262 | } |
| 1263 | case "bool_to_int": { | 1263 | case "int_from_bool": { |
| 1264 | payloadHtml += "boolToInt"; | 1264 | payloadHtml += "intFromBool"; |
| 1265 | break; | 1265 | break; |
| 1266 | } | 1266 | } |
| 1267 | case "embed_file": { | 1267 | case "embed_file": { |
| ... | @@ -1368,16 +1368,16 @@ const NAV_MODES = { | ... | @@ -1368,16 +1368,16 @@ const NAV_MODES = { |
| 1368 | payloadHtml += "workGroupId"; | 1368 | payloadHtml += "workGroupId"; |
| 1369 | break; | 1369 | break; |
| 1370 | } | 1370 | } |
| 1371 | case "ptr_to_int": { | 1371 | case "int_from_ptr": { |
| 1372 | payloadHtml += "ptrToInt"; | 1372 | payloadHtml += "intFromPtr"; |
| 1373 | break; | 1373 | break; |
| 1374 | } | 1374 | } |
| 1375 | case "error_to_int": { | 1375 | case "int_from_error": { |
| 1376 | payloadHtml += "errorToInt"; | 1376 | payloadHtml += "intFromError"; |
| 1377 | break; | 1377 | break; |
| 1378 | } | 1378 | } |
| 1379 | case "int_to_error": { | 1379 | case "error_to_int": { |
| 1380 | payloadHtml += "intToError"; | 1380 | payloadHtml += "errorFromInt"; |
| 1381 | break; | 1381 | break; |
| 1382 | } | 1382 | } |
| 1383 | case "max": { | 1383 | case "max": { |
| ... | @@ -1423,20 +1423,20 @@ const NAV_MODES = { | ... | @@ -1423,20 +1423,20 @@ const NAV_MODES = { |
| 1423 | 1423 | ||
| 1424 | let payloadHtml = "@"; | 1424 | let payloadHtml = "@"; |
| 1425 | switch (expr.builtinBin.name) { | 1425 | switch (expr.builtinBin.name) { |
| 1426 | case "float_to_int": { | 1426 | case "int_from_float": { |
| 1427 | payloadHtml += "floatToInt"; | 1427 | payloadHtml += "intFromFloat"; |
| 1428 | break; | 1428 | break; |
| 1429 | } | 1429 | } |
| 1430 | case "int_to_float": { | 1430 | case "float_from_int": { |
| 1431 | payloadHtml += "intToFloat"; | 1431 | payloadHtml += "floatFromInt"; |
| 1432 | break; | 1432 | break; |
| 1433 | } | 1433 | } |
| 1434 | case "int_to_ptr": { | 1434 | case "ptr_from_int": { |
| 1435 | payloadHtml += "intToPtr"; | 1435 | payloadHtml += "ptrFromInt"; |
| 1436 | break; | 1436 | break; |
| 1437 | } | 1437 | } |
| 1438 | case "int_to_enum": { | 1438 | case "enum_from_int": { |
| 1439 | payloadHtml += "intToEnum"; | 1439 | payloadHtml += "enumFromInt"; |
| 1440 | break; | 1440 | break; |
| 1441 | } | 1441 | } |
| 1442 | case "float_cast": { | 1442 | case "float_cast": { |
lib/std/Build/Step/Run.zig+3-3| ... | @@ -1035,9 +1035,9 @@ fn evalZigTest( | ... | @@ -1035,9 +1035,9 @@ fn evalZigTest( |
| 1035 | 1035 | ||
| 1036 | const TrHdr = std.zig.Server.Message.TestResults; | 1036 | const TrHdr = std.zig.Server.Message.TestResults; |
| 1037 | const tr_hdr = @ptrCast(*align(1) const TrHdr, body); | 1037 | const tr_hdr = @ptrCast(*align(1) const TrHdr, body); |
| 1038 | fail_count += @boolToInt(tr_hdr.flags.fail); | 1038 | fail_count += @intFromBool(tr_hdr.flags.fail); |
| 1039 | skip_count += @boolToInt(tr_hdr.flags.skip); | 1039 | skip_count += @intFromBool(tr_hdr.flags.skip); |
| 1040 | leak_count += @boolToInt(tr_hdr.flags.leak); | 1040 | leak_count += @intFromBool(tr_hdr.flags.leak); |
| 1041 | 1041 | ||
| 1042 | if (tr_hdr.flags.fail or tr_hdr.flags.leak) { | 1042 | if (tr_hdr.flags.fail or tr_hdr.flags.leak) { |
| 1043 | const name = std.mem.sliceTo(md.string_bytes[md.names[tr_hdr.index]..], 0); | 1043 | const name = std.mem.sliceTo(md.string_bytes[md.names[tr_hdr.index]..], 0); |
lib/std/RingBuffer.zig+1-1| ... | @@ -102,7 +102,7 @@ pub fn isFull(self: RingBuffer) bool { | ... | @@ -102,7 +102,7 @@ pub fn isFull(self: RingBuffer) bool { |
| 102 | 102 | ||
| 103 | /// Returns the length | 103 | /// Returns the length |
| 104 | pub fn len(self: RingBuffer) usize { | 104 | pub fn len(self: RingBuffer) usize { |
| 105 | const wrap_offset = 2 * self.data.len * @boolToInt(self.write_index < self.read_index); | 105 | const wrap_offset = 2 * self.data.len * @intFromBool(self.write_index < self.read_index); |
| 106 | const adjusted_write_index = self.write_index + wrap_offset; | 106 | const adjusted_write_index = self.write_index + wrap_offset; |
| 107 | return adjusted_write_index - self.read_index; | 107 | return adjusted_write_index - self.read_index; |
| 108 | } | 108 | } |
lib/std/Thread.zig+18-18| ... | @@ -65,8 +65,8 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void { | ... | @@ -65,8 +65,8 @@ pub fn setName(self: Thread, name: []const u8) SetNameError!void { |
| 65 | .linux => if (use_pthreads) { | 65 | .linux => if (use_pthreads) { |
| 66 | if (self.getHandle() == std.c.pthread_self()) { | 66 | if (self.getHandle() == std.c.pthread_self()) { |
| 67 | // Set the name of the calling thread (no thread id required). | 67 | // Set the name of the calling thread (no thread id required). |
| 68 | const err = try os.prctl(.SET_NAME, .{@ptrToInt(name_with_terminator.ptr)}); | 68 | const err = try os.prctl(.SET_NAME, .{@intFromPtr(name_with_terminator.ptr)}); |
| 69 | switch (@intToEnum(os.E, err)) { | 69 | switch (@enumFromInt(os.E, err)) { |
| 70 | .SUCCESS => return, | 70 | .SUCCESS => return, |
| 71 | else => |e| return os.unexpectedErrno(e), | 71 | else => |e| return os.unexpectedErrno(e), |
| 72 | } | 72 | } |
| ... | @@ -175,8 +175,8 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co | ... | @@ -175,8 +175,8 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 175 | .linux => if (use_pthreads) { | 175 | .linux => if (use_pthreads) { |
| 176 | if (self.getHandle() == std.c.pthread_self()) { | 176 | if (self.getHandle() == std.c.pthread_self()) { |
| 177 | // Get the name of the calling thread (no thread id required). | 177 | // Get the name of the calling thread (no thread id required). |
| 178 | const err = try os.prctl(.GET_NAME, .{@ptrToInt(buffer.ptr)}); | 178 | const err = try os.prctl(.GET_NAME, .{@intFromPtr(buffer.ptr)}); |
| 179 | switch (@intToEnum(os.E, err)) { | 179 | switch (@enumFromInt(os.E, err)) { |
| 180 | .SUCCESS => return std.mem.sliceTo(buffer, 0), | 180 | .SUCCESS => return std.mem.sliceTo(buffer, 0), |
| 181 | else => |e| return os.unexpectedErrno(e), | 181 | else => |e| return os.unexpectedErrno(e), |
| 182 | } | 182 | } |
| ... | @@ -611,7 +611,7 @@ const PosixThreadImpl = struct { | ... | @@ -611,7 +611,7 @@ const PosixThreadImpl = struct { |
| 611 | return @bitCast(u32, c.find_thread(null)); | 611 | return @bitCast(u32, c.find_thread(null)); |
| 612 | }, | 612 | }, |
| 613 | else => { | 613 | else => { |
| 614 | return @ptrToInt(c.pthread_self()); | 614 | return @intFromPtr(c.pthread_self()); |
| 615 | }, | 615 | }, |
| 616 | } | 616 | } |
| 617 | } | 617 | } |
| ... | @@ -776,7 +776,7 @@ const LinuxThreadImpl = struct { | ... | @@ -776,7 +776,7 @@ const LinuxThreadImpl = struct { |
| 776 | \\ movl $0, %%ebx | 776 | \\ movl $0, %%ebx |
| 777 | \\ int $128 | 777 | \\ int $128 |
| 778 | : | 778 | : |
| 779 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 779 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 780 | [len] "r" (self.mapped.len), | 780 | [len] "r" (self.mapped.len), |
| 781 | : "memory" | 781 | : "memory" |
| 782 | ), | 782 | ), |
| ... | @@ -787,7 +787,7 @@ const LinuxThreadImpl = struct { | ... | @@ -787,7 +787,7 @@ const LinuxThreadImpl = struct { |
| 787 | \\ movq $1, %%rdi | 787 | \\ movq $1, %%rdi |
| 788 | \\ syscall | 788 | \\ syscall |
| 789 | : | 789 | : |
| 790 | : [ptr] "{rdi}" (@ptrToInt(self.mapped.ptr)), | 790 | : [ptr] "{rdi}" (@intFromPtr(self.mapped.ptr)), |
| 791 | [len] "{rsi}" (self.mapped.len), | 791 | [len] "{rsi}" (self.mapped.len), |
| 792 | ), | 792 | ), |
| 793 | .arm, .armeb, .thumb, .thumbeb => asm volatile ( | 793 | .arm, .armeb, .thumb, .thumbeb => asm volatile ( |
| ... | @@ -799,7 +799,7 @@ const LinuxThreadImpl = struct { | ... | @@ -799,7 +799,7 @@ const LinuxThreadImpl = struct { |
| 799 | \\ mov r0, #0 | 799 | \\ mov r0, #0 |
| 800 | \\ svc 0 | 800 | \\ svc 0 |
| 801 | : | 801 | : |
| 802 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 802 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 803 | [len] "r" (self.mapped.len), | 803 | [len] "r" (self.mapped.len), |
| 804 | : "memory" | 804 | : "memory" |
| 805 | ), | 805 | ), |
| ... | @@ -812,7 +812,7 @@ const LinuxThreadImpl = struct { | ... | @@ -812,7 +812,7 @@ const LinuxThreadImpl = struct { |
| 812 | \\ mov x0, #0 | 812 | \\ mov x0, #0 |
| 813 | \\ svc 0 | 813 | \\ svc 0 |
| 814 | : | 814 | : |
| 815 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 815 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 816 | [len] "r" (self.mapped.len), | 816 | [len] "r" (self.mapped.len), |
| 817 | : "memory" | 817 | : "memory" |
| 818 | ), | 818 | ), |
| ... | @@ -826,7 +826,7 @@ const LinuxThreadImpl = struct { | ... | @@ -826,7 +826,7 @@ const LinuxThreadImpl = struct { |
| 826 | \\ li $4, 0 | 826 | \\ li $4, 0 |
| 827 | \\ syscall | 827 | \\ syscall |
| 828 | : | 828 | : |
| 829 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 829 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 830 | [len] "r" (self.mapped.len), | 830 | [len] "r" (self.mapped.len), |
| 831 | : "memory" | 831 | : "memory" |
| 832 | ), | 832 | ), |
| ... | @@ -839,7 +839,7 @@ const LinuxThreadImpl = struct { | ... | @@ -839,7 +839,7 @@ const LinuxThreadImpl = struct { |
| 839 | \\ li $4, 0 | 839 | \\ li $4, 0 |
| 840 | \\ syscall | 840 | \\ syscall |
| 841 | : | 841 | : |
| 842 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 842 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 843 | [len] "r" (self.mapped.len), | 843 | [len] "r" (self.mapped.len), |
| 844 | : "memory" | 844 | : "memory" |
| 845 | ), | 845 | ), |
| ... | @@ -853,7 +853,7 @@ const LinuxThreadImpl = struct { | ... | @@ -853,7 +853,7 @@ const LinuxThreadImpl = struct { |
| 853 | \\ sc | 853 | \\ sc |
| 854 | \\ blr | 854 | \\ blr |
| 855 | : | 855 | : |
| 856 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 856 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 857 | [len] "r" (self.mapped.len), | 857 | [len] "r" (self.mapped.len), |
| 858 | : "memory" | 858 | : "memory" |
| 859 | ), | 859 | ), |
| ... | @@ -866,7 +866,7 @@ const LinuxThreadImpl = struct { | ... | @@ -866,7 +866,7 @@ const LinuxThreadImpl = struct { |
| 866 | \\ mv a0, zero | 866 | \\ mv a0, zero |
| 867 | \\ ecall | 867 | \\ ecall |
| 868 | : | 868 | : |
| 869 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 869 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 870 | [len] "r" (self.mapped.len), | 870 | [len] "r" (self.mapped.len), |
| 871 | : "memory" | 871 | : "memory" |
| 872 | ), | 872 | ), |
| ... | @@ -893,7 +893,7 @@ const LinuxThreadImpl = struct { | ... | @@ -893,7 +893,7 @@ const LinuxThreadImpl = struct { |
| 893 | \\ mov 1, %%o0 | 893 | \\ mov 1, %%o0 |
| 894 | \\ t 0x6d | 894 | \\ t 0x6d |
| 895 | : | 895 | : |
| 896 | : [ptr] "r" (@ptrToInt(self.mapped.ptr)), | 896 | : [ptr] "r" (@intFromPtr(self.mapped.ptr)), |
| 897 | [len] "r" (self.mapped.len), | 897 | [len] "r" (self.mapped.len), |
| 898 | : "memory" | 898 | : "memory" |
| 899 | ), | 899 | ), |
| ... | @@ -911,7 +911,7 @@ const LinuxThreadImpl = struct { | ... | @@ -911,7 +911,7 @@ const LinuxThreadImpl = struct { |
| 911 | thread: ThreadCompletion, | 911 | thread: ThreadCompletion, |
| 912 | 912 | ||
| 913 | fn entryFn(raw_arg: usize) callconv(.C) u8 { | 913 | fn entryFn(raw_arg: usize) callconv(.C) u8 { |
| 914 | const self = @intToPtr(*@This(), raw_arg); | 914 | const self = @ptrFromInt(*@This(), raw_arg); |
| 915 | defer switch (self.thread.completion.swap(.completed, .SeqCst)) { | 915 | defer switch (self.thread.completion.swap(.completed, .SeqCst)) { |
| 916 | .running => {}, | 916 | .running => {}, |
| 917 | .completed => unreachable, | 917 | .completed => unreachable, |
| ... | @@ -980,7 +980,7 @@ const LinuxThreadImpl = struct { | ... | @@ -980,7 +980,7 @@ const LinuxThreadImpl = struct { |
| 980 | var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]); | 980 | var tls_ptr = os.linux.tls.prepareTLS(mapped[tls_offset..]); |
| 981 | var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined; | 981 | var user_desc: if (target.cpu.arch == .x86) os.linux.user_desc else void = undefined; |
| 982 | if (target.cpu.arch == .x86) { | 982 | if (target.cpu.arch == .x86) { |
| 983 | defer tls_ptr = @ptrToInt(&user_desc); | 983 | defer tls_ptr = @intFromPtr(&user_desc); |
| 984 | user_desc = .{ | 984 | user_desc = .{ |
| 985 | .entry_number = os.linux.tls.tls_image.gdt_entry_number, | 985 | .entry_number = os.linux.tls.tls_image.gdt_entry_number, |
| 986 | .base_addr = tls_ptr, | 986 | .base_addr = tls_ptr, |
| ... | @@ -1007,9 +1007,9 @@ const LinuxThreadImpl = struct { | ... | @@ -1007,9 +1007,9 @@ const LinuxThreadImpl = struct { |
| 1007 | 1007 | ||
| 1008 | switch (linux.getErrno(linux.clone( | 1008 | switch (linux.getErrno(linux.clone( |
| 1009 | Instance.entryFn, | 1009 | Instance.entryFn, |
| 1010 | @ptrToInt(&mapped[stack_offset]), | 1010 | @intFromPtr(&mapped[stack_offset]), |
| 1011 | flags, | 1011 | flags, |
| 1012 | @ptrToInt(instance), | 1012 | @intFromPtr(instance), |
| 1013 | &instance.thread.parent_tid, | 1013 | &instance.thread.parent_tid, |
| 1014 | tls_ptr, | 1014 | tls_ptr, |
| 1015 | &instance.thread.child_tid.value, | 1015 | &instance.thread.child_tid.value, |
lib/std/Thread/Condition.zig+1-1| ... | @@ -487,7 +487,7 @@ test "Condition - multi signal" { | ... | @@ -487,7 +487,7 @@ test "Condition - multi signal" { |
| 487 | 487 | ||
| 488 | // The first paddle will be hit one last time by the last paddle. | 488 | // The first paddle will be hit one last time by the last paddle. |
| 489 | for (paddles, 0..) |p, i| { | 489 | for (paddles, 0..) |p, i| { |
| 490 | const expected = @as(u32, num_iterations) + @boolToInt(i == 0); | 490 | const expected = @as(u32, num_iterations) + @intFromBool(i == 0); |
| 491 | try testing.expectEqual(p.value, expected); | 491 | try testing.expectEqual(p.value, expected); |
| 492 | } | 492 | } |
| 493 | } | 493 | } |
lib/std/Thread/Futex.zig+8-8| ... | @@ -202,7 +202,7 @@ const DarwinImpl = struct { | ... | @@ -202,7 +202,7 @@ const DarwinImpl = struct { |
| 202 | }; | 202 | }; |
| 203 | 203 | ||
| 204 | if (status >= 0) return; | 204 | if (status >= 0) return; |
| 205 | switch (@intToEnum(std.os.E, -status)) { | 205 | switch (@enumFromInt(std.os.E, -status)) { |
| 206 | // Wait was interrupted by the OS or other spurious signalling. | 206 | // Wait was interrupted by the OS or other spurious signalling. |
| 207 | .INTR => {}, | 207 | .INTR => {}, |
| 208 | // Address of the futex was paged out. This is unlikely, but possible in theory, and | 208 | // Address of the futex was paged out. This is unlikely, but possible in theory, and |
| ... | @@ -229,7 +229,7 @@ const DarwinImpl = struct { | ... | @@ -229,7 +229,7 @@ const DarwinImpl = struct { |
| 229 | const status = os.darwin.__ulock_wake(flags, addr, 0); | 229 | const status = os.darwin.__ulock_wake(flags, addr, 0); |
| 230 | 230 | ||
| 231 | if (status >= 0) return; | 231 | if (status >= 0) return; |
| 232 | switch (@intToEnum(std.os.E, -status)) { | 232 | switch (@enumFromInt(std.os.E, -status)) { |
| 233 | .INTR => continue, // spurious wake() | 233 | .INTR => continue, // spurious wake() |
| 234 | .FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t | 234 | .FAULT => unreachable, // __ulock_wake doesn't generate EFAULT according to darwin pthread_cond_t |
| 235 | .NOENT => return, // nothing was woken up | 235 | .NOENT => return, // nothing was woken up |
| ... | @@ -304,11 +304,11 @@ const FreebsdImpl = struct { | ... | @@ -304,11 +304,11 @@ const FreebsdImpl = struct { |
| 304 | } | 304 | } |
| 305 | 305 | ||
| 306 | const rc = os.freebsd._umtx_op( | 306 | const rc = os.freebsd._umtx_op( |
| 307 | @ptrToInt(&ptr.value), | 307 | @intFromPtr(&ptr.value), |
| 308 | @enumToInt(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE), | 308 | @intFromEnum(os.freebsd.UMTX_OP.WAIT_UINT_PRIVATE), |
| 309 | @as(c_ulong, expect), | 309 | @as(c_ulong, expect), |
| 310 | tm_size, | 310 | tm_size, |
| 311 | @ptrToInt(tm_ptr), | 311 | @intFromPtr(tm_ptr), |
| 312 | ); | 312 | ); |
| 313 | 313 | ||
| 314 | switch (os.errno(rc)) { | 314 | switch (os.errno(rc)) { |
| ... | @@ -326,8 +326,8 @@ const FreebsdImpl = struct { | ... | @@ -326,8 +326,8 @@ const FreebsdImpl = struct { |
| 326 | 326 | ||
| 327 | fn wake(ptr: *const Atomic(u32), max_waiters: u32) void { | 327 | fn wake(ptr: *const Atomic(u32), max_waiters: u32) void { |
| 328 | const rc = os.freebsd._umtx_op( | 328 | const rc = os.freebsd._umtx_op( |
| 329 | @ptrToInt(&ptr.value), | 329 | @intFromPtr(&ptr.value), |
| 330 | @enumToInt(os.freebsd.UMTX_OP.WAKE_PRIVATE), | 330 | @intFromEnum(os.freebsd.UMTX_OP.WAKE_PRIVATE), |
| 331 | @as(c_ulong, max_waiters), | 331 | @as(c_ulong, max_waiters), |
| 332 | 0, // there is no timeout struct | 332 | 0, // there is no timeout struct |
| 333 | 0, // there is no timeout struct pointer | 333 | 0, // there is no timeout struct pointer |
| ... | @@ -719,7 +719,7 @@ const PosixImpl = struct { | ... | @@ -719,7 +719,7 @@ const PosixImpl = struct { |
| 719 | 719 | ||
| 720 | // Make sure the pointer is aligned, | 720 | // Make sure the pointer is aligned, |
| 721 | // then cut off the zero bits from the alignment to get the unique address. | 721 | // then cut off the zero bits from the alignment to get the unique address. |
| 722 | const addr = @ptrToInt(ptr); | 722 | const addr = @intFromPtr(ptr); |
| 723 | assert(addr & (alignment - 1) == 0); | 723 | assert(addr & (alignment - 1) == 0); |
| 724 | return addr >> @ctz(@as(usize, alignment)); | 724 | return addr >> @ctz(@as(usize, alignment)); |
| 725 | } | 725 | } |
lib/std/array_hash_map.zig+1-1| ... | @@ -2310,7 +2310,7 @@ pub fn getHashPtrAddrFn(comptime K: type, comptime Context: type) (fn (Context, | ... | @@ -2310,7 +2310,7 @@ pub fn getHashPtrAddrFn(comptime K: type, comptime Context: type) (fn (Context, |
| 2310 | return struct { | 2310 | return struct { |
| 2311 | fn hash(ctx: Context, key: K) u32 { | 2311 | fn hash(ctx: Context, key: K) u32 { |
| 2312 | _ = ctx; | 2312 | _ = ctx; |
| 2313 | return getAutoHashFn(usize, void)({}, @ptrToInt(key)); | 2313 | return getAutoHashFn(usize, void)({}, @intFromPtr(key)); |
| 2314 | } | 2314 | } |
| 2315 | }.hash; | 2315 | }.hash; |
| 2316 | } | 2316 | } |
lib/std/atomic/Atomic.zig+3-3| ... | @@ -227,7 +227,7 @@ pub fn Atomic(comptime T: type) type { | ... | @@ -227,7 +227,7 @@ pub fn Atomic(comptime T: type) type { |
| 227 | .Toggle => self.fetchXor(mask, ordering), | 227 | .Toggle => self.fetchXor(mask, ordering), |
| 228 | }; | 228 | }; |
| 229 | 229 | ||
| 230 | return @boolToInt(value & mask != 0); | 230 | return @intFromBool(value & mask != 0); |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | inline fn x86BitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 { | 233 | inline fn x86BitRmw(self: *Self, comptime op: BitRmwOp, bit: Bit, comptime ordering: Ordering) u1 { |
| ... | @@ -392,8 +392,8 @@ test "Atomic.swap" { | ... | @@ -392,8 +392,8 @@ test "Atomic.swap" { |
| 392 | try testing.expectEqual(a.load(.SeqCst), true); | 392 | try testing.expectEqual(a.load(.SeqCst), true); |
| 393 | 393 | ||
| 394 | var b = Atomic(?*u8).init(null); | 394 | var b = Atomic(?*u8).init(null); |
| 395 | try testing.expectEqual(b.swap(@intToPtr(?*u8, @alignOf(u8)), ordering), null); | 395 | try testing.expectEqual(b.swap(@ptrFromInt(?*u8, @alignOf(u8)), ordering), null); |
| 396 | try testing.expectEqual(b.load(.SeqCst), @intToPtr(?*u8, @alignOf(u8))); | 396 | try testing.expectEqual(b.load(.SeqCst), @ptrFromInt(?*u8, @alignOf(u8))); |
| 397 | } | 397 | } |
| 398 | } | 398 | } |
| 399 | 399 |
lib/std/atomic/queue.zig+3-3| ... | @@ -135,7 +135,7 @@ pub fn Queue(comptime T: type) type { | ... | @@ -135,7 +135,7 @@ pub fn Queue(comptime T: type) type { |
| 135 | ) !void { | 135 | ) !void { |
| 136 | try s.writeByteNTimes(' ', indent); | 136 | try s.writeByteNTimes(' ', indent); |
| 137 | if (optional_node) |node| { | 137 | if (optional_node) |node| { |
| 138 | try s.print("0x{x}={}\n", .{ @ptrToInt(node), node.data }); | 138 | try s.print("0x{x}={}\n", .{ @intFromPtr(node), node.data }); |
| 139 | if (depth == 0) { | 139 | if (depth == 0) { |
| 140 | try s.print("(max depth)\n", .{}); | 140 | try s.print("(max depth)\n", .{}); |
| 141 | return; | 141 | return; |
| ... | @@ -387,7 +387,7 @@ test "std.atomic.Queue dump" { | ... | @@ -387,7 +387,7 @@ test "std.atomic.Queue dump" { |
| 387 | \\tail: 0x{x}=1 | 387 | \\tail: 0x{x}=1 |
| 388 | \\ (null) | 388 | \\ (null) |
| 389 | \\ | 389 | \\ |
| 390 | , .{ @ptrToInt(queue.head), @ptrToInt(queue.tail) }); | 390 | , .{ @intFromPtr(queue.head), @intFromPtr(queue.tail) }); |
| 391 | try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); | 391 | try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); |
| 392 | 392 | ||
| 393 | // Test a stream with two elements | 393 | // Test a stream with two elements |
| ... | @@ -408,6 +408,6 @@ test "std.atomic.Queue dump" { | ... | @@ -408,6 +408,6 @@ test "std.atomic.Queue dump" { |
| 408 | \\tail: 0x{x}=2 | 408 | \\tail: 0x{x}=2 |
| 409 | \\ (null) | 409 | \\ (null) |
| 410 | \\ | 410 | \\ |
| 411 | , .{ @ptrToInt(queue.head), @ptrToInt(queue.head.?.next), @ptrToInt(queue.tail) }); | 411 | , .{ @intFromPtr(queue.head), @intFromPtr(queue.head.?.next), @intFromPtr(queue.tail) }); |
| 412 | try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); | 412 | try expect(mem.eql(u8, buffer[0..fbs.pos], expected)); |
| 413 | } | 413 | } |
lib/std/bit_set.zig+4-4| ... | @@ -306,7 +306,7 @@ pub fn IntegerBitSet(comptime size: u16) type { | ... | @@ -306,7 +306,7 @@ pub fn IntegerBitSet(comptime size: u16) type { |
| 306 | } | 306 | } |
| 307 | fn boolMaskBit(index: usize, value: bool) MaskInt { | 307 | fn boolMaskBit(index: usize, value: bool) MaskInt { |
| 308 | if (MaskInt == u0) return 0; | 308 | if (MaskInt == u0) return 0; |
| 309 | return @as(MaskInt, @boolToInt(value)) << @intCast(ShiftInt, index); | 309 | return @as(MaskInt, @intFromBool(value)) << @intCast(ShiftInt, index); |
| 310 | } | 310 | } |
| 311 | }; | 311 | }; |
| 312 | } | 312 | } |
| ... | @@ -640,7 +640,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { | ... | @@ -640,7 +640,7 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type { |
| 640 | return index >> @bitSizeOf(ShiftInt); | 640 | return index >> @bitSizeOf(ShiftInt); |
| 641 | } | 641 | } |
| 642 | fn boolMaskBit(index: usize, value: bool) MaskInt { | 642 | fn boolMaskBit(index: usize, value: bool) MaskInt { |
| 643 | return @as(MaskInt, @boolToInt(value)) << @intCast(ShiftInt, index); | 643 | return @as(MaskInt, @intFromBool(value)) << @intCast(ShiftInt, index); |
| 644 | } | 644 | } |
| 645 | }; | 645 | }; |
| 646 | } | 646 | } |
| ... | @@ -669,7 +669,7 @@ pub const DynamicBitSetUnmanaged = struct { | ... | @@ -669,7 +669,7 @@ pub const DynamicBitSetUnmanaged = struct { |
| 669 | 669 | ||
| 670 | // Don't modify this value. Ideally it would go in const data so | 670 | // Don't modify this value. Ideally it would go in const data so |
| 671 | // modifications would cause a bus error, but the only way | 671 | // modifications would cause a bus error, but the only way |
| 672 | // to discard a const qualifier is through ptrToInt, which | 672 | // to discard a const qualifier is through intFromPtr, which |
| 673 | // cannot currently round trip at comptime. | 673 | // cannot currently round trip at comptime. |
| 674 | var empty_masks_data = [_]MaskInt{ 0, undefined }; | 674 | var empty_masks_data = [_]MaskInt{ 0, undefined }; |
| 675 | const empty_masks_ptr = empty_masks_data[1..2]; | 675 | const empty_masks_ptr = empty_masks_data[1..2]; |
| ... | @@ -1011,7 +1011,7 @@ pub const DynamicBitSetUnmanaged = struct { | ... | @@ -1011,7 +1011,7 @@ pub const DynamicBitSetUnmanaged = struct { |
| 1011 | return index >> @bitSizeOf(ShiftInt); | 1011 | return index >> @bitSizeOf(ShiftInt); |
| 1012 | } | 1012 | } |
| 1013 | fn boolMaskBit(index: usize, value: bool) MaskInt { | 1013 | fn boolMaskBit(index: usize, value: bool) MaskInt { |
| 1014 | return @as(MaskInt, @boolToInt(value)) << @intCast(ShiftInt, index); | 1014 | return @as(MaskInt, @intFromBool(value)) << @intCast(ShiftInt, index); |
| 1015 | } | 1015 | } |
| 1016 | fn numMasks(bit_length: usize) usize { | 1016 | fn numMasks(bit_length: usize) usize { |
| 1017 | return (bit_length + (@bitSizeOf(MaskInt) - 1)) / @bitSizeOf(MaskInt); | 1017 | return (bit_length + (@bitSizeOf(MaskInt) - 1)) / @bitSizeOf(MaskInt); |
lib/std/c.zig+1-1| ... | @@ -113,7 +113,7 @@ pub usingnamespace switch (builtin.os.tag) { | ... | @@ -113,7 +113,7 @@ pub usingnamespace switch (builtin.os.tag) { |
| 113 | 113 | ||
| 114 | pub fn getErrno(rc: anytype) c.E { | 114 | pub fn getErrno(rc: anytype) c.E { |
| 115 | if (rc == -1) { | 115 | if (rc == -1) { |
| 116 | return @intToEnum(c.E, c._errno().*); | 116 | return @enumFromInt(c.E, c._errno().*); |
| 117 | } else { | 117 | } else { |
| 118 | return .SUCCESS; | 118 | return .SUCCESS; |
| 119 | } | 119 | } |
lib/std/c/darwin.zig+31-31| ... | @@ -51,19 +51,19 @@ pub const EXC = enum(exception_type_t) { | ... | @@ -51,19 +51,19 @@ pub const EXC = enum(exception_type_t) { |
| 51 | 51 | ||
| 52 | pub const EXC_SOFT_SIGNAL = 0x10003; | 52 | pub const EXC_SOFT_SIGNAL = 0x10003; |
| 53 | 53 | ||
| 54 | pub const EXC_MASK_BAD_ACCESS = 1 << @enumToInt(EXC.BAD_ACCESS); | 54 | pub const EXC_MASK_BAD_ACCESS = 1 << @intFromEnum(EXC.BAD_ACCESS); |
| 55 | pub const EXC_MASK_BAD_INSTRUCTION = 1 << @enumToInt(EXC.BAD_INSTRUCTION); | 55 | pub const EXC_MASK_BAD_INSTRUCTION = 1 << @intFromEnum(EXC.BAD_INSTRUCTION); |
| 56 | pub const EXC_MASK_ARITHMETIC = 1 << @enumToInt(EXC.ARITHMETIC); | 56 | pub const EXC_MASK_ARITHMETIC = 1 << @intFromEnum(EXC.ARITHMETIC); |
| 57 | pub const EXC_MASK_EMULATION = 1 << @enumToInt(EXC.EMULATION); | 57 | pub const EXC_MASK_EMULATION = 1 << @intFromEnum(EXC.EMULATION); |
| 58 | pub const EXC_MASK_SOFTWARE = 1 << @enumToInt(EXC.SOFTWARE); | 58 | pub const EXC_MASK_SOFTWARE = 1 << @intFromEnum(EXC.SOFTWARE); |
| 59 | pub const EXC_MASK_BREAKPOINT = 1 << @enumToInt(EXC.BREAKPOINT); | 59 | pub const EXC_MASK_BREAKPOINT = 1 << @intFromEnum(EXC.BREAKPOINT); |
| 60 | pub const EXC_MASK_SYSCALL = 1 << @enumToInt(EXC.SYSCALL); | 60 | pub const EXC_MASK_SYSCALL = 1 << @intFromEnum(EXC.SYSCALL); |
| 61 | pub const EXC_MASK_MACH_SYSCALL = 1 << @enumToInt(EXC.MACH_SYSCALL); | 61 | pub const EXC_MASK_MACH_SYSCALL = 1 << @intFromEnum(EXC.MACH_SYSCALL); |
| 62 | pub const EXC_MASK_RPC_ALERT = 1 << @enumToInt(EXC.RPC_ALERT); | 62 | pub const EXC_MASK_RPC_ALERT = 1 << @intFromEnum(EXC.RPC_ALERT); |
| 63 | pub const EXC_MASK_CRASH = 1 << @enumToInt(EXC.CRASH); | 63 | pub const EXC_MASK_CRASH = 1 << @intFromEnum(EXC.CRASH); |
| 64 | pub const EXC_MASK_RESOURCE = 1 << @enumToInt(EXC.RESOURCE); | 64 | pub const EXC_MASK_RESOURCE = 1 << @intFromEnum(EXC.RESOURCE); |
| 65 | pub const EXC_MASK_GUARD = 1 << @enumToInt(EXC.GUARD); | 65 | pub const EXC_MASK_GUARD = 1 << @intFromEnum(EXC.GUARD); |
| 66 | pub const EXC_MASK_CORPSE_NOTIFY = 1 << @enumToInt(EXC.CORPSE_NOTIFY); | 66 | pub const EXC_MASK_CORPSE_NOTIFY = 1 << @intFromEnum(EXC.CORPSE_NOTIFY); |
| 67 | pub const EXC_MASK_MACHINE = arch_bits.EXC_MASK_MACHINE; | 67 | pub const EXC_MASK_MACHINE = arch_bits.EXC_MASK_MACHINE; |
| 68 | 68 | ||
| 69 | pub const EXC_MASK_ALL = EXC_MASK_BAD_ACCESS | | 69 | pub const EXC_MASK_ALL = EXC_MASK_BAD_ACCESS | |
| ... | @@ -1177,10 +1177,10 @@ pub const sigset_t = u32; | ... | @@ -1177,10 +1177,10 @@ pub const sigset_t = u32; |
| 1177 | pub const empty_sigset: sigset_t = 0; | 1177 | pub const empty_sigset: sigset_t = 0; |
| 1178 | 1178 | ||
| 1179 | pub const SIG = struct { | 1179 | pub const SIG = struct { |
| 1180 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 1180 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 1181 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 1181 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 1182 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 1182 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 1183 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 5); | 1183 | pub const HOLD = @ptrFromInt(?Sigaction.handler_fn, 5); |
| 1184 | 1184 | ||
| 1185 | /// block specified signal set | 1185 | /// block specified signal set |
| 1186 | pub const _BLOCK = 1; | 1186 | pub const _BLOCK = 1; |
| ... | @@ -1411,7 +1411,7 @@ pub const MAP = struct { | ... | @@ -1411,7 +1411,7 @@ pub const MAP = struct { |
| 1411 | pub const NOCACHE = 0x0400; | 1411 | pub const NOCACHE = 0x0400; |
| 1412 | /// don't reserve needed swap area | 1412 | /// don't reserve needed swap area |
| 1413 | pub const NORESERVE = 0x0040; | 1413 | pub const NORESERVE = 0x0040; |
| 1414 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 1414 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 1415 | }; | 1415 | }; |
| 1416 | 1416 | ||
| 1417 | pub const MSF = struct { | 1417 | pub const MSF = struct { |
| ... | @@ -2463,7 +2463,7 @@ pub const KernE = enum(u32) { | ... | @@ -2463,7 +2463,7 @@ pub const KernE = enum(u32) { |
| 2463 | pub const mach_msg_return_t = kern_return_t; | 2463 | pub const mach_msg_return_t = kern_return_t; |
| 2464 | 2464 | ||
| 2465 | pub fn getMachMsgError(err: mach_msg_return_t) MachMsgE { | 2465 | pub fn getMachMsgError(err: mach_msg_return_t) MachMsgE { |
| 2466 | return @intToEnum(MachMsgE, @truncate(u32, @intCast(usize, err))); | 2466 | return @enumFromInt(MachMsgE, @truncate(u32, @intCast(usize, err))); |
| 2467 | } | 2467 | } |
| 2468 | 2468 | ||
| 2469 | /// All special error code bits defined below. | 2469 | /// All special error code bits defined below. |
| ... | @@ -2665,10 +2665,10 @@ pub const RTLD = struct { | ... | @@ -2665,10 +2665,10 @@ pub const RTLD = struct { |
| 2665 | pub const NODELETE = 0x80; | 2665 | pub const NODELETE = 0x80; |
| 2666 | pub const FIRST = 0x100; | 2666 | pub const FIRST = 0x100; |
| 2667 | 2667 | ||
| 2668 | pub const NEXT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1))); | 2668 | pub const NEXT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1))); |
| 2669 | pub const DEFAULT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -2))); | 2669 | pub const DEFAULT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -2))); |
| 2670 | pub const SELF = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -3))); | 2670 | pub const SELF = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -3))); |
| 2671 | pub const MAIN_ONLY = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -5))); | 2671 | pub const MAIN_ONLY = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -5))); |
| 2672 | }; | 2672 | }; |
| 2673 | 2673 | ||
| 2674 | pub const F = struct { | 2674 | pub const F = struct { |
| ... | @@ -3418,12 +3418,12 @@ pub const PosixSpawn = struct { | ... | @@ -3418,12 +3418,12 @@ pub const PosixSpawn = struct { |
| 3418 | }; | 3418 | }; |
| 3419 | 3419 | ||
| 3420 | pub fn getKernError(err: kern_return_t) KernE { | 3420 | pub fn getKernError(err: kern_return_t) KernE { |
| 3421 | return @intToEnum(KernE, @truncate(u32, @intCast(usize, err))); | 3421 | return @enumFromInt(KernE, @truncate(u32, @intCast(usize, err))); |
| 3422 | } | 3422 | } |
| 3423 | 3423 | ||
| 3424 | pub fn unexpectedKernError(err: KernE) std.os.UnexpectedError { | 3424 | pub fn unexpectedKernError(err: KernE) std.os.UnexpectedError { |
| 3425 | if (std.os.unexpected_error_tracing) { | 3425 | if (std.os.unexpected_error_tracing) { |
| 3426 | std.debug.print("unexpected error: {d}\n", .{@enumToInt(err)}); | 3426 | std.debug.print("unexpected error: {d}\n", .{@intFromEnum(err)}); |
| 3427 | std.debug.dumpCurrentStackTrace(null); | 3427 | std.debug.dumpCurrentStackTrace(null); |
| 3428 | } | 3428 | } |
| 3429 | return error.Unexpected; | 3429 | return error.Unexpected; |
| ... | @@ -3455,7 +3455,7 @@ pub const MachTask = extern struct { | ... | @@ -3455,7 +3455,7 @@ pub const MachTask = extern struct { |
| 3455 | var out_port: mach_port_name_t = undefined; | 3455 | var out_port: mach_port_name_t = undefined; |
| 3456 | switch (getKernError(mach_port_allocate( | 3456 | switch (getKernError(mach_port_allocate( |
| 3457 | self.port, | 3457 | self.port, |
| 3458 | @enumToInt(right), | 3458 | @intFromEnum(right), |
| 3459 | &out_port, | 3459 | &out_port, |
| 3460 | ))) { | 3460 | ))) { |
| 3461 | .SUCCESS => return .{ .port = out_port }, | 3461 | .SUCCESS => return .{ .port = out_port }, |
| ... | @@ -3473,7 +3473,7 @@ pub const MachTask = extern struct { | ... | @@ -3473,7 +3473,7 @@ pub const MachTask = extern struct { |
| 3473 | self.port, | 3473 | self.port, |
| 3474 | port.port, | 3474 | port.port, |
| 3475 | port.port, | 3475 | port.port, |
| 3476 | @enumToInt(msg), | 3476 | @intFromEnum(msg), |
| 3477 | ))) { | 3477 | ))) { |
| 3478 | .SUCCESS => return, | 3478 | .SUCCESS => return, |
| 3479 | .FAILURE => return error.PermissionDenied, | 3479 | .FAILURE => return error.PermissionDenied, |
| ... | @@ -3665,7 +3665,7 @@ pub const MachTask = extern struct { | ... | @@ -3665,7 +3665,7 @@ pub const MachTask = extern struct { |
| 3665 | } | 3665 | } |
| 3666 | 3666 | ||
| 3667 | fn setProtectionImpl(task: MachTask, address: u64, len: usize, set_max: bool, prot: vm_prot_t) MachError!void { | 3667 | fn setProtectionImpl(task: MachTask, address: u64, len: usize, set_max: bool, prot: vm_prot_t) MachError!void { |
| 3668 | switch (getKernError(mach_vm_protect(task.port, address, len, @boolToInt(set_max), prot))) { | 3668 | switch (getKernError(mach_vm_protect(task.port, address, len, @intFromBool(set_max), prot))) { |
| 3669 | .SUCCESS => return, | 3669 | .SUCCESS => return, |
| 3670 | .FAILURE => return error.PermissionDenied, | 3670 | .FAILURE => return error.PermissionDenied, |
| 3671 | else => |err| return unexpectedKernError(err), | 3671 | else => |err| return unexpectedKernError(err), |
| ... | @@ -3700,7 +3700,7 @@ pub const MachTask = extern struct { | ... | @@ -3700,7 +3700,7 @@ pub const MachTask = extern struct { |
| 3700 | switch (getKernError(mach_vm_write( | 3700 | switch (getKernError(mach_vm_write( |
| 3701 | task.port, | 3701 | task.port, |
| 3702 | curr_addr, | 3702 | curr_addr, |
| 3703 | @ptrToInt(out_buf.ptr), | 3703 | @intFromPtr(out_buf.ptr), |
| 3704 | @intCast(mach_msg_type_number_t, curr_size), | 3704 | @intCast(mach_msg_type_number_t, curr_size), |
| 3705 | ))) { | 3705 | ))) { |
| 3706 | .SUCCESS => {}, | 3706 | .SUCCESS => {}, |
| ... | @@ -3752,7 +3752,7 @@ pub const MachTask = extern struct { | ... | @@ -3752,7 +3752,7 @@ pub const MachTask = extern struct { |
| 3752 | else => |err| return unexpectedKernError(err), | 3752 | else => |err| return unexpectedKernError(err), |
| 3753 | } | 3753 | } |
| 3754 | 3754 | ||
| 3755 | @memcpy(out_buf[0..curr_bytes_read], @intToPtr([*]const u8, vm_memory)); | 3755 | @memcpy(out_buf[0..curr_bytes_read], @ptrFromInt([*]const u8, vm_memory)); |
| 3756 | _ = vm_deallocate(mach_task_self(), vm_memory, curr_bytes_read); | 3756 | _ = vm_deallocate(mach_task_self(), vm_memory, curr_bytes_read); |
| 3757 | 3757 | ||
| 3758 | out_buf = out_buf[curr_bytes_read..]; | 3758 | out_buf = out_buf[curr_bytes_read..]; |
| ... | @@ -3831,7 +3831,7 @@ pub const MachTask = extern struct { | ... | @@ -3831,7 +3831,7 @@ pub const MachTask = extern struct { |
| 3831 | const self_task = machTaskForSelf(); | 3831 | const self_task = machTaskForSelf(); |
| 3832 | _ = vm_deallocate( | 3832 | _ = vm_deallocate( |
| 3833 | self_task.port, | 3833 | self_task.port, |
| 3834 | @ptrToInt(list.buf.ptr), | 3834 | @intFromPtr(list.buf.ptr), |
| 3835 | @intCast(vm_size_t, list.buf.len * @sizeOf(mach_port_t)), | 3835 | @intCast(vm_size_t, list.buf.len * @sizeOf(mach_port_t)), |
| 3836 | ); | 3836 | ); |
| 3837 | } | 3837 | } |
lib/std/c/dragonfly.zig+8-8| ... | @@ -172,7 +172,7 @@ pub const PROT = struct { | ... | @@ -172,7 +172,7 @@ pub const PROT = struct { |
| 172 | 172 | ||
| 173 | pub const MAP = struct { | 173 | pub const MAP = struct { |
| 174 | pub const FILE = 0; | 174 | pub const FILE = 0; |
| 175 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 175 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 176 | pub const ANONYMOUS = ANON; | 176 | pub const ANONYMOUS = ANON; |
| 177 | pub const COPY = PRIVATE; | 177 | pub const COPY = PRIVATE; |
| 178 | pub const SHARED = 1; | 178 | pub const SHARED = 1; |
| ... | @@ -620,9 +620,9 @@ pub const S = struct { | ... | @@ -620,9 +620,9 @@ pub const S = struct { |
| 620 | pub const BADSIG = SIG.ERR; | 620 | pub const BADSIG = SIG.ERR; |
| 621 | 621 | ||
| 622 | pub const SIG = struct { | 622 | pub const SIG = struct { |
| 623 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 623 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 624 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 624 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 625 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 625 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 626 | 626 | ||
| 627 | pub const BLOCK = 1; | 627 | pub const BLOCK = 1; |
| 628 | pub const UNBLOCK = 2; | 628 | pub const UNBLOCK = 2; |
| ... | @@ -871,10 +871,10 @@ pub const RTLD = struct { | ... | @@ -871,10 +871,10 @@ pub const RTLD = struct { |
| 871 | pub const NODELETE = 0x01000; | 871 | pub const NODELETE = 0x01000; |
| 872 | pub const NOLOAD = 0x02000; | 872 | pub const NOLOAD = 0x02000; |
| 873 | 873 | ||
| 874 | pub const NEXT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1))); | 874 | pub const NEXT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1))); |
| 875 | pub const DEFAULT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -2))); | 875 | pub const DEFAULT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -2))); |
| 876 | pub const SELF = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -3))); | 876 | pub const SELF = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -3))); |
| 877 | pub const ALL = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -4))); | 877 | pub const ALL = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -4))); |
| 878 | }; | 878 | }; |
| 879 | 879 | ||
| 880 | pub const dl_phdr_info = extern struct { | 880 | pub const dl_phdr_info = extern struct { |
lib/std/c/freebsd.zig+5-5| ... | @@ -961,7 +961,7 @@ pub const CLOCK = struct { | ... | @@ -961,7 +961,7 @@ pub const CLOCK = struct { |
| 961 | }; | 961 | }; |
| 962 | 962 | ||
| 963 | pub const MAP = struct { | 963 | pub const MAP = struct { |
| 964 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 964 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 965 | pub const SHARED = 0x0001; | 965 | pub const SHARED = 0x0001; |
| 966 | pub const PRIVATE = 0x0002; | 966 | pub const PRIVATE = 0x0002; |
| 967 | pub const FIXED = 0x0010; | 967 | pub const FIXED = 0x0010; |
| ... | @@ -1086,9 +1086,9 @@ pub const SIG = struct { | ... | @@ -1086,9 +1086,9 @@ pub const SIG = struct { |
| 1086 | pub const UNBLOCK = 2; | 1086 | pub const UNBLOCK = 2; |
| 1087 | pub const SETMASK = 3; | 1087 | pub const SETMASK = 3; |
| 1088 | 1088 | ||
| 1089 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 1089 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 1090 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 1090 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 1091 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 1091 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 1092 | 1092 | ||
| 1093 | pub const WORDS = 4; | 1093 | pub const WORDS = 4; |
| 1094 | pub const MAXSIG = 128; | 1094 | pub const MAXSIG = 128; |
| ... | @@ -2650,7 +2650,7 @@ const ioctl_cmd = enum(u32) { | ... | @@ -2650,7 +2650,7 @@ const ioctl_cmd = enum(u32) { |
| 2650 | }; | 2650 | }; |
| 2651 | 2651 | ||
| 2652 | fn ioImpl(cmd: ioctl_cmd, op: u8, nr: u8, comptime IT: type) u32 { | 2652 | fn ioImpl(cmd: ioctl_cmd, op: u8, nr: u8, comptime IT: type) u32 { |
| 2653 | return @bitCast(u32, @enumToInt(cmd) | @intCast(u32, @truncate(u8, @sizeOf(IT))) << 16 | @intCast(u32, op) << 8 | nr); | 2653 | return @bitCast(u32, @intFromEnum(cmd) | @intCast(u32, @truncate(u8, @sizeOf(IT))) << 16 | @intCast(u32, op) << 8 | nr); |
| 2654 | } | 2654 | } |
| 2655 | 2655 | ||
| 2656 | pub fn IO(op: u8, nr: u8) u32 { | 2656 | pub fn IO(op: u8, nr: u8) u32 { |
lib/std/c/haiku.zig+4-4| ... | @@ -414,7 +414,7 @@ pub const CLOCK = struct { | ... | @@ -414,7 +414,7 @@ pub const CLOCK = struct { |
| 414 | 414 | ||
| 415 | pub const MAP = struct { | 415 | pub const MAP = struct { |
| 416 | /// mmap() error return code | 416 | /// mmap() error return code |
| 417 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 417 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 418 | /// changes are seen by others | 418 | /// changes are seen by others |
| 419 | pub const SHARED = 0x01; | 419 | pub const SHARED = 0x01; |
| 420 | /// changes are only seen by caller | 420 | /// changes are only seen by caller |
| ... | @@ -481,9 +481,9 @@ pub const SA = struct { | ... | @@ -481,9 +481,9 @@ pub const SA = struct { |
| 481 | }; | 481 | }; |
| 482 | 482 | ||
| 483 | pub const SIG = struct { | 483 | pub const SIG = struct { |
| 484 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 484 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 485 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 485 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 486 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 486 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 487 | 487 | ||
| 488 | pub const HUP = 1; | 488 | pub const HUP = 1; |
| 489 | pub const INT = 2; | 489 | pub const INT = 2; |
lib/std/c/linux.zig+1-1| ... | @@ -32,7 +32,7 @@ pub const MADV = linux.MADV; | ... | @@ -32,7 +32,7 @@ pub const MADV = linux.MADV; |
| 32 | pub const MAP = struct { | 32 | pub const MAP = struct { |
| 33 | pub usingnamespace linux.MAP; | 33 | pub usingnamespace linux.MAP; |
| 34 | /// Only used by libc to communicate failure. | 34 | /// Only used by libc to communicate failure. |
| 35 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 35 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 36 | }; | 36 | }; |
| 37 | pub const MSF = linux.MSF; | 37 | pub const MSF = linux.MSF; |
| 38 | pub const MMAP2_UNIT = linux.MMAP2_UNIT; | 38 | pub const MMAP2_UNIT = linux.MMAP2_UNIT; |
lib/std/c/netbsd.zig+7-7| ... | @@ -172,9 +172,9 @@ pub const RTLD = struct { | ... | @@ -172,9 +172,9 @@ pub const RTLD = struct { |
| 172 | pub const NODELETE = 0x01000; | 172 | pub const NODELETE = 0x01000; |
| 173 | pub const NOLOAD = 0x02000; | 173 | pub const NOLOAD = 0x02000; |
| 174 | 174 | ||
| 175 | pub const NEXT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1))); | 175 | pub const NEXT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1))); |
| 176 | pub const DEFAULT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -2))); | 176 | pub const DEFAULT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -2))); |
| 177 | pub const SELF = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -3))); | 177 | pub const SELF = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -3))); |
| 178 | }; | 178 | }; |
| 179 | 179 | ||
| 180 | pub const dl_phdr_info = extern struct { | 180 | pub const dl_phdr_info = extern struct { |
| ... | @@ -591,7 +591,7 @@ pub const CLOCK = struct { | ... | @@ -591,7 +591,7 @@ pub const CLOCK = struct { |
| 591 | }; | 591 | }; |
| 592 | 592 | ||
| 593 | pub const MAP = struct { | 593 | pub const MAP = struct { |
| 594 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 594 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 595 | pub const SHARED = 0x0001; | 595 | pub const SHARED = 0x0001; |
| 596 | pub const PRIVATE = 0x0002; | 596 | pub const PRIVATE = 0x0002; |
| 597 | pub const REMAPDUP = 0x0004; | 597 | pub const REMAPDUP = 0x0004; |
| ... | @@ -1090,9 +1090,9 @@ pub const winsize = extern struct { | ... | @@ -1090,9 +1090,9 @@ pub const winsize = extern struct { |
| 1090 | const NSIG = 32; | 1090 | const NSIG = 32; |
| 1091 | 1091 | ||
| 1092 | pub const SIG = struct { | 1092 | pub const SIG = struct { |
| 1093 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 1093 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 1094 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 1094 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 1095 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 1095 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 1096 | 1096 | ||
| 1097 | pub const WORDS = 4; | 1097 | pub const WORDS = 4; |
| 1098 | pub const MAXSIG = 128; | 1098 | pub const MAXSIG = 128; |
lib/std/c/openbsd.zig+6-6| ... | @@ -449,7 +449,7 @@ pub const CLOCK = struct { | ... | @@ -449,7 +449,7 @@ pub const CLOCK = struct { |
| 449 | }; | 449 | }; |
| 450 | 450 | ||
| 451 | pub const MAP = struct { | 451 | pub const MAP = struct { |
| 452 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 452 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 453 | pub const SHARED = 0x0001; | 453 | pub const SHARED = 0x0001; |
| 454 | pub const PRIVATE = 0x0002; | 454 | pub const PRIVATE = 0x0002; |
| 455 | pub const FIXED = 0x0010; | 455 | pub const FIXED = 0x0010; |
| ... | @@ -990,11 +990,11 @@ pub const winsize = extern struct { | ... | @@ -990,11 +990,11 @@ pub const winsize = extern struct { |
| 990 | const NSIG = 33; | 990 | const NSIG = 33; |
| 991 | 991 | ||
| 992 | pub const SIG = struct { | 992 | pub const SIG = struct { |
| 993 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 993 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 994 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 994 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 995 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 995 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 996 | pub const CATCH = @intToPtr(?Sigaction.handler_fn, 2); | 996 | pub const CATCH = @ptrFromInt(?Sigaction.handler_fn, 2); |
| 997 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 3); | 997 | pub const HOLD = @ptrFromInt(?Sigaction.handler_fn, 3); |
| 998 | 998 | ||
| 999 | pub const HUP = 1; | 999 | pub const HUP = 1; |
| 1000 | pub const INT = 2; | 1000 | pub const INT = 2; |
lib/std/c/solaris.zig+10-10| ... | @@ -111,10 +111,10 @@ pub const RTLD = struct { | ... | @@ -111,10 +111,10 @@ pub const RTLD = struct { |
| 111 | pub const FIRST = 0x02000; | 111 | pub const FIRST = 0x02000; |
| 112 | pub const CONFGEN = 0x10000; | 112 | pub const CONFGEN = 0x10000; |
| 113 | 113 | ||
| 114 | pub const NEXT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1))); | 114 | pub const NEXT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1))); |
| 115 | pub const DEFAULT = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -2))); | 115 | pub const DEFAULT = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -2))); |
| 116 | pub const SELF = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -3))); | 116 | pub const SELF = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -3))); |
| 117 | pub const PROBE = @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -4))); | 117 | pub const PROBE = @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -4))); |
| 118 | }; | 118 | }; |
| 119 | 119 | ||
| 120 | pub const Flock = extern struct { | 120 | pub const Flock = extern struct { |
| ... | @@ -524,7 +524,7 @@ pub const CLOCK = struct { | ... | @@ -524,7 +524,7 @@ pub const CLOCK = struct { |
| 524 | }; | 524 | }; |
| 525 | 525 | ||
| 526 | pub const MAP = struct { | 526 | pub const MAP = struct { |
| 527 | pub const FAILED = @intToPtr(*anyopaque, maxInt(usize)); | 527 | pub const FAILED = @ptrFromInt(*anyopaque, maxInt(usize)); |
| 528 | pub const SHARED = 0x0001; | 528 | pub const SHARED = 0x0001; |
| 529 | pub const PRIVATE = 0x0002; | 529 | pub const PRIVATE = 0x0002; |
| 530 | pub const TYPE = 0x000f; | 530 | pub const TYPE = 0x000f; |
| ... | @@ -886,10 +886,10 @@ pub const winsize = extern struct { | ... | @@ -886,10 +886,10 @@ pub const winsize = extern struct { |
| 886 | const NSIG = 75; | 886 | const NSIG = 75; |
| 887 | 887 | ||
| 888 | pub const SIG = struct { | 888 | pub const SIG = struct { |
| 889 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 889 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 890 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 890 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 891 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 891 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 892 | pub const HOLD = @intToPtr(?Sigaction.handler_fn, 2); | 892 | pub const HOLD = @ptrFromInt(?Sigaction.handler_fn, 2); |
| 893 | 893 | ||
| 894 | pub const WORDS = 4; | 894 | pub const WORDS = 4; |
| 895 | pub const MAXSIG = 75; | 895 | pub const MAXSIG = 75; |
| ... | @@ -1909,7 +1909,7 @@ const IoCtlCommand = enum(u32) { | ... | @@ -1909,7 +1909,7 @@ const IoCtlCommand = enum(u32) { |
| 1909 | fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 { | 1909 | fn ioImpl(cmd: IoCtlCommand, io_type: u8, nr: u8, comptime IOT: type) i32 { |
| 1910 | const size = @intCast(u32, @truncate(u8, @sizeOf(IOT))) << 16; | 1910 | const size = @intCast(u32, @truncate(u8, @sizeOf(IOT))) << 16; |
| 1911 | const t = @intCast(u32, io_type) << 8; | 1911 | const t = @intCast(u32, io_type) << 8; |
| 1912 | return @bitCast(i32, @enumToInt(cmd) | size | t | nr); | 1912 | return @bitCast(i32, @intFromEnum(cmd) | size | t | nr); |
| 1913 | } | 1913 | } |
| 1914 | 1914 | ||
| 1915 | pub fn IO(io_type: u8, nr: u8) i32 { | 1915 | pub fn IO(io_type: u8, nr: u8) i32 { |
lib/std/child_process.zig+3-3| ... | @@ -449,7 +449,7 @@ pub const ChildProcess = struct { | ... | @@ -449,7 +449,7 @@ pub const ChildProcess = struct { |
| 449 | // has a value greater than 0 | 449 | // has a value greater than 0 |
| 450 | if ((fd[0].revents & std.os.POLL.IN) != 0) { | 450 | if ((fd[0].revents & std.os.POLL.IN) != 0) { |
| 451 | const err_int = try readIntFd(err_pipe[0]); | 451 | const err_int = try readIntFd(err_pipe[0]); |
| 452 | return @errSetCast(SpawnError, @intToError(err_int)); | 452 | return @errSetCast(SpawnError, @errorFromInt(err_int)); |
| 453 | } | 453 | } |
| 454 | } else { | 454 | } else { |
| 455 | // Write maxInt(ErrInt) to the write end of the err_pipe. This is after | 455 | // Write maxInt(ErrInt) to the write end of the err_pipe. This is after |
| ... | @@ -462,7 +462,7 @@ pub const ChildProcess = struct { | ... | @@ -462,7 +462,7 @@ pub const ChildProcess = struct { |
| 462 | // Here we potentially return the fork child's error from the parent | 462 | // Here we potentially return the fork child's error from the parent |
| 463 | // pid. | 463 | // pid. |
| 464 | if (err_int != maxInt(ErrInt)) { | 464 | if (err_int != maxInt(ErrInt)) { |
| 465 | return @errSetCast(SpawnError, @intToError(err_int)); | 465 | return @errSetCast(SpawnError, @errorFromInt(err_int)); |
| 466 | } | 466 | } |
| 467 | } | 467 | } |
| 468 | } | 468 | } |
| ... | @@ -1356,7 +1356,7 @@ fn destroyPipe(pipe: [2]os.fd_t) void { | ... | @@ -1356,7 +1356,7 @@ fn destroyPipe(pipe: [2]os.fd_t) void { |
| 1356 | // Child of fork calls this to report an error to the fork parent. | 1356 | // Child of fork calls this to report an error to the fork parent. |
| 1357 | // Then the child exits. | 1357 | // Then the child exits. |
| 1358 | fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn { | 1358 | fn forkChildErrReport(fd: i32, err: ChildProcess.SpawnError) noreturn { |
| 1359 | writeIntFd(fd, @as(ErrInt, @errorToInt(err))) catch {}; | 1359 | writeIntFd(fd, @as(ErrInt, @intFromError(err))) catch {}; |
| 1360 | // If we're linking libc, some naughty applications may have registered atexit handlers | 1360 | // If we're linking libc, some naughty applications may have registered atexit handlers |
| 1361 | // which we really do not want to run in the fork child. I caught LLVM doing this and | 1361 | // which we really do not want to run in the fork child. I caught LLVM doing this and |
| 1362 | // it caused a deadlock instead of doing an exit syscall. In the words of Avril Lavigne, | 1362 | // it caused a deadlock instead of doing an exit syscall. In the words of Avril Lavigne, |
lib/std/coff.zig+5-5| ... | @@ -1105,7 +1105,7 @@ pub const Coff = struct { | ... | @@ -1105,7 +1105,7 @@ pub const Coff = struct { |
| 1105 | assert(self.is_image); | 1105 | assert(self.is_image); |
| 1106 | 1106 | ||
| 1107 | const data_dirs = self.getDataDirectories(); | 1107 | const data_dirs = self.getDataDirectories(); |
| 1108 | const debug_dir = data_dirs[@enumToInt(DirectoryEntry.DEBUG)]; | 1108 | const debug_dir = data_dirs[@intFromEnum(DirectoryEntry.DEBUG)]; |
| 1109 | 1109 | ||
| 1110 | var stream = std.io.fixedBufferStream(self.data); | 1110 | var stream = std.io.fixedBufferStream(self.data); |
| 1111 | const reader = stream.reader(); | 1111 | const reader = stream.reader(); |
| ... | @@ -1303,9 +1303,9 @@ pub const Symtab = struct { | ... | @@ -1303,9 +1303,9 @@ pub const Symtab = struct { |
| 1303 | return .{ | 1303 | return .{ |
| 1304 | .name = raw[0..8].*, | 1304 | .name = raw[0..8].*, |
| 1305 | .value = mem.readIntLittle(u32, raw[8..12]), | 1305 | .value = mem.readIntLittle(u32, raw[8..12]), |
| 1306 | .section_number = @intToEnum(SectionNumber, mem.readIntLittle(u16, raw[12..14])), | 1306 | .section_number = @enumFromInt(SectionNumber, mem.readIntLittle(u16, raw[12..14])), |
| 1307 | .type = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])), | 1307 | .type = @bitCast(SymType, mem.readIntLittle(u16, raw[14..16])), |
| 1308 | .storage_class = @intToEnum(StorageClass, raw[16]), | 1308 | .storage_class = @enumFromInt(StorageClass, raw[16]), |
| 1309 | .number_of_aux_symbols = raw[17], | 1309 | .number_of_aux_symbols = raw[17], |
| 1310 | }; | 1310 | }; |
| 1311 | } | 1311 | } |
| ... | @@ -1333,7 +1333,7 @@ pub const Symtab = struct { | ... | @@ -1333,7 +1333,7 @@ pub const Symtab = struct { |
| 1333 | fn asWeakExtDef(raw: []const u8) WeakExternalDefinition { | 1333 | fn asWeakExtDef(raw: []const u8) WeakExternalDefinition { |
| 1334 | return .{ | 1334 | return .{ |
| 1335 | .tag_index = mem.readIntLittle(u32, raw[0..4]), | 1335 | .tag_index = mem.readIntLittle(u32, raw[0..4]), |
| 1336 | .flag = @intToEnum(WeakExternalFlag, mem.readIntLittle(u32, raw[4..8])), | 1336 | .flag = @enumFromInt(WeakExternalFlag, mem.readIntLittle(u32, raw[4..8])), |
| 1337 | .unused = raw[8..18].*, | 1337 | .unused = raw[8..18].*, |
| 1338 | }; | 1338 | }; |
| 1339 | } | 1339 | } |
| ... | @@ -1351,7 +1351,7 @@ pub const Symtab = struct { | ... | @@ -1351,7 +1351,7 @@ pub const Symtab = struct { |
| 1351 | .number_of_linenumbers = mem.readIntLittle(u16, raw[6..8]), | 1351 | .number_of_linenumbers = mem.readIntLittle(u16, raw[6..8]), |
| 1352 | .checksum = mem.readIntLittle(u32, raw[8..12]), | 1352 | .checksum = mem.readIntLittle(u32, raw[8..12]), |
| 1353 | .number = mem.readIntLittle(u16, raw[12..14]), | 1353 | .number = mem.readIntLittle(u16, raw[12..14]), |
| 1354 | .selection = @intToEnum(ComdatSelection, raw[14]), | 1354 | .selection = @enumFromInt(ComdatSelection, raw[14]), |
| 1355 | .unused = raw[15..18].*, | 1355 | .unused = raw[15..18].*, |
| 1356 | }; | 1356 | }; |
| 1357 | } | 1357 | } |
lib/std/compress/deflate/huffman_bit_writer.zig+1-1| ... | @@ -527,7 +527,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type { | ... | @@ -527,7 +527,7 @@ pub fn HuffmanBitWriter(comptime WriterType: type) type { |
| 527 | } | 527 | } |
| 528 | 528 | ||
| 529 | // Huffman. | 529 | // Huffman. |
| 530 | if (@ptrToInt(literal_encoding) == @ptrToInt(&self.fixed_literal_encoding)) { | 530 | if (@intFromPtr(literal_encoding) == @intFromPtr(&self.fixed_literal_encoding)) { |
| 531 | try self.writeFixedHeader(eof); | 531 | try self.writeFixedHeader(eof); |
| 532 | } else { | 532 | } else { |
| 533 | try self.writeDynamicHeader(num_literals, num_offsets, num_codegens, eof); | 533 | try self.writeDynamicHeader(num_literals, num_offsets, num_codegens, eof); |
lib/std/compress/lzma/decode.zig+2-2| ... | @@ -326,7 +326,7 @@ pub const DecoderState = struct { | ... | @@ -326,7 +326,7 @@ pub const DecoderState = struct { |
| 326 | while (result < 0x100) { | 326 | while (result < 0x100) { |
| 327 | const match_bit = (match_byte >> 7) & 1; | 327 | const match_bit = (match_byte >> 7) & 1; |
| 328 | match_byte <<= 1; | 328 | match_byte <<= 1; |
| 329 | const bit = @boolToInt(try decoder.decodeBit( | 329 | const bit = @intFromBool(try decoder.decodeBit( |
| 330 | reader, | 330 | reader, |
| 331 | &probs[((@as(usize, 1) + match_bit) << 8) + result], | 331 | &probs[((@as(usize, 1) + match_bit) << 8) + result], |
| 332 | update, | 332 | update, |
| ... | @@ -339,7 +339,7 @@ pub const DecoderState = struct { | ... | @@ -339,7 +339,7 @@ pub const DecoderState = struct { |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | while (result < 0x100) { | 341 | while (result < 0x100) { |
| 342 | result = (result << 1) ^ @boolToInt(try decoder.decodeBit(reader, &probs[result], update)); | 342 | result = (result << 1) ^ @intFromBool(try decoder.decodeBit(reader, &probs[result], update)); |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | return @truncate(u8, result - 0x100); | 345 | return @truncate(u8, result - 0x100); |
lib/std/compress/lzma/decode/rangecoder.zig+3-3| ... | @@ -57,7 +57,7 @@ pub const RangeDecoder = struct { | ... | @@ -57,7 +57,7 @@ pub const RangeDecoder = struct { |
| 57 | var result: u32 = 0; | 57 | var result: u32 = 0; |
| 58 | var i: usize = 0; | 58 | var i: usize = 0; |
| 59 | while (i < count) : (i += 1) | 59 | while (i < count) : (i += 1) |
| 60 | result = (result << 1) ^ @boolToInt(try self.getBit(reader)); | 60 | result = (result << 1) ^ @intFromBool(try self.getBit(reader)); |
| 61 | return result; | 61 | return result; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| ... | @@ -93,7 +93,7 @@ pub const RangeDecoder = struct { | ... | @@ -93,7 +93,7 @@ pub const RangeDecoder = struct { |
| 93 | var i: @TypeOf(num_bits) = 0; | 93 | var i: @TypeOf(num_bits) = 0; |
| 94 | while (i < num_bits) : (i += 1) { | 94 | while (i < num_bits) : (i += 1) { |
| 95 | const bit = try self.decodeBit(reader, &probs[tmp], update); | 95 | const bit = try self.decodeBit(reader, &probs[tmp], update); |
| 96 | tmp = (tmp << 1) ^ @boolToInt(bit); | 96 | tmp = (tmp << 1) ^ @intFromBool(bit); |
| 97 | } | 97 | } |
| 98 | return tmp - (@as(u32, 1) << num_bits); | 98 | return tmp - (@as(u32, 1) << num_bits); |
| 99 | } | 99 | } |
| ... | @@ -110,7 +110,7 @@ pub const RangeDecoder = struct { | ... | @@ -110,7 +110,7 @@ pub const RangeDecoder = struct { |
| 110 | var tmp: usize = 1; | 110 | var tmp: usize = 1; |
| 111 | var i: @TypeOf(num_bits) = 0; | 111 | var i: @TypeOf(num_bits) = 0; |
| 112 | while (i < num_bits) : (i += 1) { | 112 | while (i < num_bits) : (i += 1) { |
| 113 | const bit = @boolToInt(try self.decodeBit(reader, &probs[offset + tmp], update)); | 113 | const bit = @intFromBool(try self.decodeBit(reader, &probs[offset + tmp], update)); |
| 114 | tmp = (tmp << 1) ^ bit; | 114 | tmp = (tmp << 1) ^ bit; |
| 115 | result ^= @as(u32, bit) << i; | 115 | result ^= @as(u32, bit) << i; |
| 116 | } | 116 | } |
lib/std/compress/xz.zig+1-1| ... | @@ -18,7 +18,7 @@ fn readStreamFlags(reader: anytype, check: *Check) !void { | ... | @@ -18,7 +18,7 @@ fn readStreamFlags(reader: anytype, check: *Check) !void { |
| 18 | if (reserved1 != 0) | 18 | if (reserved1 != 0) |
| 19 | return error.CorruptInput; | 19 | return error.CorruptInput; |
| 20 | 20 | ||
| 21 | check.* = @intToEnum(Check, try bit_reader.readBitsNoEof(u4, 4)); | 21 | check.* = @enumFromInt(Check, try bit_reader.readBitsNoEof(u4, 4)); |
| 22 | 22 | ||
| 23 | const reserved2 = try bit_reader.readBitsNoEof(u4, 4); | 23 | const reserved2 = try bit_reader.readBitsNoEof(u4, 4); |
| 24 | if (reserved2 != 0) | 24 | if (reserved2 != 0) |
lib/std/compress/xz/block.zig+2-2| ... | @@ -124,12 +124,12 @@ pub fn Decoder(comptime ReaderType: type) type { | ... | @@ -124,12 +124,12 @@ pub fn Decoder(comptime ReaderType: type) type { |
| 124 | _, | 124 | _, |
| 125 | }; | 125 | }; |
| 126 | 126 | ||
| 127 | const filter_id = @intToEnum( | 127 | const filter_id = @enumFromInt( |
| 128 | FilterId, | 128 | FilterId, |
| 129 | try std.leb.readULEB128(u64, header_reader), | 129 | try std.leb.readULEB128(u64, header_reader), |
| 130 | ); | 130 | ); |
| 131 | 131 | ||
| 132 | if (@enumToInt(filter_id) >= 0x4000_0000_0000_0000) | 132 | if (@intFromEnum(filter_id) >= 0x4000_0000_0000_0000) |
| 133 | return error.CorruptInput; | 133 | return error.CorruptInput; |
| 134 | 134 | ||
| 135 | if (filter_id != .lzma2) | 135 | if (filter_id != .lzma2) |
lib/std/compress/zlib.zig+1-1| ... | @@ -126,7 +126,7 @@ pub fn CompressStream(comptime WriterType: type) type { | ... | @@ -126,7 +126,7 @@ pub fn CompressStream(comptime WriterType: type) type { |
| 126 | var header = ZLibHeader{ | 126 | var header = ZLibHeader{ |
| 127 | .compression_info = ZLibHeader.WINDOW_32K, | 127 | .compression_info = ZLibHeader.WINDOW_32K, |
| 128 | .compression_method = ZLibHeader.DEFLATE, | 128 | .compression_method = ZLibHeader.DEFLATE, |
| 129 | .compression_level = @enumToInt(options.level), | 129 | .compression_level = @intFromEnum(options.level), |
| 130 | .preset_dict = 0, | 130 | .preset_dict = 0, |
| 131 | .checksum = 0, | 131 | .checksum = 0, |
| 132 | }; | 132 | }; |
lib/std/compress/zstandard/decode/block.zig+5-5| ... | @@ -894,7 +894,7 @@ pub fn decodeBlockReader( | ... | @@ -894,7 +894,7 @@ pub fn decodeBlockReader( |
| 894 | /// Decode the header of a block. | 894 | /// Decode the header of a block. |
| 895 | pub fn decodeBlockHeader(src: *const [3]u8) frame.Zstandard.Block.Header { | 895 | pub fn decodeBlockHeader(src: *const [3]u8) frame.Zstandard.Block.Header { |
| 896 | const last_block = src[0] & 1 == 1; | 896 | const last_block = src[0] & 1 == 1; |
| 897 | const block_type = @intToEnum(frame.Zstandard.Block.Type, (src[0] & 0b110) >> 1); | 897 | const block_type = @enumFromInt(frame.Zstandard.Block.Type, (src[0] & 0b110) >> 1); |
| 898 | const block_size = ((src[0] & 0b11111000) >> 3) + (@as(u21, src[1]) << 5) + (@as(u21, src[2]) << 13); | 898 | const block_size = ((src[0] & 0b11111000) >> 3) + (@as(u21, src[1]) << 5) + (@as(u21, src[2]) << 13); |
| 899 | return .{ | 899 | return .{ |
| 900 | .last_block = last_block, | 900 | .last_block = last_block, |
| ... | @@ -1058,7 +1058,7 @@ fn decodeStreams(size_format: u2, stream_data: []const u8) !LiteralsSection.Stre | ... | @@ -1058,7 +1058,7 @@ fn decodeStreams(size_format: u2, stream_data: []const u8) !LiteralsSection.Stre |
| 1058 | /// - `error.EndOfStream` if there are not enough bytes in `source` | 1058 | /// - `error.EndOfStream` if there are not enough bytes in `source` |
| 1059 | pub fn decodeLiteralsHeader(source: anytype) !LiteralsSection.Header { | 1059 | pub fn decodeLiteralsHeader(source: anytype) !LiteralsSection.Header { |
| 1060 | const byte0 = try source.readByte(); | 1060 | const byte0 = try source.readByte(); |
| 1061 | const block_type = @intToEnum(LiteralsSection.BlockType, byte0 & 0b11); | 1061 | const block_type = @enumFromInt(LiteralsSection.BlockType, byte0 & 0b11); |
| 1062 | const size_format = @intCast(u2, (byte0 & 0b1100) >> 2); | 1062 | const size_format = @intCast(u2, (byte0 & 0b1100) >> 2); |
| 1063 | var regenerated_size: u20 = undefined; | 1063 | var regenerated_size: u20 = undefined; |
| 1064 | var compressed_size: ?u18 = null; | 1064 | var compressed_size: ?u18 = null; |
| ... | @@ -1132,9 +1132,9 @@ pub fn decodeSequencesHeader( | ... | @@ -1132,9 +1132,9 @@ pub fn decodeSequencesHeader( |
| 1132 | 1132 | ||
| 1133 | const compression_modes = try source.readByte(); | 1133 | const compression_modes = try source.readByte(); |
| 1134 | 1134 | ||
| 1135 | const matches_mode = @intToEnum(SequencesSection.Header.Mode, (compression_modes & 0b00001100) >> 2); | 1135 | const matches_mode = @enumFromInt(SequencesSection.Header.Mode, (compression_modes & 0b00001100) >> 2); |
| 1136 | const offsets_mode = @intToEnum(SequencesSection.Header.Mode, (compression_modes & 0b00110000) >> 4); | 1136 | const offsets_mode = @enumFromInt(SequencesSection.Header.Mode, (compression_modes & 0b00110000) >> 4); |
| 1137 | const literal_mode = @intToEnum(SequencesSection.Header.Mode, (compression_modes & 0b11000000) >> 6); | 1137 | const literal_mode = @enumFromInt(SequencesSection.Header.Mode, (compression_modes & 0b11000000) >> 6); |
| 1138 | if (compression_modes & 0b11 != 0) return error.ReservedBitSet; | 1138 | if (compression_modes & 0b11 != 0) return error.ReservedBitSet; |
| 1139 | 1139 | ||
| 1140 | return SequencesSection.Header{ | 1140 | return SequencesSection.Header{ |
lib/std/crypto/25519/edwards25519.zig+9-9| ... | @@ -38,11 +38,11 @@ pub const Edwards25519 = struct { | ... | @@ -38,11 +38,11 @@ pub const Edwards25519 = struct { |
| 38 | const vxx = x.sq().mul(v); | 38 | const vxx = x.sq().mul(v); |
| 39 | const has_m_root = vxx.sub(u).isZero(); | 39 | const has_m_root = vxx.sub(u).isZero(); |
| 40 | const has_p_root = vxx.add(u).isZero(); | 40 | const has_p_root = vxx.add(u).isZero(); |
| 41 | if ((@boolToInt(has_m_root) | @boolToInt(has_p_root)) == 0) { // best-effort to avoid two conditional branches | 41 | if ((@intFromBool(has_m_root) | @intFromBool(has_p_root)) == 0) { // best-effort to avoid two conditional branches |
| 42 | return error.InvalidEncoding; | 42 | return error.InvalidEncoding; |
| 43 | } | 43 | } |
| 44 | x.cMov(x.mul(Fe.sqrtm1), 1 - @boolToInt(has_m_root)); | 44 | x.cMov(x.mul(Fe.sqrtm1), 1 - @intFromBool(has_m_root)); |
| 45 | x.cMov(x.neg(), @boolToInt(x.isNegative()) ^ (s[31] >> 7)); | 45 | x.cMov(x.neg(), @intFromBool(x.isNegative()) ^ (s[31] >> 7)); |
| 46 | const t = x.mul(y); | 46 | const t = x.mul(y); |
| 47 | return Edwards25519{ .x = x, .y = y, .z = z, .t = t }; | 47 | return Edwards25519{ .x = x, .y = y, .z = z, .t = t }; |
| 48 | } | 48 | } |
| ... | @@ -51,7 +51,7 @@ pub const Edwards25519 = struct { | ... | @@ -51,7 +51,7 @@ pub const Edwards25519 = struct { |
| 51 | pub fn toBytes(p: Edwards25519) [encoded_length]u8 { | 51 | pub fn toBytes(p: Edwards25519) [encoded_length]u8 { |
| 52 | const zi = p.z.invert(); | 52 | const zi = p.z.invert(); |
| 53 | var s = p.y.mul(zi).toBytes(); | 53 | var s = p.y.mul(zi).toBytes(); |
| 54 | s[31] ^= @as(u8, @boolToInt(p.x.mul(zi).isNegative())) << 7; | 54 | s[31] ^= @as(u8, @intFromBool(p.x.mul(zi).isNegative())) << 7; |
| 55 | return s; | 55 | return s; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| ... | @@ -369,7 +369,7 @@ pub const Edwards25519 = struct { | ... | @@ -369,7 +369,7 @@ pub const Edwards25519 = struct { |
| 369 | 369 | ||
| 370 | // yed = (x-1)/(x+1) or 1 if the denominator is 0 | 370 | // yed = (x-1)/(x+1) or 1 if the denominator is 0 |
| 371 | var yed = x_plus_one_y_inv.mul(y).mul(x_minus_one); | 371 | var yed = x_plus_one_y_inv.mul(y).mul(x_minus_one); |
| 372 | yed.cMov(Fe.one, @boolToInt(x_plus_one_y_inv.isZero())); | 372 | yed.cMov(Fe.one, @intFromBool(x_plus_one_y_inv.isZero())); |
| 373 | 373 | ||
| 374 | return Edwards25519{ | 374 | return Edwards25519{ |
| 375 | .x = xed, | 375 | .x = xed, |
| ... | @@ -390,9 +390,9 @@ pub const Edwards25519 = struct { | ... | @@ -390,9 +390,9 @@ pub const Edwards25519 = struct { |
| 390 | const not_square = !gx1.isSquare(); | 390 | const not_square = !gx1.isSquare(); |
| 391 | 391 | ||
| 392 | // gx1 not a square => x = -x1-A | 392 | // gx1 not a square => x = -x1-A |
| 393 | x.cMov(x.neg(), @boolToInt(not_square)); | 393 | x.cMov(x.neg(), @intFromBool(not_square)); |
| 394 | x2 = Fe.zero; | 394 | x2 = Fe.zero; |
| 395 | x2.cMov(Fe.edwards25519a, @boolToInt(not_square)); | 395 | x2.cMov(Fe.edwards25519a, @intFromBool(not_square)); |
| 396 | x = x.sub(x2); | 396 | x = x.sub(x2); |
| 397 | 397 | ||
| 398 | // We have y = sqrt(gx1) or sqrt(gx2) with gx2 = gx1*(A+x1)/(-x1) | 398 | // We have y = sqrt(gx1) or sqrt(gx2) with gx2 = gx1*(A+x1)/(-x1) |
| ... | @@ -408,7 +408,7 @@ pub const Edwards25519 = struct { | ... | @@ -408,7 +408,7 @@ pub const Edwards25519 = struct { |
| 408 | 408 | ||
| 409 | const y_sign = !elr.not_square; | 409 | const y_sign = !elr.not_square; |
| 410 | const y_neg = elr.y.neg(); | 410 | const y_neg = elr.y.neg(); |
| 411 | elr.y.cMov(y_neg, @boolToInt(elr.y.isNegative()) ^ @boolToInt(y_sign)); | 411 | elr.y.cMov(y_neg, @intFromBool(elr.y.isNegative()) ^ @intFromBool(y_sign)); |
| 412 | return montToEd(elr.x, elr.y).clearCofactor(); | 412 | return montToEd(elr.x, elr.y).clearCofactor(); |
| 413 | } | 413 | } |
| 414 | 414 | ||
| ... | @@ -486,7 +486,7 @@ pub const Edwards25519 = struct { | ... | @@ -486,7 +486,7 @@ pub const Edwards25519 = struct { |
| 486 | const elr = elligator2(Fe.fromBytes(s)); | 486 | const elr = elligator2(Fe.fromBytes(s)); |
| 487 | var p = montToEd(elr.x, elr.y); | 487 | var p = montToEd(elr.x, elr.y); |
| 488 | const p_neg = p.neg(); | 488 | const p_neg = p.neg(); |
| 489 | p.cMov(p_neg, @boolToInt(p.x.isNegative()) ^ x_sign); | 489 | p.cMov(p_neg, @intFromBool(p.x.isNegative()) ^ x_sign); |
| 490 | return p.clearCofactor(); | 490 | return p.clearCofactor(); |
| 491 | } | 491 | } |
| 492 | }; | 492 | }; |
lib/std/crypto/25519/field.zig+2-2| ... | @@ -387,7 +387,7 @@ pub const Fe = struct { | ... | @@ -387,7 +387,7 @@ pub const Fe = struct { |
| 387 | /// Return the absolute value of a field element | 387 | /// Return the absolute value of a field element |
| 388 | pub fn abs(a: Fe) Fe { | 388 | pub fn abs(a: Fe) Fe { |
| 389 | var r = a; | 389 | var r = a; |
| 390 | r.cMov(a.neg(), @boolToInt(a.isNegative())); | 390 | r.cMov(a.neg(), @intFromBool(a.isNegative())); |
| 391 | return r; | 391 | return r; |
| 392 | } | 392 | } |
| 393 | 393 | ||
| ... | @@ -412,7 +412,7 @@ pub const Fe = struct { | ... | @@ -412,7 +412,7 @@ pub const Fe = struct { |
| 412 | const m_root2 = m_root.sq(); | 412 | const m_root2 = m_root.sq(); |
| 413 | e = x2.sub(m_root2); | 413 | e = x2.sub(m_root2); |
| 414 | var x = p_root; | 414 | var x = p_root; |
| 415 | x.cMov(m_root, @boolToInt(e.isZero())); | 415 | x.cMov(m_root, @intFromBool(e.isZero())); |
| 416 | return x; | 416 | return x; |
| 417 | } | 417 | } |
| 418 | 418 |
lib/std/crypto/25519/ristretto255.zig+6-6| ... | @@ -30,8 +30,8 @@ pub const Ristretto255 = struct { | ... | @@ -30,8 +30,8 @@ pub const Ristretto255 = struct { |
| 30 | const has_p_root = p_root_check.isZero(); | 30 | const has_p_root = p_root_check.isZero(); |
| 31 | const has_f_root = f_root_check.isZero(); | 31 | const has_f_root = f_root_check.isZero(); |
| 32 | const x_sqrtm1 = x.mul(Fe.sqrtm1); // x*sqrt(-1) | 32 | const x_sqrtm1 = x.mul(Fe.sqrtm1); // x*sqrt(-1) |
| 33 | x.cMov(x_sqrtm1, @boolToInt(has_p_root) | @boolToInt(has_f_root)); | 33 | x.cMov(x_sqrtm1, @intFromBool(has_p_root) | @intFromBool(has_f_root)); |
| 34 | return .{ .ratio_is_square = @boolToInt(has_m_root) | @boolToInt(has_p_root), .root = x.abs() }; | 34 | return .{ .ratio_is_square = @intFromBool(has_m_root) | @intFromBool(has_p_root), .root = x.abs() }; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | fn rejectNonCanonical(s: [encoded_length]u8) NonCanonicalError!void { | 37 | fn rejectNonCanonical(s: [encoded_length]u8) NonCanonicalError!void { |
| ... | @@ -67,7 +67,7 @@ pub const Ristretto255 = struct { | ... | @@ -67,7 +67,7 @@ pub const Ristretto255 = struct { |
| 67 | x = x.mul(s_); | 67 | x = x.mul(s_); |
| 68 | x = x.add(x).abs(); | 68 | x = x.add(x).abs(); |
| 69 | const t = x.mul(y); | 69 | const t = x.mul(y); |
| 70 | if ((1 - inv_sqrt.ratio_is_square) | @boolToInt(t.isNegative()) | @boolToInt(y.isZero()) != 0) { | 70 | if ((1 - inv_sqrt.ratio_is_square) | @intFromBool(t.isNegative()) | @intFromBool(y.isZero()) != 0) { |
| 71 | return error.InvalidEncoding; | 71 | return error.InvalidEncoding; |
| 72 | } | 72 | } |
| 73 | const p: Curve = .{ | 73 | const p: Curve = .{ |
| ... | @@ -96,7 +96,7 @@ pub const Ristretto255 = struct { | ... | @@ -96,7 +96,7 @@ pub const Ristretto255 = struct { |
| 96 | const eden = den1.mul(Fe.edwards25519sqrtamd); // den1/sqrt(a-d) | 96 | const eden = den1.mul(Fe.edwards25519sqrtamd); // den1/sqrt(a-d) |
| 97 | const t_z_inv = p.t.mul(z_inv); // T*z_inv | 97 | const t_z_inv = p.t.mul(z_inv); // T*z_inv |
| 98 | 98 | ||
| 99 | const rotate = @boolToInt(t_z_inv.isNegative()); | 99 | const rotate = @intFromBool(t_z_inv.isNegative()); |
| 100 | var x = p.x; | 100 | var x = p.x; |
| 101 | var y = p.y; | 101 | var y = p.y; |
| 102 | var den_inv = den2; | 102 | var den_inv = den2; |
| ... | @@ -106,7 +106,7 @@ pub const Ristretto255 = struct { | ... | @@ -106,7 +106,7 @@ pub const Ristretto255 = struct { |
| 106 | 106 | ||
| 107 | const x_z_inv = x.mul(z_inv); | 107 | const x_z_inv = x.mul(z_inv); |
| 108 | const yneg = y.neg(); | 108 | const yneg = y.neg(); |
| 109 | y.cMov(yneg, @boolToInt(x_z_inv.isNegative())); | 109 | y.cMov(yneg, @intFromBool(x_z_inv.isNegative())); |
| 110 | 110 | ||
| 111 | return p.z.sub(y).mul(den_inv).abs().toBytes(); | 111 | return p.z.sub(y).mul(den_inv).abs().toBytes(); |
| 112 | } | 112 | } |
| ... | @@ -163,7 +163,7 @@ pub const Ristretto255 = struct { | ... | @@ -163,7 +163,7 @@ pub const Ristretto255 = struct { |
| 163 | const q_ = &q.p; | 163 | const q_ = &q.p; |
| 164 | const a = p_.x.mul(q_.y).equivalent(p_.y.mul(q_.x)); | 164 | const a = p_.x.mul(q_.y).equivalent(p_.y.mul(q_.x)); |
| 165 | const b = p_.y.mul(q_.y).equivalent(p_.x.mul(q_.x)); | 165 | const b = p_.y.mul(q_.y).equivalent(p_.x.mul(q_.x)); |
| 166 | return (@boolToInt(a) | @boolToInt(b)) != 0; | 166 | return (@intFromBool(a) | @intFromBool(b)) != 0; |
| 167 | } | 167 | } |
| 168 | }; | 168 | }; |
| 169 | 169 |
lib/std/crypto/Certificate.zig+3-3| ... | @@ -312,7 +312,7 @@ pub const Parsed = struct { | ... | @@ -312,7 +312,7 @@ pub const Parsed = struct { |
| 312 | while (name_i < general_names.slice.end) { | 312 | while (name_i < general_names.slice.end) { |
| 313 | const general_name = try der.Element.parse(subject_alt_name, name_i); | 313 | const general_name = try der.Element.parse(subject_alt_name, name_i); |
| 314 | name_i = general_name.slice.end; | 314 | name_i = general_name.slice.end; |
| 315 | switch (@intToEnum(GeneralNameTag, @enumToInt(general_name.identifier.tag))) { | 315 | switch (@enumFromInt(GeneralNameTag, @intFromEnum(general_name.identifier.tag))) { |
| 316 | .dNSName => { | 316 | .dNSName => { |
| 317 | const dns_name = subject_alt_name[general_name.slice.start..general_name.slice.end]; | 317 | const dns_name = subject_alt_name[general_name.slice.start..general_name.slice.end]; |
| 318 | if (checkHostName(host_name, dns_name)) return; | 318 | if (checkHostName(host_name, dns_name)) return; |
| ... | @@ -597,8 +597,8 @@ const Date = struct { | ... | @@ -597,8 +597,8 @@ const Date = struct { |
| 597 | var month: u4 = 1; | 597 | var month: u4 = 1; |
| 598 | while (month < date.month) : (month += 1) { | 598 | while (month < date.month) : (month += 1) { |
| 599 | const days: u64 = std.time.epoch.getDaysInMonth( | 599 | const days: u64 = std.time.epoch.getDaysInMonth( |
| 600 | @intToEnum(std.time.epoch.YearLeapKind, @boolToInt(is_leap)), | 600 | @enumFromInt(std.time.epoch.YearLeapKind, @intFromBool(is_leap)), |
| 601 | @intToEnum(std.time.epoch.Month, month), | 601 | @enumFromInt(std.time.epoch.Month, month), |
| 602 | ); | 602 | ); |
| 603 | sec += days * std.time.epoch.secs_per_day; | 603 | sec += days * std.time.epoch.secs_per_day; |
| 604 | } | 604 | } |
lib/std/crypto/Certificate/Bundle/macos.zig+1-1| ... | @@ -42,7 +42,7 @@ pub fn rescanMac(cb: *Bundle, gpa: Allocator) RescanMacError!void { | ... | @@ -42,7 +42,7 @@ pub fn rescanMac(cb: *Bundle, gpa: Allocator) RescanMacError!void { |
| 42 | 42 | ||
| 43 | const table_header = try reader.readStructBig(TableHeader); | 43 | const table_header = try reader.readStructBig(TableHeader); |
| 44 | 44 | ||
| 45 | if (@intToEnum(std.os.darwin.cssm.DB_RECORDTYPE, table_header.table_id) != .X509_CERTIFICATE) { | 45 | if (@enumFromInt(std.os.darwin.cssm.DB_RECORDTYPE, table_header.table_id) != .X509_CERTIFICATE) { |
| 46 | continue; | 46 | continue; |
| 47 | } | 47 | } |
| 48 | 48 |
lib/std/crypto/argon2.zig+2-2| ... | @@ -115,7 +115,7 @@ fn initHash( | ... | @@ -115,7 +115,7 @@ fn initHash( |
| 115 | mem.writeIntLittle(u32, parameters[8..12], params.m); | 115 | mem.writeIntLittle(u32, parameters[8..12], params.m); |
| 116 | mem.writeIntLittle(u32, parameters[12..16], params.t); | 116 | mem.writeIntLittle(u32, parameters[12..16], params.t); |
| 117 | mem.writeIntLittle(u32, parameters[16..20], version); | 117 | mem.writeIntLittle(u32, parameters[16..20], version); |
| 118 | mem.writeIntLittle(u32, parameters[20..24], @enumToInt(mode)); | 118 | mem.writeIntLittle(u32, parameters[20..24], @intFromEnum(mode)); |
| 119 | b2.update(&parameters); | 119 | b2.update(&parameters); |
| 120 | mem.writeIntLittle(u32, &tmp, @intCast(u32, password.len)); | 120 | mem.writeIntLittle(u32, &tmp, @intCast(u32, password.len)); |
| 121 | b2.update(&tmp); | 121 | b2.update(&tmp); |
| ... | @@ -292,7 +292,7 @@ fn processSegment( | ... | @@ -292,7 +292,7 @@ fn processSegment( |
| 292 | in[2] = slice; | 292 | in[2] = slice; |
| 293 | in[3] = memory; | 293 | in[3] = memory; |
| 294 | in[4] = passes; | 294 | in[4] = passes; |
| 295 | in[5] = @enumToInt(mode); | 295 | in[5] = @intFromEnum(mode); |
| 296 | } | 296 | } |
| 297 | var index: u32 = 0; | 297 | var index: u32 = 0; |
| 298 | if (n == 0 and slice == 0) { | 298 | if (n == 0 and slice == 0) { |
lib/std/crypto/benchmark.zig+25-25| ... | @@ -54,8 +54,8 @@ pub fn benchmarkHash(comptime Hash: anytype, comptime bytes: comptime_int) !u64 | ... | @@ -54,8 +54,8 @@ pub fn benchmarkHash(comptime Hash: anytype, comptime bytes: comptime_int) !u64 |
| 54 | 54 | ||
| 55 | const end = timer.read(); | 55 | const end = timer.read(); |
| 56 | 56 | ||
| 57 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 57 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 58 | const throughput = @floatToInt(u64, bytes / elapsed_s); | 58 | const throughput = @intFromFloat(u64, bytes / elapsed_s); |
| 59 | 59 | ||
| 60 | return throughput; | 60 | return throughput; |
| 61 | } | 61 | } |
| ... | @@ -95,8 +95,8 @@ pub fn benchmarkMac(comptime Mac: anytype, comptime bytes: comptime_int) !u64 { | ... | @@ -95,8 +95,8 @@ pub fn benchmarkMac(comptime Mac: anytype, comptime bytes: comptime_int) !u64 { |
| 95 | } | 95 | } |
| 96 | const end = timer.read(); | 96 | const end = timer.read(); |
| 97 | 97 | ||
| 98 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 98 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 99 | const throughput = @floatToInt(u64, bytes / elapsed_s); | 99 | const throughput = @intFromFloat(u64, bytes / elapsed_s); |
| 100 | 100 | ||
| 101 | return throughput; | 101 | return throughput; |
| 102 | } | 102 | } |
| ... | @@ -125,8 +125,8 @@ pub fn benchmarkKeyExchange(comptime DhKeyExchange: anytype, comptime exchange_c | ... | @@ -125,8 +125,8 @@ pub fn benchmarkKeyExchange(comptime DhKeyExchange: anytype, comptime exchange_c |
| 125 | } | 125 | } |
| 126 | const end = timer.read(); | 126 | const end = timer.read(); |
| 127 | 127 | ||
| 128 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 128 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 129 | const throughput = @floatToInt(u64, exchange_count / elapsed_s); | 129 | const throughput = @intFromFloat(u64, exchange_count / elapsed_s); |
| 130 | 130 | ||
| 131 | return throughput; | 131 | return throughput; |
| 132 | } | 132 | } |
| ... | @@ -148,8 +148,8 @@ pub fn benchmarkSignature(comptime Signature: anytype, comptime signatures_count | ... | @@ -148,8 +148,8 @@ pub fn benchmarkSignature(comptime Signature: anytype, comptime signatures_count |
| 148 | } | 148 | } |
| 149 | const end = timer.read(); | 149 | const end = timer.read(); |
| 150 | 150 | ||
| 151 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 151 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 152 | const throughput = @floatToInt(u64, signatures_count / elapsed_s); | 152 | const throughput = @intFromFloat(u64, signatures_count / elapsed_s); |
| 153 | 153 | ||
| 154 | return throughput; | 154 | return throughput; |
| 155 | } | 155 | } |
| ... | @@ -172,8 +172,8 @@ pub fn benchmarkSignatureVerification(comptime Signature: anytype, comptime sign | ... | @@ -172,8 +172,8 @@ pub fn benchmarkSignatureVerification(comptime Signature: anytype, comptime sign |
| 172 | } | 172 | } |
| 173 | const end = timer.read(); | 173 | const end = timer.read(); |
| 174 | 174 | ||
| 175 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 175 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 176 | const throughput = @floatToInt(u64, signatures_count / elapsed_s); | 176 | const throughput = @intFromFloat(u64, signatures_count / elapsed_s); |
| 177 | 177 | ||
| 178 | return throughput; | 178 | return throughput; |
| 179 | } | 179 | } |
| ... | @@ -201,8 +201,8 @@ pub fn benchmarkBatchSignatureVerification(comptime Signature: anytype, comptime | ... | @@ -201,8 +201,8 @@ pub fn benchmarkBatchSignatureVerification(comptime Signature: anytype, comptime |
| 201 | } | 201 | } |
| 202 | const end = timer.read(); | 202 | const end = timer.read(); |
| 203 | 203 | ||
| 204 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 204 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 205 | const throughput = batch.len * @floatToInt(u64, signatures_count / elapsed_s); | 205 | const throughput = batch.len * @intFromFloat(u64, signatures_count / elapsed_s); |
| 206 | 206 | ||
| 207 | return throughput; | 207 | return throughput; |
| 208 | } | 208 | } |
| ... | @@ -227,8 +227,8 @@ pub fn benchmarkKem(comptime Kem: anytype, comptime kems_count: comptime_int) !u | ... | @@ -227,8 +227,8 @@ pub fn benchmarkKem(comptime Kem: anytype, comptime kems_count: comptime_int) !u |
| 227 | } | 227 | } |
| 228 | const end = timer.read(); | 228 | const end = timer.read(); |
| 229 | 229 | ||
| 230 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 230 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 231 | const throughput = @floatToInt(u64, kems_count / elapsed_s); | 231 | const throughput = @intFromFloat(u64, kems_count / elapsed_s); |
| 232 | 232 | ||
| 233 | return throughput; | 233 | return throughput; |
| 234 | } | 234 | } |
| ... | @@ -249,8 +249,8 @@ pub fn benchmarkKemDecaps(comptime Kem: anytype, comptime kems_count: comptime_i | ... | @@ -249,8 +249,8 @@ pub fn benchmarkKemDecaps(comptime Kem: anytype, comptime kems_count: comptime_i |
| 249 | } | 249 | } |
| 250 | const end = timer.read(); | 250 | const end = timer.read(); |
| 251 | 251 | ||
| 252 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 252 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 253 | const throughput = @floatToInt(u64, kems_count / elapsed_s); | 253 | const throughput = @intFromFloat(u64, kems_count / elapsed_s); |
| 254 | 254 | ||
| 255 | return throughput; | 255 | return throughput; |
| 256 | } | 256 | } |
| ... | @@ -267,8 +267,8 @@ pub fn benchmarkKemKeyGen(comptime Kem: anytype, comptime kems_count: comptime_i | ... | @@ -267,8 +267,8 @@ pub fn benchmarkKemKeyGen(comptime Kem: anytype, comptime kems_count: comptime_i |
| 267 | } | 267 | } |
| 268 | const end = timer.read(); | 268 | const end = timer.read(); |
| 269 | 269 | ||
| 270 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 270 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 271 | const throughput = @floatToInt(u64, kems_count / elapsed_s); | 271 | const throughput = @intFromFloat(u64, kems_count / elapsed_s); |
| 272 | 272 | ||
| 273 | return throughput; | 273 | return throughput; |
| 274 | } | 274 | } |
| ... | @@ -309,8 +309,8 @@ pub fn benchmarkAead(comptime Aead: anytype, comptime bytes: comptime_int) !u64 | ... | @@ -309,8 +309,8 @@ pub fn benchmarkAead(comptime Aead: anytype, comptime bytes: comptime_int) !u64 |
| 309 | mem.doNotOptimizeAway(&in); | 309 | mem.doNotOptimizeAway(&in); |
| 310 | const end = timer.read(); | 310 | const end = timer.read(); |
| 311 | 311 | ||
| 312 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 312 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 313 | const throughput = @floatToInt(u64, 2 * bytes / elapsed_s); | 313 | const throughput = @intFromFloat(u64, 2 * bytes / elapsed_s); |
| 314 | 314 | ||
| 315 | return throughput; | 315 | return throughput; |
| 316 | } | 316 | } |
| ... | @@ -338,8 +338,8 @@ pub fn benchmarkAes(comptime Aes: anytype, comptime count: comptime_int) !u64 { | ... | @@ -338,8 +338,8 @@ pub fn benchmarkAes(comptime Aes: anytype, comptime count: comptime_int) !u64 { |
| 338 | mem.doNotOptimizeAway(&in); | 338 | mem.doNotOptimizeAway(&in); |
| 339 | const end = timer.read(); | 339 | const end = timer.read(); |
| 340 | 340 | ||
| 341 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 341 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 342 | const throughput = @floatToInt(u64, count / elapsed_s); | 342 | const throughput = @intFromFloat(u64, count / elapsed_s); |
| 343 | 343 | ||
| 344 | return throughput; | 344 | return throughput; |
| 345 | } | 345 | } |
| ... | @@ -367,8 +367,8 @@ pub fn benchmarkAes8(comptime Aes: anytype, comptime count: comptime_int) !u64 { | ... | @@ -367,8 +367,8 @@ pub fn benchmarkAes8(comptime Aes: anytype, comptime count: comptime_int) !u64 { |
| 367 | mem.doNotOptimizeAway(&in); | 367 | mem.doNotOptimizeAway(&in); |
| 368 | const end = timer.read(); | 368 | const end = timer.read(); |
| 369 | 369 | ||
| 370 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 370 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 371 | const throughput = @floatToInt(u64, 8 * count / elapsed_s); | 371 | const throughput = @intFromFloat(u64, 8 * count / elapsed_s); |
| 372 | 372 | ||
| 373 | return throughput; | 373 | return throughput; |
| 374 | } | 374 | } |
| ... | @@ -422,7 +422,7 @@ fn benchmarkPwhash( | ... | @@ -422,7 +422,7 @@ fn benchmarkPwhash( |
| 422 | } | 422 | } |
| 423 | const end = timer.read(); | 423 | const end = timer.read(); |
| 424 | 424 | ||
| 425 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 425 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 426 | const throughput = elapsed_s / count; | 426 | const throughput = elapsed_s / count; |
| 427 | 427 | ||
| 428 | return throughput; | 428 | return throughput; |
lib/std/crypto/ff.zig+4-4| ... | @@ -637,7 +637,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { | ... | @@ -637,7 +637,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 637 | assert(x.limbs_count() == self.limbs_count()); | 637 | assert(x.limbs_count() == self.limbs_count()); |
| 638 | assert(y.limbs_count() == self.limbs_count()); | 638 | assert(y.limbs_count() == self.limbs_count()); |
| 639 | const overflow = self.montgomeryLoop(&d, x, y); | 639 | const overflow = self.montgomeryLoop(&d, x, y); |
| 640 | const underflow = 1 -% @boolToInt(ct.limbsCmpGeq(d.v, self.v)); | 640 | const underflow = 1 -% @intFromBool(ct.limbsCmpGeq(d.v, self.v)); |
| 641 | const need_sub = ct.eql(overflow, underflow); | 641 | const need_sub = ct.eql(overflow, underflow); |
| 642 | _ = d.v.conditionalSubWithOverflow(need_sub, self.v); | 642 | _ = d.v.conditionalSubWithOverflow(need_sub, self.v); |
| 643 | d.montgomery = x.montgomery == y.montgomery; | 643 | d.montgomery = x.montgomery == y.montgomery; |
| ... | @@ -649,7 +649,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { | ... | @@ -649,7 +649,7 @@ pub fn Modulus(comptime max_bits: comptime_int) type { |
| 649 | var d = self.zero; | 649 | var d = self.zero; |
| 650 | assert(x.limbs_count() == self.limbs_count()); | 650 | assert(x.limbs_count() == self.limbs_count()); |
| 651 | const overflow = self.montgomeryLoop(&d, x, x); | 651 | const overflow = self.montgomeryLoop(&d, x, x); |
| 652 | const underflow = 1 -% @boolToInt(ct.limbsCmpGeq(d.v, self.v)); | 652 | const underflow = 1 -% @intFromBool(ct.limbsCmpGeq(d.v, self.v)); |
| 653 | const need_sub = ct.eql(overflow, underflow); | 653 | const need_sub = ct.eql(overflow, underflow); |
| 654 | _ = d.v.conditionalSubWithOverflow(need_sub, self.v); | 654 | _ = d.v.conditionalSubWithOverflow(need_sub, self.v); |
| 655 | d.montgomery = true; | 655 | d.montgomery = true; |
| ... | @@ -763,7 +763,7 @@ const ct = if (std.options.side_channels_mitigations == .none) ct_unprotected el | ... | @@ -763,7 +763,7 @@ const ct = if (std.options.side_channels_mitigations == .none) ct_unprotected el |
| 763 | const ct_protected = struct { | 763 | const ct_protected = struct { |
| 764 | // Returns x if on is true, otherwise y. | 764 | // Returns x if on is true, otherwise y. |
| 765 | fn select(on: bool, x: Limb, y: Limb) Limb { | 765 | fn select(on: bool, x: Limb, y: Limb) Limb { |
| 766 | const mask = @as(Limb, 0) -% @boolToInt(on); | 766 | const mask = @as(Limb, 0) -% @intFromBool(on); |
| 767 | return y ^ (mask & (y ^ x)); | 767 | return y ^ (mask & (y ^ x)); |
| 768 | } | 768 | } |
| 769 | 769 | ||
| ... | @@ -789,7 +789,7 @@ const ct_protected = struct { | ... | @@ -789,7 +789,7 @@ const ct_protected = struct { |
| 789 | 789 | ||
| 790 | // Compares two big integers in constant time, returning true if x >= y. | 790 | // Compares two big integers in constant time, returning true if x >= y. |
| 791 | fn limbsCmpGeq(x: anytype, y: @TypeOf(x)) bool { | 791 | fn limbsCmpGeq(x: anytype, y: @TypeOf(x)) bool { |
| 792 | return @bitCast(bool, 1 - @boolToInt(ct.limbsCmpLt(x, y))); | 792 | return @bitCast(bool, 1 - @intFromBool(ct.limbsCmpLt(x, y))); |
| 793 | } | 793 | } |
| 794 | 794 | ||
| 795 | // Multiplies two limbs and returns the result as a wide limb. | 795 | // Multiplies two limbs and returns the result as a wide limb. |
lib/std/crypto/kyber_d00.zig+1-1| ... | @@ -1454,7 +1454,7 @@ fn Mat(comptime K: u8) type { | ... | @@ -1454,7 +1454,7 @@ fn Mat(comptime K: u8) type { |
| 1454 | 1454 | ||
| 1455 | // Returns `true` if a ≠ b. | 1455 | // Returns `true` if a ≠ b. |
| 1456 | fn ctneq(comptime len: usize, a: [len]u8, b: [len]u8) u1 { | 1456 | fn ctneq(comptime len: usize, a: [len]u8, b: [len]u8) u1 { |
| 1457 | return 1 - @boolToInt(crypto.utils.timingSafeEql([len]u8, a, b)); | 1457 | return 1 - @intFromBool(crypto.utils.timingSafeEql([len]u8, a, b)); |
| 1458 | } | 1458 | } |
| 1459 | 1459 | ||
| 1460 | // Copy src into dst given b = 1. | 1460 | // Copy src into dst given b = 1. |
lib/std/crypto/pcurves/p256.zig+8-8| ... | @@ -36,8 +36,8 @@ pub const P256 = struct { | ... | @@ -36,8 +36,8 @@ pub const P256 = struct { |
| 36 | 36 | ||
| 37 | /// Reject the neutral element. | 37 | /// Reject the neutral element. |
| 38 | pub fn rejectIdentity(p: P256) IdentityElementError!void { | 38 | pub fn rejectIdentity(p: P256) IdentityElementError!void { |
| 39 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 39 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 40 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 40 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 41 | if (is_identity != 0) { | 41 | if (is_identity != 0) { |
| 42 | return error.IdentityElement; | 42 | return error.IdentityElement; |
| 43 | } | 43 | } |
| ... | @@ -49,8 +49,8 @@ pub const P256 = struct { | ... | @@ -49,8 +49,8 @@ pub const P256 = struct { |
| 49 | const y = p.y; | 49 | const y = p.y; |
| 50 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); | 50 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); |
| 51 | const yy = y.sq(); | 51 | const yy = y.sq(); |
| 52 | const on_curve = @boolToInt(x3AxB.equivalent(yy)); | 52 | const on_curve = @intFromBool(x3AxB.equivalent(yy)); |
| 53 | const is_identity = @boolToInt(x.equivalent(AffineCoordinates.identityElement.x)) & @boolToInt(y.equivalent(AffineCoordinates.identityElement.y)); | 53 | const is_identity = @intFromBool(x.equivalent(AffineCoordinates.identityElement.x)) & @intFromBool(y.equivalent(AffineCoordinates.identityElement.y)); |
| 54 | if ((on_curve | is_identity) == 0) { | 54 | if ((on_curve | is_identity) == 0) { |
| 55 | return error.InvalidEncoding; | 55 | return error.InvalidEncoding; |
| 56 | } | 56 | } |
| ... | @@ -71,7 +71,7 @@ pub const P256 = struct { | ... | @@ -71,7 +71,7 @@ pub const P256 = struct { |
| 71 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); | 71 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); |
| 72 | var y = try x3AxB.sqrt(); | 72 | var y = try x3AxB.sqrt(); |
| 73 | const yn = y.neg(); | 73 | const yn = y.neg(); |
| 74 | y.cMov(yn, @boolToInt(is_odd) ^ @boolToInt(y.isOdd())); | 74 | y.cMov(yn, @intFromBool(is_odd) ^ @intFromBool(y.isOdd())); |
| 75 | return y; | 75 | return y; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| ... | @@ -219,7 +219,7 @@ pub const P256 = struct { | ... | @@ -219,7 +219,7 @@ pub const P256 = struct { |
| 219 | .y = Y3, | 219 | .y = Y3, |
| 220 | .z = Z3, | 220 | .z = Z3, |
| 221 | }; | 221 | }; |
| 222 | ret.cMov(p, @boolToInt(q.x.isZero())); | 222 | ret.cMov(p, @intFromBool(q.x.isZero())); |
| 223 | return ret; | 223 | return ret; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| ... | @@ -288,8 +288,8 @@ pub const P256 = struct { | ... | @@ -288,8 +288,8 @@ pub const P256 = struct { |
| 288 | 288 | ||
| 289 | /// Return affine coordinates. | 289 | /// Return affine coordinates. |
| 290 | pub fn affineCoordinates(p: P256) AffineCoordinates { | 290 | pub fn affineCoordinates(p: P256) AffineCoordinates { |
| 291 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 291 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 292 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 292 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 293 | const zinv = p.z.invert(); | 293 | const zinv = p.z.invert(); |
| 294 | var ret = AffineCoordinates{ | 294 | var ret = AffineCoordinates{ |
| 295 | .x = p.x.mul(zinv), | 295 | .x = p.x.mul(zinv), |
lib/std/crypto/pcurves/p384.zig+8-8| ... | @@ -36,8 +36,8 @@ pub const P384 = struct { | ... | @@ -36,8 +36,8 @@ pub const P384 = struct { |
| 36 | 36 | ||
| 37 | /// Reject the neutral element. | 37 | /// Reject the neutral element. |
| 38 | pub fn rejectIdentity(p: P384) IdentityElementError!void { | 38 | pub fn rejectIdentity(p: P384) IdentityElementError!void { |
| 39 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 39 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 40 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 40 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 41 | if (is_identity != 0) { | 41 | if (is_identity != 0) { |
| 42 | return error.IdentityElement; | 42 | return error.IdentityElement; |
| 43 | } | 43 | } |
| ... | @@ -49,8 +49,8 @@ pub const P384 = struct { | ... | @@ -49,8 +49,8 @@ pub const P384 = struct { |
| 49 | const y = p.y; | 49 | const y = p.y; |
| 50 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); | 50 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); |
| 51 | const yy = y.sq(); | 51 | const yy = y.sq(); |
| 52 | const on_curve = @boolToInt(x3AxB.equivalent(yy)); | 52 | const on_curve = @intFromBool(x3AxB.equivalent(yy)); |
| 53 | const is_identity = @boolToInt(x.equivalent(AffineCoordinates.identityElement.x)) & @boolToInt(y.equivalent(AffineCoordinates.identityElement.y)); | 53 | const is_identity = @intFromBool(x.equivalent(AffineCoordinates.identityElement.x)) & @intFromBool(y.equivalent(AffineCoordinates.identityElement.y)); |
| 54 | if ((on_curve | is_identity) == 0) { | 54 | if ((on_curve | is_identity) == 0) { |
| 55 | return error.InvalidEncoding; | 55 | return error.InvalidEncoding; |
| 56 | } | 56 | } |
| ... | @@ -71,7 +71,7 @@ pub const P384 = struct { | ... | @@ -71,7 +71,7 @@ pub const P384 = struct { |
| 71 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); | 71 | const x3AxB = x.sq().mul(x).sub(x).sub(x).sub(x).add(B); |
| 72 | var y = try x3AxB.sqrt(); | 72 | var y = try x3AxB.sqrt(); |
| 73 | const yn = y.neg(); | 73 | const yn = y.neg(); |
| 74 | y.cMov(yn, @boolToInt(is_odd) ^ @boolToInt(y.isOdd())); | 74 | y.cMov(yn, @intFromBool(is_odd) ^ @intFromBool(y.isOdd())); |
| 75 | return y; | 75 | return y; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| ... | @@ -219,7 +219,7 @@ pub const P384 = struct { | ... | @@ -219,7 +219,7 @@ pub const P384 = struct { |
| 219 | .y = Y3, | 219 | .y = Y3, |
| 220 | .z = Z3, | 220 | .z = Z3, |
| 221 | }; | 221 | }; |
| 222 | ret.cMov(p, @boolToInt(q.x.isZero())); | 222 | ret.cMov(p, @intFromBool(q.x.isZero())); |
| 223 | return ret; | 223 | return ret; |
| 224 | } | 224 | } |
| 225 | 225 | ||
| ... | @@ -288,8 +288,8 @@ pub const P384 = struct { | ... | @@ -288,8 +288,8 @@ pub const P384 = struct { |
| 288 | 288 | ||
| 289 | /// Return affine coordinates. | 289 | /// Return affine coordinates. |
| 290 | pub fn affineCoordinates(p: P384) AffineCoordinates { | 290 | pub fn affineCoordinates(p: P384) AffineCoordinates { |
| 291 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 291 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 292 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 292 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 293 | const zinv = p.z.invert(); | 293 | const zinv = p.z.invert(); |
| 294 | var ret = AffineCoordinates{ | 294 | var ret = AffineCoordinates{ |
| 295 | .x = p.x.mul(zinv), | 295 | .x = p.x.mul(zinv), |
lib/std/crypto/pcurves/secp256k1.zig+8-8| ... | @@ -89,8 +89,8 @@ pub const Secp256k1 = struct { | ... | @@ -89,8 +89,8 @@ pub const Secp256k1 = struct { |
| 89 | 89 | ||
| 90 | /// Reject the neutral element. | 90 | /// Reject the neutral element. |
| 91 | pub fn rejectIdentity(p: Secp256k1) IdentityElementError!void { | 91 | pub fn rejectIdentity(p: Secp256k1) IdentityElementError!void { |
| 92 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 92 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 93 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 93 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 94 | if (is_identity != 0) { | 94 | if (is_identity != 0) { |
| 95 | return error.IdentityElement; | 95 | return error.IdentityElement; |
| 96 | } | 96 | } |
| ... | @@ -102,8 +102,8 @@ pub const Secp256k1 = struct { | ... | @@ -102,8 +102,8 @@ pub const Secp256k1 = struct { |
| 102 | const y = p.y; | 102 | const y = p.y; |
| 103 | const x3B = x.sq().mul(x).add(B); | 103 | const x3B = x.sq().mul(x).add(B); |
| 104 | const yy = y.sq(); | 104 | const yy = y.sq(); |
| 105 | const on_curve = @boolToInt(x3B.equivalent(yy)); | 105 | const on_curve = @intFromBool(x3B.equivalent(yy)); |
| 106 | const is_identity = @boolToInt(x.equivalent(AffineCoordinates.identityElement.x)) & @boolToInt(y.equivalent(AffineCoordinates.identityElement.y)); | 106 | const is_identity = @intFromBool(x.equivalent(AffineCoordinates.identityElement.x)) & @intFromBool(y.equivalent(AffineCoordinates.identityElement.y)); |
| 107 | if ((on_curve | is_identity) == 0) { | 107 | if ((on_curve | is_identity) == 0) { |
| 108 | return error.InvalidEncoding; | 108 | return error.InvalidEncoding; |
| 109 | } | 109 | } |
| ... | @@ -124,7 +124,7 @@ pub const Secp256k1 = struct { | ... | @@ -124,7 +124,7 @@ pub const Secp256k1 = struct { |
| 124 | const x3B = x.sq().mul(x).add(B); | 124 | const x3B = x.sq().mul(x).add(B); |
| 125 | var y = try x3B.sqrt(); | 125 | var y = try x3B.sqrt(); |
| 126 | const yn = y.neg(); | 126 | const yn = y.neg(); |
| 127 | y.cMov(yn, @boolToInt(is_odd) ^ @boolToInt(y.isOdd())); | 127 | y.cMov(yn, @intFromBool(is_odd) ^ @intFromBool(y.isOdd())); |
| 128 | return y; | 128 | return y; |
| 129 | } | 129 | } |
| 130 | 130 | ||
| ... | @@ -253,7 +253,7 @@ pub const Secp256k1 = struct { | ... | @@ -253,7 +253,7 @@ pub const Secp256k1 = struct { |
| 253 | .y = Y3, | 253 | .y = Y3, |
| 254 | .z = Z3, | 254 | .z = Z3, |
| 255 | }; | 255 | }; |
| 256 | ret.cMov(p, @boolToInt(q.x.isZero())); | 256 | ret.cMov(p, @intFromBool(q.x.isZero())); |
| 257 | return ret; | 257 | return ret; |
| 258 | } | 258 | } |
| 259 | 259 | ||
| ... | @@ -316,8 +316,8 @@ pub const Secp256k1 = struct { | ... | @@ -316,8 +316,8 @@ pub const Secp256k1 = struct { |
| 316 | 316 | ||
| 317 | /// Return affine coordinates. | 317 | /// Return affine coordinates. |
| 318 | pub fn affineCoordinates(p: Secp256k1) AffineCoordinates { | 318 | pub fn affineCoordinates(p: Secp256k1) AffineCoordinates { |
| 319 | const affine_0 = @boolToInt(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@boolToInt(p.y.isZero()) | @boolToInt(p.y.equivalent(AffineCoordinates.identityElement.y))); | 319 | const affine_0 = @intFromBool(p.x.equivalent(AffineCoordinates.identityElement.x)) & (@intFromBool(p.y.isZero()) | @intFromBool(p.y.equivalent(AffineCoordinates.identityElement.y))); |
| 320 | const is_identity = @boolToInt(p.z.isZero()) | affine_0; | 320 | const is_identity = @intFromBool(p.z.isZero()) | affine_0; |
| 321 | const zinv = p.z.invert(); | 321 | const zinv = p.z.invert(); |
| 322 | var ret = AffineCoordinates{ | 322 | var ret = AffineCoordinates{ |
| 323 | .x = p.x.mul(zinv), | 323 | .x = p.x.mul(zinv), |
lib/std/crypto/tls.zig+6-6| ... | @@ -48,8 +48,8 @@ pub const hello_retry_request_sequence = [32]u8{ | ... | @@ -48,8 +48,8 @@ pub const hello_retry_request_sequence = [32]u8{ |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | pub const close_notify_alert = [_]u8{ | 50 | pub const close_notify_alert = [_]u8{ |
| 51 | @enumToInt(AlertLevel.warning), | 51 | @intFromEnum(AlertLevel.warning), |
| 52 | @enumToInt(AlertDescription.close_notify), | 52 | @intFromEnum(AlertDescription.close_notify), |
| 53 | }; | 53 | }; |
| 54 | 54 | ||
| 55 | pub const ProtocolVersion = enum(u16) { | 55 | pub const ProtocolVersion = enum(u16) { |
| ... | @@ -399,7 +399,7 @@ pub fn hmac(comptime Hmac: type, message: []const u8, key: [Hmac.key_length]u8) | ... | @@ -399,7 +399,7 @@ pub fn hmac(comptime Hmac: type, message: []const u8, key: [Hmac.key_length]u8) |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | pub inline fn extension(comptime et: ExtensionType, bytes: anytype) [2 + 2 + bytes.len]u8 { | 401 | pub inline fn extension(comptime et: ExtensionType, bytes: anytype) [2 + 2 + bytes.len]u8 { |
| 402 | return int2(@enumToInt(et)) ++ array(1, bytes); | 402 | return int2(@intFromEnum(et)) ++ array(1, bytes); |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | pub inline fn array(comptime elem_size: comptime_int, bytes: anytype) [2 + bytes.len]u8 { | 405 | pub inline fn array(comptime elem_size: comptime_int, bytes: anytype) [2 + bytes.len]u8 { |
| ... | @@ -411,8 +411,8 @@ pub inline fn enum_array(comptime E: type, comptime tags: []const E) [2 + @sizeO | ... | @@ -411,8 +411,8 @@ pub inline fn enum_array(comptime E: type, comptime tags: []const E) [2 + @sizeO |
| 411 | assert(@sizeOf(E) == 2); | 411 | assert(@sizeOf(E) == 2); |
| 412 | var result: [tags.len * 2]u8 = undefined; | 412 | var result: [tags.len * 2]u8 = undefined; |
| 413 | for (tags, 0..) |elem, i| { | 413 | for (tags, 0..) |elem, i| { |
| 414 | result[i * 2] = @truncate(u8, @enumToInt(elem) >> 8); | 414 | result[i * 2] = @truncate(u8, @intFromEnum(elem) >> 8); |
| 415 | result[i * 2 + 1] = @truncate(u8, @enumToInt(elem)); | 415 | result[i * 2 + 1] = @truncate(u8, @intFromEnum(elem)); |
| 416 | } | 416 | } |
| 417 | return array(2, result); | 417 | return array(2, result); |
| 418 | } | 418 | } |
| ... | @@ -513,7 +513,7 @@ pub const Decoder = struct { | ... | @@ -513,7 +513,7 @@ pub const Decoder = struct { |
| 513 | .Enum => |info| { | 513 | .Enum => |info| { |
| 514 | const int = d.decode(info.tag_type); | 514 | const int = d.decode(info.tag_type); |
| 515 | if (info.is_exhaustive) @compileError("exhaustive enum cannot be used"); | 515 | if (info.is_exhaustive) @compileError("exhaustive enum cannot be used"); |
| 516 | return @intToEnum(T, int); | 516 | return @enumFromInt(T, int); |
| 517 | }, | 517 | }, |
| 518 | else => @compileError("unsupported type: " ++ @typeName(T)), | 518 | else => @compileError("unsupported type: " ++ @typeName(T)), |
| 519 | } | 519 | } |
lib/std/crypto/tls/Client.zig+24-24| ... | @@ -180,14 +180,14 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -180,14 +180,14 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 180 | .x25519, | 180 | .x25519, |
| 181 | })) ++ tls.extension( | 181 | })) ++ tls.extension( |
| 182 | .key_share, | 182 | .key_share, |
| 183 | array(1, int2(@enumToInt(tls.NamedGroup.x25519)) ++ | 183 | array(1, int2(@intFromEnum(tls.NamedGroup.x25519)) ++ |
| 184 | array(1, x25519_kp.public_key) ++ | 184 | array(1, x25519_kp.public_key) ++ |
| 185 | int2(@enumToInt(tls.NamedGroup.secp256r1)) ++ | 185 | int2(@intFromEnum(tls.NamedGroup.secp256r1)) ++ |
| 186 | array(1, secp256r1_kp.public_key.toUncompressedSec1()) ++ | 186 | array(1, secp256r1_kp.public_key.toUncompressedSec1()) ++ |
| 187 | int2(@enumToInt(tls.NamedGroup.x25519_kyber768d00)) ++ | 187 | int2(@intFromEnum(tls.NamedGroup.x25519_kyber768d00)) ++ |
| 188 | array(1, x25519_kp.public_key ++ kyber768_kp.public_key.toBytes())), | 188 | array(1, x25519_kp.public_key ++ kyber768_kp.public_key.toBytes())), |
| 189 | ) ++ | 189 | ) ++ |
| 190 | int2(@enumToInt(tls.ExtensionType.server_name)) ++ | 190 | int2(@intFromEnum(tls.ExtensionType.server_name)) ++ |
| 191 | int2(host_len + 5) ++ // byte length of this extension payload | 191 | int2(host_len + 5) ++ // byte length of this extension payload |
| 192 | int2(host_len + 3) ++ // server_name_list byte count | 192 | int2(host_len + 3) ++ // server_name_list byte count |
| 193 | [1]u8{0x00} ++ // name_type | 193 | [1]u8{0x00} ++ // name_type |
| ... | @@ -200,7 +200,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -200,7 +200,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 200 | const legacy_compression_methods = 0x0100; | 200 | const legacy_compression_methods = 0x0100; |
| 201 | 201 | ||
| 202 | const client_hello = | 202 | const client_hello = |
| 203 | int2(@enumToInt(tls.ProtocolVersion.tls_1_2)) ++ | 203 | int2(@intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ |
| 204 | hello_rand ++ | 204 | hello_rand ++ |
| 205 | [1]u8{32} ++ legacy_session_id ++ | 205 | [1]u8{32} ++ legacy_session_id ++ |
| 206 | cipher_suites ++ | 206 | cipher_suites ++ |
| ... | @@ -208,12 +208,12 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -208,12 +208,12 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 208 | extensions_header; | 208 | extensions_header; |
| 209 | 209 | ||
| 210 | const out_handshake = | 210 | const out_handshake = |
| 211 | [_]u8{@enumToInt(tls.HandshakeType.client_hello)} ++ | 211 | [_]u8{@intFromEnum(tls.HandshakeType.client_hello)} ++ |
| 212 | int3(@intCast(u24, client_hello.len + host_len)) ++ | 212 | int3(@intCast(u24, client_hello.len + host_len)) ++ |
| 213 | client_hello; | 213 | client_hello; |
| 214 | 214 | ||
| 215 | const plaintext_header = [_]u8{ | 215 | const plaintext_header = [_]u8{ |
| 216 | @enumToInt(tls.ContentType.handshake), | 216 | @intFromEnum(tls.ContentType.handshake), |
| 217 | 0x03, 0x01, // legacy_record_version | 217 | 0x03, 0x01, // legacy_record_version |
| 218 | } ++ int2(@intCast(u16, out_handshake.len + host_len)) ++ out_handshake; | 218 | } ++ int2(@intCast(u16, out_handshake.len + host_len)) ++ out_handshake; |
| 219 | 219 | ||
| ... | @@ -348,7 +348,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -348,7 +348,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 348 | if (!have_shared_key) return error.TlsIllegalParameter; | 348 | if (!have_shared_key) return error.TlsIllegalParameter; |
| 349 | 349 | ||
| 350 | const tls_version = if (supported_version == 0) legacy_version else supported_version; | 350 | const tls_version = if (supported_version == 0) legacy_version else supported_version; |
| 351 | if (tls_version != @enumToInt(tls.ProtocolVersion.tls_1_3)) | 351 | if (tls_version != @intFromEnum(tls.ProtocolVersion.tls_1_3)) |
| 352 | return error.TlsIllegalParameter; | 352 | return error.TlsIllegalParameter; |
| 353 | 353 | ||
| 354 | switch (cipher_suite_tag) { | 354 | switch (cipher_suite_tag) { |
| ... | @@ -466,7 +466,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -466,7 +466,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 466 | }, | 466 | }, |
| 467 | }; | 467 | }; |
| 468 | 468 | ||
| 469 | const inner_ct = @intToEnum(tls.ContentType, cleartext[cleartext.len - 1]); | 469 | const inner_ct = @enumFromInt(tls.ContentType, cleartext[cleartext.len - 1]); |
| 470 | if (inner_ct != .handshake) return error.TlsUnexpectedMessage; | 470 | if (inner_ct != .handshake) return error.TlsUnexpectedMessage; |
| 471 | 471 | ||
| 472 | var ctd = tls.Decoder.fromTheirSlice(cleartext[0 .. cleartext.len - 1]); | 472 | var ctd = tls.Decoder.fromTheirSlice(cleartext[0 .. cleartext.len - 1]); |
| ... | @@ -624,7 +624,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -624,7 +624,7 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 624 | if (handshake_state != .finished) return error.TlsUnexpectedMessage; | 624 | if (handshake_state != .finished) return error.TlsUnexpectedMessage; |
| 625 | // This message is to trick buggy proxies into behaving correctly. | 625 | // This message is to trick buggy proxies into behaving correctly. |
| 626 | const client_change_cipher_spec_msg = [_]u8{ | 626 | const client_change_cipher_spec_msg = [_]u8{ |
| 627 | @enumToInt(tls.ContentType.change_cipher_spec), | 627 | @intFromEnum(tls.ContentType.change_cipher_spec), |
| 628 | 0x03, 0x03, // legacy protocol version | 628 | 0x03, 0x03, // legacy protocol version |
| 629 | 0x00, 0x01, // length | 629 | 0x00, 0x01, // length |
| 630 | 0x01, | 630 | 0x01, |
| ... | @@ -640,14 +640,14 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In | ... | @@ -640,14 +640,14 @@ pub fn init(stream: anytype, ca_bundle: Certificate.Bundle, host: []const u8) In |
| 640 | const handshake_hash = p.transcript_hash.finalResult(); | 640 | const handshake_hash = p.transcript_hash.finalResult(); |
| 641 | const verify_data = tls.hmac(P.Hmac, &handshake_hash, p.client_finished_key); | 641 | const verify_data = tls.hmac(P.Hmac, &handshake_hash, p.client_finished_key); |
| 642 | const out_cleartext = [_]u8{ | 642 | const out_cleartext = [_]u8{ |
| 643 | @enumToInt(tls.HandshakeType.finished), | 643 | @intFromEnum(tls.HandshakeType.finished), |
| 644 | 0, 0, verify_data.len, // length | 644 | 0, 0, verify_data.len, // length |
| 645 | } ++ verify_data ++ [1]u8{@enumToInt(tls.ContentType.handshake)}; | 645 | } ++ verify_data ++ [1]u8{@intFromEnum(tls.ContentType.handshake)}; |
| 646 | 646 | ||
| 647 | const wrapped_len = out_cleartext.len + P.AEAD.tag_length; | 647 | const wrapped_len = out_cleartext.len + P.AEAD.tag_length; |
| 648 | 648 | ||
| 649 | var finished_msg = [_]u8{ | 649 | var finished_msg = [_]u8{ |
| 650 | @enumToInt(tls.ContentType.application_data), | 650 | @intFromEnum(tls.ContentType.application_data), |
| 651 | 0x03, 0x03, // legacy protocol version | 651 | 0x03, 0x03, // legacy protocol version |
| 652 | 0, wrapped_len, // byte length of encrypted record | 652 | 0, wrapped_len, // byte length of encrypted record |
| 653 | } ++ @as([wrapped_len]u8, undefined); | 653 | } ++ @as([wrapped_len]u8, undefined); |
| ... | @@ -809,7 +809,7 @@ fn prepareCiphertextRecord( | ... | @@ -809,7 +809,7 @@ fn prepareCiphertextRecord( |
| 809 | }; | 809 | }; |
| 810 | 810 | ||
| 811 | @memcpy(cleartext_buf[0..encrypted_content_len], bytes[bytes_i..][0..encrypted_content_len]); | 811 | @memcpy(cleartext_buf[0..encrypted_content_len], bytes[bytes_i..][0..encrypted_content_len]); |
| 812 | cleartext_buf[encrypted_content_len] = @enumToInt(inner_content_type); | 812 | cleartext_buf[encrypted_content_len] = @intFromEnum(inner_content_type); |
| 813 | bytes_i += encrypted_content_len; | 813 | bytes_i += encrypted_content_len; |
| 814 | const ciphertext_len = encrypted_content_len + 1; | 814 | const ciphertext_len = encrypted_content_len + 1; |
| 815 | const cleartext = cleartext_buf[0..ciphertext_len]; | 815 | const cleartext = cleartext_buf[0..ciphertext_len]; |
| ... | @@ -817,8 +817,8 @@ fn prepareCiphertextRecord( | ... | @@ -817,8 +817,8 @@ fn prepareCiphertextRecord( |
| 817 | const record_start = ciphertext_end; | 817 | const record_start = ciphertext_end; |
| 818 | const ad = ciphertext_buf[ciphertext_end..][0..5]; | 818 | const ad = ciphertext_buf[ciphertext_end..][0..5]; |
| 819 | ad.* = | 819 | ad.* = |
| 820 | [_]u8{@enumToInt(tls.ContentType.application_data)} ++ | 820 | [_]u8{@intFromEnum(tls.ContentType.application_data)} ++ |
| 821 | int2(@enumToInt(tls.ProtocolVersion.tls_1_2)) ++ | 821 | int2(@intFromEnum(tls.ProtocolVersion.tls_1_2)) ++ |
| 822 | int2(ciphertext_len + P.AEAD.tag_length); | 822 | int2(ciphertext_len + P.AEAD.tag_length); |
| 823 | ciphertext_end += ad.len; | 823 | ciphertext_end += ad.len; |
| 824 | const ciphertext = ciphertext_buf[ciphertext_end..][0..ciphertext_len]; | 824 | const ciphertext = ciphertext_buf[ciphertext_end..][0..ciphertext_len]; |
| ... | @@ -1037,7 +1037,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) | ... | @@ -1037,7 +1037,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) |
| 1037 | in = 0; | 1037 | in = 0; |
| 1038 | continue; | 1038 | continue; |
| 1039 | } | 1039 | } |
| 1040 | const ct = @intToEnum(tls.ContentType, frag[in]); | 1040 | const ct = @enumFromInt(tls.ContentType, frag[in]); |
| 1041 | in += 1; | 1041 | in += 1; |
| 1042 | const legacy_version = mem.readIntBig(u16, frag[in..][0..2]); | 1042 | const legacy_version = mem.readIntBig(u16, frag[in..][0..2]); |
| 1043 | in += 2; | 1043 | in += 2; |
| ... | @@ -1070,8 +1070,8 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) | ... | @@ -1070,8 +1070,8 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) |
| 1070 | switch (ct) { | 1070 | switch (ct) { |
| 1071 | .alert => { | 1071 | .alert => { |
| 1072 | if (in + 2 > frag.len) return error.TlsDecodeError; | 1072 | if (in + 2 > frag.len) return error.TlsDecodeError; |
| 1073 | const level = @intToEnum(tls.AlertLevel, frag[in]); | 1073 | const level = @enumFromInt(tls.AlertLevel, frag[in]); |
| 1074 | const desc = @intToEnum(tls.AlertDescription, frag[in + 1]); | 1074 | const desc = @enumFromInt(tls.AlertDescription, frag[in + 1]); |
| 1075 | _ = level; | 1075 | _ = level; |
| 1076 | 1076 | ||
| 1077 | try desc.toError(); | 1077 | try desc.toError(); |
| ... | @@ -1105,11 +1105,11 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) | ... | @@ -1105,11 +1105,11 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) |
| 1105 | 1105 | ||
| 1106 | c.read_seq = try std.math.add(u64, c.read_seq, 1); | 1106 | c.read_seq = try std.math.add(u64, c.read_seq, 1); |
| 1107 | 1107 | ||
| 1108 | const inner_ct = @intToEnum(tls.ContentType, cleartext[cleartext.len - 1]); | 1108 | const inner_ct = @enumFromInt(tls.ContentType, cleartext[cleartext.len - 1]); |
| 1109 | switch (inner_ct) { | 1109 | switch (inner_ct) { |
| 1110 | .alert => { | 1110 | .alert => { |
| 1111 | const level = @intToEnum(tls.AlertLevel, cleartext[0]); | 1111 | const level = @enumFromInt(tls.AlertLevel, cleartext[0]); |
| 1112 | const desc = @intToEnum(tls.AlertDescription, cleartext[1]); | 1112 | const desc = @enumFromInt(tls.AlertDescription, cleartext[1]); |
| 1113 | if (desc == .close_notify) { | 1113 | if (desc == .close_notify) { |
| 1114 | c.received_close_notify = true; | 1114 | c.received_close_notify = true; |
| 1115 | c.partial_ciphertext_end = c.partial_ciphertext_idx; | 1115 | c.partial_ciphertext_end = c.partial_ciphertext_idx; |
| ... | @@ -1124,7 +1124,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) | ... | @@ -1124,7 +1124,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) |
| 1124 | .handshake => { | 1124 | .handshake => { |
| 1125 | var ct_i: usize = 0; | 1125 | var ct_i: usize = 0; |
| 1126 | while (true) { | 1126 | while (true) { |
| 1127 | const handshake_type = @intToEnum(tls.HandshakeType, cleartext[ct_i]); | 1127 | const handshake_type = @enumFromInt(tls.HandshakeType, cleartext[ct_i]); |
| 1128 | ct_i += 1; | 1128 | ct_i += 1; |
| 1129 | const handshake_len = mem.readIntBig(u24, cleartext[ct_i..][0..3]); | 1129 | const handshake_len = mem.readIntBig(u24, cleartext[ct_i..][0..3]); |
| 1130 | ct_i += 3; | 1130 | ct_i += 3; |
| ... | @@ -1148,7 +1148,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) | ... | @@ -1148,7 +1148,7 @@ pub fn readvAdvanced(c: *Client, stream: anytype, iovecs: []const std.os.iovec) |
| 1148 | } | 1148 | } |
| 1149 | c.read_seq = 0; | 1149 | c.read_seq = 0; |
| 1150 | 1150 | ||
| 1151 | switch (@intToEnum(tls.KeyUpdateRequest, handshake[0])) { | 1151 | switch (@enumFromInt(tls.KeyUpdateRequest, handshake[0])) { |
| 1152 | .update_requested => { | 1152 | .update_requested => { |
| 1153 | switch (c.application_cipher) { | 1153 | switch (c.application_cipher) { |
| 1154 | inline else => |*p| { | 1154 | inline else => |*p| { |
lib/std/debug.zig+15-15| ... | @@ -461,7 +461,7 @@ pub const StackIterator = struct { | ... | @@ -461,7 +461,7 @@ pub const StackIterator = struct { |
| 461 | if (native_os == .freestanding) return true; | 461 | if (native_os == .freestanding) return true; |
| 462 | 462 | ||
| 463 | const aligned_address = address & ~@intCast(usize, (mem.page_size - 1)); | 463 | const aligned_address = address & ~@intCast(usize, (mem.page_size - 1)); |
| 464 | const aligned_memory = @intToPtr([*]align(mem.page_size) u8, aligned_address)[0..mem.page_size]; | 464 | const aligned_memory = @ptrFromInt([*]align(mem.page_size) u8, aligned_address)[0..mem.page_size]; |
| 465 | 465 | ||
| 466 | if (native_os != .windows) { | 466 | if (native_os != .windows) { |
| 467 | if (native_os != .wasi) { | 467 | if (native_os != .wasi) { |
| ... | @@ -511,7 +511,7 @@ pub const StackIterator = struct { | ... | @@ -511,7 +511,7 @@ pub const StackIterator = struct { |
| 511 | if (fp == 0 or !mem.isAligned(fp, @alignOf(usize)) or !isValidMemory(fp)) | 511 | if (fp == 0 or !mem.isAligned(fp, @alignOf(usize)) or !isValidMemory(fp)) |
| 512 | return null; | 512 | return null; |
| 513 | 513 | ||
| 514 | const new_fp = math.add(usize, @intToPtr(*const usize, fp).*, fp_bias) catch return null; | 514 | const new_fp = math.add(usize, @ptrFromInt(*const usize, fp).*, fp_bias) catch return null; |
| 515 | 515 | ||
| 516 | // Sanity check: the stack grows down thus all the parent frames must be | 516 | // Sanity check: the stack grows down thus all the parent frames must be |
| 517 | // be at addresses that are greater (or equal) than the previous one. | 517 | // be at addresses that are greater (or equal) than the previous one. |
| ... | @@ -520,7 +520,7 @@ pub const StackIterator = struct { | ... | @@ -520,7 +520,7 @@ pub const StackIterator = struct { |
| 520 | if (new_fp != 0 and new_fp < self.fp) | 520 | if (new_fp != 0 and new_fp < self.fp) |
| 521 | return null; | 521 | return null; |
| 522 | 522 | ||
| 523 | const new_pc = @intToPtr( | 523 | const new_pc = @ptrFromInt( |
| 524 | *const usize, | 524 | *const usize, |
| 525 | math.add(usize, fp, pc_offset) catch return null, | 525 | math.add(usize, fp, pc_offset) catch return null, |
| 526 | ).*; | 526 | ).*; |
| ... | @@ -584,12 +584,12 @@ pub noinline fn walkStackWindows(addresses: []usize) usize { | ... | @@ -584,12 +584,12 @@ pub noinline fn walkStackWindows(addresses: []usize) usize { |
| 584 | ); | 584 | ); |
| 585 | } else { | 585 | } else { |
| 586 | // leaf function | 586 | // leaf function |
| 587 | context.setIp(@intToPtr(*u64, current_regs.sp).*); | 587 | context.setIp(@ptrFromInt(*u64, current_regs.sp).*); |
| 588 | context.setSp(current_regs.sp + @sizeOf(usize)); | 588 | context.setSp(current_regs.sp + @sizeOf(usize)); |
| 589 | } | 589 | } |
| 590 | 590 | ||
| 591 | const next_regs = context.getRegs(); | 591 | const next_regs = context.getRegs(); |
| 592 | if (next_regs.sp < @ptrToInt(tib.StackLimit) or next_regs.sp > @ptrToInt(tib.StackBase)) { | 592 | if (next_regs.sp < @intFromPtr(tib.StackLimit) or next_regs.sp > @intFromPtr(tib.StackBase)) { |
| 593 | break; | 593 | break; |
| 594 | } | 594 | } |
| 595 | 595 | ||
| ... | @@ -1216,7 +1216,7 @@ pub const DebugInfo = struct { | ... | @@ -1216,7 +1216,7 @@ pub const DebugInfo = struct { |
| 1216 | var module_valid = true; | 1216 | var module_valid = true; |
| 1217 | while (module_valid) { | 1217 | while (module_valid) { |
| 1218 | const module_info = try debug_info.modules.addOne(allocator); | 1218 | const module_info = try debug_info.modules.addOne(allocator); |
| 1219 | module_info.base_address = @ptrToInt(module_entry.modBaseAddr); | 1219 | module_info.base_address = @intFromPtr(module_entry.modBaseAddr); |
| 1220 | module_info.size = module_entry.modBaseSize; | 1220 | module_info.size = module_entry.modBaseSize; |
| 1221 | module_info.name = allocator.dupe(u8, mem.sliceTo(&module_entry.szModule, 0)) catch &.{}; | 1221 | module_info.name = allocator.dupe(u8, mem.sliceTo(&module_entry.szModule, 0)) catch &.{}; |
| 1222 | module_valid = windows.kernel32.Module32Next(handle, &module_entry) == 1; | 1222 | module_valid = windows.kernel32.Module32Next(handle, &module_entry) == 1; |
| ... | @@ -1283,9 +1283,9 @@ pub const DebugInfo = struct { | ... | @@ -1283,9 +1283,9 @@ pub const DebugInfo = struct { |
| 1283 | 1283 | ||
| 1284 | var it = macho.LoadCommandIterator{ | 1284 | var it = macho.LoadCommandIterator{ |
| 1285 | .ncmds = header.ncmds, | 1285 | .ncmds = header.ncmds, |
| 1286 | .buffer = @alignCast(@alignOf(u64), @intToPtr( | 1286 | .buffer = @alignCast(@alignOf(u64), @ptrFromInt( |
| 1287 | [*]u8, | 1287 | [*]u8, |
| 1288 | @ptrToInt(header) + @sizeOf(macho.mach_header_64), | 1288 | @intFromPtr(header) + @sizeOf(macho.mach_header_64), |
| 1289 | ))[0..header.sizeofcmds], | 1289 | ))[0..header.sizeofcmds], |
| 1290 | }; | 1290 | }; |
| 1291 | while (it.next()) |cmd| switch (cmd.cmd()) { | 1291 | while (it.next()) |cmd| switch (cmd.cmd()) { |
| ... | @@ -1332,7 +1332,7 @@ pub const DebugInfo = struct { | ... | @@ -1332,7 +1332,7 @@ pub const DebugInfo = struct { |
| 1332 | return obj_di; | 1332 | return obj_di; |
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
| 1335 | const mapped_module = @intToPtr([*]const u8, module.base_address)[0..module.size]; | 1335 | const mapped_module = @ptrFromInt([*]const u8, module.base_address)[0..module.size]; |
| 1336 | const obj_di = try self.allocator.create(ModuleDebugInfo); | 1336 | const obj_di = try self.allocator.create(ModuleDebugInfo); |
| 1337 | errdefer self.allocator.destroy(obj_di); | 1337 | errdefer self.allocator.destroy(obj_di); |
| 1338 | 1338 | ||
| ... | @@ -1897,11 +1897,11 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any | ... | @@ -1897,11 +1897,11 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any |
| 1897 | resetSegfaultHandler(); | 1897 | resetSegfaultHandler(); |
| 1898 | 1898 | ||
| 1899 | const addr = switch (native_os) { | 1899 | const addr = switch (native_os) { |
| 1900 | .linux => @ptrToInt(info.fields.sigfault.addr), | 1900 | .linux => @intFromPtr(info.fields.sigfault.addr), |
| 1901 | .freebsd, .macos => @ptrToInt(info.addr), | 1901 | .freebsd, .macos => @intFromPtr(info.addr), |
| 1902 | .netbsd => @ptrToInt(info.info.reason.fault.addr), | 1902 | .netbsd => @intFromPtr(info.info.reason.fault.addr), |
| 1903 | .openbsd => @ptrToInt(info.data.fault.addr), | 1903 | .openbsd => @intFromPtr(info.data.fault.addr), |
| 1904 | .solaris => @ptrToInt(info.reason.fault.addr), | 1904 | .solaris => @intFromPtr(info.reason.fault.addr), |
| 1905 | else => unreachable, | 1905 | else => unreachable, |
| 1906 | }; | 1906 | }; |
| 1907 | 1907 | ||
| ... | @@ -2008,7 +2008,7 @@ fn handleSegfaultWindowsExtra( | ... | @@ -2008,7 +2008,7 @@ fn handleSegfaultWindowsExtra( |
| 2008 | msg: u8, | 2008 | msg: u8, |
| 2009 | label: ?[]const u8, | 2009 | label: ?[]const u8, |
| 2010 | ) noreturn { | 2010 | ) noreturn { |
| 2011 | const exception_address = @ptrToInt(info.ExceptionRecord.ExceptionAddress); | 2011 | const exception_address = @intFromPtr(info.ExceptionRecord.ExceptionAddress); |
| 2012 | if (@hasDecl(windows, "CONTEXT")) { | 2012 | if (@hasDecl(windows, "CONTEXT")) { |
| 2013 | nosuspend switch (panic_stage) { | 2013 | nosuspend switch (panic_stage) { |
| 2014 | 0 => { | 2014 | 0 => { |
lib/std/dynamic_library.zig+18-18| ... | @@ -71,18 +71,18 @@ pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator { | ... | @@ -71,18 +71,18 @@ pub fn linkmap_iterator(phdrs: []elf.Phdr) !LinkMap.Iterator { |
| 71 | while (_DYNAMIC[i].d_tag != elf.DT_NULL) : (i += 1) { | 71 | while (_DYNAMIC[i].d_tag != elf.DT_NULL) : (i += 1) { |
| 72 | switch (_DYNAMIC[i].d_tag) { | 72 | switch (_DYNAMIC[i].d_tag) { |
| 73 | elf.DT_DEBUG => { | 73 | elf.DT_DEBUG => { |
| 74 | const ptr = @intToPtr(?*RDebug, _DYNAMIC[i].d_val); | 74 | const ptr = @ptrFromInt(?*RDebug, _DYNAMIC[i].d_val); |
| 75 | if (ptr) |r_debug| { | 75 | if (ptr) |r_debug| { |
| 76 | if (r_debug.r_version != 1) return error.InvalidExe; | 76 | if (r_debug.r_version != 1) return error.InvalidExe; |
| 77 | break :init r_debug.r_map; | 77 | break :init r_debug.r_map; |
| 78 | } | 78 | } |
| 79 | }, | 79 | }, |
| 80 | elf.DT_PLTGOT => { | 80 | elf.DT_PLTGOT => { |
| 81 | const ptr = @intToPtr(?[*]usize, _DYNAMIC[i].d_val); | 81 | const ptr = @ptrFromInt(?[*]usize, _DYNAMIC[i].d_val); |
| 82 | if (ptr) |got_table| { | 82 | if (ptr) |got_table| { |
| 83 | // The address to the link_map structure is stored in | 83 | // The address to the link_map structure is stored in |
| 84 | // the second slot | 84 | // the second slot |
| 85 | break :init @intToPtr(?*LinkMap, got_table[1]); | 85 | break :init @ptrFromInt(?*LinkMap, got_table[1]); |
| 86 | } | 86 | } |
| 87 | }, | 87 | }, |
| 88 | else => {}, | 88 | else => {}, |
| ... | @@ -136,7 +136,7 @@ pub const ElfDynLib = struct { | ... | @@ -136,7 +136,7 @@ pub const ElfDynLib = struct { |
| 136 | if (!mem.eql(u8, eh.e_ident[0..4], elf.MAGIC)) return error.NotElfFile; | 136 | if (!mem.eql(u8, eh.e_ident[0..4], elf.MAGIC)) return error.NotElfFile; |
| 137 | if (eh.e_type != elf.ET.DYN) return error.NotDynamicLibrary; | 137 | if (eh.e_type != elf.ET.DYN) return error.NotDynamicLibrary; |
| 138 | 138 | ||
| 139 | const elf_addr = @ptrToInt(file_bytes.ptr); | 139 | const elf_addr = @intFromPtr(file_bytes.ptr); |
| 140 | 140 | ||
| 141 | // Iterate over the program header entries to find out the | 141 | // Iterate over the program header entries to find out the |
| 142 | // dynamic vector as well as the total size of the virtual memory. | 142 | // dynamic vector as well as the total size of the virtual memory. |
| ... | @@ -149,10 +149,10 @@ pub const ElfDynLib = struct { | ... | @@ -149,10 +149,10 @@ pub const ElfDynLib = struct { |
| 149 | i += 1; | 149 | i += 1; |
| 150 | ph_addr += eh.e_phentsize; | 150 | ph_addr += eh.e_phentsize; |
| 151 | }) { | 151 | }) { |
| 152 | const ph = @intToPtr(*elf.Phdr, ph_addr); | 152 | const ph = @ptrFromInt(*elf.Phdr, ph_addr); |
| 153 | switch (ph.p_type) { | 153 | switch (ph.p_type) { |
| 154 | elf.PT_LOAD => virt_addr_end = @max(virt_addr_end, ph.p_vaddr + ph.p_memsz), | 154 | elf.PT_LOAD => virt_addr_end = @max(virt_addr_end, ph.p_vaddr + ph.p_memsz), |
| 155 | elf.PT_DYNAMIC => maybe_dynv = @intToPtr([*]usize, elf_addr + ph.p_offset), | 155 | elf.PT_DYNAMIC => maybe_dynv = @ptrFromInt([*]usize, elf_addr + ph.p_offset), |
| 156 | else => {}, | 156 | else => {}, |
| 157 | } | 157 | } |
| 158 | } | 158 | } |
| ... | @@ -170,7 +170,7 @@ pub const ElfDynLib = struct { | ... | @@ -170,7 +170,7 @@ pub const ElfDynLib = struct { |
| 170 | ); | 170 | ); |
| 171 | errdefer os.munmap(all_loaded_mem); | 171 | errdefer os.munmap(all_loaded_mem); |
| 172 | 172 | ||
| 173 | const base = @ptrToInt(all_loaded_mem.ptr); | 173 | const base = @intFromPtr(all_loaded_mem.ptr); |
| 174 | 174 | ||
| 175 | // Now iterate again and actually load all the program sections. | 175 | // Now iterate again and actually load all the program sections. |
| 176 | { | 176 | { |
| ... | @@ -180,7 +180,7 @@ pub const ElfDynLib = struct { | ... | @@ -180,7 +180,7 @@ pub const ElfDynLib = struct { |
| 180 | i += 1; | 180 | i += 1; |
| 181 | ph_addr += eh.e_phentsize; | 181 | ph_addr += eh.e_phentsize; |
| 182 | }) { | 182 | }) { |
| 183 | const ph = @intToPtr(*elf.Phdr, ph_addr); | 183 | const ph = @ptrFromInt(*elf.Phdr, ph_addr); |
| 184 | switch (ph.p_type) { | 184 | switch (ph.p_type) { |
| 185 | elf.PT_LOAD => { | 185 | elf.PT_LOAD => { |
| 186 | // The VirtAddr may not be page-aligned; in such case there will be | 186 | // The VirtAddr may not be page-aligned; in such case there will be |
| ... | @@ -188,7 +188,7 @@ pub const ElfDynLib = struct { | ... | @@ -188,7 +188,7 @@ pub const ElfDynLib = struct { |
| 188 | const aligned_addr = (base + ph.p_vaddr) & ~(@as(usize, mem.page_size) - 1); | 188 | const aligned_addr = (base + ph.p_vaddr) & ~(@as(usize, mem.page_size) - 1); |
| 189 | const extra_bytes = (base + ph.p_vaddr) - aligned_addr; | 189 | const extra_bytes = (base + ph.p_vaddr) - aligned_addr; |
| 190 | const extended_memsz = mem.alignForward(usize, ph.p_memsz + extra_bytes, mem.page_size); | 190 | const extended_memsz = mem.alignForward(usize, ph.p_memsz + extra_bytes, mem.page_size); |
| 191 | const ptr = @intToPtr([*]align(mem.page_size) u8, aligned_addr); | 191 | const ptr = @ptrFromInt([*]align(mem.page_size) u8, aligned_addr); |
| 192 | const prot = elfToMmapProt(ph.p_flags); | 192 | const prot = elfToMmapProt(ph.p_flags); |
| 193 | if ((ph.p_flags & elf.PF_W) == 0) { | 193 | if ((ph.p_flags & elf.PF_W) == 0) { |
| 194 | // If it does not need write access, it can be mapped from the fd. | 194 | // If it does not need write access, it can be mapped from the fd. |
| ... | @@ -228,11 +228,11 @@ pub const ElfDynLib = struct { | ... | @@ -228,11 +228,11 @@ pub const ElfDynLib = struct { |
| 228 | while (dynv[i] != 0) : (i += 2) { | 228 | while (dynv[i] != 0) : (i += 2) { |
| 229 | const p = base + dynv[i + 1]; | 229 | const p = base + dynv[i + 1]; |
| 230 | switch (dynv[i]) { | 230 | switch (dynv[i]) { |
| 231 | elf.DT_STRTAB => maybe_strings = @intToPtr([*:0]u8, p), | 231 | elf.DT_STRTAB => maybe_strings = @ptrFromInt([*:0]u8, p), |
| 232 | elf.DT_SYMTAB => maybe_syms = @intToPtr([*]elf.Sym, p), | 232 | elf.DT_SYMTAB => maybe_syms = @ptrFromInt([*]elf.Sym, p), |
| 233 | elf.DT_HASH => maybe_hashtab = @intToPtr([*]os.Elf_Symndx, p), | 233 | elf.DT_HASH => maybe_hashtab = @ptrFromInt([*]os.Elf_Symndx, p), |
| 234 | elf.DT_VERSYM => maybe_versym = @intToPtr([*]u16, p), | 234 | elf.DT_VERSYM => maybe_versym = @ptrFromInt([*]u16, p), |
| 235 | elf.DT_VERDEF => maybe_verdef = @intToPtr(*elf.Verdef, p), | 235 | elf.DT_VERDEF => maybe_verdef = @ptrFromInt(*elf.Verdef, p), |
| 236 | else => {}, | 236 | else => {}, |
| 237 | } | 237 | } |
| 238 | } | 238 | } |
| ... | @@ -261,7 +261,7 @@ pub const ElfDynLib = struct { | ... | @@ -261,7 +261,7 @@ pub const ElfDynLib = struct { |
| 261 | 261 | ||
| 262 | pub fn lookup(self: *ElfDynLib, comptime T: type, name: [:0]const u8) ?T { | 262 | pub fn lookup(self: *ElfDynLib, comptime T: type, name: [:0]const u8) ?T { |
| 263 | if (self.lookupAddress("", name)) |symbol| { | 263 | if (self.lookupAddress("", name)) |symbol| { |
| 264 | return @intToPtr(T, symbol); | 264 | return @ptrFromInt(T, symbol); |
| 265 | } else { | 265 | } else { |
| 266 | return null; | 266 | return null; |
| 267 | } | 267 | } |
| ... | @@ -284,7 +284,7 @@ pub const ElfDynLib = struct { | ... | @@ -284,7 +284,7 @@ pub const ElfDynLib = struct { |
| 284 | if (!checkver(self.verdef.?, versym[i], vername, self.strings)) | 284 | if (!checkver(self.verdef.?, versym[i], vername, self.strings)) |
| 285 | continue; | 285 | continue; |
| 286 | } | 286 | } |
| 287 | return @ptrToInt(self.memory.ptr) + self.syms[i].st_value; | 287 | return @intFromPtr(self.memory.ptr) + self.syms[i].st_value; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | return null; | 290 | return null; |
| ... | @@ -307,9 +307,9 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ | ... | @@ -307,9 +307,9 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ |
| 307 | break; | 307 | break; |
| 308 | if (def.vd_next == 0) | 308 | if (def.vd_next == 0) |
| 309 | return false; | 309 | return false; |
| 310 | def = @intToPtr(*elf.Verdef, @ptrToInt(def) + def.vd_next); | 310 | def = @ptrFromInt(*elf.Verdef, @intFromPtr(def) + def.vd_next); |
| 311 | } | 311 | } |
| 312 | const aux = @intToPtr(*elf.Verdaux, @ptrToInt(def) + def.vd_aux); | 312 | const aux = @ptrFromInt(*elf.Verdaux, @intFromPtr(def) + def.vd_aux); |
| 313 | return mem.eql(u8, vername, mem.sliceTo(strings + aux.vda_name, 0)); | 313 | return mem.eql(u8, vername, mem.sliceTo(strings + aux.vda_name, 0)); |
| 314 | } | 314 | } |
| 315 | 315 |
lib/std/elf.zig+2-2| ... | @@ -453,8 +453,8 @@ pub const Header = struct { | ... | @@ -453,8 +453,8 @@ pub const Header = struct { |
| 453 | }; | 453 | }; |
| 454 | 454 | ||
| 455 | const machine = if (need_bswap) blk: { | 455 | const machine = if (need_bswap) blk: { |
| 456 | const value = @enumToInt(hdr32.e_machine); | 456 | const value = @intFromEnum(hdr32.e_machine); |
| 457 | break :blk @intToEnum(EM, @byteSwap(value)); | 457 | break :blk @enumFromInt(EM, @byteSwap(value)); |
| 458 | } else hdr32.e_machine; | 458 | } else hdr32.e_machine; |
| 459 | 459 | ||
| 460 | return @as(Header, .{ | 460 | return @as(Header, .{ |
lib/std/enums.zig+15-15| ... | @@ -53,7 +53,7 @@ pub fn values(comptime E: type) []const E { | ... | @@ -53,7 +53,7 @@ pub fn values(comptime E: type) []const E { |
| 53 | /// Returns the tag name for `e` or null if no tag exists. | 53 | /// Returns the tag name for `e` or null if no tag exists. |
| 54 | pub fn tagName(comptime E: type, e: E) ?[]const u8 { | 54 | pub fn tagName(comptime E: type, e: E) ?[]const u8 { |
| 55 | return inline for (@typeInfo(E).Enum.fields) |f| { | 55 | return inline for (@typeInfo(E).Enum.fields) |f| { |
| 56 | if (@enumToInt(e) == f.value) break f.name; | 56 | if (@intFromEnum(e) == f.value) break f.name; |
| 57 | } else null; | 57 | } else null; |
| 58 | } | 58 | } |
| 59 | 59 | ||
| ... | @@ -61,11 +61,11 @@ test tagName { | ... | @@ -61,11 +61,11 @@ test tagName { |
| 61 | const E = enum(u8) { a, b, _ }; | 61 | const E = enum(u8) { a, b, _ }; |
| 62 | try testing.expect(tagName(E, .a) != null); | 62 | try testing.expect(tagName(E, .a) != null); |
| 63 | try testing.expectEqualStrings("a", tagName(E, .a).?); | 63 | try testing.expectEqualStrings("a", tagName(E, .a).?); |
| 64 | try testing.expect(tagName(E, @intToEnum(E, 42)) == null); | 64 | try testing.expect(tagName(E, @enumFromInt(E, 42)) == null); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | /// Determines the length of a direct-mapped enum array, indexed by | 67 | /// Determines the length of a direct-mapped enum array, indexed by |
| 68 | /// @intCast(usize, @enumToInt(enum_value)). | 68 | /// @intCast(usize, @intFromEnum(enum_value)). |
| 69 | /// If the enum is non-exhaustive, the resulting length will only be enough | 69 | /// If the enum is non-exhaustive, the resulting length will only be enough |
| 70 | /// to hold all explicit fields. | 70 | /// to hold all explicit fields. |
| 71 | /// If the enum contains any fields with values that cannot be represented | 71 | /// If the enum contains any fields with values that cannot be represented |
| ... | @@ -100,7 +100,7 @@ pub fn directEnumArrayLen(comptime E: type, comptime max_unused_slots: comptime_ | ... | @@ -100,7 +100,7 @@ pub fn directEnumArrayLen(comptime E: type, comptime max_unused_slots: comptime_ |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | /// Initializes an array of Data which can be indexed by | 102 | /// Initializes an array of Data which can be indexed by |
| 103 | /// @intCast(usize, @enumToInt(enum_value)). | 103 | /// @intCast(usize, @intFromEnum(enum_value)). |
| 104 | /// If the enum is non-exhaustive, the resulting array will only be large enough | 104 | /// If the enum is non-exhaustive, the resulting array will only be large enough |
| 105 | /// to hold all explicit fields. | 105 | /// to hold all explicit fields. |
| 106 | /// If the enum contains any fields with values that cannot be represented | 106 | /// If the enum contains any fields with values that cannot be represented |
| ... | @@ -136,7 +136,7 @@ test "std.enums.directEnumArray" { | ... | @@ -136,7 +136,7 @@ test "std.enums.directEnumArray" { |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | /// Initializes an array of Data which can be indexed by | 138 | /// Initializes an array of Data which can be indexed by |
| 139 | /// @intCast(usize, @enumToInt(enum_value)). The enum must be exhaustive. | 139 | /// @intCast(usize, @intFromEnum(enum_value)). The enum must be exhaustive. |
| 140 | /// If the enum contains any fields with values that cannot be represented | 140 | /// If the enum contains any fields with values that cannot be represented |
| 141 | /// by usize, a compile error is issued. The max_unused_slots parameter limits | 141 | /// by usize, a compile error is issued. The max_unused_slots parameter limits |
| 142 | /// the total number of items which have no matching enum key (holes in the enum | 142 | /// the total number of items which have no matching enum key (holes in the enum |
| ... | @@ -156,7 +156,7 @@ pub fn directEnumArrayDefault( | ... | @@ -156,7 +156,7 @@ pub fn directEnumArrayDefault( |
| 156 | var result: [len]Data = if (default) |d| [_]Data{d} ** len else undefined; | 156 | var result: [len]Data = if (default) |d| [_]Data{d} ** len else undefined; |
| 157 | inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f| { | 157 | inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f| { |
| 158 | const enum_value = @field(E, f.name); | 158 | const enum_value = @field(E, f.name); |
| 159 | const index = @intCast(usize, @enumToInt(enum_value)); | 159 | const index = @intCast(usize, @intFromEnum(enum_value)); |
| 160 | result[index] = @field(init_values, f.name); | 160 | result[index] = @field(init_values, f.name); |
| 161 | } | 161 | } |
| 162 | return result; | 162 | return result; |
| ... | @@ -341,7 +341,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -341,7 +341,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 341 | var self = initWithCount(0); | 341 | var self = initWithCount(0); |
| 342 | inline for (@typeInfo(E).Enum.fields) |field| { | 342 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 343 | const c = @field(init_counts, field.name); | 343 | const c = @field(init_counts, field.name); |
| 344 | const key = @intToEnum(E, field.value); | 344 | const key = @enumFromInt(E, field.value); |
| 345 | self.counts.set(key, c); | 345 | self.counts.set(key, c); |
| 346 | } | 346 | } |
| 347 | return self; | 347 | return self; |
| ... | @@ -412,7 +412,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -412,7 +412,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 412 | /// asserts operation will not overflow any key. | 412 | /// asserts operation will not overflow any key. |
| 413 | pub fn addSetAssertSafe(self: *Self, other: Self) void { | 413 | pub fn addSetAssertSafe(self: *Self, other: Self) void { |
| 414 | inline for (@typeInfo(E).Enum.fields) |field| { | 414 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 415 | const key = @intToEnum(E, field.value); | 415 | const key = @enumFromInt(E, field.value); |
| 416 | self.addAssertSafe(key, other.getCount(key)); | 416 | self.addAssertSafe(key, other.getCount(key)); |
| 417 | } | 417 | } |
| 418 | } | 418 | } |
| ... | @@ -420,7 +420,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -420,7 +420,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 420 | /// Increases the all key counts by given multiset. | 420 | /// Increases the all key counts by given multiset. |
| 421 | pub fn addSet(self: *Self, other: Self) error{Overflow}!void { | 421 | pub fn addSet(self: *Self, other: Self) error{Overflow}!void { |
| 422 | inline for (@typeInfo(E).Enum.fields) |field| { | 422 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 423 | const key = @intToEnum(E, field.value); | 423 | const key = @enumFromInt(E, field.value); |
| 424 | try self.add(key, other.getCount(key)); | 424 | try self.add(key, other.getCount(key)); |
| 425 | } | 425 | } |
| 426 | } | 426 | } |
| ... | @@ -430,7 +430,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -430,7 +430,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 430 | /// then that key will have a key count of zero. | 430 | /// then that key will have a key count of zero. |
| 431 | pub fn removeSet(self: *Self, other: Self) void { | 431 | pub fn removeSet(self: *Self, other: Self) void { |
| 432 | inline for (@typeInfo(E).Enum.fields) |field| { | 432 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 433 | const key = @intToEnum(E, field.value); | 433 | const key = @enumFromInt(E, field.value); |
| 434 | self.remove(key, other.getCount(key)); | 434 | self.remove(key, other.getCount(key)); |
| 435 | } | 435 | } |
| 436 | } | 436 | } |
| ... | @@ -439,7 +439,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -439,7 +439,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 439 | /// given multiset. | 439 | /// given multiset. |
| 440 | pub fn eql(self: Self, other: Self) bool { | 440 | pub fn eql(self: Self, other: Self) bool { |
| 441 | inline for (@typeInfo(E).Enum.fields) |field| { | 441 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 442 | const key = @intToEnum(E, field.value); | 442 | const key = @enumFromInt(E, field.value); |
| 443 | if (self.getCount(key) != other.getCount(key)) { | 443 | if (self.getCount(key) != other.getCount(key)) { |
| 444 | return false; | 444 | return false; |
| 445 | } | 445 | } |
| ... | @@ -451,7 +451,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -451,7 +451,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 451 | /// equal to the given multiset. | 451 | /// equal to the given multiset. |
| 452 | pub fn subsetOf(self: Self, other: Self) bool { | 452 | pub fn subsetOf(self: Self, other: Self) bool { |
| 453 | inline for (@typeInfo(E).Enum.fields) |field| { | 453 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 454 | const key = @intToEnum(E, field.value); | 454 | const key = @enumFromInt(E, field.value); |
| 455 | if (self.getCount(key) > other.getCount(key)) { | 455 | if (self.getCount(key) > other.getCount(key)) { |
| 456 | return false; | 456 | return false; |
| 457 | } | 457 | } |
| ... | @@ -463,7 +463,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { | ... | @@ -463,7 +463,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type { |
| 463 | /// equal to the given multiset. | 463 | /// equal to the given multiset. |
| 464 | pub fn supersetOf(self: Self, other: Self) bool { | 464 | pub fn supersetOf(self: Self, other: Self) bool { |
| 465 | inline for (@typeInfo(E).Enum.fields) |field| { | 465 | inline for (@typeInfo(E).Enum.fields) |field| { |
| 466 | const key = @intToEnum(E, field.value); | 466 | const key = @enumFromInt(E, field.value); |
| 467 | if (self.getCount(key) < other.getCount(key)) { | 467 | if (self.getCount(key) < other.getCount(key)) { |
| 468 | return false; | 468 | return false; |
| 469 | } | 469 | } |
| ... | @@ -1323,14 +1323,14 @@ pub fn EnumIndexer(comptime E: type) type { | ... | @@ -1323,14 +1323,14 @@ pub fn EnumIndexer(comptime E: type) type { |
| 1323 | pub const Key = E; | 1323 | pub const Key = E; |
| 1324 | pub const count = fields_len; | 1324 | pub const count = fields_len; |
| 1325 | pub fn indexOf(e: E) usize { | 1325 | pub fn indexOf(e: E) usize { |
| 1326 | return @intCast(usize, @enumToInt(e) - min); | 1326 | return @intCast(usize, @intFromEnum(e) - min); |
| 1327 | } | 1327 | } |
| 1328 | pub fn keyForIndex(i: usize) E { | 1328 | pub fn keyForIndex(i: usize) E { |
| 1329 | // TODO fix addition semantics. This calculation | 1329 | // TODO fix addition semantics. This calculation |
| 1330 | // gives up some safety to avoid artificially limiting | 1330 | // gives up some safety to avoid artificially limiting |
| 1331 | // the range of signed enum values to max_isize. | 1331 | // the range of signed enum values to max_isize. |
| 1332 | const enum_value = if (min < 0) @bitCast(isize, i) +% min else i + min; | 1332 | const enum_value = if (min < 0) @bitCast(isize, i) +% min else i + min; |
| 1333 | return @intToEnum(E, @intCast(std.meta.Tag(E), enum_value)); | 1333 | return @enumFromInt(E, @intCast(std.meta.Tag(E), enum_value)); |
| 1334 | } | 1334 | } |
| 1335 | }; | 1335 | }; |
| 1336 | } | 1336 | } |
lib/std/event/channel.zig+1-1| ... | @@ -247,7 +247,7 @@ pub fn Channel(comptime T: type) type { | ... | @@ -247,7 +247,7 @@ pub fn Channel(comptime T: type) type { |
| 247 | // All the "get or null" functions should resume now. | 247 | // All the "get or null" functions should resume now. |
| 248 | var remove_count: usize = 0; | 248 | var remove_count: usize = 0; |
| 249 | while (self.or_null_queue.get()) |or_null_node| { | 249 | while (self.or_null_queue.get()) |or_null_node| { |
| 250 | remove_count += @boolToInt(self.getters.remove(or_null_node.data)); | 250 | remove_count += @intFromBool(self.getters.remove(or_null_node.data)); |
| 251 | global_event_loop.onNextTick(or_null_node.data.data.tick_node); | 251 | global_event_loop.onNextTick(or_null_node.data.data.tick_node); |
| 252 | } | 252 | } |
| 253 | if (remove_count != 0) { | 253 | if (remove_count != 0) { |
lib/std/event/lock.zig+4-4| ... | @@ -55,14 +55,14 @@ pub const Lock = struct { | ... | @@ -55,14 +55,14 @@ pub const Lock = struct { |
| 55 | const head = switch (self.head) { | 55 | const head = switch (self.head) { |
| 56 | UNLOCKED => unreachable, | 56 | UNLOCKED => unreachable, |
| 57 | LOCKED => null, | 57 | LOCKED => null, |
| 58 | else => @intToPtr(*Waiter, self.head), | 58 | else => @ptrFromInt(*Waiter, self.head), |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | if (head) |h| { | 61 | if (head) |h| { |
| 62 | h.tail.next = &waiter; | 62 | h.tail.next = &waiter; |
| 63 | h.tail = &waiter; | 63 | h.tail = &waiter; |
| 64 | } else { | 64 | } else { |
| 65 | self.head = @ptrToInt(&waiter); | 65 | self.head = @intFromPtr(&waiter); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | suspend { | 68 | suspend { |
| ... | @@ -102,8 +102,8 @@ pub const Lock = struct { | ... | @@ -102,8 +102,8 @@ pub const Lock = struct { |
| 102 | break :blk null; | 102 | break :blk null; |
| 103 | }, | 103 | }, |
| 104 | else => { | 104 | else => { |
| 105 | const waiter = @intToPtr(*Waiter, self.lock.head); | 105 | const waiter = @ptrFromInt(*Waiter, self.lock.head); |
| 106 | self.lock.head = if (waiter.next == null) LOCKED else @ptrToInt(waiter.next); | 106 | self.lock.head = if (waiter.next == null) LOCKED else @intFromPtr(waiter.next); |
| 107 | if (waiter.next) |next| | 107 | if (waiter.next) |next| |
| 108 | next.tail = waiter.tail; | 108 | next.tail = waiter.tail; |
| 109 | break :blk waiter; | 109 | break :blk waiter; |
lib/std/event/loop.zig+10-10| ... | @@ -244,7 +244,7 @@ pub const Loop = struct { | ... | @@ -244,7 +244,7 @@ pub const Loop = struct { |
| 244 | 244 | ||
| 245 | self.os_data.final_eventfd_event = os.linux.epoll_event{ | 245 | self.os_data.final_eventfd_event = os.linux.epoll_event{ |
| 246 | .events = os.linux.EPOLL.IN, | 246 | .events = os.linux.EPOLL.IN, |
| 247 | .data = os.linux.epoll_data{ .ptr = @ptrToInt(&self.final_resume_node) }, | 247 | .data = os.linux.epoll_data{ .ptr = @intFromPtr(&self.final_resume_node) }, |
| 248 | }; | 248 | }; |
| 249 | try os.epoll_ctl( | 249 | try os.epoll_ctl( |
| 250 | self.os_data.epollfd, | 250 | self.os_data.epollfd, |
| ... | @@ -293,7 +293,7 @@ pub const Loop = struct { | ... | @@ -293,7 +293,7 @@ pub const Loop = struct { |
| 293 | .flags = os.system.EV_CLEAR | os.system.EV_ADD | os.system.EV_DISABLE, | 293 | .flags = os.system.EV_CLEAR | os.system.EV_ADD | os.system.EV_DISABLE, |
| 294 | .fflags = 0, | 294 | .fflags = 0, |
| 295 | .data = 0, | 295 | .data = 0, |
| 296 | .udata = @ptrToInt(&eventfd_node.data.base), | 296 | .udata = @intFromPtr(&eventfd_node.data.base), |
| 297 | }, | 297 | }, |
| 298 | }, | 298 | }, |
| 299 | .next = undefined, | 299 | .next = undefined, |
| ... | @@ -313,7 +313,7 @@ pub const Loop = struct { | ... | @@ -313,7 +313,7 @@ pub const Loop = struct { |
| 313 | .flags = os.system.EV_ADD | os.system.EV_DISABLE, | 313 | .flags = os.system.EV_ADD | os.system.EV_DISABLE, |
| 314 | .fflags = 0, | 314 | .fflags = 0, |
| 315 | .data = 0, | 315 | .data = 0, |
| 316 | .udata = @ptrToInt(&self.final_resume_node), | 316 | .udata = @intFromPtr(&self.final_resume_node), |
| 317 | }; | 317 | }; |
| 318 | const final_kev_arr = @as(*const [1]os.Kevent, &self.os_data.final_kevent); | 318 | const final_kev_arr = @as(*const [1]os.Kevent, &self.os_data.final_kevent); |
| 319 | _ = try os.kevent(self.os_data.kqfd, final_kev_arr, empty_kevs, null); | 319 | _ = try os.kevent(self.os_data.kqfd, final_kev_arr, empty_kevs, null); |
| ... | @@ -358,7 +358,7 @@ pub const Loop = struct { | ... | @@ -358,7 +358,7 @@ pub const Loop = struct { |
| 358 | .flags = os.system.EV_CLEAR | os.system.EV_ADD | os.system.EV_DISABLE | os.system.EV_ONESHOT, | 358 | .flags = os.system.EV_CLEAR | os.system.EV_ADD | os.system.EV_DISABLE | os.system.EV_ONESHOT, |
| 359 | .fflags = 0, | 359 | .fflags = 0, |
| 360 | .data = 0, | 360 | .data = 0, |
| 361 | .udata = @ptrToInt(&eventfd_node.data.base), | 361 | .udata = @intFromPtr(&eventfd_node.data.base), |
| 362 | }, | 362 | }, |
| 363 | }, | 363 | }, |
| 364 | .next = undefined, | 364 | .next = undefined, |
| ... | @@ -377,7 +377,7 @@ pub const Loop = struct { | ... | @@ -377,7 +377,7 @@ pub const Loop = struct { |
| 377 | .flags = os.system.EV_ADD | os.system.EV_ONESHOT | os.system.EV_DISABLE, | 377 | .flags = os.system.EV_ADD | os.system.EV_ONESHOT | os.system.EV_DISABLE, |
| 378 | .fflags = 0, | 378 | .fflags = 0, |
| 379 | .data = 0, | 379 | .data = 0, |
| 380 | .udata = @ptrToInt(&self.final_resume_node), | 380 | .udata = @intFromPtr(&self.final_resume_node), |
| 381 | }; | 381 | }; |
| 382 | const final_kev_arr = @as(*const [1]os.Kevent, &self.os_data.final_kevent); | 382 | const final_kev_arr = @as(*const [1]os.Kevent, &self.os_data.final_kevent); |
| 383 | _ = try os.kevent(self.os_data.kqfd, final_kev_arr, empty_kevs, null); | 383 | _ = try os.kevent(self.os_data.kqfd, final_kev_arr, empty_kevs, null); |
| ... | @@ -418,7 +418,7 @@ pub const Loop = struct { | ... | @@ -418,7 +418,7 @@ pub const Loop = struct { |
| 418 | .overlapped = ResumeNode.overlapped_init, | 418 | .overlapped = ResumeNode.overlapped_init, |
| 419 | }, | 419 | }, |
| 420 | // this one is for sending events | 420 | // this one is for sending events |
| 421 | .completion_key = @ptrToInt(&eventfd_node.data.base), | 421 | .completion_key = @intFromPtr(&eventfd_node.data.base), |
| 422 | }, | 422 | }, |
| 423 | .next = undefined, | 423 | .next = undefined, |
| 424 | }; | 424 | }; |
| ... | @@ -488,7 +488,7 @@ pub const Loop = struct { | ... | @@ -488,7 +488,7 @@ pub const Loop = struct { |
| 488 | assert(flags & os.linux.EPOLL.ET == os.linux.EPOLL.ET); | 488 | assert(flags & os.linux.EPOLL.ET == os.linux.EPOLL.ET); |
| 489 | var ev = os.linux.epoll_event{ | 489 | var ev = os.linux.epoll_event{ |
| 490 | .events = flags, | 490 | .events = flags, |
| 491 | .data = os.linux.epoll_data{ .ptr = @ptrToInt(resume_node) }, | 491 | .data = os.linux.epoll_data{ .ptr = @intFromPtr(resume_node) }, |
| 492 | }; | 492 | }; |
| 493 | try os.epoll_ctl(self.os_data.epollfd, op, fd, &ev); | 493 | try os.epoll_ctl(self.os_data.epollfd, op, fd, &ev); |
| 494 | } | 494 | } |
| ... | @@ -619,7 +619,7 @@ pub const Loop = struct { | ... | @@ -619,7 +619,7 @@ pub const Loop = struct { |
| 619 | .flags = os.system.EV_ADD | os.system.EV_ENABLE | os.system.EV_CLEAR | flags, | 619 | .flags = os.system.EV_ADD | os.system.EV_ENABLE | os.system.EV_CLEAR | flags, |
| 620 | .fflags = 0, | 620 | .fflags = 0, |
| 621 | .data = 0, | 621 | .data = 0, |
| 622 | .udata = @ptrToInt(&resume_node.base), | 622 | .udata = @intFromPtr(&resume_node.base), |
| 623 | }}; | 623 | }}; |
| 624 | const empty_kevs = &[0]os.Kevent{}; | 624 | const empty_kevs = &[0]os.Kevent{}; |
| 625 | _ = try os.kevent(self.os_data.kqfd, &kev, empty_kevs, null); | 625 | _ = try os.kevent(self.os_data.kqfd, &kev, empty_kevs, null); |
| ... | @@ -1415,7 +1415,7 @@ pub const Loop = struct { | ... | @@ -1415,7 +1415,7 @@ pub const Loop = struct { |
| 1415 | var events: [1]os.linux.epoll_event = undefined; | 1415 | var events: [1]os.linux.epoll_event = undefined; |
| 1416 | const count = os.epoll_wait(self.os_data.epollfd, events[0..], -1); | 1416 | const count = os.epoll_wait(self.os_data.epollfd, events[0..], -1); |
| 1417 | for (events[0..count]) |ev| { | 1417 | for (events[0..count]) |ev| { |
| 1418 | const resume_node = @intToPtr(*ResumeNode, ev.data.ptr); | 1418 | const resume_node = @ptrFromInt(*ResumeNode, ev.data.ptr); |
| 1419 | const handle = resume_node.handle; | 1419 | const handle = resume_node.handle; |
| 1420 | const resume_node_id = resume_node.id; | 1420 | const resume_node_id = resume_node.id; |
| 1421 | switch (resume_node_id) { | 1421 | switch (resume_node_id) { |
| ... | @@ -1439,7 +1439,7 @@ pub const Loop = struct { | ... | @@ -1439,7 +1439,7 @@ pub const Loop = struct { |
| 1439 | const empty_kevs = &[0]os.Kevent{}; | 1439 | const empty_kevs = &[0]os.Kevent{}; |
| 1440 | const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable; | 1440 | const count = os.kevent(self.os_data.kqfd, empty_kevs, eventlist[0..], null) catch unreachable; |
| 1441 | for (eventlist[0..count]) |ev| { | 1441 | for (eventlist[0..count]) |ev| { |
| 1442 | const resume_node = @intToPtr(*ResumeNode, ev.udata); | 1442 | const resume_node = @ptrFromInt(*ResumeNode, ev.udata); |
| 1443 | const handle = resume_node.handle; | 1443 | const handle = resume_node.handle; |
| 1444 | const resume_node_id = resume_node.id; | 1444 | const resume_node_id = resume_node.id; |
| 1445 | switch (resume_node_id) { | 1445 | switch (resume_node_id) { |
lib/std/fmt.zig+16-16| ... | @@ -409,15 +409,15 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T | ... | @@ -409,15 +409,15 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T |
| 409 | .Pointer => |info| { | 409 | .Pointer => |info| { |
| 410 | try writer.writeAll(@typeName(info.child) ++ "@"); | 410 | try writer.writeAll(@typeName(info.child) ++ "@"); |
| 411 | if (info.size == .Slice) | 411 | if (info.size == .Slice) |
| 412 | try formatInt(@ptrToInt(value.ptr), 16, .lower, FormatOptions{}, writer) | 412 | try formatInt(@intFromPtr(value.ptr), 16, .lower, FormatOptions{}, writer) |
| 413 | else | 413 | else |
| 414 | try formatInt(@ptrToInt(value), 16, .lower, FormatOptions{}, writer); | 414 | try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer); |
| 415 | return; | 415 | return; |
| 416 | }, | 416 | }, |
| 417 | .Optional => |info| { | 417 | .Optional => |info| { |
| 418 | if (@typeInfo(info.child) == .Pointer) { | 418 | if (@typeInfo(info.child) == .Pointer) { |
| 419 | try writer.writeAll(@typeName(info.child) ++ "@"); | 419 | try writer.writeAll(@typeName(info.child) ++ "@"); |
| 420 | try formatInt(@ptrToInt(value), 16, .lower, FormatOptions{}, writer); | 420 | try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer); |
| 421 | return; | 421 | return; |
| 422 | } | 422 | } |
| 423 | }, | 423 | }, |
| ... | @@ -531,7 +531,7 @@ pub fn formatType( | ... | @@ -531,7 +531,7 @@ pub fn formatType( |
| 531 | // Use @tagName only if value is one of known fields | 531 | // Use @tagName only if value is one of known fields |
| 532 | @setEvalBranchQuota(3 * enumInfo.fields.len); | 532 | @setEvalBranchQuota(3 * enumInfo.fields.len); |
| 533 | inline for (enumInfo.fields) |enumField| { | 533 | inline for (enumInfo.fields) |enumField| { |
| 534 | if (@enumToInt(value) == enumField.value) { | 534 | if (@intFromEnum(value) == enumField.value) { |
| 535 | try writer.writeAll("."); | 535 | try writer.writeAll("."); |
| 536 | try writer.writeAll(@tagName(value)); | 536 | try writer.writeAll(@tagName(value)); |
| 537 | return; | 537 | return; |
| ... | @@ -539,7 +539,7 @@ pub fn formatType( | ... | @@ -539,7 +539,7 @@ pub fn formatType( |
| 539 | } | 539 | } |
| 540 | 540 | ||
| 541 | try writer.writeAll("("); | 541 | try writer.writeAll("("); |
| 542 | try formatType(@enumToInt(value), actual_fmt, options, writer, max_depth); | 542 | try formatType(@intFromEnum(value), actual_fmt, options, writer, max_depth); |
| 543 | try writer.writeAll(")"); | 543 | try writer.writeAll(")"); |
| 544 | }, | 544 | }, |
| 545 | .Union => |info| { | 545 | .Union => |info| { |
| ... | @@ -559,7 +559,7 @@ pub fn formatType( | ... | @@ -559,7 +559,7 @@ pub fn formatType( |
| 559 | } | 559 | } |
| 560 | try writer.writeAll(" }"); | 560 | try writer.writeAll(" }"); |
| 561 | } else { | 561 | } else { |
| 562 | try format(writer, "@{x}", .{@ptrToInt(&value)}); | 562 | try format(writer, "@{x}", .{@intFromPtr(&value)}); |
| 563 | } | 563 | } |
| 564 | }, | 564 | }, |
| 565 | .Struct => |info| { | 565 | .Struct => |info| { |
| ... | @@ -624,7 +624,7 @@ pub fn formatType( | ... | @@ -624,7 +624,7 @@ pub fn formatType( |
| 624 | .Enum, .Union, .Struct => { | 624 | .Enum, .Union, .Struct => { |
| 625 | return formatType(value.*, actual_fmt, options, writer, max_depth); | 625 | return formatType(value.*, actual_fmt, options, writer, max_depth); |
| 626 | }, | 626 | }, |
| 627 | else => return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @ptrToInt(value) }), | 627 | else => return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @intFromPtr(value) }), |
| 628 | }, | 628 | }, |
| 629 | .Many, .C => { | 629 | .Many, .C => { |
| 630 | if (actual_fmt.len == 0) | 630 | if (actual_fmt.len == 0) |
| ... | @@ -1213,7 +1213,7 @@ pub fn formatFloatHexadecimal( | ... | @@ -1213,7 +1213,7 @@ pub fn formatFloatHexadecimal( |
| 1213 | extra_bits -= 1; | 1213 | extra_bits -= 1; |
| 1214 | } | 1214 | } |
| 1215 | // Round to nearest, tie to even. | 1215 | // Round to nearest, tie to even. |
| 1216 | mantissa |= @boolToInt(mantissa & 0b100 != 0); | 1216 | mantissa |= @intFromBool(mantissa & 0b100 != 0); |
| 1217 | mantissa += 1; | 1217 | mantissa += 1; |
| 1218 | // Drop the excess bits. | 1218 | // Drop the excess bits. |
| 1219 | mantissa >>= 2; | 1219 | mantissa >>= 2; |
| ... | @@ -2099,7 +2099,7 @@ test "optional" { | ... | @@ -2099,7 +2099,7 @@ test "optional" { |
| 2099 | try expectFmt("optional: null\n", "optional: {?}\n", .{value}); | 2099 | try expectFmt("optional: null\n", "optional: {?}\n", .{value}); |
| 2100 | } | 2100 | } |
| 2101 | { | 2101 | { |
| 2102 | const value = @intToPtr(?*i32, 0xf000d000); | 2102 | const value = @ptrFromInt(?*i32, 0xf000d000); |
| 2103 | try expectFmt("optional: *i32@f000d000\n", "optional: {*}\n", .{value}); | 2103 | try expectFmt("optional: *i32@f000d000\n", "optional: {*}\n", .{value}); |
| 2104 | } | 2104 | } |
| 2105 | } | 2105 | } |
| ... | @@ -2204,7 +2204,7 @@ test "array" { | ... | @@ -2204,7 +2204,7 @@ test "array" { |
| 2204 | 2204 | ||
| 2205 | var buf: [100]u8 = undefined; | 2205 | var buf: [100]u8 = undefined; |
| 2206 | try expectFmt( | 2206 | try expectFmt( |
| 2207 | try bufPrint(buf[0..], "array: [3]u8@{x}\n", .{@ptrToInt(&value)}), | 2207 | try bufPrint(buf[0..], "array: [3]u8@{x}\n", .{@intFromPtr(&value)}), |
| 2208 | "array: {*}\n", | 2208 | "array: {*}\n", |
| 2209 | .{&value}, | 2209 | .{&value}, |
| 2210 | ); | 2210 | ); |
| ... | @@ -2218,7 +2218,7 @@ test "slice" { | ... | @@ -2218,7 +2218,7 @@ test "slice" { |
| 2218 | } | 2218 | } |
| 2219 | { | 2219 | { |
| 2220 | var runtime_zero: usize = 0; | 2220 | var runtime_zero: usize = 0; |
| 2221 | const value = @intToPtr([*]align(1) const []const u8, 0xdeadbeef)[runtime_zero..runtime_zero]; | 2221 | const value = @ptrFromInt([*]align(1) const []const u8, 0xdeadbeef)[runtime_zero..runtime_zero]; |
| 2222 | try expectFmt("slice: []const u8@deadbeef\n", "slice: {*}\n", .{value}); | 2222 | try expectFmt("slice: []const u8@deadbeef\n", "slice: {*}\n", .{value}); |
| 2223 | } | 2223 | } |
| 2224 | { | 2224 | { |
| ... | @@ -2248,17 +2248,17 @@ test "escape non-printable" { | ... | @@ -2248,17 +2248,17 @@ test "escape non-printable" { |
| 2248 | 2248 | ||
| 2249 | test "pointer" { | 2249 | test "pointer" { |
| 2250 | { | 2250 | { |
| 2251 | const value = @intToPtr(*align(1) i32, 0xdeadbeef); | 2251 | const value = @ptrFromInt(*align(1) i32, 0xdeadbeef); |
| 2252 | try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value}); | 2252 | try expectFmt("pointer: i32@deadbeef\n", "pointer: {}\n", .{value}); |
| 2253 | try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value}); | 2253 | try expectFmt("pointer: i32@deadbeef\n", "pointer: {*}\n", .{value}); |
| 2254 | } | 2254 | } |
| 2255 | const FnPtr = *align(1) const fn () void; | 2255 | const FnPtr = *align(1) const fn () void; |
| 2256 | { | 2256 | { |
| 2257 | const value = @intToPtr(FnPtr, 0xdeadbeef); | 2257 | const value = @ptrFromInt(FnPtr, 0xdeadbeef); |
| 2258 | try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value}); | 2258 | try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value}); |
| 2259 | } | 2259 | } |
| 2260 | { | 2260 | { |
| 2261 | const value = @intToPtr(FnPtr, 0xdeadbeef); | 2261 | const value = @ptrFromInt(FnPtr, 0xdeadbeef); |
| 2262 | try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value}); | 2262 | try expectFmt("pointer: fn() void@deadbeef\n", "pointer: {}\n", .{value}); |
| 2263 | } | 2263 | } |
| 2264 | } | 2264 | } |
| ... | @@ -2360,11 +2360,11 @@ test "non-exhaustive enum" { | ... | @@ -2360,11 +2360,11 @@ test "non-exhaustive enum" { |
| 2360 | }; | 2360 | }; |
| 2361 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.One\n", "enum: {}\n", .{Enum.One}); | 2361 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.One\n", "enum: {}\n", .{Enum.One}); |
| 2362 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {}\n", .{Enum.Two}); | 2362 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {}\n", .{Enum.Two}); |
| 2363 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum(4660)\n", "enum: {}\n", .{@intToEnum(Enum, 0x1234)}); | 2363 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum(4660)\n", "enum: {}\n", .{@enumFromInt(Enum, 0x1234)}); |
| 2364 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.One\n", "enum: {x}\n", .{Enum.One}); | 2364 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.One\n", "enum: {x}\n", .{Enum.One}); |
| 2365 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {x}\n", .{Enum.Two}); | 2365 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {x}\n", .{Enum.Two}); |
| 2366 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {X}\n", .{Enum.Two}); | 2366 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum.Two\n", "enum: {X}\n", .{Enum.Two}); |
| 2367 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum(1234)\n", "enum: {x}\n", .{@intToEnum(Enum, 0x1234)}); | 2367 | try expectFmt("enum: fmt.test.non-exhaustive enum.Enum(1234)\n", "enum: {x}\n", .{@enumFromInt(Enum, 0x1234)}); |
| 2368 | } | 2368 | } |
| 2369 | 2369 | ||
| 2370 | test "float.scientific" { | 2370 | test "float.scientific" { |
lib/std/fmt/errol.zig+21-21| ... | @@ -59,7 +59,7 @@ pub fn roundToPrecision(float_decimal: *FloatDecimal, precision: usize, mode: Ro | ... | @@ -59,7 +59,7 @@ pub fn roundToPrecision(float_decimal: *FloatDecimal, precision: usize, mode: Ro |
| 59 | float_decimal.exp += 1; | 59 | float_decimal.exp += 1; |
| 60 | 60 | ||
| 61 | // Re-size the buffer to use the reserved leading byte. | 61 | // Re-size the buffer to use the reserved leading byte. |
| 62 | const one_before = @intToPtr([*]u8, @ptrToInt(&float_decimal.digits[0]) - 1); | 62 | const one_before = @ptrFromInt([*]u8, @intFromPtr(&float_decimal.digits[0]) - 1); |
| 63 | float_decimal.digits = one_before[0 .. float_decimal.digits.len + 1]; | 63 | float_decimal.digits = one_before[0 .. float_decimal.digits.len + 1]; |
| 64 | float_decimal.digits[0] = '1'; | 64 | float_decimal.digits[0] = '1'; |
| 65 | return; | 65 | return; |
| ... | @@ -113,7 +113,7 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -113,7 +113,7 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { |
| 113 | // normalize the midpoint | 113 | // normalize the midpoint |
| 114 | 114 | ||
| 115 | const e = math.frexp(val).exponent; | 115 | const e = math.frexp(val).exponent; |
| 116 | var exp = @floatToInt(i16, @floor(307 + @intToFloat(f64, e) * 0.30103)); | 116 | var exp = @intFromFloat(i16, @floor(307 + @floatFromInt(f64, e) * 0.30103)); |
| 117 | if (exp < 20) { | 117 | if (exp < 20) { |
| 118 | exp = 20; | 118 | exp = 20; |
| 119 | } else if (@intCast(usize, exp) >= lookup_table.len) { | 119 | } else if (@intCast(usize, exp) >= lookup_table.len) { |
| ... | @@ -171,25 +171,25 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -171,25 +171,25 @@ fn errolSlow(val: f64, buffer: []u8) FloatDecimal { |
| 171 | var buf_index: usize = 0; | 171 | var buf_index: usize = 0; |
| 172 | const bound = buffer.len - 1; | 172 | const bound = buffer.len - 1; |
| 173 | while (buf_index < bound) { | 173 | while (buf_index < bound) { |
| 174 | var hdig = @floatToInt(u8, @floor(high.val)); | 174 | var hdig = @intFromFloat(u8, @floor(high.val)); |
| 175 | if ((high.val == @intToFloat(f64, hdig)) and (high.off < 0)) hdig -= 1; | 175 | if ((high.val == @floatFromInt(f64, hdig)) and (high.off < 0)) hdig -= 1; |
| 176 | 176 | ||
| 177 | var ldig = @floatToInt(u8, @floor(low.val)); | 177 | var ldig = @intFromFloat(u8, @floor(low.val)); |
| 178 | if ((low.val == @intToFloat(f64, ldig)) and (low.off < 0)) ldig -= 1; | 178 | if ((low.val == @floatFromInt(f64, ldig)) and (low.off < 0)) ldig -= 1; |
| 179 | 179 | ||
| 180 | if (ldig != hdig) break; | 180 | if (ldig != hdig) break; |
| 181 | 181 | ||
| 182 | buffer[buf_index] = hdig + '0'; | 182 | buffer[buf_index] = hdig + '0'; |
| 183 | buf_index += 1; | 183 | buf_index += 1; |
| 184 | high.val -= @intToFloat(f64, hdig); | 184 | high.val -= @floatFromInt(f64, hdig); |
| 185 | low.val -= @intToFloat(f64, ldig); | 185 | low.val -= @floatFromInt(f64, ldig); |
| 186 | hpMul10(&high); | 186 | hpMul10(&high); |
| 187 | hpMul10(&low); | 187 | hpMul10(&low); |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | const tmp = (high.val + low.val) / 2.0; | 190 | const tmp = (high.val + low.val) / 2.0; |
| 191 | var mdig = @floatToInt(u8, @floor(tmp + 0.5)); | 191 | var mdig = @intFromFloat(u8, @floor(tmp + 0.5)); |
| 192 | if ((@intToFloat(f64, mdig) - tmp) == 0.5 and (mdig & 0x1) != 0) mdig -= 1; | 192 | if ((@floatFromInt(f64, mdig) - tmp) == 0.5 and (mdig & 0x1) != 0) mdig -= 1; |
| 193 | 193 | ||
| 194 | buffer[buf_index] = mdig + '0'; | 194 | buffer[buf_index] = mdig + '0'; |
| 195 | buf_index += 1; | 195 | buf_index += 1; |
| ... | @@ -303,7 +303,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -303,7 +303,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { |
| 303 | 303 | ||
| 304 | assert((val > 9.007199254740992e15) and val < (3.40282366920938e38)); | 304 | assert((val > 9.007199254740992e15) and val < (3.40282366920938e38)); |
| 305 | 305 | ||
| 306 | var mid = @floatToInt(u128, val); | 306 | var mid = @intFromFloat(u128, val); |
| 307 | var low: u128 = mid - fpeint((fpnext(val) - val) / 2.0); | 307 | var low: u128 = mid - fpeint((fpnext(val) - val) / 2.0); |
| 308 | var high: u128 = mid + fpeint((val - fpprev(val)) / 2.0); | 308 | var high: u128 = mid + fpeint((val - fpprev(val)) / 2.0); |
| 309 | 309 | ||
| ... | @@ -328,7 +328,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -328,7 +328,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { |
| 328 | var mi: i32 = mismatch10(l64, h64); | 328 | var mi: i32 = mismatch10(l64, h64); |
| 329 | var x: u64 = 1; | 329 | var x: u64 = 1; |
| 330 | { | 330 | { |
| 331 | var i: i32 = @boolToInt(lf == hf); | 331 | var i: i32 = @intFromBool(lf == hf); |
| 332 | while (i < mi) : (i += 1) { | 332 | while (i < mi) : (i += 1) { |
| 333 | x *= 10; | 333 | x *= 10; |
| 334 | } | 334 | } |
| ... | @@ -342,7 +342,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -342,7 +342,7 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { |
| 342 | if (mi != 0) { | 342 | if (mi != 0) { |
| 343 | const round_up = buffer[buf_index] >= '5'; | 343 | const round_up = buffer[buf_index] >= '5'; |
| 344 | if (buf_index == 0 or (round_up and buffer[buf_index - 1] == '9')) return errolSlow(val, buffer); | 344 | if (buf_index == 0 or (round_up and buffer[buf_index - 1] == '9')) return errolSlow(val, buffer); |
| 345 | buffer[buf_index - 1] += @boolToInt(round_up); | 345 | buffer[buf_index - 1] += @intFromBool(round_up); |
| 346 | } else { | 346 | } else { |
| 347 | buf_index += 1; | 347 | buf_index += 1; |
| 348 | } | 348 | } |
| ... | @@ -360,8 +360,8 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -360,8 +360,8 @@ fn errolInt(val: f64, buffer: []u8) FloatDecimal { |
| 360 | fn errolFixed(val: f64, buffer: []u8) FloatDecimal { | 360 | fn errolFixed(val: f64, buffer: []u8) FloatDecimal { |
| 361 | assert((val >= 16.0) and (val < 9.007199254740992e15)); | 361 | assert((val >= 16.0) and (val < 9.007199254740992e15)); |
| 362 | 362 | ||
| 363 | const u = @floatToInt(u64, val); | 363 | const u = @intFromFloat(u64, val); |
| 364 | const n = @intToFloat(f64, u); | 364 | const n = @floatFromInt(f64, u); |
| 365 | 365 | ||
| 366 | var mid = val - n; | 366 | var mid = val - n; |
| 367 | var lo = ((fpprev(val) - n) + mid) / 2.0; | 367 | var lo = ((fpprev(val) - n) + mid) / 2.0; |
| ... | @@ -375,16 +375,16 @@ fn errolFixed(val: f64, buffer: []u8) FloatDecimal { | ... | @@ -375,16 +375,16 @@ fn errolFixed(val: f64, buffer: []u8) FloatDecimal { |
| 375 | if (mid != 0.0) { | 375 | if (mid != 0.0) { |
| 376 | while (mid != 0.0) { | 376 | while (mid != 0.0) { |
| 377 | lo *= 10.0; | 377 | lo *= 10.0; |
| 378 | const ldig = @floatToInt(i32, lo); | 378 | const ldig = @intFromFloat(i32, lo); |
| 379 | lo -= @intToFloat(f64, ldig); | 379 | lo -= @floatFromInt(f64, ldig); |
| 380 | 380 | ||
| 381 | mid *= 10.0; | 381 | mid *= 10.0; |
| 382 | const mdig = @floatToInt(i32, mid); | 382 | const mdig = @intFromFloat(i32, mid); |
| 383 | mid -= @intToFloat(f64, mdig); | 383 | mid -= @floatFromInt(f64, mdig); |
| 384 | 384 | ||
| 385 | hi *= 10.0; | 385 | hi *= 10.0; |
| 386 | const hdig = @floatToInt(i32, hi); | 386 | const hdig = @intFromFloat(i32, hi); |
| 387 | hi -= @intToFloat(f64, hdig); | 387 | hi -= @floatFromInt(f64, hdig); |
| 388 | 388 | ||
| 389 | buffer[j] = @intCast(u8, mdig + '0'); | 389 | buffer[j] = @intCast(u8, mdig + '0'); |
| 390 | j += 1; | 390 | j += 1; |
lib/std/fmt/parse_float/convert_eisel_lemire.zig+1-1| ... | @@ -74,7 +74,7 @@ pub fn convertEiselLemire(comptime T: type, q: i64, w_: u64) ?BiasedFp(f64) { | ... | @@ -74,7 +74,7 @@ pub fn convertEiselLemire(comptime T: type, q: i64, w_: u64) ?BiasedFp(f64) { |
| 74 | mantissa = math.shr(u64, mantissa, -power2 + 1); | 74 | mantissa = math.shr(u64, mantissa, -power2 + 1); |
| 75 | mantissa += mantissa & 1; | 75 | mantissa += mantissa & 1; |
| 76 | mantissa >>= 1; | 76 | mantissa >>= 1; |
| 77 | power2 = @boolToInt(mantissa >= (1 << float_info.mantissa_explicit_bits)); | 77 | power2 = @intFromBool(mantissa >= (1 << float_info.mantissa_explicit_bits)); |
| 78 | return BiasedFp(f64){ .f = mantissa, .e = power2 }; | 78 | return BiasedFp(f64){ .f = mantissa, .e = power2 }; |
| 79 | } | 79 | } |
| 80 | 80 |
lib/std/fmt/parse_float/convert_fast.zig+2-2| ... | @@ -108,7 +108,7 @@ pub fn convertFast(comptime T: type, n: Number(T)) ?T { | ... | @@ -108,7 +108,7 @@ pub fn convertFast(comptime T: type, n: Number(T)) ?T { |
| 108 | var value: T = 0; | 108 | var value: T = 0; |
| 109 | if (n.exponent <= info.max_exponent_fast_path) { | 109 | if (n.exponent <= info.max_exponent_fast_path) { |
| 110 | // normal fast path | 110 | // normal fast path |
| 111 | value = @intToFloat(T, n.mantissa); | 111 | value = @floatFromInt(T, n.mantissa); |
| 112 | value = if (n.exponent < 0) | 112 | value = if (n.exponent < 0) |
| 113 | value / fastPow10(T, @intCast(usize, -n.exponent)) | 113 | value / fastPow10(T, @intCast(usize, -n.exponent)) |
| 114 | else | 114 | else |
| ... | @@ -120,7 +120,7 @@ pub fn convertFast(comptime T: type, n: Number(T)) ?T { | ... | @@ -120,7 +120,7 @@ pub fn convertFast(comptime T: type, n: Number(T)) ?T { |
| 120 | if (mantissa > info.max_mantissa_fast_path) { | 120 | if (mantissa > info.max_mantissa_fast_path) { |
| 121 | return null; | 121 | return null; |
| 122 | } | 122 | } |
| 123 | value = @intToFloat(T, mantissa) * fastPow10(T, info.max_exponent_fast_path); | 123 | value = @floatFromInt(T, mantissa) * fastPow10(T, info.max_exponent_fast_path); |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | if (n.negative) { | 126 | if (n.negative) { |
lib/std/fs.zig+4-4| ... | @@ -1268,8 +1268,8 @@ pub const Dir = struct { | ... | @@ -1268,8 +1268,8 @@ pub const Dir = struct { |
| 1268 | &range_off, | 1268 | &range_off, |
| 1269 | &range_len, | 1269 | &range_len, |
| 1270 | null, | 1270 | null, |
| 1271 | @boolToInt(flags.lock_nonblocking), | 1271 | @intFromBool(flags.lock_nonblocking), |
| 1272 | @boolToInt(exclusive), | 1272 | @intFromBool(exclusive), |
| 1273 | ); | 1273 | ); |
| 1274 | return file; | 1274 | return file; |
| 1275 | } | 1275 | } |
| ... | @@ -1429,8 +1429,8 @@ pub const Dir = struct { | ... | @@ -1429,8 +1429,8 @@ pub const Dir = struct { |
| 1429 | &range_off, | 1429 | &range_off, |
| 1430 | &range_len, | 1430 | &range_len, |
| 1431 | null, | 1431 | null, |
| 1432 | @boolToInt(flags.lock_nonblocking), | 1432 | @intFromBool(flags.lock_nonblocking), |
| 1433 | @boolToInt(exclusive), | 1433 | @intFromBool(exclusive), |
| 1434 | ); | 1434 | ); |
| 1435 | return file; | 1435 | return file; |
| 1436 | } | 1436 | } |
lib/std/fs/file.zig+5-5| ... | @@ -516,7 +516,7 @@ pub const File = struct { | ... | @@ -516,7 +516,7 @@ pub const File = struct { |
| 516 | /// Returns `true` if the chosen class has the selected permission. | 516 | /// Returns `true` if the chosen class has the selected permission. |
| 517 | /// This method is only available on Unix platforms. | 517 | /// This method is only available on Unix platforms. |
| 518 | pub fn unixHas(self: Self, class: Class, permission: Permission) bool { | 518 | pub fn unixHas(self: Self, class: Class, permission: Permission) bool { |
| 519 | const mask = @as(Mode, @enumToInt(permission)) << @as(u3, @enumToInt(class)) * 3; | 519 | const mask = @as(Mode, @intFromEnum(permission)) << @as(u3, @intFromEnum(class)) * 3; |
| 520 | return self.mode & mask != 0; | 520 | return self.mode & mask != 0; |
| 521 | } | 521 | } |
| 522 | 522 | ||
| ... | @@ -527,7 +527,7 @@ pub const File = struct { | ... | @@ -527,7 +527,7 @@ pub const File = struct { |
| 527 | write: ?bool = null, | 527 | write: ?bool = null, |
| 528 | execute: ?bool = null, | 528 | execute: ?bool = null, |
| 529 | }) void { | 529 | }) void { |
| 530 | const shift = @as(u3, @enumToInt(class)) * 3; | 530 | const shift = @as(u3, @intFromEnum(class)) * 3; |
| 531 | if (permissions.read) |r| { | 531 | if (permissions.read) |r| { |
| 532 | if (r) { | 532 | if (r) { |
| 533 | self.mode |= @as(Mode, 0o4) << shift; | 533 | self.mode |= @as(Mode, 0o4) << shift; |
| ... | @@ -973,7 +973,7 @@ pub const File = struct { | ... | @@ -973,7 +973,7 @@ pub const File = struct { |
| 973 | // The file size returned by stat is used as hint to set the buffer | 973 | // The file size returned by stat is used as hint to set the buffer |
| 974 | // size. If the reported size is zero, as it happens on Linux for files | 974 | // size. If the reported size is zero, as it happens on Linux for files |
| 975 | // in /proc, a small buffer is allocated instead. | 975 | // in /proc, a small buffer is allocated instead. |
| 976 | const initial_cap = (if (size > 0) size else 1024) + @boolToInt(optional_sentinel != null); | 976 | const initial_cap = (if (size > 0) size else 1024) + @intFromBool(optional_sentinel != null); |
| 977 | var array_list = try std.ArrayListAligned(u8, alignment).initCapacity(allocator, initial_cap); | 977 | var array_list = try std.ArrayListAligned(u8, alignment).initCapacity(allocator, initial_cap); |
| 978 | defer array_list.deinit(); | 978 | defer array_list.deinit(); |
| 979 | 979 | ||
| ... | @@ -1488,7 +1488,7 @@ pub const File = struct { | ... | @@ -1488,7 +1488,7 @@ pub const File = struct { |
| 1488 | &range_len, | 1488 | &range_len, |
| 1489 | null, | 1489 | null, |
| 1490 | windows.FALSE, // non-blocking=false | 1490 | windows.FALSE, // non-blocking=false |
| 1491 | @boolToInt(exclusive), | 1491 | @intFromBool(exclusive), |
| 1492 | ) catch |err| switch (err) { | 1492 | ) catch |err| switch (err) { |
| 1493 | error.WouldBlock => unreachable, // non-blocking=false | 1493 | error.WouldBlock => unreachable, // non-blocking=false |
| 1494 | else => |e| return e, | 1494 | else => |e| return e, |
| ... | @@ -1555,7 +1555,7 @@ pub const File = struct { | ... | @@ -1555,7 +1555,7 @@ pub const File = struct { |
| 1555 | &range_len, | 1555 | &range_len, |
| 1556 | null, | 1556 | null, |
| 1557 | windows.TRUE, // non-blocking=true | 1557 | windows.TRUE, // non-blocking=true |
| 1558 | @boolToInt(exclusive), | 1558 | @intFromBool(exclusive), |
| 1559 | ) catch |err| switch (err) { | 1559 | ) catch |err| switch (err) { |
| 1560 | error.WouldBlock => return false, | 1560 | error.WouldBlock => return false, |
| 1561 | else => |e| return e, | 1561 | else => |e| return e, |
lib/std/fs/path.zig+3-3| ... | @@ -67,7 +67,7 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn | ... | @@ -67,7 +67,7 @@ fn joinSepMaybeZ(allocator: Allocator, separator: u8, comptime sepPredicate: fn |
| 67 | if (this_path.len == 0) continue; | 67 | if (this_path.len == 0) continue; |
| 68 | const prev_sep = sepPredicate(prev_path[prev_path.len - 1]); | 68 | const prev_sep = sepPredicate(prev_path[prev_path.len - 1]); |
| 69 | const this_sep = sepPredicate(this_path[0]); | 69 | const this_sep = sepPredicate(this_path[0]); |
| 70 | sum += @boolToInt(!prev_sep and !this_sep); | 70 | sum += @intFromBool(!prev_sep and !this_sep); |
| 71 | sum += if (prev_sep and this_sep) this_path.len - 1 else this_path.len; | 71 | sum += if (prev_sep and this_sep) this_path.len - 1 else this_path.len; |
| 72 | prev_path = this_path; | 72 | prev_path = this_path; |
| 73 | } | 73 | } |
| ... | @@ -663,7 +663,7 @@ pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.E | ... | @@ -663,7 +663,7 @@ pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.E |
| 663 | continue; | 663 | continue; |
| 664 | } else if (mem.eql(u8, component, "..")) { | 664 | } else if (mem.eql(u8, component, "..")) { |
| 665 | if (result.items.len == 0) { | 665 | if (result.items.len == 0) { |
| 666 | negative_count += @boolToInt(!is_abs); | 666 | negative_count += @intFromBool(!is_abs); |
| 667 | continue; | 667 | continue; |
| 668 | } | 668 | } |
| 669 | while (true) { | 669 | while (true) { |
| ... | @@ -1092,7 +1092,7 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) ! | ... | @@ -1092,7 +1092,7 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) ! |
| 1092 | while (from_it.next()) |_| { | 1092 | while (from_it.next()) |_| { |
| 1093 | up_index_end += "\\..".len; | 1093 | up_index_end += "\\..".len; |
| 1094 | } | 1094 | } |
| 1095 | const result = try allocator.alloc(u8, up_index_end + @boolToInt(to_rest.len > 0) + to_rest.len); | 1095 | const result = try allocator.alloc(u8, up_index_end + @intFromBool(to_rest.len > 0) + to_rest.len); |
| 1096 | errdefer allocator.free(result); | 1096 | errdefer allocator.free(result); |
| 1097 | 1097 | ||
| 1098 | result[0..2].* = "..".*; | 1098 | result[0..2].* = "..".*; |
lib/std/fs/watch.zig+3-3| ... | @@ -285,7 +285,7 @@ pub fn Watch(comptime V: type) type { | ... | @@ -285,7 +285,7 @@ pub fn Watch(comptime V: type) type { |
| 285 | os.NOTE_WRITE | os.NOTE_DELETE | os.NOTE_REVOKE, | 285 | os.NOTE_WRITE | os.NOTE_DELETE | os.NOTE_REVOKE, |
| 286 | .fflags = 0, | 286 | .fflags = 0, |
| 287 | .data = 0, | 287 | .data = 0, |
| 288 | .udata = @ptrToInt(&resume_node.base), | 288 | .udata = @intFromPtr(&resume_node.base), |
| 289 | }; | 289 | }; |
| 290 | suspend { | 290 | suspend { |
| 291 | global_event_loop.beginOneEvent(); | 291 | global_event_loop.beginOneEvent(); |
| ... | @@ -486,7 +486,7 @@ pub fn Watch(comptime V: type) type { | ... | @@ -486,7 +486,7 @@ pub fn Watch(comptime V: type) type { |
| 486 | } else { | 486 | } else { |
| 487 | var ptr: [*]u8 = &event_buf; | 487 | var ptr: [*]u8 = &event_buf; |
| 488 | const end_ptr = ptr + bytes_transferred; | 488 | const end_ptr = ptr + bytes_transferred; |
| 489 | while (@ptrToInt(ptr) < @ptrToInt(end_ptr)) { | 489 | while (@intFromPtr(ptr) < @intFromPtr(end_ptr)) { |
| 490 | const ev = @ptrCast(*const windows.FILE_NOTIFY_INFORMATION, ptr); | 490 | const ev = @ptrCast(*const windows.FILE_NOTIFY_INFORMATION, ptr); |
| 491 | const emit = switch (ev.Action) { | 491 | const emit = switch (ev.Action) { |
| 492 | windows.FILE_ACTION_REMOVED => WatchEventId.Delete, | 492 | windows.FILE_ACTION_REMOVED => WatchEventId.Delete, |
| ... | @@ -585,7 +585,7 @@ pub fn Watch(comptime V: type) type { | ... | @@ -585,7 +585,7 @@ pub fn Watch(comptime V: type) type { |
| 585 | 585 | ||
| 586 | var ptr: [*]u8 = &event_buf; | 586 | var ptr: [*]u8 = &event_buf; |
| 587 | const end_ptr = ptr + bytes_read; | 587 | const end_ptr = ptr + bytes_read; |
| 588 | while (@ptrToInt(ptr) < @ptrToInt(end_ptr)) { | 588 | while (@intFromPtr(ptr) < @intFromPtr(end_ptr)) { |
| 589 | const ev = @ptrCast(*const os.linux.inotify_event, ptr); | 589 | const ev = @ptrCast(*const os.linux.inotify_event, ptr); |
| 590 | if (ev.mask & os.linux.IN_CLOSE_WRITE == os.linux.IN_CLOSE_WRITE) { | 590 | if (ev.mask & os.linux.IN_CLOSE_WRITE == os.linux.IN_CLOSE_WRITE) { |
| 591 | const basename_ptr = ptr + @sizeOf(os.linux.inotify_event); | 591 | const basename_ptr = ptr + @sizeOf(os.linux.inotify_event); |
lib/std/hash/auto_hash.zig+6-6| ... | @@ -25,7 +25,7 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) | ... | @@ -25,7 +25,7 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) |
| 25 | 25 | ||
| 26 | switch (info.Pointer.size) { | 26 | switch (info.Pointer.size) { |
| 27 | .One => switch (strat) { | 27 | .One => switch (strat) { |
| 28 | .Shallow => hash(hasher, @ptrToInt(key), .Shallow), | 28 | .Shallow => hash(hasher, @intFromPtr(key), .Shallow), |
| 29 | .Deep => hash(hasher, key.*, .Shallow), | 29 | .Deep => hash(hasher, key.*, .Shallow), |
| 30 | .DeepRecursive => hash(hasher, key.*, .DeepRecursive), | 30 | .DeepRecursive => hash(hasher, key.*, .DeepRecursive), |
| 31 | }, | 31 | }, |
| ... | @@ -44,7 +44,7 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) | ... | @@ -44,7 +44,7 @@ pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) |
| 44 | .Many, | 44 | .Many, |
| 45 | .C, | 45 | .C, |
| 46 | => switch (strat) { | 46 | => switch (strat) { |
| 47 | .Shallow => hash(hasher, @ptrToInt(key), .Shallow), | 47 | .Shallow => hash(hasher, @intFromPtr(key), .Shallow), |
| 48 | else => @compileError( | 48 | else => @compileError( |
| 49 | \\ unknown-length pointers and C pointers cannot be hashed deeply. | 49 | \\ unknown-length pointers and C pointers cannot be hashed deeply. |
| 50 | \\ Consider providing your own hash function. | 50 | \\ Consider providing your own hash function. |
| ... | @@ -108,10 +108,10 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { | ... | @@ -108,10 +108,10 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void { |
| 108 | }, | 108 | }, |
| 109 | }, | 109 | }, |
| 110 | 110 | ||
| 111 | .Bool => hash(hasher, @boolToInt(key), strat), | 111 | .Bool => hash(hasher, @intFromBool(key), strat), |
| 112 | .Enum => hash(hasher, @enumToInt(key), strat), | 112 | .Enum => hash(hasher, @intFromEnum(key), strat), |
| 113 | .ErrorSet => hash(hasher, @errorToInt(key), strat), | 113 | .ErrorSet => hash(hasher, @intFromError(key), strat), |
| 114 | .AnyFrame, .Fn => hash(hasher, @ptrToInt(key), strat), | 114 | .AnyFrame, .Fn => hash(hasher, @intFromPtr(key), strat), |
| 115 | 115 | ||
| 116 | .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }), | 116 | .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }), |
| 117 | 117 |
lib/std/hash/benchmark.zig+4-4| ... | @@ -127,8 +127,8 @@ pub fn benchmarkHash(comptime H: anytype, bytes: usize, allocator: std.mem.Alloc | ... | @@ -127,8 +127,8 @@ pub fn benchmarkHash(comptime H: anytype, bytes: usize, allocator: std.mem.Alloc |
| 127 | 127 | ||
| 128 | const end = timer.read(); | 128 | const end = timer.read(); |
| 129 | 129 | ||
| 130 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 130 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 131 | const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); | 131 | const throughput = @intFromFloat(u64, @floatFromInt(f64, bytes) / elapsed_s); |
| 132 | 132 | ||
| 133 | return Result{ | 133 | return Result{ |
| 134 | .hash = final, | 134 | .hash = final, |
| ... | @@ -166,8 +166,8 @@ pub fn benchmarkHashSmallKeys(comptime H: anytype, key_size: usize, bytes: usize | ... | @@ -166,8 +166,8 @@ pub fn benchmarkHashSmallKeys(comptime H: anytype, key_size: usize, bytes: usize |
| 166 | } | 166 | } |
| 167 | const end = timer.read(); | 167 | const end = timer.read(); |
| 168 | 168 | ||
| 169 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 169 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 170 | const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); | 170 | const throughput = @intFromFloat(u64, @floatFromInt(f64, bytes) / elapsed_s); |
| 171 | 171 | ||
| 172 | std.mem.doNotOptimizeAway(sum); | 172 | std.mem.doNotOptimizeAway(sum); |
| 173 | 173 |
lib/std/hash/crc.zig+2-2| ... | @@ -129,7 +129,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type { | ... | @@ -129,7 +129,7 @@ pub fn Crc32WithPoly(comptime poly: Polynomial) type { |
| 129 | var j: usize = 0; | 129 | var j: usize = 0; |
| 130 | while (j < 8) : (j += 1) { | 130 | while (j < 8) : (j += 1) { |
| 131 | if (crc & 1 == 1) { | 131 | if (crc & 1 == 1) { |
| 132 | crc = (crc >> 1) ^ @enumToInt(poly); | 132 | crc = (crc >> 1) ^ @intFromEnum(poly); |
| 133 | } else { | 133 | } else { |
| 134 | crc = (crc >> 1); | 134 | crc = (crc >> 1); |
| 135 | } | 135 | } |
| ... | @@ -222,7 +222,7 @@ pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type { | ... | @@ -222,7 +222,7 @@ pub fn Crc32SmallWithPoly(comptime poly: Polynomial) type { |
| 222 | var j: usize = 0; | 222 | var j: usize = 0; |
| 223 | while (j < 8) : (j += 1) { | 223 | while (j < 8) : (j += 1) { |
| 224 | if (crc & 1 == 1) { | 224 | if (crc & 1 == 1) { |
| 225 | crc = (crc >> 1) ^ @enumToInt(poly); | 225 | crc = (crc >> 1) ^ @intFromEnum(poly); |
| 226 | } else { | 226 | } else { |
| 227 | crc = (crc >> 1); | 227 | crc = (crc >> 1); |
| 228 | } | 228 | } |
lib/std/hash_map.zig+7-7| ... | @@ -1442,7 +1442,7 @@ pub fn HashMapUnmanaged( | ... | @@ -1442,7 +1442,7 @@ pub fn HashMapUnmanaged( |
| 1442 | // map, which is assumed to exist as keyPtr must be valid. This | 1442 | // map, which is assumed to exist as keyPtr must be valid. This |
| 1443 | // item must be at index 0. | 1443 | // item must be at index 0. |
| 1444 | const idx = if (@sizeOf(K) > 0) | 1444 | const idx = if (@sizeOf(K) > 0) |
| 1445 | (@ptrToInt(keyPtr) - @ptrToInt(self.keys())) / @sizeOf(K) | 1445 | (@intFromPtr(keyPtr) - @intFromPtr(self.keys())) / @sizeOf(K) |
| 1446 | else | 1446 | else |
| 1447 | 0; | 1447 | 0; |
| 1448 | 1448 | ||
| ... | @@ -1554,19 +1554,19 @@ pub fn HashMapUnmanaged( | ... | @@ -1554,19 +1554,19 @@ pub fn HashMapUnmanaged( |
| 1554 | const total_size = std.mem.alignForward(usize, vals_end, max_align); | 1554 | const total_size = std.mem.alignForward(usize, vals_end, max_align); |
| 1555 | 1555 | ||
| 1556 | const slice = try allocator.alignedAlloc(u8, max_align, total_size); | 1556 | const slice = try allocator.alignedAlloc(u8, max_align, total_size); |
| 1557 | const ptr = @ptrToInt(slice.ptr); | 1557 | const ptr = @intFromPtr(slice.ptr); |
| 1558 | 1558 | ||
| 1559 | const metadata = ptr + @sizeOf(Header); | 1559 | const metadata = ptr + @sizeOf(Header); |
| 1560 | 1560 | ||
| 1561 | const hdr = @intToPtr(*Header, ptr); | 1561 | const hdr = @ptrFromInt(*Header, ptr); |
| 1562 | if (@sizeOf([*]V) != 0) { | 1562 | if (@sizeOf([*]V) != 0) { |
| 1563 | hdr.values = @intToPtr([*]V, ptr + vals_start); | 1563 | hdr.values = @ptrFromInt([*]V, ptr + vals_start); |
| 1564 | } | 1564 | } |
| 1565 | if (@sizeOf([*]K) != 0) { | 1565 | if (@sizeOf([*]K) != 0) { |
| 1566 | hdr.keys = @intToPtr([*]K, ptr + keys_start); | 1566 | hdr.keys = @ptrFromInt([*]K, ptr + keys_start); |
| 1567 | } | 1567 | } |
| 1568 | hdr.capacity = new_capacity; | 1568 | hdr.capacity = new_capacity; |
| 1569 | self.metadata = @intToPtr([*]Metadata, metadata); | 1569 | self.metadata = @ptrFromInt([*]Metadata, metadata); |
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| 1572 | fn deallocate(self: *Self, allocator: Allocator) void { | 1572 | fn deallocate(self: *Self, allocator: Allocator) void { |
| ... | @@ -1589,7 +1589,7 @@ pub fn HashMapUnmanaged( | ... | @@ -1589,7 +1589,7 @@ pub fn HashMapUnmanaged( |
| 1589 | 1589 | ||
| 1590 | const total_size = std.mem.alignForward(usize, vals_end, max_align); | 1590 | const total_size = std.mem.alignForward(usize, vals_end, max_align); |
| 1591 | 1591 | ||
| 1592 | const slice = @intToPtr([*]align(max_align) u8, @ptrToInt(self.header()))[0..total_size]; | 1592 | const slice = @ptrFromInt([*]align(max_align) u8, @intFromPtr(self.header()))[0..total_size]; |
| 1593 | allocator.free(slice); | 1593 | allocator.free(slice); |
| 1594 | 1594 | ||
| 1595 | self.metadata = null; | 1595 | self.metadata = null; |
lib/std/heap.zig+18-18| ... | @@ -61,7 +61,7 @@ const CAllocator = struct { | ... | @@ -61,7 +61,7 @@ const CAllocator = struct { |
| 61 | pub const supports_posix_memalign = @hasDecl(c, "posix_memalign"); | 61 | pub const supports_posix_memalign = @hasDecl(c, "posix_memalign"); |
| 62 | 62 | ||
| 63 | fn getHeader(ptr: [*]u8) *[*]u8 { | 63 | fn getHeader(ptr: [*]u8) *[*]u8 { |
| 64 | return @intToPtr(*[*]u8, @ptrToInt(ptr) - @sizeOf(usize)); | 64 | return @ptrFromInt(*[*]u8, @intFromPtr(ptr) - @sizeOf(usize)); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | fn alignedAlloc(len: usize, log2_align: u8) ?[*]u8 { | 67 | fn alignedAlloc(len: usize, log2_align: u8) ?[*]u8 { |
| ... | @@ -82,7 +82,7 @@ const CAllocator = struct { | ... | @@ -82,7 +82,7 @@ const CAllocator = struct { |
| 82 | // alignment padding and store the original malloc()'ed pointer before | 82 | // alignment padding and store the original malloc()'ed pointer before |
| 83 | // the aligned address. | 83 | // the aligned address. |
| 84 | var unaligned_ptr = @ptrCast([*]u8, c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null); | 84 | var unaligned_ptr = @ptrCast([*]u8, c.malloc(len + alignment - 1 + @sizeOf(usize)) orelse return null); |
| 85 | const unaligned_addr = @ptrToInt(unaligned_ptr); | 85 | const unaligned_addr = @intFromPtr(unaligned_ptr); |
| 86 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), alignment); | 86 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), alignment); |
| 87 | var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); | 87 | var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); |
| 88 | getHeader(aligned_ptr).* = unaligned_ptr; | 88 | getHeader(aligned_ptr).* = unaligned_ptr; |
| ... | @@ -105,7 +105,7 @@ const CAllocator = struct { | ... | @@ -105,7 +105,7 @@ const CAllocator = struct { |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | const unaligned_ptr = getHeader(ptr).*; | 107 | const unaligned_ptr = getHeader(ptr).*; |
| 108 | const delta = @ptrToInt(ptr) - @ptrToInt(unaligned_ptr); | 108 | const delta = @intFromPtr(ptr) - @intFromPtr(unaligned_ptr); |
| 109 | return CAllocator.malloc_size(unaligned_ptr) - delta; | 109 | return CAllocator.malloc_size(unaligned_ptr) - delta; |
| 110 | } | 110 | } |
| 111 | 111 | ||
| ... | @@ -283,7 +283,7 @@ pub const HeapAllocator = switch (builtin.os.tag) { | ... | @@ -283,7 +283,7 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 283 | } | 283 | } |
| 284 | 284 | ||
| 285 | fn getRecordPtr(buf: []u8) *align(1) usize { | 285 | fn getRecordPtr(buf: []u8) *align(1) usize { |
| 286 | return @intToPtr(*align(1) usize, @ptrToInt(buf.ptr) + buf.len); | 286 | return @ptrFromInt(*align(1) usize, @intFromPtr(buf.ptr) + buf.len); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| 289 | fn alloc( | 289 | fn alloc( |
| ... | @@ -306,9 +306,9 @@ pub const HeapAllocator = switch (builtin.os.tag) { | ... | @@ -306,9 +306,9 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 306 | break :blk other_hh.?; // can't be null because of the cmpxchg | 306 | break :blk other_hh.?; // can't be null because of the cmpxchg |
| 307 | }; | 307 | }; |
| 308 | const ptr = os.windows.kernel32.HeapAlloc(heap_handle, 0, amt) orelse return null; | 308 | const ptr = os.windows.kernel32.HeapAlloc(heap_handle, 0, amt) orelse return null; |
| 309 | const root_addr = @ptrToInt(ptr); | 309 | const root_addr = @intFromPtr(ptr); |
| 310 | const aligned_addr = mem.alignForward(usize, root_addr, ptr_align); | 310 | const aligned_addr = mem.alignForward(usize, root_addr, ptr_align); |
| 311 | const buf = @intToPtr([*]u8, aligned_addr)[0..n]; | 311 | const buf = @ptrFromInt([*]u8, aligned_addr)[0..n]; |
| 312 | getRecordPtr(buf).* = root_addr; | 312 | getRecordPtr(buf).* = root_addr; |
| 313 | return buf.ptr; | 313 | return buf.ptr; |
| 314 | } | 314 | } |
| ... | @@ -325,15 +325,15 @@ pub const HeapAllocator = switch (builtin.os.tag) { | ... | @@ -325,15 +325,15 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 325 | const self = @ptrCast(*HeapAllocator, @alignCast(@alignOf(HeapAllocator), ctx)); | 325 | const self = @ptrCast(*HeapAllocator, @alignCast(@alignOf(HeapAllocator), ctx)); |
| 326 | 326 | ||
| 327 | const root_addr = getRecordPtr(buf).*; | 327 | const root_addr = getRecordPtr(buf).*; |
| 328 | const align_offset = @ptrToInt(buf.ptr) - root_addr; | 328 | const align_offset = @intFromPtr(buf.ptr) - root_addr; |
| 329 | const amt = align_offset + new_size + @sizeOf(usize); | 329 | const amt = align_offset + new_size + @sizeOf(usize); |
| 330 | const new_ptr = os.windows.kernel32.HeapReAlloc( | 330 | const new_ptr = os.windows.kernel32.HeapReAlloc( |
| 331 | self.heap_handle.?, | 331 | self.heap_handle.?, |
| 332 | os.windows.HEAP_REALLOC_IN_PLACE_ONLY, | 332 | os.windows.HEAP_REALLOC_IN_PLACE_ONLY, |
| 333 | @intToPtr(*anyopaque, root_addr), | 333 | @ptrFromInt(*anyopaque, root_addr), |
| 334 | amt, | 334 | amt, |
| 335 | ) orelse return false; | 335 | ) orelse return false; |
| 336 | assert(new_ptr == @intToPtr(*anyopaque, root_addr)); | 336 | assert(new_ptr == @ptrFromInt(*anyopaque, root_addr)); |
| 337 | getRecordPtr(buf.ptr[0..new_size]).* = root_addr; | 337 | getRecordPtr(buf.ptr[0..new_size]).* = root_addr; |
| 338 | return true; | 338 | return true; |
| 339 | } | 339 | } |
| ... | @@ -347,20 +347,20 @@ pub const HeapAllocator = switch (builtin.os.tag) { | ... | @@ -347,20 +347,20 @@ pub const HeapAllocator = switch (builtin.os.tag) { |
| 347 | _ = log2_buf_align; | 347 | _ = log2_buf_align; |
| 348 | _ = return_address; | 348 | _ = return_address; |
| 349 | const self = @ptrCast(*HeapAllocator, @alignCast(@alignOf(HeapAllocator), ctx)); | 349 | const self = @ptrCast(*HeapAllocator, @alignCast(@alignOf(HeapAllocator), ctx)); |
| 350 | os.windows.HeapFree(self.heap_handle.?, 0, @intToPtr(*anyopaque, getRecordPtr(buf).*)); | 350 | os.windows.HeapFree(self.heap_handle.?, 0, @ptrFromInt(*anyopaque, getRecordPtr(buf).*)); |
| 351 | } | 351 | } |
| 352 | }, | 352 | }, |
| 353 | else => @compileError("Unsupported OS"), | 353 | else => @compileError("Unsupported OS"), |
| 354 | }; | 354 | }; |
| 355 | 355 | ||
| 356 | fn sliceContainsPtr(container: []u8, ptr: [*]u8) bool { | 356 | fn sliceContainsPtr(container: []u8, ptr: [*]u8) bool { |
| 357 | return @ptrToInt(ptr) >= @ptrToInt(container.ptr) and | 357 | return @intFromPtr(ptr) >= @intFromPtr(container.ptr) and |
| 358 | @ptrToInt(ptr) < (@ptrToInt(container.ptr) + container.len); | 358 | @intFromPtr(ptr) < (@intFromPtr(container.ptr) + container.len); |
| 359 | } | 359 | } |
| 360 | 360 | ||
| 361 | fn sliceContainsSlice(container: []u8, slice: []u8) bool { | 361 | fn sliceContainsSlice(container: []u8, slice: []u8) bool { |
| 362 | return @ptrToInt(slice.ptr) >= @ptrToInt(container.ptr) and | 362 | return @intFromPtr(slice.ptr) >= @intFromPtr(container.ptr) and |
| 363 | (@ptrToInt(slice.ptr) + slice.len) <= (@ptrToInt(container.ptr) + container.len); | 363 | (@intFromPtr(slice.ptr) + slice.len) <= (@intFromPtr(container.ptr) + container.len); |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | pub const FixedBufferAllocator = struct { | 366 | pub const FixedBufferAllocator = struct { |
| ... | @@ -804,21 +804,21 @@ pub fn testAllocatorLargeAlignment(base_allocator: mem.Allocator) !void { | ... | @@ -804,21 +804,21 @@ pub fn testAllocatorLargeAlignment(base_allocator: mem.Allocator) !void { |
| 804 | align_mask = @shlWithOverflow(~@as(usize, 0), @as(Allocator.Log2Align, @ctz(large_align)))[0]; | 804 | align_mask = @shlWithOverflow(~@as(usize, 0), @as(Allocator.Log2Align, @ctz(large_align)))[0]; |
| 805 | 805 | ||
| 806 | var slice = try allocator.alignedAlloc(u8, large_align, 500); | 806 | var slice = try allocator.alignedAlloc(u8, large_align, 500); |
| 807 | try testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); | 807 | try testing.expect(@intFromPtr(slice.ptr) & align_mask == @intFromPtr(slice.ptr)); |
| 808 | 808 | ||
| 809 | if (allocator.resize(slice, 100)) { | 809 | if (allocator.resize(slice, 100)) { |
| 810 | slice = slice[0..100]; | 810 | slice = slice[0..100]; |
| 811 | } | 811 | } |
| 812 | 812 | ||
| 813 | slice = try allocator.realloc(slice, 5000); | 813 | slice = try allocator.realloc(slice, 5000); |
| 814 | try testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); | 814 | try testing.expect(@intFromPtr(slice.ptr) & align_mask == @intFromPtr(slice.ptr)); |
| 815 | 815 | ||
| 816 | if (allocator.resize(slice, 10)) { | 816 | if (allocator.resize(slice, 10)) { |
| 817 | slice = slice[0..10]; | 817 | slice = slice[0..10]; |
| 818 | } | 818 | } |
| 819 | 819 | ||
| 820 | slice = try allocator.realloc(slice, 20000); | 820 | slice = try allocator.realloc(slice, 20000); |
| 821 | try testing.expect(@ptrToInt(slice.ptr) & align_mask == @ptrToInt(slice.ptr)); | 821 | try testing.expect(@intFromPtr(slice.ptr) & align_mask == @intFromPtr(slice.ptr)); |
| 822 | 822 | ||
| 823 | allocator.free(slice); | 823 | allocator.free(slice); |
| 824 | } | 824 | } |
| ... | @@ -840,7 +840,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void { | ... | @@ -840,7 +840,7 @@ pub fn testAllocatorAlignedShrink(base_allocator: mem.Allocator) !void { |
| 840 | // which is 16 pages, hence the 32. This test may require to increase | 840 | // which is 16 pages, hence the 32. This test may require to increase |
| 841 | // the size of the allocations feeding the `allocator` parameter if they | 841 | // the size of the allocations feeding the `allocator` parameter if they |
| 842 | // fail, because of this high over-alignment we want to have. | 842 | // fail, because of this high over-alignment we want to have. |
| 843 | while (@ptrToInt(slice.ptr) == mem.alignForward(usize, @ptrToInt(slice.ptr), mem.page_size * 32)) { | 843 | while (@intFromPtr(slice.ptr) == mem.alignForward(usize, @intFromPtr(slice.ptr), mem.page_size * 32)) { |
| 844 | try stuff_to_free.append(slice); | 844 | try stuff_to_free.append(slice); |
| 845 | slice = try allocator.alignedAlloc(u8, 16, alloc_size); | 845 | slice = try allocator.alignedAlloc(u8, 16, alloc_size); |
| 846 | } | 846 | } |
lib/std/heap/PageAllocator.zig+3-3| ... | @@ -39,7 +39,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 { | ... | @@ -39,7 +39,7 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 { |
| 39 | -1, | 39 | -1, |
| 40 | 0, | 40 | 0, |
| 41 | ) catch return null; | 41 | ) catch return null; |
| 42 | assert(mem.isAligned(@ptrToInt(slice.ptr), mem.page_size)); | 42 | assert(mem.isAligned(@intFromPtr(slice.ptr), mem.page_size)); |
| 43 | const new_hint = @alignCast(mem.page_size, slice.ptr + aligned_len); | 43 | const new_hint = @alignCast(mem.page_size, slice.ptr + aligned_len); |
| 44 | _ = @cmpxchgStrong(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, hint, new_hint, .Monotonic, .Monotonic); | 44 | _ = @cmpxchgStrong(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, hint, new_hint, .Monotonic, .Monotonic); |
| 45 | return slice.ptr; | 45 | return slice.ptr; |
| ... | @@ -59,14 +59,14 @@ fn resize( | ... | @@ -59,14 +59,14 @@ fn resize( |
| 59 | if (builtin.os.tag == .windows) { | 59 | if (builtin.os.tag == .windows) { |
| 60 | const w = os.windows; | 60 | const w = os.windows; |
| 61 | if (new_size <= buf_unaligned.len) { | 61 | if (new_size <= buf_unaligned.len) { |
| 62 | const base_addr = @ptrToInt(buf_unaligned.ptr); | 62 | const base_addr = @intFromPtr(buf_unaligned.ptr); |
| 63 | const old_addr_end = base_addr + buf_unaligned.len; | 63 | const old_addr_end = base_addr + buf_unaligned.len; |
| 64 | const new_addr_end = mem.alignForward(usize, base_addr + new_size, mem.page_size); | 64 | const new_addr_end = mem.alignForward(usize, base_addr + new_size, mem.page_size); |
| 65 | if (old_addr_end > new_addr_end) { | 65 | if (old_addr_end > new_addr_end) { |
| 66 | // For shrinking that is not releasing, we will only | 66 | // For shrinking that is not releasing, we will only |
| 67 | // decommit the pages not needed anymore. | 67 | // decommit the pages not needed anymore. |
| 68 | w.VirtualFree( | 68 | w.VirtualFree( |
| 69 | @intToPtr(*anyopaque, new_addr_end), | 69 | @ptrFromInt(*anyopaque, new_addr_end), |
| 70 | old_addr_end - new_addr_end, | 70 | old_addr_end - new_addr_end, |
| 71 | w.MEM_DECOMMIT, | 71 | w.MEM_DECOMMIT, |
| 72 | ); | 72 | ); |
lib/std/heap/WasmAllocator.zig+7-7| ... | @@ -55,7 +55,7 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[* | ... | @@ -55,7 +55,7 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[* |
| 55 | const addr = a: { | 55 | const addr = a: { |
| 56 | const top_free_ptr = frees[class]; | 56 | const top_free_ptr = frees[class]; |
| 57 | if (top_free_ptr != 0) { | 57 | if (top_free_ptr != 0) { |
| 58 | const node = @intToPtr(*usize, top_free_ptr + (slot_size - @sizeOf(usize))); | 58 | const node = @ptrFromInt(*usize, top_free_ptr + (slot_size - @sizeOf(usize))); |
| 59 | frees[class] = node.*; | 59 | frees[class] = node.*; |
| 60 | break :a top_free_ptr; | 60 | break :a top_free_ptr; |
| 61 | } | 61 | } |
| ... | @@ -74,11 +74,11 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[* | ... | @@ -74,11 +74,11 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, return_address: usize) ?[* |
| 74 | break :a next_addr; | 74 | break :a next_addr; |
| 75 | } | 75 | } |
| 76 | }; | 76 | }; |
| 77 | return @intToPtr([*]u8, addr); | 77 | return @ptrFromInt([*]u8, addr); |
| 78 | } | 78 | } |
| 79 | const bigpages_needed = bigPagesNeeded(actual_len); | 79 | const bigpages_needed = bigPagesNeeded(actual_len); |
| 80 | const addr = allocBigPages(bigpages_needed); | 80 | const addr = allocBigPages(bigpages_needed); |
| 81 | return @intToPtr([*]u8, addr); | 81 | return @ptrFromInt([*]u8, addr); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | fn resize( | 84 | fn resize( |
| ... | @@ -121,16 +121,16 @@ fn free( | ... | @@ -121,16 +121,16 @@ fn free( |
| 121 | const actual_len = @max(buf.len + @sizeOf(usize), buf_align); | 121 | const actual_len = @max(buf.len + @sizeOf(usize), buf_align); |
| 122 | const slot_size = math.ceilPowerOfTwoAssert(usize, actual_len); | 122 | const slot_size = math.ceilPowerOfTwoAssert(usize, actual_len); |
| 123 | const class = math.log2(slot_size) - min_class; | 123 | const class = math.log2(slot_size) - min_class; |
| 124 | const addr = @ptrToInt(buf.ptr); | 124 | const addr = @intFromPtr(buf.ptr); |
| 125 | if (class < size_class_count) { | 125 | if (class < size_class_count) { |
| 126 | const node = @intToPtr(*usize, addr + (slot_size - @sizeOf(usize))); | 126 | const node = @ptrFromInt(*usize, addr + (slot_size - @sizeOf(usize))); |
| 127 | node.* = frees[class]; | 127 | node.* = frees[class]; |
| 128 | frees[class] = addr; | 128 | frees[class] = addr; |
| 129 | } else { | 129 | } else { |
| 130 | const bigpages_needed = bigPagesNeeded(actual_len); | 130 | const bigpages_needed = bigPagesNeeded(actual_len); |
| 131 | const pow2_pages = math.ceilPowerOfTwoAssert(usize, bigpages_needed); | 131 | const pow2_pages = math.ceilPowerOfTwoAssert(usize, bigpages_needed); |
| 132 | const big_slot_size_bytes = pow2_pages * bigpage_size; | 132 | const big_slot_size_bytes = pow2_pages * bigpage_size; |
| 133 | const node = @intToPtr(*usize, addr + (big_slot_size_bytes - @sizeOf(usize))); | 133 | const node = @ptrFromInt(*usize, addr + (big_slot_size_bytes - @sizeOf(usize))); |
| 134 | const big_class = math.log2(pow2_pages); | 134 | const big_class = math.log2(pow2_pages); |
| 135 | node.* = big_frees[big_class]; | 135 | node.* = big_frees[big_class]; |
| 136 | big_frees[big_class] = addr; | 136 | big_frees[big_class] = addr; |
| ... | @@ -148,7 +148,7 @@ fn allocBigPages(n: usize) usize { | ... | @@ -148,7 +148,7 @@ fn allocBigPages(n: usize) usize { |
| 148 | 148 | ||
| 149 | const top_free_ptr = big_frees[class]; | 149 | const top_free_ptr = big_frees[class]; |
| 150 | if (top_free_ptr != 0) { | 150 | if (top_free_ptr != 0) { |
| 151 | const node = @intToPtr(*usize, top_free_ptr + (slot_size_bytes - @sizeOf(usize))); | 151 | const node = @ptrFromInt(*usize, top_free_ptr + (slot_size_bytes - @sizeOf(usize))); |
| 152 | big_frees[class] = node.*; | 152 | big_frees[class] = node.*; |
| 153 | return top_free_ptr; | 153 | return top_free_ptr; |
| 154 | } | 154 | } |
lib/std/heap/WasmPageAllocator.zig+8-8| ... | @@ -40,14 +40,14 @@ const FreeBlock = struct { | ... | @@ -40,14 +40,14 @@ const FreeBlock = struct { |
| 40 | 40 | ||
| 41 | fn getBit(self: FreeBlock, idx: usize) PageStatus { | 41 | fn getBit(self: FreeBlock, idx: usize) PageStatus { |
| 42 | const bit_offset = 0; | 42 | const bit_offset = 0; |
| 43 | return @intToEnum(PageStatus, Io.get(mem.sliceAsBytes(self.data), idx, bit_offset)); | 43 | return @enumFromInt(PageStatus, Io.get(mem.sliceAsBytes(self.data), idx, bit_offset)); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | fn setBits(self: FreeBlock, start_idx: usize, len: usize, val: PageStatus) void { | 46 | fn setBits(self: FreeBlock, start_idx: usize, len: usize, val: PageStatus) void { |
| 47 | const bit_offset = 0; | 47 | const bit_offset = 0; |
| 48 | var i: usize = 0; | 48 | var i: usize = 0; |
| 49 | while (i < len) : (i += 1) { | 49 | while (i < len) : (i += 1) { |
| 50 | Io.set(mem.sliceAsBytes(self.data), start_idx + i, bit_offset, @enumToInt(val)); | 50 | Io.set(mem.sliceAsBytes(self.data), start_idx + i, bit_offset, @intFromEnum(val)); |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| ... | @@ -109,7 +109,7 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, ra: usize) ?[*]u8 { | ... | @@ -109,7 +109,7 @@ fn alloc(ctx: *anyopaque, len: usize, log2_align: u8, ra: usize) ?[*]u8 { |
| 109 | if (len > maxInt(usize) - (mem.page_size - 1)) return null; | 109 | if (len > maxInt(usize) - (mem.page_size - 1)) return null; |
| 110 | const page_count = nPages(len); | 110 | const page_count = nPages(len); |
| 111 | const page_idx = allocPages(page_count, log2_align) catch return null; | 111 | const page_idx = allocPages(page_count, log2_align) catch return null; |
| 112 | return @intToPtr([*]u8, page_idx * mem.page_size); | 112 | return @ptrFromInt([*]u8, page_idx * mem.page_size); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | fn allocPages(page_count: usize, log2_align: u8) !usize { | 115 | fn allocPages(page_count: usize, log2_align: u8) !usize { |
| ... | @@ -151,7 +151,7 @@ fn freePages(start: usize, end: usize) void { | ... | @@ -151,7 +151,7 @@ fn freePages(start: usize, end: usize) void { |
| 151 | // TODO: would it be better if we use the first page instead? | 151 | // TODO: would it be better if we use the first page instead? |
| 152 | new_end -= 1; | 152 | new_end -= 1; |
| 153 | 153 | ||
| 154 | extended.data = @intToPtr([*]u128, new_end * mem.page_size)[0 .. mem.page_size / @sizeOf(u128)]; | 154 | extended.data = @ptrFromInt([*]u128, new_end * mem.page_size)[0 .. mem.page_size / @sizeOf(u128)]; |
| 155 | // Since this is the first page being freed and we consume it, assume *nothing* is free. | 155 | // Since this is the first page being freed and we consume it, assume *nothing* is free. |
| 156 | @memset(extended.data, PageStatus.none_free); | 156 | @memset(extended.data, PageStatus.none_free); |
| 157 | } | 157 | } |
| ... | @@ -175,7 +175,7 @@ fn resize( | ... | @@ -175,7 +175,7 @@ fn resize( |
| 175 | const current_n = nPages(aligned_len); | 175 | const current_n = nPages(aligned_len); |
| 176 | const new_n = nPages(new_len); | 176 | const new_n = nPages(new_len); |
| 177 | if (new_n != current_n) { | 177 | if (new_n != current_n) { |
| 178 | const base = nPages(@ptrToInt(buf.ptr)); | 178 | const base = nPages(@intFromPtr(buf.ptr)); |
| 179 | freePages(base + new_n, base + current_n); | 179 | freePages(base + new_n, base + current_n); |
| 180 | } | 180 | } |
| 181 | return true; | 181 | return true; |
| ... | @@ -192,7 +192,7 @@ fn free( | ... | @@ -192,7 +192,7 @@ fn free( |
| 192 | _ = return_address; | 192 | _ = return_address; |
| 193 | const aligned_len = mem.alignForward(usize, buf.len, mem.page_size); | 193 | const aligned_len = mem.alignForward(usize, buf.len, mem.page_size); |
| 194 | const current_n = nPages(aligned_len); | 194 | const current_n = nPages(aligned_len); |
| 195 | const base = nPages(@ptrToInt(buf.ptr)); | 195 | const base = nPages(@intFromPtr(buf.ptr)); |
| 196 | freePages(base, base + current_n); | 196 | freePages(base, base + current_n); |
| 197 | } | 197 | } |
| 198 | 198 | ||
| ... | @@ -202,7 +202,7 @@ test "internals" { | ... | @@ -202,7 +202,7 @@ test "internals" { |
| 202 | 202 | ||
| 203 | const conventional_memsize = WasmPageAllocator.conventional.totalPages() * mem.page_size; | 203 | const conventional_memsize = WasmPageAllocator.conventional.totalPages() * mem.page_size; |
| 204 | const initial = try page_allocator.alloc(u8, mem.page_size); | 204 | const initial = try page_allocator.alloc(u8, mem.page_size); |
| 205 | try testing.expect(@ptrToInt(initial.ptr) < conventional_memsize); // If this isn't conventional, the rest of these tests don't make sense. Also we have a serious memory leak in the test suite. | 205 | try testing.expect(@intFromPtr(initial.ptr) < conventional_memsize); // If this isn't conventional, the rest of these tests don't make sense. Also we have a serious memory leak in the test suite. |
| 206 | 206 | ||
| 207 | var inplace = try page_allocator.realloc(initial, 1); | 207 | var inplace = try page_allocator.realloc(initial, 1); |
| 208 | try testing.expectEqual(initial.ptr, inplace.ptr); | 208 | try testing.expectEqual(initial.ptr, inplace.ptr); |
| ... | @@ -219,7 +219,7 @@ test "internals" { | ... | @@ -219,7 +219,7 @@ test "internals" { |
| 219 | page_allocator.free(padding); | 219 | page_allocator.free(padding); |
| 220 | 220 | ||
| 221 | const ext = try page_allocator.alloc(u8, conventional_memsize); | 221 | const ext = try page_allocator.alloc(u8, conventional_memsize); |
| 222 | try testing.expect(@ptrToInt(ext.ptr) >= conventional_memsize); | 222 | try testing.expect(@intFromPtr(ext.ptr) >= conventional_memsize); |
| 223 | 223 | ||
| 224 | const use_small = try page_allocator.alloc(u8, 1); | 224 | const use_small = try page_allocator.alloc(u8, 1); |
| 225 | try testing.expectEqual(initial.ptr, use_small.ptr); | 225 | try testing.expectEqual(initial.ptr, use_small.ptr); |
lib/std/heap/arena_allocator.zig+4-4| ... | @@ -185,7 +185,7 @@ pub const ArenaAllocator = struct { | ... | @@ -185,7 +185,7 @@ pub const ArenaAllocator = struct { |
| 185 | while (true) { | 185 | while (true) { |
| 186 | const cur_alloc_buf = @ptrCast([*]u8, cur_node)[0..cur_node.data]; | 186 | const cur_alloc_buf = @ptrCast([*]u8, cur_node)[0..cur_node.data]; |
| 187 | const cur_buf = cur_alloc_buf[@sizeOf(BufNode)..]; | 187 | const cur_buf = cur_alloc_buf[@sizeOf(BufNode)..]; |
| 188 | const addr = @ptrToInt(cur_buf.ptr) + self.state.end_index; | 188 | const addr = @intFromPtr(cur_buf.ptr) + self.state.end_index; |
| 189 | const adjusted_addr = mem.alignForward(usize, addr, ptr_align); | 189 | const adjusted_addr = mem.alignForward(usize, addr, ptr_align); |
| 190 | const adjusted_index = self.state.end_index + (adjusted_addr - addr); | 190 | const adjusted_index = self.state.end_index + (adjusted_addr - addr); |
| 191 | const new_end_index = adjusted_index + n; | 191 | const new_end_index = adjusted_index + n; |
| ... | @@ -214,7 +214,7 @@ pub const ArenaAllocator = struct { | ... | @@ -214,7 +214,7 @@ pub const ArenaAllocator = struct { |
| 214 | 214 | ||
| 215 | const cur_node = self.state.buffer_list.first orelse return false; | 215 | const cur_node = self.state.buffer_list.first orelse return false; |
| 216 | const cur_buf = @ptrCast([*]u8, cur_node)[@sizeOf(BufNode)..cur_node.data]; | 216 | const cur_buf = @ptrCast([*]u8, cur_node)[@sizeOf(BufNode)..cur_node.data]; |
| 217 | if (@ptrToInt(cur_buf.ptr) + self.state.end_index != @ptrToInt(buf.ptr) + buf.len) { | 217 | if (@intFromPtr(cur_buf.ptr) + self.state.end_index != @intFromPtr(buf.ptr) + buf.len) { |
| 218 | // It's not the most recent allocation, so it cannot be expanded, | 218 | // It's not the most recent allocation, so it cannot be expanded, |
| 219 | // but it's fine if they want to make it smaller. | 219 | // but it's fine if they want to make it smaller. |
| 220 | return new_len <= buf.len; | 220 | return new_len <= buf.len; |
| ... | @@ -240,7 +240,7 @@ pub const ArenaAllocator = struct { | ... | @@ -240,7 +240,7 @@ pub const ArenaAllocator = struct { |
| 240 | const cur_node = self.state.buffer_list.first orelse return; | 240 | const cur_node = self.state.buffer_list.first orelse return; |
| 241 | const cur_buf = @ptrCast([*]u8, cur_node)[@sizeOf(BufNode)..cur_node.data]; | 241 | const cur_buf = @ptrCast([*]u8, cur_node)[@sizeOf(BufNode)..cur_node.data]; |
| 242 | 242 | ||
| 243 | if (@ptrToInt(cur_buf.ptr) + self.state.end_index == @ptrToInt(buf.ptr) + buf.len) { | 243 | if (@intFromPtr(cur_buf.ptr) + self.state.end_index == @intFromPtr(buf.ptr) + buf.len) { |
| 244 | self.state.end_index -= buf.len; | 244 | self.state.end_index -= buf.len; |
| 245 | } | 245 | } |
| 246 | } | 246 | } |
| ... | @@ -262,7 +262,7 @@ test "ArenaAllocator (reset with preheating)" { | ... | @@ -262,7 +262,7 @@ test "ArenaAllocator (reset with preheating)" { |
| 262 | const size = random.intRangeAtMost(usize, 16, 256); | 262 | const size = random.intRangeAtMost(usize, 16, 256); |
| 263 | const alignment = 32; | 263 | const alignment = 32; |
| 264 | const slice = try arena_allocator.allocator().alignedAlloc(u8, alignment, size); | 264 | const slice = try arena_allocator.allocator().alignedAlloc(u8, alignment, size); |
| 265 | try std.testing.expect(std.mem.isAligned(@ptrToInt(slice.ptr), alignment)); | 265 | try std.testing.expect(std.mem.isAligned(@intFromPtr(slice.ptr), alignment)); |
| 266 | try std.testing.expectEqual(size, slice.len); | 266 | try std.testing.expectEqual(size, slice.len); |
| 267 | alloced_bytes += slice.len; | 267 | alloced_bytes += slice.len; |
| 268 | } | 268 | } |
lib/std/heap/general_purpose_allocator.zig+41-41| ... | @@ -216,8 +216,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -216,8 +216,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 216 | } | 216 | } |
| 217 | 217 | ||
| 218 | fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.builtin.StackTrace { | 218 | fn getStackTrace(self: *LargeAlloc, trace_kind: TraceKind) std.builtin.StackTrace { |
| 219 | assert(@enumToInt(trace_kind) < trace_n); | 219 | assert(@intFromEnum(trace_kind) < trace_n); |
| 220 | const stack_addresses = &self.stack_addresses[@enumToInt(trace_kind)]; | 220 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; |
| 221 | var len: usize = 0; | 221 | var len: usize = 0; |
| 222 | while (len < stack_n and stack_addresses[len] != 0) { | 222 | while (len < stack_n and stack_addresses[len] != 0) { |
| 223 | len += 1; | 223 | len += 1; |
| ... | @@ -229,8 +229,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -229,8 +229,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | fn captureStackTrace(self: *LargeAlloc, ret_addr: usize, trace_kind: TraceKind) void { | 231 | fn captureStackTrace(self: *LargeAlloc, ret_addr: usize, trace_kind: TraceKind) void { |
| 232 | assert(@enumToInt(trace_kind) < trace_n); | 232 | assert(@intFromEnum(trace_kind) < trace_n); |
| 233 | const stack_addresses = &self.stack_addresses[@enumToInt(trace_kind)]; | 233 | const stack_addresses = &self.stack_addresses[@intFromEnum(trace_kind)]; |
| 234 | collectStackTrace(ret_addr, stack_addresses); | 234 | collectStackTrace(ret_addr, stack_addresses); |
| 235 | } | 235 | } |
| 236 | }; | 236 | }; |
| ... | @@ -250,7 +250,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -250,7 +250,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 250 | used_count: SlotIndex, | 250 | used_count: SlotIndex, |
| 251 | 251 | ||
| 252 | fn usedBits(bucket: *BucketHeader, index: usize) *u8 { | 252 | fn usedBits(bucket: *BucketHeader, index: usize) *u8 { |
| 253 | return @intToPtr(*u8, @ptrToInt(bucket) + @sizeOf(BucketHeader) + index); | 253 | return @ptrFromInt(*u8, @intFromPtr(bucket) + @sizeOf(BucketHeader) + index); |
| 254 | } | 254 | } |
| 255 | 255 | ||
| 256 | fn stackTracePtr( | 256 | fn stackTracePtr( |
| ... | @@ -261,7 +261,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -261,7 +261,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 261 | ) *[stack_n]usize { | 261 | ) *[stack_n]usize { |
| 262 | const start_ptr = @ptrCast([*]u8, bucket) + bucketStackFramesStart(size_class); | 262 | const start_ptr = @ptrCast([*]u8, bucket) + bucketStackFramesStart(size_class); |
| 263 | const addr = start_ptr + one_trace_size * traces_per_slot * slot_index + | 263 | const addr = start_ptr + one_trace_size * traces_per_slot * slot_index + |
| 264 | @enumToInt(trace_kind) * @as(usize, one_trace_size); | 264 | @intFromEnum(trace_kind) * @as(usize, one_trace_size); |
| 265 | return @ptrCast(*[stack_n]usize, @alignCast(@alignOf(usize), addr)); | 265 | return @ptrCast(*[stack_n]usize, @alignCast(@alignOf(usize), addr)); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| ... | @@ -344,7 +344,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -344,7 +344,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 344 | const stack_trace = bucketStackTrace(bucket, size_class, slot_index, .alloc); | 344 | const stack_trace = bucketStackTrace(bucket, size_class, slot_index, .alloc); |
| 345 | const addr = bucket.page + slot_index * size_class; | 345 | const addr = bucket.page + slot_index * size_class; |
| 346 | log.err("memory address 0x{x} leaked: {}", .{ | 346 | log.err("memory address 0x{x} leaked: {}", .{ |
| 347 | @ptrToInt(addr), stack_trace, | 347 | @intFromPtr(addr), stack_trace, |
| 348 | }); | 348 | }); |
| 349 | leaks = true; | 349 | leaks = true; |
| 350 | } | 350 | } |
| ... | @@ -376,7 +376,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -376,7 +376,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 376 | if (config.retain_metadata and large_alloc.freed) continue; | 376 | if (config.retain_metadata and large_alloc.freed) continue; |
| 377 | const stack_trace = large_alloc.getStackTrace(.alloc); | 377 | const stack_trace = large_alloc.getStackTrace(.alloc); |
| 378 | log.err("memory address 0x{x} leaked: {}", .{ | 378 | log.err("memory address 0x{x} leaked: {}", .{ |
| 379 | @ptrToInt(large_alloc.bytes.ptr), stack_trace, | 379 | @intFromPtr(large_alloc.bytes.ptr), stack_trace, |
| 380 | }); | 380 | }); |
| 381 | leaks = true; | 381 | leaks = true; |
| 382 | } | 382 | } |
| ... | @@ -427,7 +427,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -427,7 +427,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 427 | var it = self.large_allocations.iterator(); | 427 | var it = self.large_allocations.iterator(); |
| 428 | while (it.next()) |large| { | 428 | while (it.next()) |large| { |
| 429 | if (large.value_ptr.freed) { | 429 | if (large.value_ptr.freed) { |
| 430 | _ = self.large_allocations.remove(@ptrToInt(large.value_ptr.bytes.ptr)); | 430 | _ = self.large_allocations.remove(@intFromPtr(large.value_ptr.bytes.ptr)); |
| 431 | } | 431 | } |
| 432 | } | 432 | } |
| 433 | } | 433 | } |
| ... | @@ -444,7 +444,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -444,7 +444,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 444 | self.small_allocations.deinit(self.backing_allocator); | 444 | self.small_allocations.deinit(self.backing_allocator); |
| 445 | } | 445 | } |
| 446 | self.* = undefined; | 446 | self.* = undefined; |
| 447 | return @intToEnum(Check, @boolToInt(leaks)); | 447 | return @enumFromInt(Check, @intFromBool(leaks)); |
| 448 | } | 448 | } |
| 449 | 449 | ||
| 450 | fn collectStackTrace(first_trace_addr: usize, addresses: *[stack_n]usize) void { | 450 | fn collectStackTrace(first_trace_addr: usize, addresses: *[stack_n]usize) void { |
| ... | @@ -510,8 +510,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -510,8 +510,8 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 510 | const first_bucket = bucket_list orelse return null; | 510 | const first_bucket = bucket_list orelse return null; |
| 511 | var bucket = first_bucket; | 511 | var bucket = first_bucket; |
| 512 | while (true) { | 512 | while (true) { |
| 513 | const in_bucket_range = (addr >= @ptrToInt(bucket.page) and | 513 | const in_bucket_range = (addr >= @intFromPtr(bucket.page) and |
| 514 | addr < @ptrToInt(bucket.page) + page_size); | 514 | addr < @intFromPtr(bucket.page) + page_size); |
| 515 | if (in_bucket_range) return bucket; | 515 | if (in_bucket_range) return bucket; |
| 516 | bucket = bucket.prev; | 516 | bucket = bucket.prev; |
| 517 | if (bucket == first_bucket) { | 517 | if (bucket == first_bucket) { |
| ... | @@ -529,7 +529,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -529,7 +529,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 529 | new_size: usize, | 529 | new_size: usize, |
| 530 | ret_addr: usize, | 530 | ret_addr: usize, |
| 531 | ) bool { | 531 | ) bool { |
| 532 | const entry = self.large_allocations.getEntry(@ptrToInt(old_mem.ptr)) orelse { | 532 | const entry = self.large_allocations.getEntry(@intFromPtr(old_mem.ptr)) orelse { |
| 533 | if (config.safety) { | 533 | if (config.safety) { |
| 534 | @panic("Invalid free"); | 534 | @panic("Invalid free"); |
| 535 | } else { | 535 | } else { |
| ... | @@ -604,7 +604,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -604,7 +604,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 604 | log2_old_align: u8, | 604 | log2_old_align: u8, |
| 605 | ret_addr: usize, | 605 | ret_addr: usize, |
| 606 | ) void { | 606 | ) void { |
| 607 | const entry = self.large_allocations.getEntry(@ptrToInt(old_mem.ptr)) orelse { | 607 | const entry = self.large_allocations.getEntry(@intFromPtr(old_mem.ptr)) orelse { |
| 608 | if (config.safety) { | 608 | if (config.safety) { |
| 609 | @panic("Invalid free"); | 609 | @panic("Invalid free"); |
| 610 | } else { | 610 | } else { |
| ... | @@ -649,7 +649,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -649,7 +649,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 649 | } | 649 | } |
| 650 | 650 | ||
| 651 | if (!config.retain_metadata) { | 651 | if (!config.retain_metadata) { |
| 652 | assert(self.large_allocations.remove(@ptrToInt(old_mem.ptr))); | 652 | assert(self.large_allocations.remove(@intFromPtr(old_mem.ptr))); |
| 653 | } else { | 653 | } else { |
| 654 | entry.value_ptr.freed = true; | 654 | entry.value_ptr.freed = true; |
| 655 | entry.value_ptr.captureStackTrace(ret_addr, .free); | 655 | entry.value_ptr.captureStackTrace(ret_addr, .free); |
| ... | @@ -683,7 +683,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -683,7 +683,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 683 | var bucket_index = math.log2(size_class_hint); | 683 | var bucket_index = math.log2(size_class_hint); |
| 684 | var size_class: usize = size_class_hint; | 684 | var size_class: usize = size_class_hint; |
| 685 | const bucket = while (bucket_index < small_bucket_count) : (bucket_index += 1) { | 685 | const bucket = while (bucket_index < small_bucket_count) : (bucket_index += 1) { |
| 686 | if (searchBucket(self.buckets[bucket_index], @ptrToInt(old_mem.ptr))) |bucket| { | 686 | if (searchBucket(self.buckets[bucket_index], @intFromPtr(old_mem.ptr))) |bucket| { |
| 687 | // move bucket to head of list to optimize search for nearby allocations | 687 | // move bucket to head of list to optimize search for nearby allocations |
| 688 | self.buckets[bucket_index] = bucket; | 688 | self.buckets[bucket_index] = bucket; |
| 689 | break bucket; | 689 | break bucket; |
| ... | @@ -691,9 +691,9 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -691,9 +691,9 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 691 | size_class *= 2; | 691 | size_class *= 2; |
| 692 | } else blk: { | 692 | } else blk: { |
| 693 | if (config.retain_metadata) { | 693 | if (config.retain_metadata) { |
| 694 | if (!self.large_allocations.contains(@ptrToInt(old_mem.ptr))) { | 694 | if (!self.large_allocations.contains(@intFromPtr(old_mem.ptr))) { |
| 695 | // object not in active buckets or a large allocation, so search empty buckets | 695 | // object not in active buckets or a large allocation, so search empty buckets |
| 696 | if (searchBucket(self.empty_buckets, @ptrToInt(old_mem.ptr))) |bucket| { | 696 | if (searchBucket(self.empty_buckets, @intFromPtr(old_mem.ptr))) |bucket| { |
| 697 | // bucket is empty so is_used below will always be false and we exit there | 697 | // bucket is empty so is_used below will always be false and we exit there |
| 698 | break :blk bucket; | 698 | break :blk bucket; |
| 699 | } else { | 699 | } else { |
| ... | @@ -703,7 +703,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -703,7 +703,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 703 | } | 703 | } |
| 704 | return self.resizeLarge(old_mem, log2_old_align, new_size, ret_addr); | 704 | return self.resizeLarge(old_mem, log2_old_align, new_size, ret_addr); |
| 705 | }; | 705 | }; |
| 706 | const byte_offset = @ptrToInt(old_mem.ptr) - @ptrToInt(bucket.page); | 706 | const byte_offset = @intFromPtr(old_mem.ptr) - @intFromPtr(bucket.page); |
| 707 | const slot_index = @intCast(SlotIndex, byte_offset / size_class); | 707 | const slot_index = @intCast(SlotIndex, byte_offset / size_class); |
| 708 | const used_byte_index = slot_index / 8; | 708 | const used_byte_index = slot_index / 8; |
| 709 | const used_bit_index = @intCast(u3, slot_index % 8); | 709 | const used_bit_index = @intCast(u3, slot_index % 8); |
| ... | @@ -720,7 +720,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -720,7 +720,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 720 | 720 | ||
| 721 | // Definitely an in-use small alloc now. | 721 | // Definitely an in-use small alloc now. |
| 722 | if (config.safety) { | 722 | if (config.safety) { |
| 723 | const entry = self.small_allocations.getEntry(@ptrToInt(old_mem.ptr)) orelse | 723 | const entry = self.small_allocations.getEntry(@intFromPtr(old_mem.ptr)) orelse |
| 724 | @panic("Invalid free"); | 724 | @panic("Invalid free"); |
| 725 | if (old_mem.len != entry.value_ptr.requested_size or log2_old_align != entry.value_ptr.log2_ptr_align) { | 725 | if (old_mem.len != entry.value_ptr.requested_size or log2_old_align != entry.value_ptr.log2_ptr_align) { |
| 726 | var addresses: [stack_n]usize = [1]usize{0} ** stack_n; | 726 | var addresses: [stack_n]usize = [1]usize{0} ** stack_n; |
| ... | @@ -768,7 +768,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -768,7 +768,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 768 | }); | 768 | }); |
| 769 | } | 769 | } |
| 770 | if (config.safety) { | 770 | if (config.safety) { |
| 771 | const entry = self.small_allocations.getEntry(@ptrToInt(old_mem.ptr)).?; | 771 | const entry = self.small_allocations.getEntry(@intFromPtr(old_mem.ptr)).?; |
| 772 | entry.value_ptr.requested_size = new_size; | 772 | entry.value_ptr.requested_size = new_size; |
| 773 | } | 773 | } |
| 774 | return true; | 774 | return true; |
| ... | @@ -803,7 +803,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -803,7 +803,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 803 | var bucket_index = math.log2(size_class_hint); | 803 | var bucket_index = math.log2(size_class_hint); |
| 804 | var size_class: usize = size_class_hint; | 804 | var size_class: usize = size_class_hint; |
| 805 | const bucket = while (bucket_index < small_bucket_count) : (bucket_index += 1) { | 805 | const bucket = while (bucket_index < small_bucket_count) : (bucket_index += 1) { |
| 806 | if (searchBucket(self.buckets[bucket_index], @ptrToInt(old_mem.ptr))) |bucket| { | 806 | if (searchBucket(self.buckets[bucket_index], @intFromPtr(old_mem.ptr))) |bucket| { |
| 807 | // move bucket to head of list to optimize search for nearby allocations | 807 | // move bucket to head of list to optimize search for nearby allocations |
| 808 | self.buckets[bucket_index] = bucket; | 808 | self.buckets[bucket_index] = bucket; |
| 809 | break bucket; | 809 | break bucket; |
| ... | @@ -811,9 +811,9 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -811,9 +811,9 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 811 | size_class *= 2; | 811 | size_class *= 2; |
| 812 | } else blk: { | 812 | } else blk: { |
| 813 | if (config.retain_metadata) { | 813 | if (config.retain_metadata) { |
| 814 | if (!self.large_allocations.contains(@ptrToInt(old_mem.ptr))) { | 814 | if (!self.large_allocations.contains(@intFromPtr(old_mem.ptr))) { |
| 815 | // object not in active buckets or a large allocation, so search empty buckets | 815 | // object not in active buckets or a large allocation, so search empty buckets |
| 816 | if (searchBucket(self.empty_buckets, @ptrToInt(old_mem.ptr))) |bucket| { | 816 | if (searchBucket(self.empty_buckets, @intFromPtr(old_mem.ptr))) |bucket| { |
| 817 | // bucket is empty so is_used below will always be false and we exit there | 817 | // bucket is empty so is_used below will always be false and we exit there |
| 818 | break :blk bucket; | 818 | break :blk bucket; |
| 819 | } else { | 819 | } else { |
| ... | @@ -824,7 +824,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -824,7 +824,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 824 | self.freeLarge(old_mem, log2_old_align, ret_addr); | 824 | self.freeLarge(old_mem, log2_old_align, ret_addr); |
| 825 | return; | 825 | return; |
| 826 | }; | 826 | }; |
| 827 | const byte_offset = @ptrToInt(old_mem.ptr) - @ptrToInt(bucket.page); | 827 | const byte_offset = @intFromPtr(old_mem.ptr) - @intFromPtr(bucket.page); |
| 828 | const slot_index = @intCast(SlotIndex, byte_offset / size_class); | 828 | const slot_index = @intCast(SlotIndex, byte_offset / size_class); |
| 829 | const used_byte_index = slot_index / 8; | 829 | const used_byte_index = slot_index / 8; |
| 830 | const used_bit_index = @intCast(u3, slot_index % 8); | 830 | const used_bit_index = @intCast(u3, slot_index % 8); |
| ... | @@ -842,7 +842,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -842,7 +842,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 842 | 842 | ||
| 843 | // Definitely an in-use small alloc now. | 843 | // Definitely an in-use small alloc now. |
| 844 | if (config.safety) { | 844 | if (config.safety) { |
| 845 | const entry = self.small_allocations.getEntry(@ptrToInt(old_mem.ptr)) orelse | 845 | const entry = self.small_allocations.getEntry(@intFromPtr(old_mem.ptr)) orelse |
| 846 | @panic("Invalid free"); | 846 | @panic("Invalid free"); |
| 847 | if (old_mem.len != entry.value_ptr.requested_size or log2_old_align != entry.value_ptr.log2_ptr_align) { | 847 | if (old_mem.len != entry.value_ptr.requested_size or log2_old_align != entry.value_ptr.log2_ptr_align) { |
| 848 | var addresses: [stack_n]usize = [1]usize{0} ** stack_n; | 848 | var addresses: [stack_n]usize = [1]usize{0} ** stack_n; |
| ... | @@ -915,7 +915,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -915,7 +915,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 915 | @memset(old_mem, undefined); | 915 | @memset(old_mem, undefined); |
| 916 | } | 916 | } |
| 917 | if (config.safety) { | 917 | if (config.safety) { |
| 918 | assert(self.small_allocations.remove(@ptrToInt(old_mem.ptr))); | 918 | assert(self.small_allocations.remove(@intFromPtr(old_mem.ptr))); |
| 919 | } | 919 | } |
| 920 | if (config.verbose_log) { | 920 | if (config.verbose_log) { |
| 921 | log.info("small free {d} bytes at {*}", .{ old_mem.len, old_mem.ptr }); | 921 | log.info("small free {d} bytes at {*}", .{ old_mem.len, old_mem.ptr }); |
| ... | @@ -956,7 +956,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -956,7 +956,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 956 | return error.OutOfMemory; | 956 | return error.OutOfMemory; |
| 957 | const slice = ptr[0..len]; | 957 | const slice = ptr[0..len]; |
| 958 | 958 | ||
| 959 | const gop = self.large_allocations.getOrPutAssumeCapacity(@ptrToInt(slice.ptr)); | 959 | const gop = self.large_allocations.getOrPutAssumeCapacity(@intFromPtr(slice.ptr)); |
| 960 | if (config.retain_metadata and !config.never_unmap) { | 960 | if (config.retain_metadata and !config.never_unmap) { |
| 961 | // Backing allocator may be reusing memory that we're retaining metadata for | 961 | // Backing allocator may be reusing memory that we're retaining metadata for |
| 962 | assert(!gop.found_existing or gop.value_ptr.freed); | 962 | assert(!gop.found_existing or gop.value_ptr.freed); |
| ... | @@ -986,7 +986,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { | ... | @@ -986,7 +986,7 @@ pub fn GeneralPurposeAllocator(comptime config: Config) type { |
| 986 | const new_size_class = math.ceilPowerOfTwoAssert(usize, new_aligned_size); | 986 | const new_size_class = math.ceilPowerOfTwoAssert(usize, new_aligned_size); |
| 987 | const ptr = try self.allocSlot(new_size_class, ret_addr); | 987 | const ptr = try self.allocSlot(new_size_class, ret_addr); |
| 988 | if (config.safety) { | 988 | if (config.safety) { |
| 989 | const gop = self.small_allocations.getOrPutAssumeCapacity(@ptrToInt(ptr)); | 989 | const gop = self.small_allocations.getOrPutAssumeCapacity(@intFromPtr(ptr)); |
| 990 | gop.value_ptr.requested_size = len; | 990 | gop.value_ptr.requested_size = len; |
| 991 | gop.value_ptr.log2_ptr_align = log2_ptr_align; | 991 | gop.value_ptr.log2_ptr_align = log2_ptr_align; |
| 992 | } | 992 | } |
| ... | @@ -1212,7 +1212,7 @@ test "shrink large object to large object with larger alignment" { | ... | @@ -1212,7 +1212,7 @@ test "shrink large object to large object with larger alignment" { |
| 1212 | // alignment. Then we shrink the allocation after the loop, but increase the | 1212 | // alignment. Then we shrink the allocation after the loop, but increase the |
| 1213 | // alignment to the higher one, that we know will force it to realloc. | 1213 | // alignment to the higher one, that we know will force it to realloc. |
| 1214 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); | 1214 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); |
| 1215 | while (mem.isAligned(@ptrToInt(slice.ptr), big_alignment)) { | 1215 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { |
| 1216 | try stuff_to_free.append(slice); | 1216 | try stuff_to_free.append(slice); |
| 1217 | slice = try allocator.alignedAlloc(u8, 16, alloc_size); | 1217 | slice = try allocator.alignedAlloc(u8, 16, alloc_size); |
| 1218 | } | 1218 | } |
| ... | @@ -1281,7 +1281,7 @@ test "realloc large object to larger alignment" { | ... | @@ -1281,7 +1281,7 @@ test "realloc large object to larger alignment" { |
| 1281 | }; | 1281 | }; |
| 1282 | // This loop allocates until we find a page that is not aligned to the big alignment. | 1282 | // This loop allocates until we find a page that is not aligned to the big alignment. |
| 1283 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); | 1283 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); |
| 1284 | while (mem.isAligned(@ptrToInt(slice.ptr), big_alignment)) { | 1284 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { |
| 1285 | try stuff_to_free.append(slice); | 1285 | try stuff_to_free.append(slice); |
| 1286 | slice = try allocator.alignedAlloc(u8, 16, page_size * 2 + 50); | 1286 | slice = try allocator.alignedAlloc(u8, 16, page_size * 2 + 50); |
| 1287 | } | 1287 | } |
| ... | @@ -1375,18 +1375,18 @@ test "double frees" { | ... | @@ -1375,18 +1375,18 @@ test "double frees" { |
| 1375 | const index: usize = 6; | 1375 | const index: usize = 6; |
| 1376 | const size_class: usize = @as(usize, 1) << 6; | 1376 | const size_class: usize = @as(usize, 1) << 6; |
| 1377 | const small = try allocator.alloc(u8, size_class); | 1377 | const small = try allocator.alloc(u8, size_class); |
| 1378 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @ptrToInt(small.ptr)) != null); | 1378 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @intFromPtr(small.ptr)) != null); |
| 1379 | allocator.free(small); | 1379 | allocator.free(small); |
| 1380 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @ptrToInt(small.ptr)) == null); | 1380 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @intFromPtr(small.ptr)) == null); |
| 1381 | try std.testing.expect(GPA.searchBucket(gpa.empty_buckets, @ptrToInt(small.ptr)) != null); | 1381 | try std.testing.expect(GPA.searchBucket(gpa.empty_buckets, @intFromPtr(small.ptr)) != null); |
| 1382 | 1382 | ||
| 1383 | // detect a large allocation double free | 1383 | // detect a large allocation double free |
| 1384 | const large = try allocator.alloc(u8, 2 * page_size); | 1384 | const large = try allocator.alloc(u8, 2 * page_size); |
| 1385 | try std.testing.expect(gpa.large_allocations.contains(@ptrToInt(large.ptr))); | 1385 | try std.testing.expect(gpa.large_allocations.contains(@intFromPtr(large.ptr))); |
| 1386 | try std.testing.expectEqual(gpa.large_allocations.getEntry(@ptrToInt(large.ptr)).?.value_ptr.bytes, large); | 1386 | try std.testing.expectEqual(gpa.large_allocations.getEntry(@intFromPtr(large.ptr)).?.value_ptr.bytes, large); |
| 1387 | allocator.free(large); | 1387 | allocator.free(large); |
| 1388 | try std.testing.expect(gpa.large_allocations.contains(@ptrToInt(large.ptr))); | 1388 | try std.testing.expect(gpa.large_allocations.contains(@intFromPtr(large.ptr))); |
| 1389 | try std.testing.expect(gpa.large_allocations.getEntry(@ptrToInt(large.ptr)).?.value_ptr.freed); | 1389 | try std.testing.expect(gpa.large_allocations.getEntry(@intFromPtr(large.ptr)).?.value_ptr.freed); |
| 1390 | 1390 | ||
| 1391 | const normal_small = try allocator.alloc(u8, size_class); | 1391 | const normal_small = try allocator.alloc(u8, size_class); |
| 1392 | defer allocator.free(normal_small); | 1392 | defer allocator.free(normal_small); |
| ... | @@ -1396,9 +1396,9 @@ test "double frees" { | ... | @@ -1396,9 +1396,9 @@ test "double frees" { |
| 1396 | // check that flushing retained metadata doesn't disturb live allocations | 1396 | // check that flushing retained metadata doesn't disturb live allocations |
| 1397 | gpa.flushRetainedMetadata(); | 1397 | gpa.flushRetainedMetadata(); |
| 1398 | try std.testing.expect(gpa.empty_buckets == null); | 1398 | try std.testing.expect(gpa.empty_buckets == null); |
| 1399 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @ptrToInt(normal_small.ptr)) != null); | 1399 | try std.testing.expect(GPA.searchBucket(gpa.buckets[index], @intFromPtr(normal_small.ptr)) != null); |
| 1400 | try std.testing.expect(gpa.large_allocations.contains(@ptrToInt(normal_large.ptr))); | 1400 | try std.testing.expect(gpa.large_allocations.contains(@intFromPtr(normal_large.ptr))); |
| 1401 | try std.testing.expect(!gpa.large_allocations.contains(@ptrToInt(large.ptr))); | 1401 | try std.testing.expect(!gpa.large_allocations.contains(@intFromPtr(large.ptr))); |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| 1404 | test "bug 9995 fix, large allocs count requested size not backing size" { | 1404 | test "bug 9995 fix, large allocs count requested size not backing size" { |
lib/std/http.zig+1-1| ... | @@ -232,7 +232,7 @@ pub const Status = enum(u10) { | ... | @@ -232,7 +232,7 @@ pub const Status = enum(u10) { |
| 232 | }; | 232 | }; |
| 233 | 233 | ||
| 234 | pub fn class(self: Status) Class { | 234 | pub fn class(self: Status) Class { |
| 235 | return switch (@enumToInt(self)) { | 235 | return switch (@intFromEnum(self)) { |
| 236 | 100...199 => .informational, | 236 | 100...199 => .informational, |
| 237 | 200...299 => .success, | 237 | 200...299 => .success, |
| 238 | 300...399 => .redirect, | 238 | 300...399 => .redirect, |
lib/std/http/Client.zig+1-1| ... | @@ -343,7 +343,7 @@ pub const Response = struct { | ... | @@ -343,7 +343,7 @@ pub const Response = struct { |
| 343 | else => return error.HttpHeadersInvalid, | 343 | else => return error.HttpHeadersInvalid, |
| 344 | }; | 344 | }; |
| 345 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; | 345 | if (first_line[8] != ' ') return error.HttpHeadersInvalid; |
| 346 | const status = @intToEnum(http.Status, parseInt3(first_line[9..12].*)); | 346 | const status = @enumFromInt(http.Status, parseInt3(first_line[9..12].*)); |
| 347 | const reason = mem.trimLeft(u8, first_line[12..], " "); | 347 | const reason = mem.trimLeft(u8, first_line[12..], " "); |
| 348 | 348 | ||
| 349 | res.version = version; | 349 | res.version = version; |
lib/std/http/Server.zig+1-1| ... | @@ -402,7 +402,7 @@ pub const Response = struct { | ... | @@ -402,7 +402,7 @@ pub const Response = struct { |
| 402 | 402 | ||
| 403 | try w.writeAll(@tagName(res.version)); | 403 | try w.writeAll(@tagName(res.version)); |
| 404 | try w.writeByte(' '); | 404 | try w.writeByte(' '); |
| 405 | try w.print("{d}", .{@enumToInt(res.status)}); | 405 | try w.print("{d}", .{@intFromEnum(res.status)}); |
| 406 | try w.writeByte(' '); | 406 | try w.writeByte(' '); |
| 407 | if (res.reason) |reason| { | 407 | if (res.reason) |reason| { |
| 408 | try w.writeAll(reason); | 408 | try w.writeAll(reason); |
lib/std/io.zig+3-3| ... | @@ -257,7 +257,7 @@ pub fn Poller(comptime StreamEnum: type) type { | ... | @@ -257,7 +257,7 @@ pub fn Poller(comptime StreamEnum: type) type { |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | pub inline fn fifo(self: *Self, comptime which: StreamEnum) *PollFifo { | 259 | pub inline fn fifo(self: *Self, comptime which: StreamEnum) *PollFifo { |
| 260 | return &self.fifos[@enumToInt(which)]; | 260 | return &self.fifos[@intFromEnum(which)]; |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | fn pollWindows(self: *Self) !bool { | 263 | fn pollWindows(self: *Self) !bool { |
| ... | @@ -275,7 +275,7 @@ pub fn Poller(comptime StreamEnum: type) type { | ... | @@ -275,7 +275,7 @@ pub fn Poller(comptime StreamEnum: type) type { |
| 275 | )) { | 275 | )) { |
| 276 | .pending => { | 276 | .pending => { |
| 277 | self.windows.active.handles_buf[self.windows.active.count] = handle; | 277 | self.windows.active.handles_buf[self.windows.active.count] = handle; |
| 278 | self.windows.active.stream_map[self.windows.active.count] = @intToEnum(StreamEnum, i); | 278 | self.windows.active.stream_map[self.windows.active.count] = @enumFromInt(StreamEnum, i); |
| 279 | self.windows.active.count += 1; | 279 | self.windows.active.count += 1; |
| 280 | }, | 280 | }, |
| 281 | .closed => {}, // don't add to the wait_objects list | 281 | .closed => {}, // don't add to the wait_objects list |
| ... | @@ -302,7 +302,7 @@ pub fn Poller(comptime StreamEnum: type) type { | ... | @@ -302,7 +302,7 @@ pub fn Poller(comptime StreamEnum: type) type { |
| 302 | const active_idx = status - os.windows.WAIT_OBJECT_0; | 302 | const active_idx = status - os.windows.WAIT_OBJECT_0; |
| 303 | 303 | ||
| 304 | const handle = self.windows.active.handles_buf[active_idx]; | 304 | const handle = self.windows.active.handles_buf[active_idx]; |
| 305 | const stream_idx = @enumToInt(self.windows.active.stream_map[active_idx]); | 305 | const stream_idx = @intFromEnum(self.windows.active.stream_map[active_idx]); |
| 306 | var read_bytes: u32 = undefined; | 306 | var read_bytes: u32 = undefined; |
| 307 | if (0 == os.windows.kernel32.GetOverlappedResult( | 307 | if (0 == os.windows.kernel32.GetOverlappedResult( |
| 308 | handle, | 308 | handle, |
lib/std/io/bit_reader.zig+1-1| ... | @@ -143,7 +143,7 @@ pub fn BitReader(comptime endian: std.builtin.Endian, comptime ReaderType: type) | ... | @@ -143,7 +143,7 @@ pub fn BitReader(comptime endian: std.builtin.Endian, comptime ReaderType: type) |
| 143 | b.* = try self.readBits(u8, u8_bit_count, &out_bits); | 143 | b.* = try self.readBits(u8, u8_bit_count, &out_bits); |
| 144 | out_bits_total += out_bits; | 144 | out_bits_total += out_bits; |
| 145 | } | 145 | } |
| 146 | const incomplete_byte = @boolToInt(out_bits_total % u8_bit_count > 0); | 146 | const incomplete_byte = @intFromBool(out_bits_total % u8_bit_count > 0); |
| 147 | return (out_bits_total / u8_bit_count) + incomplete_byte; | 147 | return (out_bits_total / u8_bit_count) + incomplete_byte; |
| 148 | } | 148 | } |
| 149 | 149 |
lib/std/io/c_writer.zig+1-1| ... | @@ -13,7 +13,7 @@ pub fn cWriter(c_file: *std.c.FILE) CWriter { | ... | @@ -13,7 +13,7 @@ pub fn cWriter(c_file: *std.c.FILE) CWriter { |
| 13 | fn cWriterWrite(c_file: *std.c.FILE, bytes: []const u8) std.fs.File.WriteError!usize { | 13 | fn cWriterWrite(c_file: *std.c.FILE, bytes: []const u8) std.fs.File.WriteError!usize { |
| 14 | const amt_written = std.c.fwrite(bytes.ptr, 1, bytes.len, c_file); | 14 | const amt_written = std.c.fwrite(bytes.ptr, 1, bytes.len, c_file); |
| 15 | if (amt_written >= 0) return amt_written; | 15 | if (amt_written >= 0) return amt_written; |
| 16 | switch (@intToEnum(os.E, std.c._errno().*)) { | 16 | switch (@enumFromInt(os.E, std.c._errno().*)) { |
| 17 | .SUCCESS => unreachable, | 17 | .SUCCESS => unreachable, |
| 18 | .INVAL => unreachable, | 18 | .INVAL => unreachable, |
| 19 | .FAULT => unreachable, | 19 | .FAULT => unreachable, |
lib/std/json/static.zig+1-1| ... | @@ -176,7 +176,7 @@ fn parseInternal( | ... | @@ -176,7 +176,7 @@ fn parseInternal( |
| 176 | const float = try std.fmt.parseFloat(f128, slice); | 176 | const float = try std.fmt.parseFloat(f128, slice); |
| 177 | if (@round(float) != float) return error.InvalidNumber; | 177 | if (@round(float) != float) return error.InvalidNumber; |
| 178 | if (float > std.math.maxInt(T) or float < std.math.minInt(T)) return error.Overflow; | 178 | if (float > std.math.maxInt(T) or float < std.math.minInt(T)) return error.Overflow; |
| 179 | return @floatToInt(T, float); | 179 | return @intFromFloat(T, float); |
| 180 | }, | 180 | }, |
| 181 | .Optional => |optionalInfo| { | 181 | .Optional => |optionalInfo| { |
| 182 | switch (try source.peekNextTokenType()) { | 182 | switch (try source.peekNextTokenType()) { |
lib/std/leb128.zig+1-1| ... | @@ -318,7 +318,7 @@ fn test_write_leb128(value: anytype) !void { | ... | @@ -318,7 +318,7 @@ fn test_write_leb128(value: anytype) !void { |
| 318 | if (@typeInfo(T).Int.bits <= 7) break :bn @as(u16, 1); | 318 | if (@typeInfo(T).Int.bits <= 7) break :bn @as(u16, 1); |
| 319 | 319 | ||
| 320 | const unused_bits = if (value < 0) @clz(~value) else @clz(value); | 320 | const unused_bits = if (value < 0) @clz(~value) else @clz(value); |
| 321 | const used_bits: u16 = (@typeInfo(T).Int.bits - unused_bits) + @boolToInt(t_signed); | 321 | const used_bits: u16 = (@typeInfo(T).Int.bits - unused_bits) + @intFromBool(t_signed); |
| 322 | if (used_bits <= 7) break :bn @as(u16, 1); | 322 | if (used_bits <= 7) break :bn @as(u16, 1); |
| 323 | break :bn ((used_bits + 6) / 7); | 323 | break :bn ((used_bits + 6) / 7); |
| 324 | }; | 324 | }; |
lib/std/log.zig+3-3| ... | @@ -36,7 +36,7 @@ | ... | @@ -36,7 +36,7 @@ |
| 36 | //! // .my_project, .nice_library and the default | 36 | //! // .my_project, .nice_library and the default |
| 37 | //! const scope_prefix = "(" ++ switch (scope) { | 37 | //! const scope_prefix = "(" ++ switch (scope) { |
| 38 | //! .my_project, .nice_library, std.log.default_log_scope => @tagName(scope), | 38 | //! .my_project, .nice_library, std.log.default_log_scope => @tagName(scope), |
| 39 | //! else => if (@enumToInt(level) <= @enumToInt(std.log.Level.err)) | 39 | //! else => if (@intFromEnum(level) <= @intFromEnum(std.log.Level.err)) |
| 40 | //! @tagName(scope) | 40 | //! @tagName(scope) |
| 41 | //! else | 41 | //! else |
| 42 | //! return, | 42 | //! return, |
| ... | @@ -128,9 +128,9 @@ fn log( | ... | @@ -128,9 +128,9 @@ fn log( |
| 128 | /// Determine if a specific log message level and scope combination are enabled for logging. | 128 | /// Determine if a specific log message level and scope combination are enabled for logging. |
| 129 | pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.EnumLiteral)) bool { | 129 | pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.EnumLiteral)) bool { |
| 130 | inline for (scope_levels) |scope_level| { | 130 | inline for (scope_levels) |scope_level| { |
| 131 | if (scope_level.scope == scope) return @enumToInt(message_level) <= @enumToInt(scope_level.level); | 131 | if (scope_level.scope == scope) return @intFromEnum(message_level) <= @intFromEnum(scope_level.level); |
| 132 | } | 132 | } |
| 133 | return @enumToInt(message_level) <= @enumToInt(level); | 133 | return @intFromEnum(message_level) <= @intFromEnum(level); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | /// Determine if a specific log message level using the default log scope is enabled for logging. | 136 | /// Determine if a specific log message level using the default log scope is enabled for logging. |
lib/std/math.zig+10-10| ... | @@ -1104,7 +1104,7 @@ pub const AlignCastError = error{UnalignedMemory}; | ... | @@ -1104,7 +1104,7 @@ pub const AlignCastError = error{UnalignedMemory}; |
| 1104 | 1104 | ||
| 1105 | /// Align cast a pointer but return an error if it's the wrong alignment | 1105 | /// Align cast a pointer but return an error if it's the wrong alignment |
| 1106 | pub fn alignCast(comptime alignment: u29, ptr: anytype) AlignCastError!@TypeOf(@alignCast(alignment, ptr)) { | 1106 | pub fn alignCast(comptime alignment: u29, ptr: anytype) AlignCastError!@TypeOf(@alignCast(alignment, ptr)) { |
| 1107 | const addr = @ptrToInt(ptr); | 1107 | const addr = @intFromPtr(ptr); |
| 1108 | if (addr % alignment != 0) { | 1108 | if (addr % alignment != 0) { |
| 1109 | return error.UnalignedMemory; | 1109 | return error.UnalignedMemory; |
| 1110 | } | 1110 | } |
| ... | @@ -1311,7 +1311,7 @@ pub fn lossyCast(comptime T: type, value: anytype) T { | ... | @@ -1311,7 +1311,7 @@ pub fn lossyCast(comptime T: type, value: anytype) T { |
| 1311 | switch (@typeInfo(T)) { | 1311 | switch (@typeInfo(T)) { |
| 1312 | .Float => { | 1312 | .Float => { |
| 1313 | switch (@typeInfo(@TypeOf(value))) { | 1313 | switch (@typeInfo(@TypeOf(value))) { |
| 1314 | .Int => return @intToFloat(T, value), | 1314 | .Int => return @floatFromInt(T, value), |
| 1315 | .Float => return @floatCast(T, value), | 1315 | .Float => return @floatCast(T, value), |
| 1316 | .ComptimeInt => return @as(T, value), | 1316 | .ComptimeInt => return @as(T, value), |
| 1317 | .ComptimeFloat => return @as(T, value), | 1317 | .ComptimeFloat => return @as(T, value), |
| ... | @@ -1335,7 +1335,7 @@ pub fn lossyCast(comptime T: type, value: anytype) T { | ... | @@ -1335,7 +1335,7 @@ pub fn lossyCast(comptime T: type, value: anytype) T { |
| 1335 | } else if (value <= minInt(T)) { | 1335 | } else if (value <= minInt(T)) { |
| 1336 | return @as(T, minInt(T)); | 1336 | return @as(T, minInt(T)); |
| 1337 | } else { | 1337 | } else { |
| 1338 | return @floatToInt(T, value); | 1338 | return @intFromFloat(T, value); |
| 1339 | } | 1339 | } |
| 1340 | }, | 1340 | }, |
| 1341 | else => @compileError("bad type"), | 1341 | else => @compileError("bad type"), |
| ... | @@ -1401,7 +1401,7 @@ pub fn maxInt(comptime T: type) comptime_int { | ... | @@ -1401,7 +1401,7 @@ pub fn maxInt(comptime T: type) comptime_int { |
| 1401 | const info = @typeInfo(T); | 1401 | const info = @typeInfo(T); |
| 1402 | const bit_count = info.Int.bits; | 1402 | const bit_count = info.Int.bits; |
| 1403 | if (bit_count == 0) return 0; | 1403 | if (bit_count == 0) return 0; |
| 1404 | return (1 << (bit_count - @boolToInt(info.Int.signedness == .signed))) - 1; | 1404 | return (1 << (bit_count - @intFromBool(info.Int.signedness == .signed))) - 1; |
| 1405 | } | 1405 | } |
| 1406 | 1406 | ||
| 1407 | /// Returns the minimum value of integer type T. | 1407 | /// Returns the minimum value of integer type T. |
| ... | @@ -1624,7 +1624,7 @@ test "order.compare" { | ... | @@ -1624,7 +1624,7 @@ test "order.compare" { |
| 1624 | 1624 | ||
| 1625 | test "compare.reverse" { | 1625 | test "compare.reverse" { |
| 1626 | inline for (@typeInfo(CompareOperator).Enum.fields) |op_field| { | 1626 | inline for (@typeInfo(CompareOperator).Enum.fields) |op_field| { |
| 1627 | const op = @intToEnum(CompareOperator, op_field.value); | 1627 | const op = @enumFromInt(CompareOperator, op_field.value); |
| 1628 | try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2)); | 1628 | try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2)); |
| 1629 | try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3)); | 1629 | try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3)); |
| 1630 | try testing.expect(compare(4, op, 3) == compare(3, op.reverse(), 4)); | 1630 | try testing.expect(compare(4, op, 3) == compare(3, op.reverse(), 4)); |
| ... | @@ -1643,13 +1643,13 @@ pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt { | ... | @@ -1643,13 +1643,13 @@ pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt { |
| 1643 | 1643 | ||
| 1644 | // The u1 and i1 cases tend to overflow, | 1644 | // The u1 and i1 cases tend to overflow, |
| 1645 | // so we special case them here. | 1645 | // so we special case them here. |
| 1646 | if (MaskInt == u1) return @boolToInt(value); | 1646 | if (MaskInt == u1) return @intFromBool(value); |
| 1647 | if (MaskInt == i1) { | 1647 | if (MaskInt == i1) { |
| 1648 | // The @as here is a workaround for #7950 | 1648 | // The @as here is a workaround for #7950 |
| 1649 | return @bitCast(i1, @as(u1, @boolToInt(value))); | 1649 | return @bitCast(i1, @as(u1, @intFromBool(value))); |
| 1650 | } | 1650 | } |
| 1651 | 1651 | ||
| 1652 | return -%@intCast(MaskInt, @boolToInt(value)); | 1652 | return -%@intCast(MaskInt, @intFromBool(value)); |
| 1653 | } | 1653 | } |
| 1654 | 1654 | ||
| 1655 | test "boolMask" { | 1655 | test "boolMask" { |
| ... | @@ -1708,8 +1708,8 @@ pub fn break_f80(x: f80) F80 { | ... | @@ -1708,8 +1708,8 @@ pub fn break_f80(x: f80) F80 { |
| 1708 | pub inline fn sign(i: anytype) @TypeOf(i) { | 1708 | pub inline fn sign(i: anytype) @TypeOf(i) { |
| 1709 | const T = @TypeOf(i); | 1709 | const T = @TypeOf(i); |
| 1710 | return switch (@typeInfo(T)) { | 1710 | return switch (@typeInfo(T)) { |
| 1711 | .Int, .ComptimeInt => @as(T, @boolToInt(i > 0)) - @as(T, @boolToInt(i < 0)), | 1711 | .Int, .ComptimeInt => @as(T, @intFromBool(i > 0)) - @as(T, @intFromBool(i < 0)), |
| 1712 | .Float, .ComptimeFloat => @intToFloat(T, @boolToInt(i > 0)) - @intToFloat(T, @boolToInt(i < 0)), | 1712 | .Float, .ComptimeFloat => @floatFromInt(T, @intFromBool(i > 0)) - @floatFromInt(T, @intFromBool(i < 0)), |
| 1713 | .Vector => |vinfo| blk: { | 1713 | .Vector => |vinfo| blk: { |
| 1714 | switch (@typeInfo(vinfo.child)) { | 1714 | switch (@typeInfo(vinfo.child)) { |
| 1715 | .Int, .Float => { | 1715 | .Int, .Float => { |
lib/std/math/big/int.zig+9-9| ... | @@ -1127,7 +1127,7 @@ pub const Mutable = struct { | ... | @@ -1127,7 +1127,7 @@ pub const Mutable = struct { |
| 1127 | return; | 1127 | return; |
| 1128 | } | 1128 | } |
| 1129 | 1129 | ||
| 1130 | const checkbit = bit_count - shift - @boolToInt(signedness == .signed); | 1130 | const checkbit = bit_count - shift - @intFromBool(signedness == .signed); |
| 1131 | // If `checkbit` and more significant bits are zero, no overflow will take place. | 1131 | // If `checkbit` and more significant bits are zero, no overflow will take place. |
| 1132 | 1132 | ||
| 1133 | if (checkbit >= a.limbs.len * limb_bits) { | 1133 | if (checkbit >= a.limbs.len * limb_bits) { |
| ... | @@ -1274,10 +1274,10 @@ pub const Mutable = struct { | ... | @@ -1274,10 +1274,10 @@ pub const Mutable = struct { |
| 1274 | 1274 | ||
| 1275 | if (a.limbs.len > b.limbs.len) { | 1275 | if (a.limbs.len > b.limbs.len) { |
| 1276 | r.positive = llsignedxor(r.limbs, a.limbs, a.positive, b.limbs, b.positive); | 1276 | r.positive = llsignedxor(r.limbs, a.limbs, a.positive, b.limbs, b.positive); |
| 1277 | r.normalize(a.limbs.len + @boolToInt(a.positive != b.positive)); | 1277 | r.normalize(a.limbs.len + @intFromBool(a.positive != b.positive)); |
| 1278 | } else { | 1278 | } else { |
| 1279 | r.positive = llsignedxor(r.limbs, b.limbs, b.positive, a.limbs, a.positive); | 1279 | r.positive = llsignedxor(r.limbs, b.limbs, b.positive, a.limbs, a.positive); |
| 1280 | r.normalize(b.limbs.len + @boolToInt(a.positive != b.positive)); | 1280 | r.normalize(b.limbs.len + @intFromBool(a.positive != b.positive)); |
| 1281 | } | 1281 | } |
| 1282 | } | 1282 | } |
| 1283 | 1283 | ||
| ... | @@ -2128,7 +2128,7 @@ pub const Const = struct { | ... | @@ -2128,7 +2128,7 @@ pub const Const = struct { |
| 2128 | return false; | 2128 | return false; |
| 2129 | } | 2129 | } |
| 2130 | 2130 | ||
| 2131 | const req_bits = self.bitCountTwosComp() + @boolToInt(self.positive and signedness == .signed); | 2131 | const req_bits = self.bitCountTwosComp() + @intFromBool(self.positive and signedness == .signed); |
| 2132 | return bit_count >= req_bits; | 2132 | return bit_count >= req_bits; |
| 2133 | } | 2133 | } |
| 2134 | 2134 | ||
| ... | @@ -2143,7 +2143,7 @@ pub const Const = struct { | ... | @@ -2143,7 +2143,7 @@ pub const Const = struct { |
| 2143 | /// value. It is inexact and may exceed the given value by ~1-2 bytes. | 2143 | /// value. It is inexact and may exceed the given value by ~1-2 bytes. |
| 2144 | /// TODO See if we can make this exact. | 2144 | /// TODO See if we can make this exact. |
| 2145 | pub fn sizeInBaseUpperBound(self: Const, base: usize) usize { | 2145 | pub fn sizeInBaseUpperBound(self: Const, base: usize) usize { |
| 2146 | const bit_count = @as(usize, @boolToInt(!self.positive)) + self.bitCountAbs(); | 2146 | const bit_count = @as(usize, @intFromBool(!self.positive)) + self.bitCountAbs(); |
| 2147 | return (bit_count / math.log2(base)) + 2; | 2147 | return (bit_count / math.log2(base)) + 2; |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
| ... | @@ -3143,7 +3143,7 @@ pub const Managed = struct { | ... | @@ -3143,7 +3143,7 @@ pub const Managed = struct { |
| 3143 | 3143 | ||
| 3144 | /// r = a ^ b | 3144 | /// r = a ^ b |
| 3145 | pub fn bitXor(r: *Managed, a: *const Managed, b: *const Managed) !void { | 3145 | pub fn bitXor(r: *Managed, a: *const Managed, b: *const Managed) !void { |
| 3146 | var cap = @max(a.len(), b.len()) + @boolToInt(a.isPositive() != b.isPositive()); | 3146 | var cap = @max(a.len(), b.len()) + @intFromBool(a.isPositive() != b.isPositive()); |
| 3147 | try r.ensureCapacity(cap); | 3147 | try r.ensureCapacity(cap); |
| 3148 | 3148 | ||
| 3149 | var m = r.toMutable(); | 3149 | var m = r.toMutable(); |
| ... | @@ -4048,9 +4048,9 @@ fn llsignedxor(r: []Limb, a: []const Limb, a_positive: bool, b: []const Limb, b_ | ... | @@ -4048,9 +4048,9 @@ fn llsignedxor(r: []Limb, a: []const Limb, a_positive: bool, b: []const Limb, b_ |
| 4048 | // - if the result is supposed to be negative, add 1. | 4048 | // - if the result is supposed to be negative, add 1. |
| 4049 | 4049 | ||
| 4050 | var i: usize = 0; | 4050 | var i: usize = 0; |
| 4051 | var a_borrow = @boolToInt(!a_positive); | 4051 | var a_borrow = @intFromBool(!a_positive); |
| 4052 | var b_borrow = @boolToInt(!b_positive); | 4052 | var b_borrow = @intFromBool(!b_positive); |
| 4053 | var r_carry = @boolToInt(a_positive != b_positive); | 4053 | var r_carry = @intFromBool(a_positive != b_positive); |
| 4054 | 4054 | ||
| 4055 | while (i < b.len) : (i += 1) { | 4055 | while (i < b.len) : (i += 1) { |
| 4056 | const ov1 = @subWithOverflow(a[i], a_borrow); | 4056 | const ov1 = @subWithOverflow(a[i], a_borrow); |
lib/std/math/big/rational.zig+3-3| ... | @@ -276,7 +276,7 @@ pub const Rational = struct { | ... | @@ -276,7 +276,7 @@ pub const Rational = struct { |
| 276 | } | 276 | } |
| 277 | mantissa >>= 1; | 277 | mantissa >>= 1; |
| 278 | 278 | ||
| 279 | const f = math.scalbn(@intToFloat(T, mantissa), @intCast(i32, exp - msize1)); | 279 | const f = math.scalbn(@floatFromInt(T, mantissa), @intCast(i32, exp - msize1)); |
| 280 | if (math.isInf(f)) { | 280 | if (math.isInf(f)) { |
| 281 | exact = false; | 281 | exact = false; |
| 282 | } | 282 | } |
| ... | @@ -289,7 +289,7 @@ pub const Rational = struct { | ... | @@ -289,7 +289,7 @@ pub const Rational = struct { |
| 289 | try self.p.set(p); | 289 | try self.p.set(p); |
| 290 | try self.q.set(q); | 290 | try self.q.set(q); |
| 291 | 291 | ||
| 292 | self.p.setSign(@boolToInt(self.p.isPositive()) ^ @boolToInt(self.q.isPositive()) == 0); | 292 | self.p.setSign(@intFromBool(self.p.isPositive()) ^ @intFromBool(self.q.isPositive()) == 0); |
| 293 | self.q.setSign(true); | 293 | self.q.setSign(true); |
| 294 | 294 | ||
| 295 | try self.reduce(); | 295 | try self.reduce(); |
| ... | @@ -310,7 +310,7 @@ pub const Rational = struct { | ... | @@ -310,7 +310,7 @@ pub const Rational = struct { |
| 310 | try self.p.copy(a.toConst()); | 310 | try self.p.copy(a.toConst()); |
| 311 | try self.q.copy(b.toConst()); | 311 | try self.q.copy(b.toConst()); |
| 312 | 312 | ||
| 313 | self.p.setSign(@boolToInt(self.p.isPositive()) ^ @boolToInt(self.q.isPositive()) == 0); | 313 | self.p.setSign(@intFromBool(self.p.isPositive()) ^ @intFromBool(self.q.isPositive()) == 0); |
| 314 | self.q.setSign(true); | 314 | self.q.setSign(true); |
| 315 | 315 | ||
| 316 | try self.reduce(); | 316 | try self.reduce(); |
lib/std/math/complex/atan.zig+2-2| ... | @@ -32,7 +32,7 @@ fn redupif32(x: f32) f32 { | ... | @@ -32,7 +32,7 @@ fn redupif32(x: f32) f32 { |
| 32 | t -= 0.5; | 32 | t -= 0.5; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | const u = @intToFloat(f32, @floatToInt(i32, t)); | 35 | const u = @floatFromInt(f32, @intFromFloat(i32, t)); |
| 36 | return ((x - u * DP1) - u * DP2) - t * DP3; | 36 | return ((x - u * DP1) - u * DP2) - t * DP3; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| ... | @@ -81,7 +81,7 @@ fn redupif64(x: f64) f64 { | ... | @@ -81,7 +81,7 @@ fn redupif64(x: f64) f64 { |
| 81 | t -= 0.5; | 81 | t -= 0.5; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | const u = @intToFloat(f64, @floatToInt(i64, t)); | 84 | const u = @floatFromInt(f64, @intFromFloat(i64, t)); |
| 85 | return ((x - u * DP1) - u * DP2) - t * DP3; | 85 | return ((x - u * DP1) - u * DP2) - t * DP3; |
| 86 | } | 86 | } |
| 87 | 87 |
lib/std/math/expm1.zig+4-4| ... | @@ -88,8 +88,8 @@ fn expm1_32(x_: f32) f32 { | ... | @@ -88,8 +88,8 @@ fn expm1_32(x_: f32) f32 { |
| 88 | kf += 0.5; | 88 | kf += 0.5; |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | k = @floatToInt(i32, kf); | 91 | k = @intFromFloat(i32, kf); |
| 92 | const t = @intToFloat(f32, k); | 92 | const t = @floatFromInt(f32, k); |
| 93 | hi = x - t * ln2_hi; | 93 | hi = x - t * ln2_hi; |
| 94 | lo = t * ln2_lo; | 94 | lo = t * ln2_lo; |
| 95 | } | 95 | } |
| ... | @@ -219,8 +219,8 @@ fn expm1_64(x_: f64) f64 { | ... | @@ -219,8 +219,8 @@ fn expm1_64(x_: f64) f64 { |
| 219 | kf += 0.5; | 219 | kf += 0.5; |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | k = @floatToInt(i32, kf); | 222 | k = @intFromFloat(i32, kf); |
| 223 | const t = @intToFloat(f64, k); | 223 | const t = @floatFromInt(f64, k); |
| 224 | hi = x - t * ln2_hi; | 224 | hi = x - t * ln2_hi; |
| 225 | lo = t * ln2_lo; | 225 | lo = t * ln2_lo; |
| 226 | } | 226 | } |
lib/std/math/ilogb.zig+1-1| ... | @@ -48,7 +48,7 @@ fn ilogbX(comptime T: type, x: T) i32 { | ... | @@ -48,7 +48,7 @@ fn ilogbX(comptime T: type, x: T) i32 { |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | // offset sign bit, exponent bits, and integer bit (if present) + bias | 50 | // offset sign bit, exponent bits, and integer bit (if present) + bias |
| 51 | const offset = 1 + exponentBits + @as(comptime_int, @boolToInt(T == f80)) - exponentBias; | 51 | const offset = 1 + exponentBits + @as(comptime_int, @intFromBool(T == f80)) - exponentBias; |
| 52 | return offset - @intCast(i32, @clz(u)); | 52 | return offset - @intCast(i32, @clz(u)); |
| 53 | } | 53 | } |
| 54 | 54 |
lib/std/math/ldexp.zig+3-3| ... | @@ -24,7 +24,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { | ... | @@ -24,7 +24,7 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { |
| 24 | 24 | ||
| 25 | var exponent: i32 = @intCast(i32, (repr << 1) >> (mantissa_bits + 1)); | 25 | var exponent: i32 = @intCast(i32, (repr << 1) >> (mantissa_bits + 1)); |
| 26 | if (exponent == 0) | 26 | if (exponent == 0) |
| 27 | exponent += (@as(i32, exponent_bits) + @boolToInt(T == f80)) - @clz(repr << 1); | 27 | exponent += (@as(i32, exponent_bits) + @intFromBool(T == f80)) - @clz(repr << 1); |
| 28 | 28 | ||
| 29 | if (n >= 0) { | 29 | if (n >= 0) { |
| 30 | if (n > max_biased_exponent - exponent) { | 30 | if (n > max_biased_exponent - exponent) { |
| ... | @@ -53,11 +53,11 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { | ... | @@ -53,11 +53,11 @@ pub fn ldexp(x: anytype, n: i32) @TypeOf(x) { |
| 53 | var result = repr & mantissa_mask; | 53 | var result = repr & mantissa_mask; |
| 54 | 54 | ||
| 55 | if (T != f80) // Include integer bit | 55 | if (T != f80) // Include integer bit |
| 56 | result |= @as(TBits, @boolToInt(exponent > 0)) << fractional_bits; | 56 | result |= @as(TBits, @intFromBool(exponent > 0)) << fractional_bits; |
| 57 | result = @intCast(TBits, (result >> (shift - 1))); | 57 | result = @intCast(TBits, (result >> (shift - 1))); |
| 58 | 58 | ||
| 59 | // Round result, including round-to-even for exact ties | 59 | // Round result, including round-to-even for exact ties |
| 60 | result = ((result + 1) >> 1) & ~@as(TBits, @boolToInt(exact_tie)); | 60 | result = ((result + 1) >> 1) & ~@as(TBits, @intFromBool(exact_tie)); |
| 61 | return @bitCast(T, result | sign_bit); | 61 | return @bitCast(T, result | sign_bit); |
| 62 | } | 62 | } |
| 63 | 63 |
lib/std/math/log.zig+1-1| ... | @@ -30,7 +30,7 @@ pub fn log(comptime T: type, base: T, x: T) T { | ... | @@ -30,7 +30,7 @@ pub fn log(comptime T: type, base: T, x: T) T { |
| 30 | // TODO implement integer log without using float math | 30 | // TODO implement integer log without using float math |
| 31 | .Int => |IntType| switch (IntType.signedness) { | 31 | .Int => |IntType| switch (IntType.signedness) { |
| 32 | .signed => @compileError("log not implemented for signed integers"), | 32 | .signed => @compileError("log not implemented for signed integers"), |
| 33 | .unsigned => return @floatToInt(T, @floor(@log(@intToFloat(f64, x)) / @log(float_base))), | 33 | .unsigned => return @intFromFloat(T, @floor(@log(@floatFromInt(f64, x)) / @log(float_base))), |
| 34 | }, | 34 | }, |
| 35 | 35 | ||
| 36 | .Float => { | 36 | .Float => { |
lib/std/math/log10.zig+1-1| ... | @@ -134,7 +134,7 @@ inline fn less_than_5(x: u32) u32 { | ... | @@ -134,7 +134,7 @@ inline fn less_than_5(x: u32) u32 { |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | fn oldlog10(x: anytype) u8 { | 136 | fn oldlog10(x: anytype) u8 { |
| 137 | return @floatToInt(u8, @log10(@intToFloat(f64, x))); | 137 | return @intFromFloat(u8, @log10(@floatFromInt(f64, x))); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | test "oldlog10 doesn't work" { | 140 | test "oldlog10 doesn't work" { |
lib/std/math/log1p.zig+2-2| ... | @@ -96,7 +96,7 @@ fn log1p_32(x: f32) f32 { | ... | @@ -96,7 +96,7 @@ fn log1p_32(x: f32) f32 { |
| 96 | const t2 = z * (Lg1 + w * Lg3); | 96 | const t2 = z * (Lg1 + w * Lg3); |
| 97 | const R = t2 + t1; | 97 | const R = t2 + t1; |
| 98 | const hfsq = 0.5 * f * f; | 98 | const hfsq = 0.5 * f * f; |
| 99 | const dk = @intToFloat(f32, k); | 99 | const dk = @floatFromInt(f32, k); |
| 100 | 100 | ||
| 101 | return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi; | 101 | return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi; |
| 102 | } | 102 | } |
| ... | @@ -176,7 +176,7 @@ fn log1p_64(x: f64) f64 { | ... | @@ -176,7 +176,7 @@ fn log1p_64(x: f64) f64 { |
| 176 | const t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); | 176 | const t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); |
| 177 | const t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); | 177 | const t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); |
| 178 | const R = t2 + t1; | 178 | const R = t2 + t1; |
| 179 | const dk = @intToFloat(f64, k); | 179 | const dk = @floatFromInt(f64, k); |
| 180 | 180 | ||
| 181 | return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi; | 181 | return s * (hfsq + R) + (dk * ln2_lo + c) - hfsq + f + dk * ln2_hi; |
| 182 | } | 182 | } |
lib/std/math/pow.zig+2-2| ... | @@ -144,7 +144,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { | ... | @@ -144,7 +144,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { |
| 144 | var xe = r2.exponent; | 144 | var xe = r2.exponent; |
| 145 | var x1 = r2.significand; | 145 | var x1 = r2.significand; |
| 146 | 146 | ||
| 147 | var i = @floatToInt(std.meta.Int(.signed, @typeInfo(T).Float.bits), yi); | 147 | var i = @intFromFloat(std.meta.Int(.signed, @typeInfo(T).Float.bits), yi); |
| 148 | while (i != 0) : (i >>= 1) { | 148 | while (i != 0) : (i >>= 1) { |
| 149 | const overflow_shift = math.floatExponentBits(T) + 1; | 149 | const overflow_shift = math.floatExponentBits(T) + 1; |
| 150 | if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) { | 150 | if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) { |
| ... | @@ -179,7 +179,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { | ... | @@ -179,7 +179,7 @@ pub fn pow(comptime T: type, x: T, y: T) T { |
| 179 | 179 | ||
| 180 | fn isOddInteger(x: f64) bool { | 180 | fn isOddInteger(x: f64) bool { |
| 181 | const r = math.modf(x); | 181 | const r = math.modf(x); |
| 182 | return r.fpart == 0.0 and @floatToInt(i64, r.ipart) & 1 == 1; | 182 | return r.fpart == 0.0 and @intFromFloat(i64, r.ipart) & 1 == 1; |
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | test "math.pow" { | 185 | test "math.pow" { |
lib/std/mem.zig+11-11| ... | @@ -73,7 +73,7 @@ pub fn ValidationAllocator(comptime T: type) type { | ... | @@ -73,7 +73,7 @@ pub fn ValidationAllocator(comptime T: type) type { |
| 73 | const underlying = self.getUnderlyingAllocatorPtr(); | 73 | const underlying = self.getUnderlyingAllocatorPtr(); |
| 74 | const result = underlying.rawAlloc(n, log2_ptr_align, ret_addr) orelse | 74 | const result = underlying.rawAlloc(n, log2_ptr_align, ret_addr) orelse |
| 75 | return null; | 75 | return null; |
| 76 | assert(mem.isAlignedLog2(@ptrToInt(result), log2_ptr_align)); | 76 | assert(mem.isAlignedLog2(@intFromPtr(result), log2_ptr_align)); |
| 77 | return result; | 77 | return result; |
| 78 | } | 78 | } |
| 79 | 79 | ||
| ... | @@ -185,7 +185,7 @@ test "Allocator.resize" { | ... | @@ -185,7 +185,7 @@ test "Allocator.resize" { |
| 185 | var values = try testing.allocator.alloc(T, 100); | 185 | var values = try testing.allocator.alloc(T, 100); |
| 186 | defer testing.allocator.free(values); | 186 | defer testing.allocator.free(values); |
| 187 | 187 | ||
| 188 | for (values, 0..) |*v, i| v.* = @intToFloat(T, i); | 188 | for (values, 0..) |*v, i| v.* = @floatFromInt(T, i); |
| 189 | if (!testing.allocator.resize(values, values.len + 10)) return error.OutOfMemory; | 189 | if (!testing.allocator.resize(values, values.len + 10)) return error.OutOfMemory; |
| 190 | values = values.ptr[0 .. values.len + 10]; | 190 | values = values.ptr[0 .. values.len + 10]; |
| 191 | try testing.expect(values.len == 110); | 191 | try testing.expect(values.len == 110); |
| ... | @@ -233,7 +233,7 @@ pub fn zeroes(comptime T: type) T { | ... | @@ -233,7 +233,7 @@ pub fn zeroes(comptime T: type) T { |
| 233 | return @as(T, 0); | 233 | return @as(T, 0); |
| 234 | }, | 234 | }, |
| 235 | .Enum, .EnumLiteral => { | 235 | .Enum, .EnumLiteral => { |
| 236 | return @intToEnum(T, 0); | 236 | return @enumFromInt(T, 0); |
| 237 | }, | 237 | }, |
| 238 | .Void => { | 238 | .Void => { |
| 239 | return {}; | 239 | return {}; |
| ... | @@ -1374,7 +1374,7 @@ pub fn readVarPackedInt( | ... | @@ -1374,7 +1374,7 @@ pub fn readVarPackedInt( |
| 1374 | const value = if (read_size == 1) b: { | 1374 | const value = if (read_size == 1) b: { |
| 1375 | break :b @truncate(uN, read_bytes[0] >> bit_shift); | 1375 | break :b @truncate(uN, read_bytes[0] >> bit_shift); |
| 1376 | } else b: { | 1376 | } else b: { |
| 1377 | const i: u1 = @boolToInt(endian == .Big); | 1377 | const i: u1 = @intFromBool(endian == .Big); |
| 1378 | const head = @truncate(uN, read_bytes[i] >> bit_shift); | 1378 | const head = @truncate(uN, read_bytes[i] >> bit_shift); |
| 1379 | const tail_shift = @intCast(Log2N, @as(u4, 8) - bit_shift); | 1379 | const tail_shift = @intCast(Log2N, @as(u4, 8) - bit_shift); |
| 1380 | const tail = @truncate(uN, read_bytes[1 - i]); | 1380 | const tail = @truncate(uN, read_bytes[1 - i]); |
| ... | @@ -3778,7 +3778,7 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize { | ... | @@ -3778,7 +3778,7 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize { |
| 3778 | return 0; | 3778 | return 0; |
| 3779 | 3779 | ||
| 3780 | // Calculate the aligned base address with an eye out for overflow. | 3780 | // Calculate the aligned base address with an eye out for overflow. |
| 3781 | const addr = @ptrToInt(ptr); | 3781 | const addr = @intFromPtr(ptr); |
| 3782 | var ov = @addWithOverflow(addr, align_to - 1); | 3782 | var ov = @addWithOverflow(addr, align_to - 1); |
| 3783 | if (ov[1] != 0) return null; | 3783 | if (ov[1] != 0) return null; |
| 3784 | ov[0] &= ~@as(usize, align_to - 1); | 3784 | ov[0] &= ~@as(usize, align_to - 1); |
| ... | @@ -3800,16 +3800,16 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize { | ... | @@ -3800,16 +3800,16 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize { |
| 3800 | pub fn alignPointer(ptr: anytype, align_to: usize) ?@TypeOf(ptr) { | 3800 | pub fn alignPointer(ptr: anytype, align_to: usize) ?@TypeOf(ptr) { |
| 3801 | const adjust_off = alignPointerOffset(ptr, align_to) orelse return null; | 3801 | const adjust_off = alignPointerOffset(ptr, align_to) orelse return null; |
| 3802 | const T = @TypeOf(ptr); | 3802 | const T = @TypeOf(ptr); |
| 3803 | // Avoid the use of intToPtr to avoid losing the pointer provenance info. | 3803 | // Avoid the use of ptrFromInt to avoid losing the pointer provenance info. |
| 3804 | return @alignCast(@typeInfo(T).Pointer.alignment, ptr + adjust_off); | 3804 | return @alignCast(@typeInfo(T).Pointer.alignment, ptr + adjust_off); |
| 3805 | } | 3805 | } |
| 3806 | 3806 | ||
| 3807 | test "alignPointer" { | 3807 | test "alignPointer" { |
| 3808 | const S = struct { | 3808 | const S = struct { |
| 3809 | fn checkAlign(comptime T: type, base: usize, align_to: usize, expected: usize) !void { | 3809 | fn checkAlign(comptime T: type, base: usize, align_to: usize, expected: usize) !void { |
| 3810 | var ptr = @intToPtr(T, base); | 3810 | var ptr = @ptrFromInt(T, base); |
| 3811 | var aligned = alignPointer(ptr, align_to); | 3811 | var aligned = alignPointer(ptr, align_to); |
| 3812 | try testing.expectEqual(expected, @ptrToInt(aligned)); | 3812 | try testing.expectEqual(expected, @intFromPtr(aligned)); |
| 3813 | } | 3813 | } |
| 3814 | }; | 3814 | }; |
| 3815 | 3815 | ||
| ... | @@ -4236,8 +4236,8 @@ pub fn doNotOptimizeAway(val: anytype) void { | ... | @@ -4236,8 +4236,8 @@ pub fn doNotOptimizeAway(val: anytype) void { |
| 4236 | const t = @typeInfo(@TypeOf(val)); | 4236 | const t = @typeInfo(@TypeOf(val)); |
| 4237 | switch (t) { | 4237 | switch (t) { |
| 4238 | .Void, .Null, .ComptimeInt, .ComptimeFloat => return, | 4238 | .Void, .Null, .ComptimeInt, .ComptimeFloat => return, |
| 4239 | .Enum => doNotOptimizeAway(@enumToInt(val)), | 4239 | .Enum => doNotOptimizeAway(@intFromEnum(val)), |
| 4240 | .Bool => doNotOptimizeAway(@boolToInt(val)), | 4240 | .Bool => doNotOptimizeAway(@intFromBool(val)), |
| 4241 | .Int => { | 4241 | .Int => { |
| 4242 | const bits = t.Int.bits; | 4242 | const bits = t.Int.bits; |
| 4243 | if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) { | 4243 | if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) { |
| ... | @@ -4425,7 +4425,7 @@ fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) t | ... | @@ -4425,7 +4425,7 @@ fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) t |
| 4425 | /// Returns the largest slice in the given bytes that conforms to the new alignment, | 4425 | /// Returns the largest slice in the given bytes that conforms to the new alignment, |
| 4426 | /// or `null` if the given bytes contain no conforming address. | 4426 | /// or `null` if the given bytes contain no conforming address. |
| 4427 | pub fn alignInBytes(bytes: []u8, comptime new_alignment: usize) ?[]align(new_alignment) u8 { | 4427 | pub fn alignInBytes(bytes: []u8, comptime new_alignment: usize) ?[]align(new_alignment) u8 { |
| 4428 | const begin_address = @ptrToInt(bytes.ptr); | 4428 | const begin_address = @intFromPtr(bytes.ptr); |
| 4429 | const end_address = begin_address + bytes.len; | 4429 | const end_address = begin_address + bytes.len; |
| 4430 | 4430 | ||
| 4431 | const begin_address_aligned = mem.alignForward(usize, begin_address, new_alignment); | 4431 | const begin_address_aligned = mem.alignForward(usize, begin_address, new_alignment); |
lib/std/mem/Allocator.zig+4-4| ... | @@ -101,7 +101,7 @@ pub inline fn rawFree(self: Allocator, buf: []u8, log2_buf_align: u8, ret_addr: | ... | @@ -101,7 +101,7 @@ pub inline fn rawFree(self: Allocator, buf: []u8, log2_buf_align: u8, ret_addr: |
| 101 | /// Returns a pointer to undefined memory. | 101 | /// Returns a pointer to undefined memory. |
| 102 | /// Call `destroy` with the result to free the memory. | 102 | /// Call `destroy` with the result to free the memory. |
| 103 | pub fn create(self: Allocator, comptime T: type) Error!*T { | 103 | pub fn create(self: Allocator, comptime T: type) Error!*T { |
| 104 | if (@sizeOf(T) == 0) return @intToPtr(*T, math.maxInt(usize)); | 104 | if (@sizeOf(T) == 0) return @ptrFromInt(*T, math.maxInt(usize)); |
| 105 | const slice = try self.allocAdvancedWithRetAddr(T, null, 1, @returnAddress()); | 105 | const slice = try self.allocAdvancedWithRetAddr(T, null, 1, @returnAddress()); |
| 106 | return &slice[0]; | 106 | return &slice[0]; |
| 107 | } | 107 | } |
| ... | @@ -209,7 +209,7 @@ pub fn allocAdvancedWithRetAddr( | ... | @@ -209,7 +209,7 @@ pub fn allocAdvancedWithRetAddr( |
| 209 | 209 | ||
| 210 | if (n == 0) { | 210 | if (n == 0) { |
| 211 | const ptr = comptime std.mem.alignBackward(usize, math.maxInt(usize), a); | 211 | const ptr = comptime std.mem.alignBackward(usize, math.maxInt(usize), a); |
| 212 | return @intToPtr([*]align(a) T, ptr)[0..0]; | 212 | return @ptrFromInt([*]align(a) T, ptr)[0..0]; |
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | const byte_count = math.mul(usize, @sizeOf(T), n) catch return Error.OutOfMemory; | 215 | const byte_count = math.mul(usize, @sizeOf(T), n) catch return Error.OutOfMemory; |
| ... | @@ -268,13 +268,13 @@ pub fn reallocAdvanced( | ... | @@ -268,13 +268,13 @@ pub fn reallocAdvanced( |
| 268 | if (new_n == 0) { | 268 | if (new_n == 0) { |
| 269 | self.free(old_mem); | 269 | self.free(old_mem); |
| 270 | const ptr = comptime std.mem.alignBackward(usize, math.maxInt(usize), Slice.alignment); | 270 | const ptr = comptime std.mem.alignBackward(usize, math.maxInt(usize), Slice.alignment); |
| 271 | return @intToPtr([*]align(Slice.alignment) T, ptr)[0..0]; | 271 | return @ptrFromInt([*]align(Slice.alignment) T, ptr)[0..0]; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | const old_byte_slice = mem.sliceAsBytes(old_mem); | 274 | const old_byte_slice = mem.sliceAsBytes(old_mem); |
| 275 | const byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory; | 275 | const byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory; |
| 276 | // Note: can't set shrunk memory to undefined as memory shouldn't be modified on realloc failure | 276 | // Note: can't set shrunk memory to undefined as memory shouldn't be modified on realloc failure |
| 277 | if (mem.isAligned(@ptrToInt(old_byte_slice.ptr), Slice.alignment)) { | 277 | if (mem.isAligned(@intFromPtr(old_byte_slice.ptr), Slice.alignment)) { |
| 278 | if (self.rawResize(old_byte_slice, log2a(Slice.alignment), byte_count, return_address)) { | 278 | if (self.rawResize(old_byte_slice, log2a(Slice.alignment), byte_count, return_address)) { |
| 279 | return mem.bytesAsSlice(T, @alignCast(Slice.alignment, old_byte_slice.ptr[0..byte_count])); | 279 | return mem.bytesAsSlice(T, @alignCast(Slice.alignment, old_byte_slice.ptr[0..byte_count])); |
| 280 | } | 280 | } |
lib/std/meta.zig+6-6| ... | @@ -453,7 +453,7 @@ pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeIn | ... | @@ -453,7 +453,7 @@ pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeIn |
| 453 | .Enum => Type.EnumField, | 453 | .Enum => Type.EnumField, |
| 454 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), | 454 | else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"), |
| 455 | } { | 455 | } { |
| 456 | return fields(T)[@enumToInt(field)]; | 456 | return fields(T)[@intFromEnum(field)]; |
| 457 | } | 457 | } |
| 458 | 458 | ||
| 459 | test "std.meta.fieldInfo" { | 459 | test "std.meta.fieldInfo" { |
| ... | @@ -591,7 +591,7 @@ pub fn FieldEnum(comptime T: type) type { | ... | @@ -591,7 +591,7 @@ pub fn FieldEnum(comptime T: type) type { |
| 591 | if (@typeInfo(T) == .Union) { | 591 | if (@typeInfo(T) == .Union) { |
| 592 | if (@typeInfo(T).Union.tag_type) |tag_type| { | 592 | if (@typeInfo(T).Union.tag_type) |tag_type| { |
| 593 | for (std.enums.values(tag_type), 0..) |v, i| { | 593 | for (std.enums.values(tag_type), 0..) |v, i| { |
| 594 | if (@enumToInt(v) != i) break; // enum values not consecutive | 594 | if (@intFromEnum(v) != i) break; // enum values not consecutive |
| 595 | if (!std.mem.eql(u8, @tagName(v), field_infos[i].name)) break; // fields out of order | 595 | if (!std.mem.eql(u8, @tagName(v), field_infos[i].name)) break; // fields out of order |
| 596 | } else { | 596 | } else { |
| 597 | return tag_type; | 597 | return tag_type; |
| ... | @@ -929,8 +929,8 @@ test "intToEnum with error return" { | ... | @@ -929,8 +929,8 @@ test "intToEnum with error return" { |
| 929 | try testing.expect(intToEnum(E1, zero) catch unreachable == E1.A); | 929 | try testing.expect(intToEnum(E1, zero) catch unreachable == E1.A); |
| 930 | try testing.expect(intToEnum(E2, one) catch unreachable == E2.B); | 930 | try testing.expect(intToEnum(E2, one) catch unreachable == E2.B); |
| 931 | try testing.expect(intToEnum(E3, zero) catch unreachable == E3.A); | 931 | try testing.expect(intToEnum(E3, zero) catch unreachable == E3.A); |
| 932 | try testing.expect(intToEnum(E3, 127) catch unreachable == @intToEnum(E3, 127)); | 932 | try testing.expect(intToEnum(E3, 127) catch unreachable == @enumFromInt(E3, 127)); |
| 933 | try testing.expect(intToEnum(E3, -128) catch unreachable == @intToEnum(E3, -128)); | 933 | try testing.expect(intToEnum(E3, -128) catch unreachable == @enumFromInt(E3, -128)); |
| 934 | try testing.expectError(error.InvalidEnumTag, intToEnum(E1, one)); | 934 | try testing.expectError(error.InvalidEnumTag, intToEnum(E1, one)); |
| 935 | try testing.expectError(error.InvalidEnumTag, intToEnum(E3, 128)); | 935 | try testing.expectError(error.InvalidEnumTag, intToEnum(E3, 128)); |
| 936 | try testing.expectError(error.InvalidEnumTag, intToEnum(E3, -129)); | 936 | try testing.expectError(error.InvalidEnumTag, intToEnum(E3, -129)); |
| ... | @@ -943,14 +943,14 @@ pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTa | ... | @@ -943,14 +943,14 @@ pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTa |
| 943 | 943 | ||
| 944 | if (!enum_info.is_exhaustive) { | 944 | if (!enum_info.is_exhaustive) { |
| 945 | if (std.math.cast(enum_info.tag_type, tag_int)) |tag| { | 945 | if (std.math.cast(enum_info.tag_type, tag_int)) |tag| { |
| 946 | return @intToEnum(EnumTag, tag); | 946 | return @enumFromInt(EnumTag, tag); |
| 947 | } | 947 | } |
| 948 | return error.InvalidEnumTag; | 948 | return error.InvalidEnumTag; |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | inline for (enum_info.fields) |f| { | 951 | inline for (enum_info.fields) |f| { |
| 952 | const this_tag_value = @field(EnumTag, f.name); | 952 | const this_tag_value = @field(EnumTag, f.name); |
| 953 | if (tag_int == @enumToInt(this_tag_value)) { | 953 | if (tag_int == @intFromEnum(this_tag_value)) { |
| 954 | return this_tag_value; | 954 | return this_tag_value; |
| 955 | } | 955 | } |
| 956 | } | 956 | } |
lib/std/meta/trailer_flags.zig+5-5| ... | @@ -43,7 +43,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -43,7 +43,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 43 | pub const Self = @This(); | 43 | pub const Self = @This(); |
| 44 | 44 | ||
| 45 | pub fn has(self: Self, comptime field: FieldEnum) bool { | 45 | pub fn has(self: Self, comptime field: FieldEnum) bool { |
| 46 | const field_index = @enumToInt(field); | 46 | const field_index = @intFromEnum(field); |
| 47 | return (self.bits & (1 << field_index)) != 0; | 47 | return (self.bits & (1 << field_index)) != 0; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| ... | @@ -54,7 +54,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -54,7 +54,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | pub fn setFlag(self: *Self, comptime field: FieldEnum) void { | 56 | pub fn setFlag(self: *Self, comptime field: FieldEnum) void { |
| 57 | const field_index = @enumToInt(field); | 57 | const field_index = @intFromEnum(field); |
| 58 | self.bits |= 1 << field_index; | 58 | self.bits |= 1 << field_index; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| ... | @@ -72,7 +72,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -72,7 +72,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 72 | pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void { | 72 | pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void { |
| 73 | inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| { | 73 | inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| { |
| 74 | if (@field(fields, field.name)) |value| | 74 | if (@field(fields, field.name)) |value| |
| 75 | self.set(p, @intToEnum(FieldEnum, i), value); | 75 | self.set(p, @enumFromInt(FieldEnum, i), value); |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | 78 | ||
| ... | @@ -103,7 +103,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -103,7 +103,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 103 | var off: usize = 0; | 103 | var off: usize = 0; |
| 104 | inline for (@typeInfo(Fields).Struct.fields, 0..) |field_info, i| { | 104 | inline for (@typeInfo(Fields).Struct.fields, 0..) |field_info, i| { |
| 105 | const active = (self.bits & (1 << i)) != 0; | 105 | const active = (self.bits & (1 << i)) != 0; |
| 106 | if (i == @enumToInt(field)) { | 106 | if (i == @intFromEnum(field)) { |
| 107 | assert(active); | 107 | assert(active); |
| 108 | return mem.alignForward(usize, off, @alignOf(field_info.type)); | 108 | return mem.alignForward(usize, off, @alignOf(field_info.type)); |
| 109 | } else if (active) { | 109 | } else if (active) { |
| ... | @@ -114,7 +114,7 @@ pub fn TrailerFlags(comptime Fields: type) type { | ... | @@ -114,7 +114,7 @@ pub fn TrailerFlags(comptime Fields: type) type { |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | pub fn Field(comptime field: FieldEnum) type { | 116 | pub fn Field(comptime field: FieldEnum) type { |
| 117 | return @typeInfo(Fields).Struct.fields[@enumToInt(field)].type; | 117 | return @typeInfo(Fields).Struct.fields[@intFromEnum(field)].type; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | pub fn sizeInBytes(self: Self) usize { | 120 | pub fn sizeInBytes(self: Self) usize { |
lib/std/multi_array_list.zig+12-12| ... | @@ -64,7 +64,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -64,7 +64,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 64 | /// and then get the field arrays from the slice. | 64 | /// and then get the field arrays from the slice. |
| 65 | pub const Slice = struct { | 65 | pub const Slice = struct { |
| 66 | /// This array is indexed by the field index which can be obtained | 66 | /// This array is indexed by the field index which can be obtained |
| 67 | /// by using @enumToInt() on the Field enum | 67 | /// by using @intFromEnum() on the Field enum |
| 68 | ptrs: [fields.len][*]u8, | 68 | ptrs: [fields.len][*]u8, |
| 69 | len: usize, | 69 | len: usize, |
| 70 | capacity: usize, | 70 | capacity: usize, |
| ... | @@ -74,7 +74,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -74,7 +74,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 74 | if (self.capacity == 0) { | 74 | if (self.capacity == 0) { |
| 75 | return &[_]F{}; | 75 | return &[_]F{}; |
| 76 | } | 76 | } |
| 77 | const byte_ptr = self.ptrs[@enumToInt(field)]; | 77 | const byte_ptr = self.ptrs[@intFromEnum(field)]; |
| 78 | const casted_ptr: [*]F = if (@sizeOf(F) == 0) | 78 | const casted_ptr: [*]F = if (@sizeOf(F) == 0) |
| 79 | undefined | 79 | undefined |
| 80 | else | 80 | else |
| ... | @@ -89,14 +89,14 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -89,14 +89,14 @@ pub fn MultiArrayList(comptime T: type) type { |
| 89 | else => unreachable, | 89 | else => unreachable, |
| 90 | }; | 90 | }; |
| 91 | inline for (fields, 0..) |field_info, i| { | 91 | inline for (fields, 0..) |field_info, i| { |
| 92 | self.items(@intToEnum(Field, i))[index] = @field(e, field_info.name); | 92 | self.items(@enumFromInt(Field, i))[index] = @field(e, field_info.name); |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | pub fn get(self: Slice, index: usize) T { | 96 | pub fn get(self: Slice, index: usize) T { |
| 97 | var result: Elem = undefined; | 97 | var result: Elem = undefined; |
| 98 | inline for (fields, 0..) |field_info, i| { | 98 | inline for (fields, 0..) |field_info, i| { |
| 99 | @field(result, field_info.name) = self.items(@intToEnum(Field, i))[index]; | 99 | @field(result, field_info.name) = self.items(@enumFromInt(Field, i))[index]; |
| 100 | } | 100 | } |
| 101 | return switch (@typeInfo(T)) { | 101 | return switch (@typeInfo(T)) { |
| 102 | .Struct => result, | 102 | .Struct => result, |
| ... | @@ -294,7 +294,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -294,7 +294,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 294 | }; | 294 | }; |
| 295 | const slices = self.slice(); | 295 | const slices = self.slice(); |
| 296 | inline for (fields, 0..) |field_info, field_index| { | 296 | inline for (fields, 0..) |field_info, field_index| { |
| 297 | const field_slice = slices.items(@intToEnum(Field, field_index)); | 297 | const field_slice = slices.items(@enumFromInt(Field, field_index)); |
| 298 | var i: usize = self.len - 1; | 298 | var i: usize = self.len - 1; |
| 299 | while (i > index) : (i -= 1) { | 299 | while (i > index) : (i -= 1) { |
| 300 | field_slice[i] = field_slice[i - 1]; | 300 | field_slice[i] = field_slice[i - 1]; |
| ... | @@ -309,7 +309,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -309,7 +309,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 309 | pub fn swapRemove(self: *Self, index: usize) void { | 309 | pub fn swapRemove(self: *Self, index: usize) void { |
| 310 | const slices = self.slice(); | 310 | const slices = self.slice(); |
| 311 | inline for (fields, 0..) |_, i| { | 311 | inline for (fields, 0..) |_, i| { |
| 312 | const field_slice = slices.items(@intToEnum(Field, i)); | 312 | const field_slice = slices.items(@enumFromInt(Field, i)); |
| 313 | field_slice[index] = field_slice[self.len - 1]; | 313 | field_slice[index] = field_slice[self.len - 1]; |
| 314 | field_slice[self.len - 1] = undefined; | 314 | field_slice[self.len - 1] = undefined; |
| 315 | } | 315 | } |
| ... | @@ -321,7 +321,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -321,7 +321,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 321 | pub fn orderedRemove(self: *Self, index: usize) void { | 321 | pub fn orderedRemove(self: *Self, index: usize) void { |
| 322 | const slices = self.slice(); | 322 | const slices = self.slice(); |
| 323 | inline for (fields, 0..) |_, field_index| { | 323 | inline for (fields, 0..) |_, field_index| { |
| 324 | const field_slice = slices.items(@intToEnum(Field, field_index)); | 324 | const field_slice = slices.items(@enumFromInt(Field, field_index)); |
| 325 | var i = index; | 325 | var i = index; |
| 326 | while (i < self.len - 1) : (i += 1) { | 326 | while (i < self.len - 1) : (i += 1) { |
| 327 | field_slice[i] = field_slice[i + 1]; | 327 | field_slice[i] = field_slice[i + 1]; |
| ... | @@ -358,7 +358,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -358,7 +358,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 358 | const self_slice = self.slice(); | 358 | const self_slice = self.slice(); |
| 359 | inline for (fields, 0..) |field_info, i| { | 359 | inline for (fields, 0..) |field_info, i| { |
| 360 | if (@sizeOf(field_info.type) != 0) { | 360 | if (@sizeOf(field_info.type) != 0) { |
| 361 | const field = @intToEnum(Field, i); | 361 | const field = @enumFromInt(Field, i); |
| 362 | const dest_slice = self_slice.items(field)[new_len..]; | 362 | const dest_slice = self_slice.items(field)[new_len..]; |
| 363 | // We use memset here for more efficient codegen in safety-checked, | 363 | // We use memset here for more efficient codegen in safety-checked, |
| 364 | // valgrind-enabled builds. Otherwise the valgrind client request | 364 | // valgrind-enabled builds. Otherwise the valgrind client request |
| ... | @@ -379,7 +379,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -379,7 +379,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 379 | const other_slice = other.slice(); | 379 | const other_slice = other.slice(); |
| 380 | inline for (fields, 0..) |field_info, i| { | 380 | inline for (fields, 0..) |field_info, i| { |
| 381 | if (@sizeOf(field_info.type) != 0) { | 381 | if (@sizeOf(field_info.type) != 0) { |
| 382 | const field = @intToEnum(Field, i); | 382 | const field = @enumFromInt(Field, i); |
| 383 | @memcpy(other_slice.items(field), self_slice.items(field)); | 383 | @memcpy(other_slice.items(field), self_slice.items(field)); |
| 384 | } | 384 | } |
| 385 | } | 385 | } |
| ... | @@ -440,7 +440,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -440,7 +440,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 440 | const other_slice = other.slice(); | 440 | const other_slice = other.slice(); |
| 441 | inline for (fields, 0..) |field_info, i| { | 441 | inline for (fields, 0..) |field_info, i| { |
| 442 | if (@sizeOf(field_info.type) != 0) { | 442 | if (@sizeOf(field_info.type) != 0) { |
| 443 | const field = @intToEnum(Field, i); | 443 | const field = @enumFromInt(Field, i); |
| 444 | @memcpy(other_slice.items(field), self_slice.items(field)); | 444 | @memcpy(other_slice.items(field), self_slice.items(field)); |
| 445 | } | 445 | } |
| 446 | } | 446 | } |
| ... | @@ -459,7 +459,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -459,7 +459,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 459 | const result_slice = result.slice(); | 459 | const result_slice = result.slice(); |
| 460 | inline for (fields, 0..) |field_info, i| { | 460 | inline for (fields, 0..) |field_info, i| { |
| 461 | if (@sizeOf(field_info.type) != 0) { | 461 | if (@sizeOf(field_info.type) != 0) { |
| 462 | const field = @intToEnum(Field, i); | 462 | const field = @enumFromInt(Field, i); |
| 463 | @memcpy(result_slice.items(field), self_slice.items(field)); | 463 | @memcpy(result_slice.items(field), self_slice.items(field)); |
| 464 | } | 464 | } |
| 465 | } | 465 | } |
| ... | @@ -476,7 +476,7 @@ pub fn MultiArrayList(comptime T: type) type { | ... | @@ -476,7 +476,7 @@ pub fn MultiArrayList(comptime T: type) type { |
| 476 | pub fn swap(sc: @This(), a_index: usize, b_index: usize) void { | 476 | pub fn swap(sc: @This(), a_index: usize, b_index: usize) void { |
| 477 | inline for (fields, 0..) |field_info, i| { | 477 | inline for (fields, 0..) |field_info, i| { |
| 478 | if (@sizeOf(field_info.type) != 0) { | 478 | if (@sizeOf(field_info.type) != 0) { |
| 479 | const field = @intToEnum(Field, i); | 479 | const field = @enumFromInt(Field, i); |
| 480 | const ptr = sc.slice.items(field); | 480 | const ptr = sc.slice.items(field); |
| 481 | mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]); | 481 | mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]); |
| 482 | } | 482 | } |
lib/std/net.zig+10-10| ... | @@ -804,8 +804,8 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get | ... | @@ -804,8 +804,8 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get |
| 804 | var first = true; | 804 | var first = true; |
| 805 | while (true) { | 805 | while (true) { |
| 806 | const rc = ws2_32.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res); | 806 | const rc = ws2_32.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res); |
| 807 | switch (@intToEnum(os.windows.ws2_32.WinsockError, @intCast(u16, rc))) { | 807 | switch (@enumFromInt(os.windows.ws2_32.WinsockError, @intCast(u16, rc))) { |
| 808 | @intToEnum(os.windows.ws2_32.WinsockError, 0) => break, | 808 | @enumFromInt(os.windows.ws2_32.WinsockError, 0) => break, |
| 809 | .WSATRY_AGAIN => return error.TemporaryNameServerFailure, | 809 | .WSATRY_AGAIN => return error.TemporaryNameServerFailure, |
| 810 | .WSANO_RECOVERY => return error.NameServerFailure, | 810 | .WSANO_RECOVERY => return error.NameServerFailure, |
| 811 | .WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported, | 811 | .WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported, |
| ... | @@ -874,7 +874,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get | ... | @@ -874,7 +874,7 @@ pub fn getAddressList(allocator: mem.Allocator, name: []const u8, port: u16) Get |
| 874 | }; | 874 | }; |
| 875 | var res: ?*os.addrinfo = null; | 875 | var res: ?*os.addrinfo = null; |
| 876 | switch (sys.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { | 876 | switch (sys.getaddrinfo(name_c.ptr, port_c.ptr, &hints, &res)) { |
| 877 | @intToEnum(sys.EAI, 0) => {}, | 877 | @enumFromInt(sys.EAI, 0) => {}, |
| 878 | .ADDRFAMILY => return error.HostLacksNetworkAddresses, | 878 | .ADDRFAMILY => return error.HostLacksNetworkAddresses, |
| 879 | .AGAIN => return error.TemporaryNameServerFailure, | 879 | .AGAIN => return error.TemporaryNameServerFailure, |
| 880 | .BADFLAGS => unreachable, // Invalid hints | 880 | .BADFLAGS => unreachable, // Invalid hints |
| ... | @@ -1688,19 +1688,19 @@ fn dnsParse( | ... | @@ -1688,19 +1688,19 @@ fn dnsParse( |
| 1688 | if (qdcount + ancount > 64) return error.InvalidDnsPacket; | 1688 | if (qdcount + ancount > 64) return error.InvalidDnsPacket; |
| 1689 | while (qdcount != 0) { | 1689 | while (qdcount != 0) { |
| 1690 | qdcount -= 1; | 1690 | qdcount -= 1; |
| 1691 | while (@ptrToInt(p) - @ptrToInt(r.ptr) < r.len and p[0] -% 1 < 127) p += 1; | 1691 | while (@intFromPtr(p) - @intFromPtr(r.ptr) < r.len and p[0] -% 1 < 127) p += 1; |
| 1692 | if (p[0] > 193 or (p[0] == 193 and p[1] > 254) or @ptrToInt(p) > @ptrToInt(r.ptr) + r.len - 6) | 1692 | if (p[0] > 193 or (p[0] == 193 and p[1] > 254) or @intFromPtr(p) > @intFromPtr(r.ptr) + r.len - 6) |
| 1693 | return error.InvalidDnsPacket; | 1693 | return error.InvalidDnsPacket; |
| 1694 | p += @as(usize, 5) + @boolToInt(p[0] != 0); | 1694 | p += @as(usize, 5) + @intFromBool(p[0] != 0); |
| 1695 | } | 1695 | } |
| 1696 | while (ancount != 0) { | 1696 | while (ancount != 0) { |
| 1697 | ancount -= 1; | 1697 | ancount -= 1; |
| 1698 | while (@ptrToInt(p) - @ptrToInt(r.ptr) < r.len and p[0] -% 1 < 127) p += 1; | 1698 | while (@intFromPtr(p) - @intFromPtr(r.ptr) < r.len and p[0] -% 1 < 127) p += 1; |
| 1699 | if (p[0] > 193 or (p[0] == 193 and p[1] > 254) or @ptrToInt(p) > @ptrToInt(r.ptr) + r.len - 6) | 1699 | if (p[0] > 193 or (p[0] == 193 and p[1] > 254) or @intFromPtr(p) > @intFromPtr(r.ptr) + r.len - 6) |
| 1700 | return error.InvalidDnsPacket; | 1700 | return error.InvalidDnsPacket; |
| 1701 | p += @as(usize, 1) + @boolToInt(p[0] != 0); | 1701 | p += @as(usize, 1) + @intFromBool(p[0] != 0); |
| 1702 | const len = p[8] * @as(usize, 256) + p[9]; | 1702 | const len = p[8] * @as(usize, 256) + p[9]; |
| 1703 | if (@ptrToInt(p) + len > @ptrToInt(r.ptr) + r.len) return error.InvalidDnsPacket; | 1703 | if (@intFromPtr(p) + len > @intFromPtr(r.ptr) + r.len) return error.InvalidDnsPacket; |
| 1704 | try callback(ctx, p[1], p[10..][0..len], r); | 1704 | try callback(ctx, p[1], p[10..][0..len], r); |
| 1705 | p += 10 + len; | 1705 | p += 10 + len; |
| 1706 | } | 1706 | } |
lib/std/os.zig+27-27| ... | @@ -608,7 +608,7 @@ pub fn abort() noreturn { | ... | @@ -608,7 +608,7 @@ pub fn abort() noreturn { |
| 608 | sigprocmask(SIG.UNBLOCK, &sigabrtmask, null); | 608 | sigprocmask(SIG.UNBLOCK, &sigabrtmask, null); |
| 609 | 609 | ||
| 610 | // Beyond this point should be unreachable. | 610 | // Beyond this point should be unreachable. |
| 611 | @intToPtr(*allowzero volatile u8, 0).* = 0; | 611 | @ptrFromInt(*allowzero volatile u8, 0).* = 0; |
| 612 | raise(SIG.KILL) catch {}; | 612 | raise(SIG.KILL) catch {}; |
| 613 | exit(127); // Pid 1 might not be signalled in some containers. | 613 | exit(127); // Pid 1 might not be signalled in some containers. |
| 614 | } | 614 | } |
| ... | @@ -678,10 +678,10 @@ pub fn exit(status: u8) noreturn { | ... | @@ -678,10 +678,10 @@ pub fn exit(status: u8) noreturn { |
| 678 | // exit() is only available if exitBootServices() has not been called yet. | 678 | // exit() is only available if exitBootServices() has not been called yet. |
| 679 | // This call to exit should not fail, so we don't care about its return value. | 679 | // This call to exit should not fail, so we don't care about its return value. |
| 680 | if (uefi.system_table.boot_services) |bs| { | 680 | if (uefi.system_table.boot_services) |bs| { |
| 681 | _ = bs.exit(uefi.handle, @intToEnum(uefi.Status, status), 0, null); | 681 | _ = bs.exit(uefi.handle, @enumFromInt(uefi.Status, status), 0, null); |
| 682 | } | 682 | } |
| 683 | // If we can't exit, reboot the system instead. | 683 | // If we can't exit, reboot the system instead. |
| 684 | uefi.system_table.runtime_services.resetSystem(uefi.tables.ResetType.ResetCold, @intToEnum(uefi.Status, status), 0, null); | 684 | uefi.system_table.runtime_services.resetSystem(uefi.tables.ResetType.ResetCold, @enumFromInt(uefi.Status, status), 0, null); |
| 685 | } | 685 | } |
| 686 | system.exit(status); | 686 | system.exit(status); |
| 687 | } | 687 | } |
| ... | @@ -2045,7 +2045,7 @@ pub fn getcwd(out_buffer: []u8) GetCwdError![]u8 { | ... | @@ -2045,7 +2045,7 @@ pub fn getcwd(out_buffer: []u8) GetCwdError![]u8 { |
| 2045 | 2045 | ||
| 2046 | const err = if (builtin.link_libc) blk: { | 2046 | const err = if (builtin.link_libc) blk: { |
| 2047 | const c_err = if (std.c.getcwd(out_buffer.ptr, out_buffer.len)) |_| 0 else std.c._errno().*; | 2047 | const c_err = if (std.c.getcwd(out_buffer.ptr, out_buffer.len)) |_| 0 else std.c._errno().*; |
| 2048 | break :blk @intToEnum(E, c_err); | 2048 | break :blk @enumFromInt(E, c_err); |
| 2049 | } else blk: { | 2049 | } else blk: { |
| 2050 | break :blk errno(system.getcwd(out_buffer.ptr, out_buffer.len)); | 2050 | break :blk errno(system.getcwd(out_buffer.ptr, out_buffer.len)); |
| 2051 | }; | 2051 | }; |
| ... | @@ -3249,7 +3249,7 @@ pub fn isatty(handle: fd_t) bool { | ... | @@ -3249,7 +3249,7 @@ pub fn isatty(handle: fd_t) bool { |
| 3249 | while (true) { | 3249 | while (true) { |
| 3250 | var wsz: linux.winsize = undefined; | 3250 | var wsz: linux.winsize = undefined; |
| 3251 | const fd = @bitCast(usize, @as(isize, handle)); | 3251 | const fd = @bitCast(usize, @as(isize, handle)); |
| 3252 | const rc = linux.syscall3(.ioctl, fd, linux.T.IOCGWINSZ, @ptrToInt(&wsz)); | 3252 | const rc = linux.syscall3(.ioctl, fd, linux.T.IOCGWINSZ, @intFromPtr(&wsz)); |
| 3253 | switch (linux.getErrno(rc)) { | 3253 | switch (linux.getErrno(rc)) { |
| 3254 | .SUCCESS => return true, | 3254 | .SUCCESS => return true, |
| 3255 | .INTR => continue, | 3255 | .INTR => continue, |
| ... | @@ -4016,7 +4016,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { | ... | @@ -4016,7 +4016,7 @@ pub fn getsockoptError(sockfd: fd_t) ConnectError!void { |
| 4016 | const rc = system.getsockopt(sockfd, SOL.SOCKET, SO.ERROR, @ptrCast([*]u8, &err_code), &size); | 4016 | const rc = system.getsockopt(sockfd, SOL.SOCKET, SO.ERROR, @ptrCast([*]u8, &err_code), &size); |
| 4017 | assert(size == 4); | 4017 | assert(size == 4); |
| 4018 | switch (errno(rc)) { | 4018 | switch (errno(rc)) { |
| 4019 | .SUCCESS => switch (@intToEnum(E, err_code)) { | 4019 | .SUCCESS => switch (@enumFromInt(E, err_code)) { |
| 4020 | .SUCCESS => return, | 4020 | .SUCCESS => return, |
| 4021 | .ACCES => return error.PermissionDenied, | 4021 | .ACCES => return error.PermissionDenied, |
| 4022 | .PERM => return error.PermissionDenied, | 4022 | .PERM => return error.PermissionDenied, |
| ... | @@ -4425,10 +4425,10 @@ pub fn mmap( | ... | @@ -4425,10 +4425,10 @@ pub fn mmap( |
| 4425 | const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset); | 4425 | const rc = mmap_sym(ptr, length, prot, flags, fd, ioffset); |
| 4426 | const err = if (builtin.link_libc) blk: { | 4426 | const err = if (builtin.link_libc) blk: { |
| 4427 | if (rc != std.c.MAP.FAILED) return @ptrCast([*]align(mem.page_size) u8, @alignCast(mem.page_size, rc))[0..length]; | 4427 | if (rc != std.c.MAP.FAILED) return @ptrCast([*]align(mem.page_size) u8, @alignCast(mem.page_size, rc))[0..length]; |
| 4428 | break :blk @intToEnum(E, system._errno().*); | 4428 | break :blk @enumFromInt(E, system._errno().*); |
| 4429 | } else blk: { | 4429 | } else blk: { |
| 4430 | const err = errno(rc); | 4430 | const err = errno(rc); |
| 4431 | if (err == .SUCCESS) return @intToPtr([*]align(mem.page_size) u8, rc)[0..length]; | 4431 | if (err == .SUCCESS) return @ptrFromInt([*]align(mem.page_size) u8, rc)[0..length]; |
| 4432 | break :blk err; | 4432 | break :blk err; |
| 4433 | }; | 4433 | }; |
| 4434 | switch (err) { | 4434 | switch (err) { |
| ... | @@ -5164,7 +5164,7 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP | ... | @@ -5164,7 +5164,7 @@ pub fn realpathZ(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP |
| 5164 | 5164 | ||
| 5165 | return getFdPath(fd, out_buffer); | 5165 | return getFdPath(fd, out_buffer); |
| 5166 | } | 5166 | } |
| 5167 | const result_path = std.c.realpath(pathname, out_buffer) orelse switch (@intToEnum(E, std.c._errno().*)) { | 5167 | const result_path = std.c.realpath(pathname, out_buffer) orelse switch (@enumFromInt(E, std.c._errno().*)) { |
| 5168 | .SUCCESS => unreachable, | 5168 | .SUCCESS => unreachable, |
| 5169 | .INVAL => unreachable, | 5169 | .INVAL => unreachable, |
| 5170 | .BADF => unreachable, | 5170 | .BADF => unreachable, |
| ... | @@ -5275,7 +5275,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { | ... | @@ -5275,7 +5275,7 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { |
| 5275 | if (comptime builtin.os.version_range.semver.max.order(.{ .major = 13, .minor = 0, .patch = 0 }) == .gt) { | 5275 | if (comptime builtin.os.version_range.semver.max.order(.{ .major = 13, .minor = 0, .patch = 0 }) == .gt) { |
| 5276 | var kfile: system.kinfo_file = undefined; | 5276 | var kfile: system.kinfo_file = undefined; |
| 5277 | kfile.structsize = system.KINFO_FILE_SIZE; | 5277 | kfile.structsize = system.KINFO_FILE_SIZE; |
| 5278 | switch (errno(system.fcntl(fd, system.F.KINFO, @ptrToInt(&kfile)))) { | 5278 | switch (errno(system.fcntl(fd, system.F.KINFO, @intFromPtr(&kfile)))) { |
| 5279 | .SUCCESS => {}, | 5279 | .SUCCESS => {}, |
| 5280 | .BADF => return error.FileNotFound, | 5280 | .BADF => return error.FileNotFound, |
| 5281 | else => |err| return unexpectedErrno(err), | 5281 | else => |err| return unexpectedErrno(err), |
| ... | @@ -5400,21 +5400,21 @@ pub fn dl_iterate_phdr( | ... | @@ -5400,21 +5400,21 @@ pub fn dl_iterate_phdr( |
| 5400 | switch (system.dl_iterate_phdr(struct { | 5400 | switch (system.dl_iterate_phdr(struct { |
| 5401 | fn callbackC(info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int { | 5401 | fn callbackC(info: *dl_phdr_info, size: usize, data: ?*anyopaque) callconv(.C) c_int { |
| 5402 | const context_ptr = @ptrCast(*const Context, @alignCast(@alignOf(*const Context), data)); | 5402 | const context_ptr = @ptrCast(*const Context, @alignCast(@alignOf(*const Context), data)); |
| 5403 | callback(info, size, context_ptr.*) catch |err| return @errorToInt(err); | 5403 | callback(info, size, context_ptr.*) catch |err| return @intFromError(err); |
| 5404 | return 0; | 5404 | return 0; |
| 5405 | } | 5405 | } |
| 5406 | }.callbackC, @intToPtr(?*anyopaque, @ptrToInt(&context)))) { | 5406 | }.callbackC, @ptrFromInt(?*anyopaque, @intFromPtr(&context)))) { |
| 5407 | 0 => return, | 5407 | 0 => return, |
| 5408 | else => |err| return @errSetCast(Error, @intToError(@intCast(u16, err))), // TODO don't hardcode u16 | 5408 | else => |err| return @errSetCast(Error, @errorFromInt(@intCast(u16, err))), // TODO don't hardcode u16 |
| 5409 | } | 5409 | } |
| 5410 | } | 5410 | } |
| 5411 | 5411 | ||
| 5412 | const elf_base = std.process.getBaseAddress(); | 5412 | const elf_base = std.process.getBaseAddress(); |
| 5413 | const ehdr = @intToPtr(*elf.Ehdr, elf_base); | 5413 | const ehdr = @ptrFromInt(*elf.Ehdr, elf_base); |
| 5414 | // Make sure the base address points to an ELF image. | 5414 | // Make sure the base address points to an ELF image. |
| 5415 | assert(mem.eql(u8, ehdr.e_ident[0..4], elf.MAGIC)); | 5415 | assert(mem.eql(u8, ehdr.e_ident[0..4], elf.MAGIC)); |
| 5416 | const n_phdr = ehdr.e_phnum; | 5416 | const n_phdr = ehdr.e_phnum; |
| 5417 | const phdrs = (@intToPtr([*]elf.Phdr, elf_base + ehdr.e_phoff))[0..n_phdr]; | 5417 | const phdrs = (@ptrFromInt([*]elf.Phdr, elf_base + ehdr.e_phoff))[0..n_phdr]; |
| 5418 | 5418 | ||
| 5419 | var it = dl.linkmap_iterator(phdrs) catch unreachable; | 5419 | var it = dl.linkmap_iterator(phdrs) catch unreachable; |
| 5420 | 5420 | ||
| ... | @@ -5425,7 +5425,7 @@ pub fn dl_iterate_phdr( | ... | @@ -5425,7 +5425,7 @@ pub fn dl_iterate_phdr( |
| 5425 | // is non-zero. | 5425 | // is non-zero. |
| 5426 | const base_address = for (phdrs) |*phdr| { | 5426 | const base_address = for (phdrs) |*phdr| { |
| 5427 | if (phdr.p_type == elf.PT_PHDR) { | 5427 | if (phdr.p_type == elf.PT_PHDR) { |
| 5428 | break @ptrToInt(phdrs.ptr) - phdr.p_vaddr; | 5428 | break @intFromPtr(phdrs.ptr) - phdr.p_vaddr; |
| 5429 | // We could try computing the difference between _DYNAMIC and | 5429 | // We could try computing the difference between _DYNAMIC and |
| 5430 | // the p_vaddr of the PT_DYNAMIC section, but using the phdr is | 5430 | // the p_vaddr of the PT_DYNAMIC section, but using the phdr is |
| 5431 | // good enough (Is it?). | 5431 | // good enough (Is it?). |
| ... | @@ -5448,12 +5448,12 @@ pub fn dl_iterate_phdr( | ... | @@ -5448,12 +5448,12 @@ pub fn dl_iterate_phdr( |
| 5448 | var dlpi_phnum: u16 = undefined; | 5448 | var dlpi_phnum: u16 = undefined; |
| 5449 | 5449 | ||
| 5450 | if (entry.l_addr != 0) { | 5450 | if (entry.l_addr != 0) { |
| 5451 | const elf_header = @intToPtr(*elf.Ehdr, entry.l_addr); | 5451 | const elf_header = @ptrFromInt(*elf.Ehdr, entry.l_addr); |
| 5452 | dlpi_phdr = @intToPtr([*]elf.Phdr, entry.l_addr + elf_header.e_phoff); | 5452 | dlpi_phdr = @ptrFromInt([*]elf.Phdr, entry.l_addr + elf_header.e_phoff); |
| 5453 | dlpi_phnum = elf_header.e_phnum; | 5453 | dlpi_phnum = elf_header.e_phnum; |
| 5454 | } else { | 5454 | } else { |
| 5455 | // This is the running ELF image | 5455 | // This is the running ELF image |
| 5456 | dlpi_phdr = @intToPtr([*]elf.Phdr, elf_base + ehdr.e_phoff); | 5456 | dlpi_phdr = @ptrFromInt([*]elf.Phdr, elf_base + ehdr.e_phoff); |
| 5457 | dlpi_phnum = ehdr.e_phnum; | 5457 | dlpi_phnum = ehdr.e_phnum; |
| 5458 | } | 5458 | } |
| 5459 | 5459 | ||
| ... | @@ -5626,7 +5626,7 @@ pub const UnexpectedError = error{ | ... | @@ -5626,7 +5626,7 @@ pub const UnexpectedError = error{ |
| 5626 | /// and you get an unexpected error. | 5626 | /// and you get an unexpected error. |
| 5627 | pub fn unexpectedErrno(err: E) UnexpectedError { | 5627 | pub fn unexpectedErrno(err: E) UnexpectedError { |
| 5628 | if (unexpected_error_tracing) { | 5628 | if (unexpected_error_tracing) { |
| 5629 | std.debug.print("unexpected errno: {d}\n", .{@enumToInt(err)}); | 5629 | std.debug.print("unexpected errno: {d}\n", .{@intFromEnum(err)}); |
| 5630 | std.debug.dumpCurrentStackTrace(null); | 5630 | std.debug.dumpCurrentStackTrace(null); |
| 5631 | } | 5631 | } |
| 5632 | return error.Unexpected; | 5632 | return error.Unexpected; |
| ... | @@ -5773,7 +5773,7 @@ pub fn res_mkquery( | ... | @@ -5773,7 +5773,7 @@ pub fn res_mkquery( |
| 5773 | var name = dname; | 5773 | var name = dname; |
| 5774 | if (mem.endsWith(u8, name, ".")) name.len -= 1; | 5774 | if (mem.endsWith(u8, name, ".")) name.len -= 1; |
| 5775 | assert(name.len <= 253); | 5775 | assert(name.len <= 253); |
| 5776 | const n = 17 + name.len + @boolToInt(name.len != 0); | 5776 | const n = 17 + name.len + @intFromBool(name.len != 0); |
| 5777 | 5777 | ||
| 5778 | // Construct query template - ID will be filled later | 5778 | // Construct query template - ID will be filled later |
| 5779 | var q: [280]u8 = undefined; | 5779 | var q: [280]u8 = undefined; |
| ... | @@ -6673,7 +6673,7 @@ pub fn dn_expand( | ... | @@ -6673,7 +6673,7 @@ pub fn dn_expand( |
| 6673 | if ((p[0] & 0xc0) != 0) { | 6673 | if ((p[0] & 0xc0) != 0) { |
| 6674 | if (p + 1 == end) return error.InvalidDnsPacket; | 6674 | if (p + 1 == end) return error.InvalidDnsPacket; |
| 6675 | var j = ((p[0] & @as(usize, 0x3f)) << 8) | p[1]; | 6675 | var j = ((p[0] & @as(usize, 0x3f)) << 8) | p[1]; |
| 6676 | if (len == std.math.maxInt(usize)) len = @ptrToInt(p) + 2 - @ptrToInt(comp_dn.ptr); | 6676 | if (len == std.math.maxInt(usize)) len = @intFromPtr(p) + 2 - @intFromPtr(comp_dn.ptr); |
| 6677 | if (j >= msg.len) return error.InvalidDnsPacket; | 6677 | if (j >= msg.len) return error.InvalidDnsPacket; |
| 6678 | p = msg.ptr + j; | 6678 | p = msg.ptr + j; |
| 6679 | } else if (p[0] != 0) { | 6679 | } else if (p[0] != 0) { |
| ... | @@ -6683,7 +6683,7 @@ pub fn dn_expand( | ... | @@ -6683,7 +6683,7 @@ pub fn dn_expand( |
| 6683 | } | 6683 | } |
| 6684 | var j = p[0]; | 6684 | var j = p[0]; |
| 6685 | p += 1; | 6685 | p += 1; |
| 6686 | if (j >= @ptrToInt(end) - @ptrToInt(p) or j >= @ptrToInt(dend) - @ptrToInt(dest)) { | 6686 | if (j >= @intFromPtr(end) - @intFromPtr(p) or j >= @intFromPtr(dend) - @intFromPtr(dest)) { |
| 6687 | return error.InvalidDnsPacket; | 6687 | return error.InvalidDnsPacket; |
| 6688 | } | 6688 | } |
| 6689 | while (j != 0) { | 6689 | while (j != 0) { |
| ... | @@ -6694,7 +6694,7 @@ pub fn dn_expand( | ... | @@ -6694,7 +6694,7 @@ pub fn dn_expand( |
| 6694 | } | 6694 | } |
| 6695 | } else { | 6695 | } else { |
| 6696 | dest[0] = 0; | 6696 | dest[0] = 0; |
| 6697 | if (len == std.math.maxInt(usize)) len = @ptrToInt(p) + 1 - @ptrToInt(comp_dn.ptr); | 6697 | if (len == std.math.maxInt(usize)) len = @intFromPtr(p) + 1 - @intFromPtr(comp_dn.ptr); |
| 6698 | return len; | 6698 | return len; |
| 6699 | } | 6699 | } |
| 6700 | } | 6700 | } |
| ... | @@ -6908,7 +6908,7 @@ pub const IoCtl_SIOCGIFINDEX_Error = error{ | ... | @@ -6908,7 +6908,7 @@ pub const IoCtl_SIOCGIFINDEX_Error = error{ |
| 6908 | 6908 | ||
| 6909 | pub fn ioctl_SIOCGIFINDEX(fd: fd_t, ifr: *ifreq) IoCtl_SIOCGIFINDEX_Error!void { | 6909 | pub fn ioctl_SIOCGIFINDEX(fd: fd_t, ifr: *ifreq) IoCtl_SIOCGIFINDEX_Error!void { |
| 6910 | while (true) { | 6910 | while (true) { |
| 6911 | switch (errno(system.ioctl(fd, SIOCGIFINDEX, @ptrToInt(ifr)))) { | 6911 | switch (errno(system.ioctl(fd, SIOCGIFINDEX, @intFromPtr(ifr)))) { |
| 6912 | .SUCCESS => return, | 6912 | .SUCCESS => return, |
| 6913 | .INVAL => unreachable, // Bad parameters. | 6913 | .INVAL => unreachable, // Bad parameters. |
| 6914 | .NOTTY => unreachable, | 6914 | .NOTTY => unreachable, |
| ... | @@ -7032,7 +7032,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 { | ... | @@ -7032,7 +7032,7 @@ pub fn prctl(option: PR, args: anytype) PrctlError!u31 { |
| 7032 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; | 7032 | inline while (i < args.len) : (i += 1) buf[i] = args[i]; |
| 7033 | } | 7033 | } |
| 7034 | 7034 | ||
| 7035 | const rc = system.prctl(@enumToInt(option), buf[0], buf[1], buf[2], buf[3]); | 7035 | const rc = system.prctl(@intFromEnum(option), buf[0], buf[1], buf[2], buf[3]); |
| 7036 | switch (errno(rc)) { | 7036 | switch (errno(rc)) { |
| 7037 | .SUCCESS => return @intCast(u31, rc), | 7037 | .SUCCESS => return @intCast(u31, rc), |
| 7038 | .ACCES => return error.AccessDenied, | 7038 | .ACCES => return error.AccessDenied, |
| ... | @@ -7318,7 +7318,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError! | ... | @@ -7318,7 +7318,7 @@ pub fn ptrace(request: u32, pid: pid_t, addr: usize, signal: usize) PtraceError! |
| 7318 | .macos, .ios, .tvos, .watchos => switch (errno(darwin.ptrace( | 7318 | .macos, .ios, .tvos, .watchos => switch (errno(darwin.ptrace( |
| 7319 | math.cast(i32, request) orelse return error.Overflow, | 7319 | math.cast(i32, request) orelse return error.Overflow, |
| 7320 | pid, | 7320 | pid, |
| 7321 | @intToPtr(?[*]u8, addr), | 7321 | @ptrFromInt(?[*]u8, addr), |
| 7322 | math.cast(i32, signal) orelse return error.Overflow, | 7322 | math.cast(i32, signal) orelse return error.Overflow, |
| 7323 | ))) { | 7323 | ))) { |
| 7324 | .SUCCESS => {}, | 7324 | .SUCCESS => {}, |
lib/std/os/linux.zig+227-227| ... | @@ -206,7 +206,7 @@ fn splitValue64(val: i64) [2]u32 { | ... | @@ -206,7 +206,7 @@ fn splitValue64(val: i64) [2]u32 { |
| 206 | pub fn getErrno(r: usize) E { | 206 | pub fn getErrno(r: usize) E { |
| 207 | const signed_r = @bitCast(isize, r); | 207 | const signed_r = @bitCast(isize, r); |
| 208 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; | 208 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; |
| 209 | return @intToEnum(E, int); | 209 | return @enumFromInt(E, int); |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | pub fn dup(old: i32) usize { | 212 | pub fn dup(old: i32) usize { |
| ... | @@ -234,7 +234,7 @@ pub fn dup3(old: i32, new: i32, flags: u32) usize { | ... | @@ -234,7 +234,7 @@ pub fn dup3(old: i32, new: i32, flags: u32) usize { |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | pub fn chdir(path: [*:0]const u8) usize { | 236 | pub fn chdir(path: [*:0]const u8) usize { |
| 237 | return syscall1(.chdir, @ptrToInt(path)); | 237 | return syscall1(.chdir, @intFromPtr(path)); |
| 238 | } | 238 | } |
| 239 | 239 | ||
| 240 | pub fn fchdir(fd: fd_t) usize { | 240 | pub fn fchdir(fd: fd_t) usize { |
| ... | @@ -242,11 +242,11 @@ pub fn fchdir(fd: fd_t) usize { | ... | @@ -242,11 +242,11 @@ pub fn fchdir(fd: fd_t) usize { |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | pub fn chroot(path: [*:0]const u8) usize { | 244 | pub fn chroot(path: [*:0]const u8) usize { |
| 245 | return syscall1(.chroot, @ptrToInt(path)); | 245 | return syscall1(.chroot, @intFromPtr(path)); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | pub fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) usize { | 248 | pub fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) usize { |
| 249 | return syscall3(.execve, @ptrToInt(path), @ptrToInt(argv), @ptrToInt(envp)); | 249 | return syscall3(.execve, @intFromPtr(path), @intFromPtr(argv), @intFromPtr(envp)); |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | pub fn fork() usize { | 252 | pub fn fork() usize { |
| ... | @@ -273,7 +273,7 @@ pub fn futimens(fd: i32, times: *const [2]timespec) usize { | ... | @@ -273,7 +273,7 @@ pub fn futimens(fd: i32, times: *const [2]timespec) usize { |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, flags: u32) usize { | 275 | pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, flags: u32) usize { |
| 276 | return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(times), flags); | 276 | return syscall4(.utimensat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), @intFromPtr(times), flags); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize { | 279 | pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize { |
| ... | @@ -301,22 +301,22 @@ pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize { | ... | @@ -301,22 +301,22 @@ pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize { |
| 301 | } | 301 | } |
| 302 | 302 | ||
| 303 | pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*const timespec) usize { | 303 | pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*const timespec) usize { |
| 304 | return syscall4(.futex, @ptrToInt(uaddr), futex_op, @bitCast(u32, val), @ptrToInt(timeout)); | 304 | return syscall4(.futex, @intFromPtr(uaddr), futex_op, @bitCast(u32, val), @intFromPtr(timeout)); |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | pub fn futex_wake(uaddr: *const i32, futex_op: u32, val: i32) usize { | 307 | pub fn futex_wake(uaddr: *const i32, futex_op: u32, val: i32) usize { |
| 308 | return syscall3(.futex, @ptrToInt(uaddr), futex_op, @bitCast(u32, val)); | 308 | return syscall3(.futex, @intFromPtr(uaddr), futex_op, @bitCast(u32, val)); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | pub fn getcwd(buf: [*]u8, size: usize) usize { | 311 | pub fn getcwd(buf: [*]u8, size: usize) usize { |
| 312 | return syscall2(.getcwd, @ptrToInt(buf), size); | 312 | return syscall2(.getcwd, @intFromPtr(buf), size); |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | pub fn getdents(fd: i32, dirp: [*]u8, len: usize) usize { | 315 | pub fn getdents(fd: i32, dirp: [*]u8, len: usize) usize { |
| 316 | return syscall3( | 316 | return syscall3( |
| 317 | .getdents, | 317 | .getdents, |
| 318 | @bitCast(usize, @as(isize, fd)), | 318 | @bitCast(usize, @as(isize, fd)), |
| 319 | @ptrToInt(dirp), | 319 | @intFromPtr(dirp), |
| 320 | @min(len, maxInt(c_int)), | 320 | @min(len, maxInt(c_int)), |
| 321 | ); | 321 | ); |
| 322 | } | 322 | } |
| ... | @@ -325,7 +325,7 @@ pub fn getdents64(fd: i32, dirp: [*]u8, len: usize) usize { | ... | @@ -325,7 +325,7 @@ pub fn getdents64(fd: i32, dirp: [*]u8, len: usize) usize { |
| 325 | return syscall3( | 325 | return syscall3( |
| 326 | .getdents64, | 326 | .getdents64, |
| 327 | @bitCast(usize, @as(isize, fd)), | 327 | @bitCast(usize, @as(isize, fd)), |
| 328 | @ptrToInt(dirp), | 328 | @intFromPtr(dirp), |
| 329 | @min(len, maxInt(c_int)), | 329 | @min(len, maxInt(c_int)), |
| 330 | ); | 330 | ); |
| 331 | } | 331 | } |
| ... | @@ -335,7 +335,7 @@ pub fn inotify_init1(flags: u32) usize { | ... | @@ -335,7 +335,7 @@ pub fn inotify_init1(flags: u32) usize { |
| 335 | } | 335 | } |
| 336 | 336 | ||
| 337 | pub fn inotify_add_watch(fd: i32, pathname: [*:0]const u8, mask: u32) usize { | 337 | pub fn inotify_add_watch(fd: i32, pathname: [*:0]const u8, mask: u32) usize { |
| 338 | return syscall3(.inotify_add_watch, @bitCast(usize, @as(isize, fd)), @ptrToInt(pathname), mask); | 338 | return syscall3(.inotify_add_watch, @bitCast(usize, @as(isize, fd)), @intFromPtr(pathname), mask); |
| 339 | } | 339 | } |
| 340 | 340 | ||
| 341 | pub fn inotify_rm_watch(fd: i32, wd: i32) usize { | 341 | pub fn inotify_rm_watch(fd: i32, wd: i32) usize { |
| ... | @@ -344,61 +344,61 @@ pub fn inotify_rm_watch(fd: i32, wd: i32) usize { | ... | @@ -344,61 +344,61 @@ pub fn inotify_rm_watch(fd: i32, wd: i32) usize { |
| 344 | 344 | ||
| 345 | pub fn readlink(noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { | 345 | pub fn readlink(noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { |
| 346 | if (@hasField(SYS, "readlink")) { | 346 | if (@hasField(SYS, "readlink")) { |
| 347 | return syscall3(.readlink, @ptrToInt(path), @ptrToInt(buf_ptr), buf_len); | 347 | return syscall3(.readlink, @intFromPtr(path), @intFromPtr(buf_ptr), buf_len); |
| 348 | } else { | 348 | } else { |
| 349 | return syscall4(.readlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(path), @ptrToInt(buf_ptr), buf_len); | 349 | return syscall4(.readlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len); |
| 350 | } | 350 | } |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | pub fn readlinkat(dirfd: i32, noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { | 353 | pub fn readlinkat(dirfd: i32, noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize { |
| 354 | return syscall4(.readlinkat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(buf_ptr), buf_len); | 354 | return syscall4(.readlinkat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len); |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | pub fn mkdir(path: [*:0]const u8, mode: u32) usize { | 357 | pub fn mkdir(path: [*:0]const u8, mode: u32) usize { |
| 358 | if (@hasField(SYS, "mkdir")) { | 358 | if (@hasField(SYS, "mkdir")) { |
| 359 | return syscall2(.mkdir, @ptrToInt(path), mode); | 359 | return syscall2(.mkdir, @intFromPtr(path), mode); |
| 360 | } else { | 360 | } else { |
| 361 | return syscall3(.mkdirat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(path), mode); | 361 | return syscall3(.mkdirat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(path), mode); |
| 362 | } | 362 | } |
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | pub fn mkdirat(dirfd: i32, path: [*:0]const u8, mode: u32) usize { | 365 | pub fn mkdirat(dirfd: i32, path: [*:0]const u8, mode: u32) usize { |
| 366 | return syscall3(.mkdirat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), mode); | 366 | return syscall3(.mkdirat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), mode); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | pub fn mknod(path: [*:0]const u8, mode: u32, dev: u32) usize { | 369 | pub fn mknod(path: [*:0]const u8, mode: u32, dev: u32) usize { |
| 370 | if (@hasField(SYS, "mknod")) { | 370 | if (@hasField(SYS, "mknod")) { |
| 371 | return syscall3(.mknod, @ptrToInt(path), mode, dev); | 371 | return syscall3(.mknod, @intFromPtr(path), mode, dev); |
| 372 | } else { | 372 | } else { |
| 373 | return mknodat(AT.FDCWD, path, mode, dev); | 373 | return mknodat(AT.FDCWD, path, mode, dev); |
| 374 | } | 374 | } |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | pub fn mknodat(dirfd: i32, path: [*:0]const u8, mode: u32, dev: u32) usize { | 377 | pub fn mknodat(dirfd: i32, path: [*:0]const u8, mode: u32, dev: u32) usize { |
| 378 | return syscall4(.mknodat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), mode, dev); | 378 | return syscall4(.mknodat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), mode, dev); |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | pub fn mount(special: [*:0]const u8, dir: [*:0]const u8, fstype: ?[*:0]const u8, flags: u32, data: usize) usize { | 381 | pub fn mount(special: [*:0]const u8, dir: [*:0]const u8, fstype: ?[*:0]const u8, flags: u32, data: usize) usize { |
| 382 | return syscall5(.mount, @ptrToInt(special), @ptrToInt(dir), @ptrToInt(fstype), flags, data); | 382 | return syscall5(.mount, @intFromPtr(special), @intFromPtr(dir), @intFromPtr(fstype), flags, data); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | pub fn umount(special: [*:0]const u8) usize { | 385 | pub fn umount(special: [*:0]const u8) usize { |
| 386 | return syscall2(.umount2, @ptrToInt(special), 0); | 386 | return syscall2(.umount2, @intFromPtr(special), 0); |
| 387 | } | 387 | } |
| 388 | 388 | ||
| 389 | pub fn umount2(special: [*:0]const u8, flags: u32) usize { | 389 | pub fn umount2(special: [*:0]const u8, flags: u32) usize { |
| 390 | return syscall2(.umount2, @ptrToInt(special), flags); | 390 | return syscall2(.umount2, @intFromPtr(special), flags); |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: i64) usize { | 393 | pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: i64) usize { |
| 394 | if (@hasField(SYS, "mmap2")) { | 394 | if (@hasField(SYS, "mmap2")) { |
| 395 | // Make sure the offset is also specified in multiples of page size | 395 | // Make sure the offset is also specified in multiples of page size |
| 396 | if ((offset & (MMAP2_UNIT - 1)) != 0) | 396 | if ((offset & (MMAP2_UNIT - 1)) != 0) |
| 397 | return @bitCast(usize, -@as(isize, @enumToInt(E.INVAL))); | 397 | return @bitCast(usize, -@as(isize, @intFromEnum(E.INVAL))); |
| 398 | 398 | ||
| 399 | return syscall6( | 399 | return syscall6( |
| 400 | .mmap2, | 400 | .mmap2, |
| 401 | @ptrToInt(address), | 401 | @intFromPtr(address), |
| 402 | length, | 402 | length, |
| 403 | prot, | 403 | prot, |
| 404 | flags, | 404 | flags, |
| ... | @@ -408,7 +408,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of | ... | @@ -408,7 +408,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of |
| 408 | } else { | 408 | } else { |
| 409 | return syscall6( | 409 | return syscall6( |
| 410 | .mmap, | 410 | .mmap, |
| 411 | @ptrToInt(address), | 411 | @intFromPtr(address), |
| 412 | length, | 412 | length, |
| 413 | prot, | 413 | prot, |
| 414 | flags, | 414 | flags, |
| ... | @@ -419,7 +419,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of | ... | @@ -419,7 +419,7 @@ pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, of |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | pub fn mprotect(address: [*]const u8, length: usize, protection: usize) usize { | 421 | pub fn mprotect(address: [*]const u8, length: usize, protection: usize) usize { |
| 422 | return syscall3(.mprotect, @ptrToInt(address), length, protection); | 422 | return syscall3(.mprotect, @intFromPtr(address), length, protection); |
| 423 | } | 423 | } |
| 424 | 424 | ||
| 425 | pub const MSF = struct { | 425 | pub const MSF = struct { |
| ... | @@ -429,22 +429,22 @@ pub const MSF = struct { | ... | @@ -429,22 +429,22 @@ pub const MSF = struct { |
| 429 | }; | 429 | }; |
| 430 | 430 | ||
| 431 | pub fn msync(address: [*]const u8, length: usize, flags: i32) usize { | 431 | pub fn msync(address: [*]const u8, length: usize, flags: i32) usize { |
| 432 | return syscall3(.msync, @ptrToInt(address), length, @bitCast(u32, flags)); | 432 | return syscall3(.msync, @intFromPtr(address), length, @bitCast(u32, flags)); |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | pub fn munmap(address: [*]const u8, length: usize) usize { | 435 | pub fn munmap(address: [*]const u8, length: usize) usize { |
| 436 | return syscall2(.munmap, @ptrToInt(address), length); | 436 | return syscall2(.munmap, @intFromPtr(address), length); |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize { | 439 | pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize { |
| 440 | if (@hasField(SYS, "poll")) { | 440 | if (@hasField(SYS, "poll")) { |
| 441 | return syscall3(.poll, @ptrToInt(fds), n, @bitCast(u32, timeout)); | 441 | return syscall3(.poll, @intFromPtr(fds), n, @bitCast(u32, timeout)); |
| 442 | } else { | 442 | } else { |
| 443 | return syscall5( | 443 | return syscall5( |
| 444 | .ppoll, | 444 | .ppoll, |
| 445 | @ptrToInt(fds), | 445 | @intFromPtr(fds), |
| 446 | n, | 446 | n, |
| 447 | @ptrToInt(if (timeout >= 0) | 447 | @intFromPtr(if (timeout >= 0) |
| 448 | &timespec{ | 448 | &timespec{ |
| 449 | .tv_sec = @divTrunc(timeout, 1000), | 449 | .tv_sec = @divTrunc(timeout, 1000), |
| 450 | .tv_nsec = @rem(timeout, 1000) * 1000000, | 450 | .tv_nsec = @rem(timeout, 1000) * 1000000, |
| ... | @@ -458,11 +458,11 @@ pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize { | ... | @@ -458,11 +458,11 @@ pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize { |
| 458 | } | 458 | } |
| 459 | 459 | ||
| 460 | pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize { | 460 | pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize { |
| 461 | return syscall5(.ppoll, @ptrToInt(fds), n, @ptrToInt(timeout), @ptrToInt(sigmask), NSIG / 8); | 461 | return syscall5(.ppoll, @intFromPtr(fds), n, @intFromPtr(timeout), @intFromPtr(sigmask), NSIG / 8); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | pub fn read(fd: i32, buf: [*]u8, count: usize) usize { | 464 | pub fn read(fd: i32, buf: [*]u8, count: usize) usize { |
| 465 | return syscall3(.read, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count); | 465 | return syscall3(.read, @bitCast(usize, @as(isize, fd)), @intFromPtr(buf), count); |
| 466 | } | 466 | } |
| 467 | 467 | ||
| 468 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize { | 468 | pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize { |
| ... | @@ -470,7 +470,7 @@ pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize { | ... | @@ -470,7 +470,7 @@ pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize { |
| 470 | return syscall5( | 470 | return syscall5( |
| 471 | .preadv, | 471 | .preadv, |
| 472 | @bitCast(usize, @as(isize, fd)), | 472 | @bitCast(usize, @as(isize, fd)), |
| 473 | @ptrToInt(iov), | 473 | @intFromPtr(iov), |
| 474 | count, | 474 | count, |
| 475 | // Kernel expects the offset is split into largest natural word-size. | 475 | // Kernel expects the offset is split into largest natural word-size. |
| 476 | // See following link for detail: | 476 | // See following link for detail: |
| ... | @@ -485,7 +485,7 @@ pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: i64, flags: k | ... | @@ -485,7 +485,7 @@ pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: i64, flags: k |
| 485 | return syscall6( | 485 | return syscall6( |
| 486 | .preadv2, | 486 | .preadv2, |
| 487 | @bitCast(usize, @as(isize, fd)), | 487 | @bitCast(usize, @as(isize, fd)), |
| 488 | @ptrToInt(iov), | 488 | @intFromPtr(iov), |
| 489 | count, | 489 | count, |
| 490 | // See comments in preadv | 490 | // See comments in preadv |
| 491 | @truncate(usize, offset_u), | 491 | @truncate(usize, offset_u), |
| ... | @@ -495,11 +495,11 @@ pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: i64, flags: k | ... | @@ -495,11 +495,11 @@ pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: i64, flags: k |
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize { | 497 | pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize { |
| 498 | return syscall3(.readv, @bitCast(usize, @as(isize, fd)), @ptrToInt(iov), count); | 498 | return syscall3(.readv, @bitCast(usize, @as(isize, fd)), @intFromPtr(iov), count); |
| 499 | } | 499 | } |
| 500 | 500 | ||
| 501 | pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { | 501 | pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize { |
| 502 | return syscall3(.writev, @bitCast(usize, @as(isize, fd)), @ptrToInt(iov), count); | 502 | return syscall3(.writev, @bitCast(usize, @as(isize, fd)), @intFromPtr(iov), count); |
| 503 | } | 503 | } |
| 504 | 504 | ||
| 505 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64) usize { | 505 | pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64) usize { |
| ... | @@ -507,7 +507,7 @@ pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64) us | ... | @@ -507,7 +507,7 @@ pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64) us |
| 507 | return syscall5( | 507 | return syscall5( |
| 508 | .pwritev, | 508 | .pwritev, |
| 509 | @bitCast(usize, @as(isize, fd)), | 509 | @bitCast(usize, @as(isize, fd)), |
| 510 | @ptrToInt(iov), | 510 | @intFromPtr(iov), |
| 511 | count, | 511 | count, |
| 512 | // See comments in preadv | 512 | // See comments in preadv |
| 513 | @truncate(usize, offset_u), | 513 | @truncate(usize, offset_u), |
| ... | @@ -520,7 +520,7 @@ pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64, f | ... | @@ -520,7 +520,7 @@ pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64, f |
| 520 | return syscall6( | 520 | return syscall6( |
| 521 | .pwritev2, | 521 | .pwritev2, |
| 522 | @bitCast(usize, @as(isize, fd)), | 522 | @bitCast(usize, @as(isize, fd)), |
| 523 | @ptrToInt(iov), | 523 | @intFromPtr(iov), |
| 524 | count, | 524 | count, |
| 525 | // See comments in preadv | 525 | // See comments in preadv |
| 526 | @truncate(usize, offset_u), | 526 | @truncate(usize, offset_u), |
| ... | @@ -531,22 +531,22 @@ pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64, f | ... | @@ -531,22 +531,22 @@ pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64, f |
| 531 | 531 | ||
| 532 | pub fn rmdir(path: [*:0]const u8) usize { | 532 | pub fn rmdir(path: [*:0]const u8) usize { |
| 533 | if (@hasField(SYS, "rmdir")) { | 533 | if (@hasField(SYS, "rmdir")) { |
| 534 | return syscall1(.rmdir, @ptrToInt(path)); | 534 | return syscall1(.rmdir, @intFromPtr(path)); |
| 535 | } else { | 535 | } else { |
| 536 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(path), AT.REMOVEDIR); | 536 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(path), AT.REMOVEDIR); |
| 537 | } | 537 | } |
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | pub fn symlink(existing: [*:0]const u8, new: [*:0]const u8) usize { | 540 | pub fn symlink(existing: [*:0]const u8, new: [*:0]const u8) usize { |
| 541 | if (@hasField(SYS, "symlink")) { | 541 | if (@hasField(SYS, "symlink")) { |
| 542 | return syscall2(.symlink, @ptrToInt(existing), @ptrToInt(new)); | 542 | return syscall2(.symlink, @intFromPtr(existing), @intFromPtr(new)); |
| 543 | } else { | 543 | } else { |
| 544 | return syscall3(.symlinkat, @ptrToInt(existing), @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(new)); | 544 | return syscall3(.symlinkat, @intFromPtr(existing), @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(new)); |
| 545 | } | 545 | } |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) usize { | 548 | pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) usize { |
| 549 | return syscall3(.symlinkat, @ptrToInt(existing), @bitCast(usize, @as(isize, newfd)), @ptrToInt(newpath)); | 549 | return syscall3(.symlinkat, @intFromPtr(existing), @bitCast(usize, @as(isize, newfd)), @intFromPtr(newpath)); |
| 550 | } | 550 | } |
| 551 | 551 | ||
| 552 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { | 552 | pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { |
| ... | @@ -556,7 +556,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { | ... | @@ -556,7 +556,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { |
| 556 | return syscall6( | 556 | return syscall6( |
| 557 | .pread64, | 557 | .pread64, |
| 558 | @bitCast(usize, @as(isize, fd)), | 558 | @bitCast(usize, @as(isize, fd)), |
| 559 | @ptrToInt(buf), | 559 | @intFromPtr(buf), |
| 560 | count, | 560 | count, |
| 561 | 0, | 561 | 0, |
| 562 | offset_halves[0], | 562 | offset_halves[0], |
| ... | @@ -566,7 +566,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { | ... | @@ -566,7 +566,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { |
| 566 | return syscall5( | 566 | return syscall5( |
| 567 | .pread64, | 567 | .pread64, |
| 568 | @bitCast(usize, @as(isize, fd)), | 568 | @bitCast(usize, @as(isize, fd)), |
| 569 | @ptrToInt(buf), | 569 | @intFromPtr(buf), |
| 570 | count, | 570 | count, |
| 571 | offset_halves[0], | 571 | offset_halves[0], |
| 572 | offset_halves[1], | 572 | offset_halves[1], |
| ... | @@ -581,7 +581,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { | ... | @@ -581,7 +581,7 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { |
| 581 | return syscall4( | 581 | return syscall4( |
| 582 | syscall_number, | 582 | syscall_number, |
| 583 | @bitCast(usize, @as(isize, fd)), | 583 | @bitCast(usize, @as(isize, fd)), |
| 584 | @ptrToInt(buf), | 584 | @intFromPtr(buf), |
| 585 | count, | 585 | count, |
| 586 | @bitCast(u64, offset), | 586 | @bitCast(u64, offset), |
| 587 | ); | 587 | ); |
| ... | @@ -590,32 +590,32 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { | ... | @@ -590,32 +590,32 @@ pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize { |
| 590 | 590 | ||
| 591 | pub fn access(path: [*:0]const u8, mode: u32) usize { | 591 | pub fn access(path: [*:0]const u8, mode: u32) usize { |
| 592 | if (@hasField(SYS, "access")) { | 592 | if (@hasField(SYS, "access")) { |
| 593 | return syscall2(.access, @ptrToInt(path), mode); | 593 | return syscall2(.access, @intFromPtr(path), mode); |
| 594 | } else { | 594 | } else { |
| 595 | return syscall4(.faccessat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(path), mode, 0); | 595 | return syscall4(.faccessat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(path), mode, 0); |
| 596 | } | 596 | } |
| 597 | } | 597 | } |
| 598 | 598 | ||
| 599 | pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize { | 599 | pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize { |
| 600 | return syscall4(.faccessat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), mode, flags); | 600 | return syscall4(.faccessat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), mode, flags); |
| 601 | } | 601 | } |
| 602 | 602 | ||
| 603 | pub fn pipe(fd: *[2]i32) usize { | 603 | pub fn pipe(fd: *[2]i32) usize { |
| 604 | if (comptime (native_arch.isMIPS() or native_arch.isSPARC())) { | 604 | if (comptime (native_arch.isMIPS() or native_arch.isSPARC())) { |
| 605 | return syscall_pipe(fd); | 605 | return syscall_pipe(fd); |
| 606 | } else if (@hasField(SYS, "pipe")) { | 606 | } else if (@hasField(SYS, "pipe")) { |
| 607 | return syscall1(.pipe, @ptrToInt(fd)); | 607 | return syscall1(.pipe, @intFromPtr(fd)); |
| 608 | } else { | 608 | } else { |
| 609 | return syscall2(.pipe2, @ptrToInt(fd), 0); | 609 | return syscall2(.pipe2, @intFromPtr(fd), 0); |
| 610 | } | 610 | } |
| 611 | } | 611 | } |
| 612 | 612 | ||
| 613 | pub fn pipe2(fd: *[2]i32, flags: u32) usize { | 613 | pub fn pipe2(fd: *[2]i32, flags: u32) usize { |
| 614 | return syscall2(.pipe2, @ptrToInt(fd), flags); | 614 | return syscall2(.pipe2, @intFromPtr(fd), flags); |
| 615 | } | 615 | } |
| 616 | 616 | ||
| 617 | pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { | 617 | pub fn write(fd: i32, buf: [*]const u8, count: usize) usize { |
| 618 | return syscall3(.write, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count); | 618 | return syscall3(.write, @bitCast(usize, @as(isize, fd)), @intFromPtr(buf), count); |
| 619 | } | 619 | } |
| 620 | 620 | ||
| 621 | pub fn ftruncate(fd: i32, length: i64) usize { | 621 | pub fn ftruncate(fd: i32, length: i64) usize { |
| ... | @@ -654,7 +654,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { | ... | @@ -654,7 +654,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { |
| 654 | return syscall6( | 654 | return syscall6( |
| 655 | .pwrite64, | 655 | .pwrite64, |
| 656 | @bitCast(usize, @as(isize, fd)), | 656 | @bitCast(usize, @as(isize, fd)), |
| 657 | @ptrToInt(buf), | 657 | @intFromPtr(buf), |
| 658 | count, | 658 | count, |
| 659 | 0, | 659 | 0, |
| 660 | offset_halves[0], | 660 | offset_halves[0], |
| ... | @@ -664,7 +664,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { | ... | @@ -664,7 +664,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { |
| 664 | return syscall5( | 664 | return syscall5( |
| 665 | .pwrite64, | 665 | .pwrite64, |
| 666 | @bitCast(usize, @as(isize, fd)), | 666 | @bitCast(usize, @as(isize, fd)), |
| 667 | @ptrToInt(buf), | 667 | @intFromPtr(buf), |
| 668 | count, | 668 | count, |
| 669 | offset_halves[0], | 669 | offset_halves[0], |
| 670 | offset_halves[1], | 670 | offset_halves[1], |
| ... | @@ -679,7 +679,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { | ... | @@ -679,7 +679,7 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { |
| 679 | return syscall4( | 679 | return syscall4( |
| 680 | syscall_number, | 680 | syscall_number, |
| 681 | @bitCast(usize, @as(isize, fd)), | 681 | @bitCast(usize, @as(isize, fd)), |
| 682 | @ptrToInt(buf), | 682 | @intFromPtr(buf), |
| 683 | count, | 683 | count, |
| 684 | @bitCast(u64, offset), | 684 | @bitCast(u64, offset), |
| 685 | ); | 685 | ); |
| ... | @@ -688,11 +688,11 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { | ... | @@ -688,11 +688,11 @@ pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize { |
| 688 | 688 | ||
| 689 | pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize { | 689 | pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize { |
| 690 | if (@hasField(SYS, "rename")) { | 690 | if (@hasField(SYS, "rename")) { |
| 691 | return syscall2(.rename, @ptrToInt(old), @ptrToInt(new)); | 691 | return syscall2(.rename, @intFromPtr(old), @intFromPtr(new)); |
| 692 | } else if (@hasField(SYS, "renameat")) { | 692 | } else if (@hasField(SYS, "renameat")) { |
| 693 | return syscall4(.renameat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(old), @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(new)); | 693 | return syscall4(.renameat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(old), @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(new)); |
| 694 | } else { | 694 | } else { |
| 695 | return syscall5(.renameat2, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(old), @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(new), 0); | 695 | return syscall5(.renameat2, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(old), @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(new), 0); |
| 696 | } | 696 | } |
| 697 | } | 697 | } |
| 698 | 698 | ||
| ... | @@ -701,17 +701,17 @@ pub fn renameat(oldfd: i32, oldpath: [*]const u8, newfd: i32, newpath: [*]const | ... | @@ -701,17 +701,17 @@ pub fn renameat(oldfd: i32, oldpath: [*]const u8, newfd: i32, newpath: [*]const |
| 701 | return syscall4( | 701 | return syscall4( |
| 702 | .renameat, | 702 | .renameat, |
| 703 | @bitCast(usize, @as(isize, oldfd)), | 703 | @bitCast(usize, @as(isize, oldfd)), |
| 704 | @ptrToInt(oldpath), | 704 | @intFromPtr(oldpath), |
| 705 | @bitCast(usize, @as(isize, newfd)), | 705 | @bitCast(usize, @as(isize, newfd)), |
| 706 | @ptrToInt(newpath), | 706 | @intFromPtr(newpath), |
| 707 | ); | 707 | ); |
| 708 | } else { | 708 | } else { |
| 709 | return syscall5( | 709 | return syscall5( |
| 710 | .renameat2, | 710 | .renameat2, |
| 711 | @bitCast(usize, @as(isize, oldfd)), | 711 | @bitCast(usize, @as(isize, oldfd)), |
| 712 | @ptrToInt(oldpath), | 712 | @intFromPtr(oldpath), |
| 713 | @bitCast(usize, @as(isize, newfd)), | 713 | @bitCast(usize, @as(isize, newfd)), |
| 714 | @ptrToInt(newpath), | 714 | @intFromPtr(newpath), |
| 715 | 0, | 715 | 0, |
| 716 | ); | 716 | ); |
| 717 | } | 717 | } |
| ... | @@ -721,21 +721,21 @@ pub fn renameat2(oldfd: i32, oldpath: [*:0]const u8, newfd: i32, newpath: [*:0]c | ... | @@ -721,21 +721,21 @@ pub fn renameat2(oldfd: i32, oldpath: [*:0]const u8, newfd: i32, newpath: [*:0]c |
| 721 | return syscall5( | 721 | return syscall5( |
| 722 | .renameat2, | 722 | .renameat2, |
| 723 | @bitCast(usize, @as(isize, oldfd)), | 723 | @bitCast(usize, @as(isize, oldfd)), |
| 724 | @ptrToInt(oldpath), | 724 | @intFromPtr(oldpath), |
| 725 | @bitCast(usize, @as(isize, newfd)), | 725 | @bitCast(usize, @as(isize, newfd)), |
| 726 | @ptrToInt(newpath), | 726 | @intFromPtr(newpath), |
| 727 | flags, | 727 | flags, |
| 728 | ); | 728 | ); |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | pub fn open(path: [*:0]const u8, flags: u32, perm: mode_t) usize { | 731 | pub fn open(path: [*:0]const u8, flags: u32, perm: mode_t) usize { |
| 732 | if (@hasField(SYS, "open")) { | 732 | if (@hasField(SYS, "open")) { |
| 733 | return syscall3(.open, @ptrToInt(path), flags, perm); | 733 | return syscall3(.open, @intFromPtr(path), flags, perm); |
| 734 | } else { | 734 | } else { |
| 735 | return syscall4( | 735 | return syscall4( |
| 736 | .openat, | 736 | .openat, |
| 737 | @bitCast(usize, @as(isize, AT.FDCWD)), | 737 | @bitCast(usize, @as(isize, AT.FDCWD)), |
| 738 | @ptrToInt(path), | 738 | @intFromPtr(path), |
| 739 | flags, | 739 | flags, |
| 740 | perm, | 740 | perm, |
| 741 | ); | 741 | ); |
| ... | @@ -743,17 +743,17 @@ pub fn open(path: [*:0]const u8, flags: u32, perm: mode_t) usize { | ... | @@ -743,17 +743,17 @@ pub fn open(path: [*:0]const u8, flags: u32, perm: mode_t) usize { |
| 743 | } | 743 | } |
| 744 | 744 | ||
| 745 | pub fn create(path: [*:0]const u8, perm: mode_t) usize { | 745 | pub fn create(path: [*:0]const u8, perm: mode_t) usize { |
| 746 | return syscall2(.creat, @ptrToInt(path), perm); | 746 | return syscall2(.creat, @intFromPtr(path), perm); |
| 747 | } | 747 | } |
| 748 | 748 | ||
| 749 | pub fn openat(dirfd: i32, path: [*:0]const u8, flags: u32, mode: mode_t) usize { | 749 | pub fn openat(dirfd: i32, path: [*:0]const u8, flags: u32, mode: mode_t) usize { |
| 750 | // dirfd could be negative, for example AT.FDCWD is -100 | 750 | // dirfd could be negative, for example AT.FDCWD is -100 |
| 751 | return syscall4(.openat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), flags, mode); | 751 | return syscall4(.openat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), flags, mode); |
| 752 | } | 752 | } |
| 753 | 753 | ||
| 754 | /// See also `clone` (from the arch-specific include) | 754 | /// See also `clone` (from the arch-specific include) |
| 755 | pub fn clone5(flags: usize, child_stack_ptr: usize, parent_tid: *i32, child_tid: *i32, newtls: usize) usize { | 755 | pub fn clone5(flags: usize, child_stack_ptr: usize, parent_tid: *i32, child_tid: *i32, newtls: usize) usize { |
| 756 | return syscall5(.clone, flags, child_stack_ptr, @ptrToInt(parent_tid), @ptrToInt(child_tid), newtls); | 756 | return syscall5(.clone, flags, child_stack_ptr, @intFromPtr(parent_tid), @intFromPtr(child_tid), newtls); |
| 757 | } | 757 | } |
| 758 | 758 | ||
| 759 | /// See also `clone` (from the arch-specific include) | 759 | /// See also `clone` (from the arch-specific include) |
| ... | @@ -771,12 +771,12 @@ pub fn fchmod(fd: i32, mode: mode_t) usize { | ... | @@ -771,12 +771,12 @@ pub fn fchmod(fd: i32, mode: mode_t) usize { |
| 771 | 771 | ||
| 772 | pub fn chmod(path: [*:0]const u8, mode: mode_t) usize { | 772 | pub fn chmod(path: [*:0]const u8, mode: mode_t) usize { |
| 773 | if (@hasField(SYS, "chmod")) { | 773 | if (@hasField(SYS, "chmod")) { |
| 774 | return syscall2(.chmod, @ptrToInt(path), mode); | 774 | return syscall2(.chmod, @intFromPtr(path), mode); |
| 775 | } else { | 775 | } else { |
| 776 | return syscall4( | 776 | return syscall4( |
| 777 | .fchmodat, | 777 | .fchmodat, |
| 778 | @bitCast(usize, @as(isize, AT.FDCWD)), | 778 | @bitCast(usize, @as(isize, AT.FDCWD)), |
| 779 | @ptrToInt(path), | 779 | @intFromPtr(path), |
| 780 | mode, | 780 | mode, |
| 781 | 0, | 781 | 0, |
| 782 | ); | 782 | ); |
| ... | @@ -792,7 +792,7 @@ pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { | ... | @@ -792,7 +792,7 @@ pub fn fchown(fd: i32, owner: uid_t, group: gid_t) usize { |
| 792 | } | 792 | } |
| 793 | 793 | ||
| 794 | pub fn fchmodat(fd: i32, path: [*:0]const u8, mode: mode_t, flags: u32) usize { | 794 | pub fn fchmodat(fd: i32, path: [*:0]const u8, mode: mode_t, flags: u32) usize { |
| 795 | return syscall4(.fchmodat, @bitCast(usize, @as(isize, fd)), @ptrToInt(path), mode, flags); | 795 | return syscall4(.fchmodat, @bitCast(usize, @as(isize, fd)), @intFromPtr(path), mode, flags); |
| 796 | } | 796 | } |
| 797 | 797 | ||
| 798 | /// Can only be called on 32 bit systems. For 64 bit see `lseek`. | 798 | /// Can only be called on 32 bit systems. For 64 bit see `lseek`. |
| ... | @@ -804,7 +804,7 @@ pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize { | ... | @@ -804,7 +804,7 @@ pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize { |
| 804 | @bitCast(usize, @as(isize, fd)), | 804 | @bitCast(usize, @as(isize, fd)), |
| 805 | @truncate(usize, offset >> 32), | 805 | @truncate(usize, offset >> 32), |
| 806 | @truncate(usize, offset), | 806 | @truncate(usize, offset), |
| 807 | @ptrToInt(result), | 807 | @intFromPtr(result), |
| 808 | whence, | 808 | whence, |
| 809 | ); | 809 | ); |
| 810 | } | 810 | } |
| ... | @@ -874,15 +874,15 @@ pub const LINUX_REBOOT = struct { | ... | @@ -874,15 +874,15 @@ pub const LINUX_REBOOT = struct { |
| 874 | pub fn reboot(magic: LINUX_REBOOT.MAGIC1, magic2: LINUX_REBOOT.MAGIC2, cmd: LINUX_REBOOT.CMD, arg: ?*const anyopaque) usize { | 874 | pub fn reboot(magic: LINUX_REBOOT.MAGIC1, magic2: LINUX_REBOOT.MAGIC2, cmd: LINUX_REBOOT.CMD, arg: ?*const anyopaque) usize { |
| 875 | return std.os.linux.syscall4( | 875 | return std.os.linux.syscall4( |
| 876 | .reboot, | 876 | .reboot, |
| 877 | @enumToInt(magic), | 877 | @intFromEnum(magic), |
| 878 | @enumToInt(magic2), | 878 | @intFromEnum(magic2), |
| 879 | @enumToInt(cmd), | 879 | @intFromEnum(cmd), |
| 880 | @ptrToInt(arg), | 880 | @intFromPtr(arg), |
| 881 | ); | 881 | ); |
| 882 | } | 882 | } |
| 883 | 883 | ||
| 884 | pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { | 884 | pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize { |
| 885 | return syscall3(.getrandom, @ptrToInt(buf), count, flags); | 885 | return syscall3(.getrandom, @intFromPtr(buf), count, flags); |
| 886 | } | 886 | } |
| 887 | 887 | ||
| 888 | pub fn kill(pid: pid_t, sig: i32) usize { | 888 | pub fn kill(pid: pid_t, sig: i32) usize { |
| ... | @@ -901,17 +901,17 @@ pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: i32) usize { | ... | @@ -901,17 +901,17 @@ pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: i32) usize { |
| 901 | if (@hasField(SYS, "link")) { | 901 | if (@hasField(SYS, "link")) { |
| 902 | return syscall3( | 902 | return syscall3( |
| 903 | .link, | 903 | .link, |
| 904 | @ptrToInt(oldpath), | 904 | @intFromPtr(oldpath), |
| 905 | @ptrToInt(newpath), | 905 | @intFromPtr(newpath), |
| 906 | @bitCast(usize, @as(isize, flags)), | 906 | @bitCast(usize, @as(isize, flags)), |
| 907 | ); | 907 | ); |
| 908 | } else { | 908 | } else { |
| 909 | return syscall5( | 909 | return syscall5( |
| 910 | .linkat, | 910 | .linkat, |
| 911 | @bitCast(usize, @as(isize, AT.FDCWD)), | 911 | @bitCast(usize, @as(isize, AT.FDCWD)), |
| 912 | @ptrToInt(oldpath), | 912 | @intFromPtr(oldpath), |
| 913 | @bitCast(usize, @as(isize, AT.FDCWD)), | 913 | @bitCast(usize, @as(isize, AT.FDCWD)), |
| 914 | @ptrToInt(newpath), | 914 | @intFromPtr(newpath), |
| 915 | @bitCast(usize, @as(isize, flags)), | 915 | @bitCast(usize, @as(isize, flags)), |
| 916 | ); | 916 | ); |
| 917 | } | 917 | } |
| ... | @@ -921,41 +921,41 @@ pub fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]co | ... | @@ -921,41 +921,41 @@ pub fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]co |
| 921 | return syscall5( | 921 | return syscall5( |
| 922 | .linkat, | 922 | .linkat, |
| 923 | @bitCast(usize, @as(isize, oldfd)), | 923 | @bitCast(usize, @as(isize, oldfd)), |
| 924 | @ptrToInt(oldpath), | 924 | @intFromPtr(oldpath), |
| 925 | @bitCast(usize, @as(isize, newfd)), | 925 | @bitCast(usize, @as(isize, newfd)), |
| 926 | @ptrToInt(newpath), | 926 | @intFromPtr(newpath), |
| 927 | @bitCast(usize, @as(isize, flags)), | 927 | @bitCast(usize, @as(isize, flags)), |
| 928 | ); | 928 | ); |
| 929 | } | 929 | } |
| 930 | 930 | ||
| 931 | pub fn unlink(path: [*:0]const u8) usize { | 931 | pub fn unlink(path: [*:0]const u8) usize { |
| 932 | if (@hasField(SYS, "unlink")) { | 932 | if (@hasField(SYS, "unlink")) { |
| 933 | return syscall1(.unlink, @ptrToInt(path)); | 933 | return syscall1(.unlink, @intFromPtr(path)); |
| 934 | } else { | 934 | } else { |
| 935 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @ptrToInt(path), 0); | 935 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, AT.FDCWD)), @intFromPtr(path), 0); |
| 936 | } | 936 | } |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | pub fn unlinkat(dirfd: i32, path: [*:0]const u8, flags: u32) usize { | 939 | pub fn unlinkat(dirfd: i32, path: [*:0]const u8, flags: u32) usize { |
| 940 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), flags); | 940 | return syscall3(.unlinkat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), flags); |
| 941 | } | 941 | } |
| 942 | 942 | ||
| 943 | pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize { | 943 | pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize { |
| 944 | return syscall4(.wait4, @bitCast(usize, @as(isize, pid)), @ptrToInt(status), flags, 0); | 944 | return syscall4(.wait4, @bitCast(usize, @as(isize, pid)), @intFromPtr(status), flags, 0); |
| 945 | } | 945 | } |
| 946 | 946 | ||
| 947 | pub fn wait4(pid: pid_t, status: *u32, flags: u32, usage: ?*rusage) usize { | 947 | pub fn wait4(pid: pid_t, status: *u32, flags: u32, usage: ?*rusage) usize { |
| 948 | return syscall4( | 948 | return syscall4( |
| 949 | .wait4, | 949 | .wait4, |
| 950 | @bitCast(usize, @as(isize, pid)), | 950 | @bitCast(usize, @as(isize, pid)), |
| 951 | @ptrToInt(status), | 951 | @intFromPtr(status), |
| 952 | flags, | 952 | flags, |
| 953 | @ptrToInt(usage), | 953 | @intFromPtr(usage), |
| 954 | ); | 954 | ); |
| 955 | } | 955 | } |
| 956 | 956 | ||
| 957 | pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize { | 957 | pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize { |
| 958 | return syscall5(.waitid, @enumToInt(id_type), @bitCast(usize, @as(isize, id)), @ptrToInt(infop), flags, 0); | 958 | return syscall5(.waitid, @intFromEnum(id_type), @bitCast(usize, @as(isize, id)), @intFromPtr(infop), flags, 0); |
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize { | 961 | pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize { |
| ... | @@ -978,16 +978,16 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { | ... | @@ -978,16 +978,16 @@ pub fn clock_gettime(clk_id: i32, tp: *timespec) usize { |
| 978 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); | 978 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); |
| 979 | const rc = f(clk_id, tp); | 979 | const rc = f(clk_id, tp); |
| 980 | switch (rc) { | 980 | switch (rc) { |
| 981 | 0, @bitCast(usize, -@as(isize, @enumToInt(E.INVAL))) => return rc, | 981 | 0, @bitCast(usize, -@as(isize, @intFromEnum(E.INVAL))) => return rc, |
| 982 | else => {}, | 982 | else => {}, |
| 983 | } | 983 | } |
| 984 | } | 984 | } |
| 985 | } | 985 | } |
| 986 | return syscall2(.clock_gettime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp)); | 986 | return syscall2(.clock_gettime, @bitCast(usize, @as(isize, clk_id)), @intFromPtr(tp)); |
| 987 | } | 987 | } |
| 988 | 988 | ||
| 989 | fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { | 989 | fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { |
| 990 | const ptr = @intToPtr(?*const anyopaque, vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM)); | 990 | const ptr = @ptrFromInt(?*const anyopaque, vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM)); |
| 991 | // Note that we may not have a VDSO at all, update the stub address anyway | 991 | // Note that we may not have a VDSO at all, update the stub address anyway |
| 992 | // so that clock_gettime will fall back on the good old (and slow) syscall | 992 | // so that clock_gettime will fall back on the good old (and slow) syscall |
| 993 | @atomicStore(?*const anyopaque, &vdso_clock_gettime, ptr, .Monotonic); | 993 | @atomicStore(?*const anyopaque, &vdso_clock_gettime, ptr, .Monotonic); |
| ... | @@ -996,27 +996,27 @@ fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { | ... | @@ -996,27 +996,27 @@ fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize { |
| 996 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); | 996 | const f = @ptrCast(vdso_clock_gettime_ty, fn_ptr); |
| 997 | return f(clk, ts); | 997 | return f(clk, ts); |
| 998 | } | 998 | } |
| 999 | return @bitCast(usize, -@as(isize, @enumToInt(E.NOSYS))); | 999 | return @bitCast(usize, -@as(isize, @intFromEnum(E.NOSYS))); |
| 1000 | } | 1000 | } |
| 1001 | 1001 | ||
| 1002 | pub fn clock_getres(clk_id: i32, tp: *timespec) usize { | 1002 | pub fn clock_getres(clk_id: i32, tp: *timespec) usize { |
| 1003 | return syscall2(.clock_getres, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp)); | 1003 | return syscall2(.clock_getres, @bitCast(usize, @as(isize, clk_id)), @intFromPtr(tp)); |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| 1006 | pub fn clock_settime(clk_id: i32, tp: *const timespec) usize { | 1006 | pub fn clock_settime(clk_id: i32, tp: *const timespec) usize { |
| 1007 | return syscall2(.clock_settime, @bitCast(usize, @as(isize, clk_id)), @ptrToInt(tp)); | 1007 | return syscall2(.clock_settime, @bitCast(usize, @as(isize, clk_id)), @intFromPtr(tp)); |
| 1008 | } | 1008 | } |
| 1009 | 1009 | ||
| 1010 | pub fn gettimeofday(tv: *timeval, tz: *timezone) usize { | 1010 | pub fn gettimeofday(tv: *timeval, tz: *timezone) usize { |
| 1011 | return syscall2(.gettimeofday, @ptrToInt(tv), @ptrToInt(tz)); | 1011 | return syscall2(.gettimeofday, @intFromPtr(tv), @intFromPtr(tz)); |
| 1012 | } | 1012 | } |
| 1013 | 1013 | ||
| 1014 | pub fn settimeofday(tv: *const timeval, tz: *const timezone) usize { | 1014 | pub fn settimeofday(tv: *const timeval, tz: *const timezone) usize { |
| 1015 | return syscall2(.settimeofday, @ptrToInt(tv), @ptrToInt(tz)); | 1015 | return syscall2(.settimeofday, @intFromPtr(tv), @intFromPtr(tz)); |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize { | 1018 | pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize { |
| 1019 | return syscall2(.nanosleep, @ptrToInt(req), @ptrToInt(rem)); | 1019 | return syscall2(.nanosleep, @intFromPtr(req), @intFromPtr(rem)); |
| 1020 | } | 1020 | } |
| 1021 | 1021 | ||
| 1022 | pub fn setuid(uid: uid_t) usize { | 1022 | pub fn setuid(uid: uid_t) usize { |
| ... | @@ -1107,17 +1107,17 @@ pub fn setegid(egid: gid_t) usize { | ... | @@ -1107,17 +1107,17 @@ pub fn setegid(egid: gid_t) usize { |
| 1107 | 1107 | ||
| 1108 | pub fn getresuid(ruid: *uid_t, euid: *uid_t, suid: *uid_t) usize { | 1108 | pub fn getresuid(ruid: *uid_t, euid: *uid_t, suid: *uid_t) usize { |
| 1109 | if (@hasField(SYS, "getresuid32")) { | 1109 | if (@hasField(SYS, "getresuid32")) { |
| 1110 | return syscall3(.getresuid32, @ptrToInt(ruid), @ptrToInt(euid), @ptrToInt(suid)); | 1110 | return syscall3(.getresuid32, @intFromPtr(ruid), @intFromPtr(euid), @intFromPtr(suid)); |
| 1111 | } else { | 1111 | } else { |
| 1112 | return syscall3(.getresuid, @ptrToInt(ruid), @ptrToInt(euid), @ptrToInt(suid)); | 1112 | return syscall3(.getresuid, @intFromPtr(ruid), @intFromPtr(euid), @intFromPtr(suid)); |
| 1113 | } | 1113 | } |
| 1114 | } | 1114 | } |
| 1115 | 1115 | ||
| 1116 | pub fn getresgid(rgid: *gid_t, egid: *gid_t, sgid: *gid_t) usize { | 1116 | pub fn getresgid(rgid: *gid_t, egid: *gid_t, sgid: *gid_t) usize { |
| 1117 | if (@hasField(SYS, "getresgid32")) { | 1117 | if (@hasField(SYS, "getresgid32")) { |
| 1118 | return syscall3(.getresgid32, @ptrToInt(rgid), @ptrToInt(egid), @ptrToInt(sgid)); | 1118 | return syscall3(.getresgid32, @intFromPtr(rgid), @intFromPtr(egid), @intFromPtr(sgid)); |
| 1119 | } else { | 1119 | } else { |
| 1120 | return syscall3(.getresgid, @ptrToInt(rgid), @ptrToInt(egid), @ptrToInt(sgid)); | 1120 | return syscall3(.getresgid, @intFromPtr(rgid), @intFromPtr(egid), @intFromPtr(sgid)); |
| 1121 | } | 1121 | } |
| 1122 | } | 1122 | } |
| 1123 | 1123 | ||
| ... | @@ -1139,17 +1139,17 @@ pub fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) usize { | ... | @@ -1139,17 +1139,17 @@ pub fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) usize { |
| 1139 | 1139 | ||
| 1140 | pub fn getgroups(size: usize, list: *gid_t) usize { | 1140 | pub fn getgroups(size: usize, list: *gid_t) usize { |
| 1141 | if (@hasField(SYS, "getgroups32")) { | 1141 | if (@hasField(SYS, "getgroups32")) { |
| 1142 | return syscall2(.getgroups32, size, @ptrToInt(list)); | 1142 | return syscall2(.getgroups32, size, @intFromPtr(list)); |
| 1143 | } else { | 1143 | } else { |
| 1144 | return syscall2(.getgroups, size, @ptrToInt(list)); | 1144 | return syscall2(.getgroups, size, @intFromPtr(list)); |
| 1145 | } | 1145 | } |
| 1146 | } | 1146 | } |
| 1147 | 1147 | ||
| 1148 | pub fn setgroups(size: usize, list: [*]const gid_t) usize { | 1148 | pub fn setgroups(size: usize, list: [*]const gid_t) usize { |
| 1149 | if (@hasField(SYS, "setgroups32")) { | 1149 | if (@hasField(SYS, "setgroups32")) { |
| 1150 | return syscall2(.setgroups32, size, @ptrToInt(list)); | 1150 | return syscall2(.setgroups32, size, @intFromPtr(list)); |
| 1151 | } else { | 1151 | } else { |
| 1152 | return syscall2(.setgroups, size, @ptrToInt(list)); | 1152 | return syscall2(.setgroups, size, @intFromPtr(list)); |
| 1153 | } | 1153 | } |
| 1154 | } | 1154 | } |
| 1155 | 1155 | ||
| ... | @@ -1162,7 +1162,7 @@ pub fn gettid() pid_t { | ... | @@ -1162,7 +1162,7 @@ pub fn gettid() pid_t { |
| 1162 | } | 1162 | } |
| 1163 | 1163 | ||
| 1164 | pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?*sigset_t) usize { | 1164 | pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?*sigset_t) usize { |
| 1165 | return syscall4(.rt_sigprocmask, flags, @ptrToInt(set), @ptrToInt(oldset), NSIG / 8); | 1165 | return syscall4(.rt_sigprocmask, flags, @intFromPtr(set), @intFromPtr(oldset), NSIG / 8); |
| 1166 | } | 1166 | } |
| 1167 | 1167 | ||
| 1168 | pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize { | 1168 | pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize { |
| ... | @@ -1187,12 +1187,12 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact | ... | @@ -1187,12 +1187,12 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact |
| 1187 | @memcpy(@ptrCast([*]u8, &ksa.mask)[0..mask_size], @ptrCast([*]const u8, &new.mask)); | 1187 | @memcpy(@ptrCast([*]u8, &ksa.mask)[0..mask_size], @ptrCast([*]const u8, &new.mask)); |
| 1188 | } | 1188 | } |
| 1189 | 1189 | ||
| 1190 | const ksa_arg = if (act != null) @ptrToInt(&ksa) else 0; | 1190 | const ksa_arg = if (act != null) @intFromPtr(&ksa) else 0; |
| 1191 | const oldksa_arg = if (oact != null) @ptrToInt(&oldksa) else 0; | 1191 | const oldksa_arg = if (oact != null) @intFromPtr(&oldksa) else 0; |
| 1192 | 1192 | ||
| 1193 | const result = switch (native_arch) { | 1193 | const result = switch (native_arch) { |
| 1194 | // The sparc version of rt_sigaction needs the restorer function to be passed as an argument too. | 1194 | // The sparc version of rt_sigaction needs the restorer function to be passed as an argument too. |
| 1195 | .sparc, .sparc64 => syscall5(.rt_sigaction, sig, ksa_arg, oldksa_arg, @ptrToInt(ksa.restorer), mask_size), | 1195 | .sparc, .sparc64 => syscall5(.rt_sigaction, sig, ksa_arg, oldksa_arg, @intFromPtr(ksa.restorer), mask_size), |
| 1196 | else => syscall4(.rt_sigaction, sig, ksa_arg, oldksa_arg, mask_size), | 1196 | else => syscall4(.rt_sigaction, sig, ksa_arg, oldksa_arg, mask_size), |
| 1197 | }; | 1197 | }; |
| 1198 | if (getErrno(result) != .SUCCESS) return result; | 1198 | if (getErrno(result) != .SUCCESS) return result; |
| ... | @@ -1223,16 +1223,16 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool { | ... | @@ -1223,16 +1223,16 @@ pub fn sigismember(set: *const sigset_t, sig: u6) bool { |
| 1223 | 1223 | ||
| 1224 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1224 | pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1225 | if (native_arch == .x86) { | 1225 | if (native_arch == .x86) { |
| 1226 | return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); | 1226 | return socketcall(SC.getsockname, &[3]usize{ @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len) }); |
| 1227 | } | 1227 | } |
| 1228 | return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); | 1228 | return syscall3(.getsockname, @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len)); |
| 1229 | } | 1229 | } |
| 1230 | 1230 | ||
| 1231 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { | 1231 | pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize { |
| 1232 | if (native_arch == .x86) { | 1232 | if (native_arch == .x86) { |
| 1233 | return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len) }); | 1233 | return socketcall(SC.getpeername, &[3]usize{ @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len) }); |
| 1234 | } | 1234 | } |
| 1235 | return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len)); | 1235 | return syscall3(.getpeername, @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len)); |
| 1236 | } | 1236 | } |
| 1237 | 1237 | ||
| 1238 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { | 1238 | pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| ... | @@ -1244,21 +1244,21 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { | ... | @@ -1244,21 +1244,21 @@ pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize { |
| 1244 | 1244 | ||
| 1245 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { | 1245 | pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize { |
| 1246 | if (native_arch == .x86) { | 1246 | if (native_arch == .x86) { |
| 1247 | return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen) }); | 1247 | return socketcall(SC.setsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @intFromPtr(optval), @intCast(usize, optlen) }); |
| 1248 | } | 1248 | } |
| 1249 | return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @intCast(usize, optlen)); | 1249 | return syscall5(.setsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @intFromPtr(optval), @intCast(usize, optlen)); |
| 1250 | } | 1250 | } |
| 1251 | 1251 | ||
| 1252 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { | 1252 | pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize { |
| 1253 | if (native_arch == .x86) { | 1253 | if (native_arch == .x86) { |
| 1254 | return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen) }); | 1254 | return socketcall(SC.getsockopt, &[5]usize{ @bitCast(usize, @as(isize, fd)), level, optname, @intFromPtr(optval), @intFromPtr(optlen) }); |
| 1255 | } | 1255 | } |
| 1256 | return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @ptrToInt(optval), @ptrToInt(optlen)); | 1256 | return syscall5(.getsockopt, @bitCast(usize, @as(isize, fd)), level, optname, @intFromPtr(optval), @intFromPtr(optlen)); |
| 1257 | } | 1257 | } |
| 1258 | 1258 | ||
| 1259 | pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize { | 1259 | pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize { |
| 1260 | const fd_usize = @bitCast(usize, @as(isize, fd)); | 1260 | const fd_usize = @bitCast(usize, @as(isize, fd)); |
| 1261 | const msg_usize = @ptrToInt(msg); | 1261 | const msg_usize = @intFromPtr(msg); |
| 1262 | if (native_arch == .x86) { | 1262 | if (native_arch == .x86) { |
| 1263 | return socketcall(SC.sendmsg, &[3]usize{ fd_usize, msg_usize, flags }); | 1263 | return socketcall(SC.sendmsg, &[3]usize{ fd_usize, msg_usize, flags }); |
| 1264 | } else { | 1264 | } else { |
| ... | @@ -1281,7 +1281,7 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize | ... | @@ -1281,7 +1281,7 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize |
| 1281 | // batch-send all messages up to the current message | 1281 | // batch-send all messages up to the current message |
| 1282 | if (next_unsent < i) { | 1282 | if (next_unsent < i) { |
| 1283 | const batch_size = i - next_unsent; | 1283 | const batch_size = i - next_unsent; |
| 1284 | const r = syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(&msgvec[next_unsent]), batch_size, flags); | 1284 | const r = syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @intFromPtr(&msgvec[next_unsent]), batch_size, flags); |
| 1285 | if (getErrno(r) != 0) return next_unsent; | 1285 | if (getErrno(r) != 0) return next_unsent; |
| 1286 | if (r < batch_size) return next_unsent + r; | 1286 | if (r < batch_size) return next_unsent + r; |
| 1287 | } | 1287 | } |
| ... | @@ -1297,18 +1297,18 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize | ... | @@ -1297,18 +1297,18 @@ pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize |
| 1297 | } | 1297 | } |
| 1298 | if (next_unsent < kvlen or next_unsent == 0) { // want to make sure at least one syscall occurs (e.g. to trigger MSG.EOR) | 1298 | if (next_unsent < kvlen or next_unsent == 0) { // want to make sure at least one syscall occurs (e.g. to trigger MSG.EOR) |
| 1299 | const batch_size = kvlen - next_unsent; | 1299 | const batch_size = kvlen - next_unsent; |
| 1300 | const r = syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(&msgvec[next_unsent]), batch_size, flags); | 1300 | const r = syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @intFromPtr(&msgvec[next_unsent]), batch_size, flags); |
| 1301 | if (getErrno(r) != 0) return r; | 1301 | if (getErrno(r) != 0) return r; |
| 1302 | return next_unsent + r; | 1302 | return next_unsent + r; |
| 1303 | } | 1303 | } |
| 1304 | return kvlen; | 1304 | return kvlen; |
| 1305 | } | 1305 | } |
| 1306 | return syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @ptrToInt(msgvec), vlen, flags); | 1306 | return syscall4(.sendmmsg, @bitCast(usize, @as(isize, fd)), @intFromPtr(msgvec), vlen, flags); |
| 1307 | } | 1307 | } |
| 1308 | 1308 | ||
| 1309 | pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize { | 1309 | pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize { |
| 1310 | const fd_usize = @bitCast(usize, @as(isize, fd)); | 1310 | const fd_usize = @bitCast(usize, @as(isize, fd)); |
| 1311 | const addr_usize = @ptrToInt(addr); | 1311 | const addr_usize = @intFromPtr(addr); |
| 1312 | if (native_arch == .x86) { | 1312 | if (native_arch == .x86) { |
| 1313 | return socketcall(SC.connect, &[3]usize{ fd_usize, addr_usize, len }); | 1313 | return socketcall(SC.connect, &[3]usize{ fd_usize, addr_usize, len }); |
| 1314 | } else { | 1314 | } else { |
| ... | @@ -1318,7 +1318,7 @@ pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize { | ... | @@ -1318,7 +1318,7 @@ pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize { |
| 1318 | 1318 | ||
| 1319 | pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize { | 1319 | pub fn recvmsg(fd: i32, msg: *msghdr, flags: u32) usize { |
| 1320 | const fd_usize = @bitCast(usize, @as(isize, fd)); | 1320 | const fd_usize = @bitCast(usize, @as(isize, fd)); |
| 1321 | const msg_usize = @ptrToInt(msg); | 1321 | const msg_usize = @intFromPtr(msg); |
| 1322 | if (native_arch == .x86) { | 1322 | if (native_arch == .x86) { |
| 1323 | return socketcall(SC.recvmsg, &[3]usize{ fd_usize, msg_usize, flags }); | 1323 | return socketcall(SC.recvmsg, &[3]usize{ fd_usize, msg_usize, flags }); |
| 1324 | } else { | 1324 | } else { |
| ... | @@ -1335,9 +1335,9 @@ pub fn recvfrom( | ... | @@ -1335,9 +1335,9 @@ pub fn recvfrom( |
| 1335 | noalias alen: ?*socklen_t, | 1335 | noalias alen: ?*socklen_t, |
| 1336 | ) usize { | 1336 | ) usize { |
| 1337 | const fd_usize = @bitCast(usize, @as(isize, fd)); | 1337 | const fd_usize = @bitCast(usize, @as(isize, fd)); |
| 1338 | const buf_usize = @ptrToInt(buf); | 1338 | const buf_usize = @intFromPtr(buf); |
| 1339 | const addr_usize = @ptrToInt(addr); | 1339 | const addr_usize = @intFromPtr(addr); |
| 1340 | const alen_usize = @ptrToInt(alen); | 1340 | const alen_usize = @intFromPtr(alen); |
| 1341 | if (native_arch == .x86) { | 1341 | if (native_arch == .x86) { |
| 1342 | return socketcall(SC.recvfrom, &[6]usize{ fd_usize, buf_usize, len, flags, addr_usize, alen_usize }); | 1342 | return socketcall(SC.recvfrom, &[6]usize{ fd_usize, buf_usize, len, flags, addr_usize, alen_usize }); |
| 1343 | } else { | 1343 | } else { |
| ... | @@ -1354,9 +1354,9 @@ pub fn shutdown(fd: i32, how: i32) usize { | ... | @@ -1354,9 +1354,9 @@ pub fn shutdown(fd: i32, how: i32) usize { |
| 1354 | 1354 | ||
| 1355 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { | 1355 | pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize { |
| 1356 | if (native_arch == .x86) { | 1356 | if (native_arch == .x86) { |
| 1357 | return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len) }); | 1357 | return socketcall(SC.bind, &[3]usize{ @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intCast(usize, len) }); |
| 1358 | } | 1358 | } |
| 1359 | return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @intCast(usize, len)); | 1359 | return syscall3(.bind, @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intCast(usize, len)); |
| 1360 | } | 1360 | } |
| 1361 | 1361 | ||
| 1362 | pub fn listen(fd: i32, backlog: u32) usize { | 1362 | pub fn listen(fd: i32, backlog: u32) usize { |
| ... | @@ -1368,9 +1368,9 @@ pub fn listen(fd: i32, backlog: u32) usize { | ... | @@ -1368,9 +1368,9 @@ pub fn listen(fd: i32, backlog: u32) usize { |
| 1368 | 1368 | ||
| 1369 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { | 1369 | pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize { |
| 1370 | if (native_arch == .x86) { | 1370 | if (native_arch == .x86) { |
| 1371 | return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen) }); | 1371 | return socketcall(SC.sendto, &[6]usize{ @bitCast(usize, @as(isize, fd)), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intCast(usize, alen) }); |
| 1372 | } | 1372 | } |
| 1373 | return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen)); | 1373 | return syscall6(.sendto, @bitCast(usize, @as(isize, fd)), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intCast(usize, alen)); |
| 1374 | } | 1374 | } |
| 1375 | 1375 | ||
| 1376 | pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { | 1376 | pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { |
| ... | @@ -1379,7 +1379,7 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { | ... | @@ -1379,7 +1379,7 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { |
| 1379 | .sendfile64, | 1379 | .sendfile64, |
| 1380 | @bitCast(usize, @as(isize, outfd)), | 1380 | @bitCast(usize, @as(isize, outfd)), |
| 1381 | @bitCast(usize, @as(isize, infd)), | 1381 | @bitCast(usize, @as(isize, infd)), |
| 1382 | @ptrToInt(offset), | 1382 | @intFromPtr(offset), |
| 1383 | count, | 1383 | count, |
| 1384 | ); | 1384 | ); |
| 1385 | } else { | 1385 | } else { |
| ... | @@ -1387,7 +1387,7 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { | ... | @@ -1387,7 +1387,7 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { |
| 1387 | .sendfile, | 1387 | .sendfile, |
| 1388 | @bitCast(usize, @as(isize, outfd)), | 1388 | @bitCast(usize, @as(isize, outfd)), |
| 1389 | @bitCast(usize, @as(isize, infd)), | 1389 | @bitCast(usize, @as(isize, infd)), |
| 1390 | @ptrToInt(offset), | 1390 | @intFromPtr(offset), |
| 1391 | count, | 1391 | count, |
| 1392 | ); | 1392 | ); |
| 1393 | } | 1393 | } |
| ... | @@ -1395,9 +1395,9 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { | ... | @@ -1395,9 +1395,9 @@ pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize { |
| 1395 | 1395 | ||
| 1396 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize { | 1396 | pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: *[2]i32) usize { |
| 1397 | if (native_arch == .x86) { | 1397 | if (native_arch == .x86) { |
| 1398 | return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd) }); | 1398 | return socketcall(SC.socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @intFromPtr(fd) }); |
| 1399 | } | 1399 | } |
| 1400 | return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(fd)); | 1400 | return syscall4(.socketpair, @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @intFromPtr(fd)); |
| 1401 | } | 1401 | } |
| 1402 | 1402 | ||
| 1403 | pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize { | 1403 | pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize { |
| ... | @@ -1409,40 +1409,40 @@ pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize | ... | @@ -1409,40 +1409,40 @@ pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize |
| 1409 | 1409 | ||
| 1410 | pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize { | 1410 | pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize { |
| 1411 | if (native_arch == .x86) { | 1411 | if (native_arch == .x86) { |
| 1412 | return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags }); | 1412 | return socketcall(SC.accept4, &[4]usize{ @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len), flags }); |
| 1413 | } | 1413 | } |
| 1414 | return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @ptrToInt(addr), @ptrToInt(len), flags); | 1414 | return syscall4(.accept4, @bitCast(usize, @as(isize, fd)), @intFromPtr(addr), @intFromPtr(len), flags); |
| 1415 | } | 1415 | } |
| 1416 | 1416 | ||
| 1417 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { | 1417 | pub fn fstat(fd: i32, stat_buf: *Stat) usize { |
| 1418 | if (@hasField(SYS, "fstat64")) { | 1418 | if (@hasField(SYS, "fstat64")) { |
| 1419 | return syscall2(.fstat64, @bitCast(usize, @as(isize, fd)), @ptrToInt(stat_buf)); | 1419 | return syscall2(.fstat64, @bitCast(usize, @as(isize, fd)), @intFromPtr(stat_buf)); |
| 1420 | } else { | 1420 | } else { |
| 1421 | return syscall2(.fstat, @bitCast(usize, @as(isize, fd)), @ptrToInt(stat_buf)); | 1421 | return syscall2(.fstat, @bitCast(usize, @as(isize, fd)), @intFromPtr(stat_buf)); |
| 1422 | } | 1422 | } |
| 1423 | } | 1423 | } |
| 1424 | 1424 | ||
| 1425 | pub fn stat(pathname: [*:0]const u8, statbuf: *Stat) usize { | 1425 | pub fn stat(pathname: [*:0]const u8, statbuf: *Stat) usize { |
| 1426 | if (@hasField(SYS, "stat64")) { | 1426 | if (@hasField(SYS, "stat64")) { |
| 1427 | return syscall2(.stat64, @ptrToInt(pathname), @ptrToInt(statbuf)); | 1427 | return syscall2(.stat64, @intFromPtr(pathname), @intFromPtr(statbuf)); |
| 1428 | } else { | 1428 | } else { |
| 1429 | return syscall2(.stat, @ptrToInt(pathname), @ptrToInt(statbuf)); | 1429 | return syscall2(.stat, @intFromPtr(pathname), @intFromPtr(statbuf)); |
| 1430 | } | 1430 | } |
| 1431 | } | 1431 | } |
| 1432 | 1432 | ||
| 1433 | pub fn lstat(pathname: [*:0]const u8, statbuf: *Stat) usize { | 1433 | pub fn lstat(pathname: [*:0]const u8, statbuf: *Stat) usize { |
| 1434 | if (@hasField(SYS, "lstat64")) { | 1434 | if (@hasField(SYS, "lstat64")) { |
| 1435 | return syscall2(.lstat64, @ptrToInt(pathname), @ptrToInt(statbuf)); | 1435 | return syscall2(.lstat64, @intFromPtr(pathname), @intFromPtr(statbuf)); |
| 1436 | } else { | 1436 | } else { |
| 1437 | return syscall2(.lstat, @ptrToInt(pathname), @ptrToInt(statbuf)); | 1437 | return syscall2(.lstat, @intFromPtr(pathname), @intFromPtr(statbuf)); |
| 1438 | } | 1438 | } |
| 1439 | } | 1439 | } |
| 1440 | 1440 | ||
| 1441 | pub fn fstatat(dirfd: i32, path: [*:0]const u8, stat_buf: *Stat, flags: u32) usize { | 1441 | pub fn fstatat(dirfd: i32, path: [*:0]const u8, stat_buf: *Stat, flags: u32) usize { |
| 1442 | if (@hasField(SYS, "fstatat64")) { | 1442 | if (@hasField(SYS, "fstatat64")) { |
| 1443 | return syscall4(.fstatat64, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); | 1443 | return syscall4(.fstatat64, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), @intFromPtr(stat_buf), flags); |
| 1444 | } else { | 1444 | } else { |
| 1445 | return syscall4(.fstatat, @bitCast(usize, @as(isize, dirfd)), @ptrToInt(path), @ptrToInt(stat_buf), flags); | 1445 | return syscall4(.fstatat, @bitCast(usize, @as(isize, dirfd)), @intFromPtr(path), @intFromPtr(stat_buf), flags); |
| 1446 | } | 1446 | } |
| 1447 | } | 1447 | } |
| 1448 | 1448 | ||
| ... | @@ -1451,61 +1451,61 @@ pub fn statx(dirfd: i32, path: [*]const u8, flags: u32, mask: u32, statx_buf: *S | ... | @@ -1451,61 +1451,61 @@ pub fn statx(dirfd: i32, path: [*]const u8, flags: u32, mask: u32, statx_buf: *S |
| 1451 | return syscall5( | 1451 | return syscall5( |
| 1452 | .statx, | 1452 | .statx, |
| 1453 | @bitCast(usize, @as(isize, dirfd)), | 1453 | @bitCast(usize, @as(isize, dirfd)), |
| 1454 | @ptrToInt(path), | 1454 | @intFromPtr(path), |
| 1455 | flags, | 1455 | flags, |
| 1456 | mask, | 1456 | mask, |
| 1457 | @ptrToInt(statx_buf), | 1457 | @intFromPtr(statx_buf), |
| 1458 | ); | 1458 | ); |
| 1459 | } | 1459 | } |
| 1460 | return @bitCast(usize, -@as(isize, @enumToInt(E.NOSYS))); | 1460 | return @bitCast(usize, -@as(isize, @intFromEnum(E.NOSYS))); |
| 1461 | } | 1461 | } |
| 1462 | 1462 | ||
| 1463 | pub fn listxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize { | 1463 | pub fn listxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize { |
| 1464 | return syscall3(.listxattr, @ptrToInt(path), @ptrToInt(list), size); | 1464 | return syscall3(.listxattr, @intFromPtr(path), @intFromPtr(list), size); |
| 1465 | } | 1465 | } |
| 1466 | 1466 | ||
| 1467 | pub fn llistxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize { | 1467 | pub fn llistxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize { |
| 1468 | return syscall3(.llistxattr, @ptrToInt(path), @ptrToInt(list), size); | 1468 | return syscall3(.llistxattr, @intFromPtr(path), @intFromPtr(list), size); |
| 1469 | } | 1469 | } |
| 1470 | 1470 | ||
| 1471 | pub fn flistxattr(fd: usize, list: [*]u8, size: usize) usize { | 1471 | pub fn flistxattr(fd: usize, list: [*]u8, size: usize) usize { |
| 1472 | return syscall3(.flistxattr, fd, @ptrToInt(list), size); | 1472 | return syscall3(.flistxattr, fd, @intFromPtr(list), size); |
| 1473 | } | 1473 | } |
| 1474 | 1474 | ||
| 1475 | pub fn getxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize { | 1475 | pub fn getxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize { |
| 1476 | return syscall4(.getxattr, @ptrToInt(path), @ptrToInt(name), @ptrToInt(value), size); | 1476 | return syscall4(.getxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size); |
| 1477 | } | 1477 | } |
| 1478 | 1478 | ||
| 1479 | pub fn lgetxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize { | 1479 | pub fn lgetxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize { |
| 1480 | return syscall4(.lgetxattr, @ptrToInt(path), @ptrToInt(name), @ptrToInt(value), size); | 1480 | return syscall4(.lgetxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size); |
| 1481 | } | 1481 | } |
| 1482 | 1482 | ||
| 1483 | pub fn fgetxattr(fd: usize, name: [*:0]const u8, value: [*]u8, size: usize) usize { | 1483 | pub fn fgetxattr(fd: usize, name: [*:0]const u8, value: [*]u8, size: usize) usize { |
| 1484 | return syscall4(.lgetxattr, fd, @ptrToInt(name), @ptrToInt(value), size); | 1484 | return syscall4(.lgetxattr, fd, @intFromPtr(name), @intFromPtr(value), size); |
| 1485 | } | 1485 | } |
| 1486 | 1486 | ||
| 1487 | pub fn setxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { | 1487 | pub fn setxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { |
| 1488 | return syscall5(.setxattr, @ptrToInt(path), @ptrToInt(name), @ptrToInt(value), size, flags); | 1488 | return syscall5(.setxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size, flags); |
| 1489 | } | 1489 | } |
| 1490 | 1490 | ||
| 1491 | pub fn lsetxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { | 1491 | pub fn lsetxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { |
| 1492 | return syscall5(.lsetxattr, @ptrToInt(path), @ptrToInt(name), @ptrToInt(value), size, flags); | 1492 | return syscall5(.lsetxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size, flags); |
| 1493 | } | 1493 | } |
| 1494 | 1494 | ||
| 1495 | pub fn fsetxattr(fd: usize, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { | 1495 | pub fn fsetxattr(fd: usize, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize { |
| 1496 | return syscall5(.fsetxattr, fd, @ptrToInt(name), @ptrToInt(value), size, flags); | 1496 | return syscall5(.fsetxattr, fd, @intFromPtr(name), @intFromPtr(value), size, flags); |
| 1497 | } | 1497 | } |
| 1498 | 1498 | ||
| 1499 | pub fn removexattr(path: [*:0]const u8, name: [*:0]const u8) usize { | 1499 | pub fn removexattr(path: [*:0]const u8, name: [*:0]const u8) usize { |
| 1500 | return syscall2(.removexattr, @ptrToInt(path), @ptrToInt(name)); | 1500 | return syscall2(.removexattr, @intFromPtr(path), @intFromPtr(name)); |
| 1501 | } | 1501 | } |
| 1502 | 1502 | ||
| 1503 | pub fn lremovexattr(path: [*:0]const u8, name: [*:0]const u8) usize { | 1503 | pub fn lremovexattr(path: [*:0]const u8, name: [*:0]const u8) usize { |
| 1504 | return syscall2(.lremovexattr, @ptrToInt(path), @ptrToInt(name)); | 1504 | return syscall2(.lremovexattr, @intFromPtr(path), @intFromPtr(name)); |
| 1505 | } | 1505 | } |
| 1506 | 1506 | ||
| 1507 | pub fn fremovexattr(fd: usize, name: [*:0]const u8) usize { | 1507 | pub fn fremovexattr(fd: usize, name: [*:0]const u8) usize { |
| 1508 | return syscall2(.fremovexattr, fd, @ptrToInt(name)); | 1508 | return syscall2(.fremovexattr, fd, @intFromPtr(name)); |
| 1509 | } | 1509 | } |
| 1510 | 1510 | ||
| 1511 | pub fn sched_yield() usize { | 1511 | pub fn sched_yield() usize { |
| ... | @@ -1513,30 +1513,30 @@ pub fn sched_yield() usize { | ... | @@ -1513,30 +1513,30 @@ pub fn sched_yield() usize { |
| 1513 | } | 1513 | } |
| 1514 | 1514 | ||
| 1515 | pub fn sched_getaffinity(pid: pid_t, size: usize, set: *cpu_set_t) usize { | 1515 | pub fn sched_getaffinity(pid: pid_t, size: usize, set: *cpu_set_t) usize { |
| 1516 | const rc = syscall3(.sched_getaffinity, @bitCast(usize, @as(isize, pid)), size, @ptrToInt(set)); | 1516 | const rc = syscall3(.sched_getaffinity, @bitCast(usize, @as(isize, pid)), size, @intFromPtr(set)); |
| 1517 | if (@bitCast(isize, rc) < 0) return rc; | 1517 | if (@bitCast(isize, rc) < 0) return rc; |
| 1518 | if (rc < size) @memset(@ptrCast([*]u8, set)[rc..size], 0); | 1518 | if (rc < size) @memset(@ptrCast([*]u8, set)[rc..size], 0); |
| 1519 | return 0; | 1519 | return 0; |
| 1520 | } | 1520 | } |
| 1521 | 1521 | ||
| 1522 | pub fn getcpu(cpu: *u32, node: *u32) usize { | 1522 | pub fn getcpu(cpu: *u32, node: *u32) usize { |
| 1523 | return syscall3(.getcpu, @ptrToInt(cpu), @ptrToInt(node), 0); | 1523 | return syscall3(.getcpu, @intFromPtr(cpu), @intFromPtr(node), 0); |
| 1524 | } | 1524 | } |
| 1525 | 1525 | ||
| 1526 | pub fn sched_getcpu() usize { | 1526 | pub fn sched_getcpu() usize { |
| 1527 | var cpu: u32 = undefined; | 1527 | var cpu: u32 = undefined; |
| 1528 | const rc = syscall3(.getcpu, @ptrToInt(&cpu), 0, 0); | 1528 | const rc = syscall3(.getcpu, @intFromPtr(&cpu), 0, 0); |
| 1529 | if (@bitCast(isize, rc) < 0) return rc; | 1529 | if (@bitCast(isize, rc) < 0) return rc; |
| 1530 | return @intCast(usize, cpu); | 1530 | return @intCast(usize, cpu); |
| 1531 | } | 1531 | } |
| 1532 | 1532 | ||
| 1533 | /// libc has no wrapper for this syscall | 1533 | /// libc has no wrapper for this syscall |
| 1534 | pub fn mbind(addr: ?*anyopaque, len: u32, mode: i32, nodemask: *const u32, maxnode: u32, flags: u32) usize { | 1534 | pub fn mbind(addr: ?*anyopaque, len: u32, mode: i32, nodemask: *const u32, maxnode: u32, flags: u32) usize { |
| 1535 | return syscall6(.mbind, @ptrToInt(addr), len, @bitCast(usize, @as(isize, mode)), @ptrToInt(nodemask), maxnode, flags); | 1535 | return syscall6(.mbind, @intFromPtr(addr), len, @bitCast(usize, @as(isize, mode)), @intFromPtr(nodemask), maxnode, flags); |
| 1536 | } | 1536 | } |
| 1537 | 1537 | ||
| 1538 | pub fn sched_setaffinity(pid: pid_t, size: usize, set: *const cpu_set_t) usize { | 1538 | pub fn sched_setaffinity(pid: pid_t, size: usize, set: *const cpu_set_t) usize { |
| 1539 | const rc = syscall3(.sched_setaffinity, @bitCast(usize, @as(isize, pid)), size, @ptrToInt(set)); | 1539 | const rc = syscall3(.sched_setaffinity, @bitCast(usize, @as(isize, pid)), size, @intFromPtr(set)); |
| 1540 | if (@bitCast(isize, rc) < 0) return rc; | 1540 | if (@bitCast(isize, rc) < 0) return rc; |
| 1541 | return 0; | 1541 | return 0; |
| 1542 | } | 1542 | } |
| ... | @@ -1550,7 +1550,7 @@ pub fn epoll_create1(flags: usize) usize { | ... | @@ -1550,7 +1550,7 @@ pub fn epoll_create1(flags: usize) usize { |
| 1550 | } | 1550 | } |
| 1551 | 1551 | ||
| 1552 | pub fn epoll_ctl(epoll_fd: i32, op: u32, fd: i32, ev: ?*epoll_event) usize { | 1552 | pub fn epoll_ctl(epoll_fd: i32, op: u32, fd: i32, ev: ?*epoll_event) usize { |
| 1553 | return syscall4(.epoll_ctl, @bitCast(usize, @as(isize, epoll_fd)), @intCast(usize, op), @bitCast(usize, @as(isize, fd)), @ptrToInt(ev)); | 1553 | return syscall4(.epoll_ctl, @bitCast(usize, @as(isize, epoll_fd)), @intCast(usize, op), @bitCast(usize, @as(isize, fd)), @intFromPtr(ev)); |
| 1554 | } | 1554 | } |
| 1555 | 1555 | ||
| 1556 | pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32) usize { | 1556 | pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32) usize { |
| ... | @@ -1561,10 +1561,10 @@ pub fn epoll_pwait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeou | ... | @@ -1561,10 +1561,10 @@ pub fn epoll_pwait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeou |
| 1561 | return syscall6( | 1561 | return syscall6( |
| 1562 | .epoll_pwait, | 1562 | .epoll_pwait, |
| 1563 | @bitCast(usize, @as(isize, epoll_fd)), | 1563 | @bitCast(usize, @as(isize, epoll_fd)), |
| 1564 | @ptrToInt(events), | 1564 | @intFromPtr(events), |
| 1565 | @intCast(usize, maxevents), | 1565 | @intCast(usize, maxevents), |
| 1566 | @bitCast(usize, @as(isize, timeout)), | 1566 | @bitCast(usize, @as(isize, timeout)), |
| 1567 | @ptrToInt(sigmask), | 1567 | @intFromPtr(sigmask), |
| 1568 | @sizeOf(sigset_t), | 1568 | @sizeOf(sigset_t), |
| 1569 | ); | 1569 | ); |
| 1570 | } | 1570 | } |
| ... | @@ -1583,11 +1583,11 @@ pub const itimerspec = extern struct { | ... | @@ -1583,11 +1583,11 @@ pub const itimerspec = extern struct { |
| 1583 | }; | 1583 | }; |
| 1584 | 1584 | ||
| 1585 | pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { | 1585 | pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize { |
| 1586 | return syscall2(.timerfd_gettime, @bitCast(usize, @as(isize, fd)), @ptrToInt(curr_value)); | 1586 | return syscall2(.timerfd_gettime, @bitCast(usize, @as(isize, fd)), @intFromPtr(curr_value)); |
| 1587 | } | 1587 | } |
| 1588 | 1588 | ||
| 1589 | pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { | 1589 | pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 1590 | return syscall4(.timerfd_settime, @bitCast(usize, @as(isize, fd)), flags, @ptrToInt(new_value), @ptrToInt(old_value)); | 1590 | return syscall4(.timerfd_settime, @bitCast(usize, @as(isize, fd)), flags, @intFromPtr(new_value), @intFromPtr(old_value)); |
| 1591 | } | 1591 | } |
| 1592 | 1592 | ||
| 1593 | pub const sigevent = extern struct { | 1593 | pub const sigevent = extern struct { |
| ... | @@ -1609,7 +1609,7 @@ pub const timer_t = ?*anyopaque; | ... | @@ -1609,7 +1609,7 @@ pub const timer_t = ?*anyopaque; |
| 1609 | 1609 | ||
| 1610 | pub fn timer_create(clockid: i32, sevp: *sigevent, timerid: *timer_t) usize { | 1610 | pub fn timer_create(clockid: i32, sevp: *sigevent, timerid: *timer_t) usize { |
| 1611 | var t: timer_t = undefined; | 1611 | var t: timer_t = undefined; |
| 1612 | const rc = syscall3(.timer_create, @bitCast(usize, @as(isize, clockid)), @ptrToInt(sevp), @ptrToInt(&t)); | 1612 | const rc = syscall3(.timer_create, @bitCast(usize, @as(isize, clockid)), @intFromPtr(sevp), @intFromPtr(&t)); |
| 1613 | if (@bitCast(isize, rc) < 0) return rc; | 1613 | if (@bitCast(isize, rc) < 0) return rc; |
| 1614 | timerid.* = t; | 1614 | timerid.* = t; |
| 1615 | return rc; | 1615 | return rc; |
| ... | @@ -1620,11 +1620,11 @@ pub fn timer_delete(timerid: timer_t) usize { | ... | @@ -1620,11 +1620,11 @@ pub fn timer_delete(timerid: timer_t) usize { |
| 1620 | } | 1620 | } |
| 1621 | 1621 | ||
| 1622 | pub fn timer_gettime(timerid: timer_t, curr_value: *itimerspec) usize { | 1622 | pub fn timer_gettime(timerid: timer_t, curr_value: *itimerspec) usize { |
| 1623 | return syscall2(.timer_gettime, @ptrToInt(timerid), @ptrToInt(curr_value)); | 1623 | return syscall2(.timer_gettime, @intFromPtr(timerid), @intFromPtr(curr_value)); |
| 1624 | } | 1624 | } |
| 1625 | 1625 | ||
| 1626 | pub fn timer_settime(timerid: timer_t, flags: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { | 1626 | pub fn timer_settime(timerid: timer_t, flags: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 1627 | return syscall4(.timer_settime, @ptrToInt(timerid), @bitCast(usize, @as(isize, flags)), @ptrToInt(new_value), @ptrToInt(old_value)); | 1627 | return syscall4(.timer_settime, @intFromPtr(timerid), @bitCast(usize, @as(isize, flags)), @intFromPtr(new_value), @intFromPtr(old_value)); |
| 1628 | } | 1628 | } |
| 1629 | 1629 | ||
| 1630 | // Flags for the 'setitimer' system call | 1630 | // Flags for the 'setitimer' system call |
| ... | @@ -1635,11 +1635,11 @@ pub const ITIMER = enum(i32) { | ... | @@ -1635,11 +1635,11 @@ pub const ITIMER = enum(i32) { |
| 1635 | }; | 1635 | }; |
| 1636 | 1636 | ||
| 1637 | pub fn getitimer(which: i32, curr_value: *itimerspec) usize { | 1637 | pub fn getitimer(which: i32, curr_value: *itimerspec) usize { |
| 1638 | return syscall2(.getitimer, @bitCast(usize, @as(isize, which)), @ptrToInt(curr_value)); | 1638 | return syscall2(.getitimer, @bitCast(usize, @as(isize, which)), @intFromPtr(curr_value)); |
| 1639 | } | 1639 | } |
| 1640 | 1640 | ||
| 1641 | pub fn setitimer(which: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { | 1641 | pub fn setitimer(which: i32, new_value: *const itimerspec, old_value: ?*itimerspec) usize { |
| 1642 | return syscall3(.setitimer, @bitCast(usize, @as(isize, which)), @ptrToInt(new_value), @ptrToInt(old_value)); | 1642 | return syscall3(.setitimer, @bitCast(usize, @as(isize, which)), @intFromPtr(new_value), @intFromPtr(old_value)); |
| 1643 | } | 1643 | } |
| 1644 | 1644 | ||
| 1645 | pub fn unshare(flags: usize) usize { | 1645 | pub fn unshare(flags: usize) usize { |
| ... | @@ -1647,55 +1647,55 @@ pub fn unshare(flags: usize) usize { | ... | @@ -1647,55 +1647,55 @@ pub fn unshare(flags: usize) usize { |
| 1647 | } | 1647 | } |
| 1648 | 1648 | ||
| 1649 | pub fn capget(hdrp: *cap_user_header_t, datap: *cap_user_data_t) usize { | 1649 | pub fn capget(hdrp: *cap_user_header_t, datap: *cap_user_data_t) usize { |
| 1650 | return syscall2(.capget, @ptrToInt(hdrp), @ptrToInt(datap)); | 1650 | return syscall2(.capget, @intFromPtr(hdrp), @intFromPtr(datap)); |
| 1651 | } | 1651 | } |
| 1652 | 1652 | ||
| 1653 | pub fn capset(hdrp: *cap_user_header_t, datap: *const cap_user_data_t) usize { | 1653 | pub fn capset(hdrp: *cap_user_header_t, datap: *const cap_user_data_t) usize { |
| 1654 | return syscall2(.capset, @ptrToInt(hdrp), @ptrToInt(datap)); | 1654 | return syscall2(.capset, @intFromPtr(hdrp), @intFromPtr(datap)); |
| 1655 | } | 1655 | } |
| 1656 | 1656 | ||
| 1657 | pub fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) usize { | 1657 | pub fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) usize { |
| 1658 | return syscall2(.sigaltstack, @ptrToInt(ss), @ptrToInt(old_ss)); | 1658 | return syscall2(.sigaltstack, @intFromPtr(ss), @intFromPtr(old_ss)); |
| 1659 | } | 1659 | } |
| 1660 | 1660 | ||
| 1661 | pub fn uname(uts: *utsname) usize { | 1661 | pub fn uname(uts: *utsname) usize { |
| 1662 | return syscall1(.uname, @ptrToInt(uts)); | 1662 | return syscall1(.uname, @intFromPtr(uts)); |
| 1663 | } | 1663 | } |
| 1664 | 1664 | ||
| 1665 | pub fn io_uring_setup(entries: u32, p: *io_uring_params) usize { | 1665 | pub fn io_uring_setup(entries: u32, p: *io_uring_params) usize { |
| 1666 | return syscall2(.io_uring_setup, entries, @ptrToInt(p)); | 1666 | return syscall2(.io_uring_setup, entries, @intFromPtr(p)); |
| 1667 | } | 1667 | } |
| 1668 | 1668 | ||
| 1669 | pub fn io_uring_enter(fd: i32, to_submit: u32, min_complete: u32, flags: u32, sig: ?*sigset_t) usize { | 1669 | pub fn io_uring_enter(fd: i32, to_submit: u32, min_complete: u32, flags: u32, sig: ?*sigset_t) usize { |
| 1670 | return syscall6(.io_uring_enter, @bitCast(usize, @as(isize, fd)), to_submit, min_complete, flags, @ptrToInt(sig), NSIG / 8); | 1670 | return syscall6(.io_uring_enter, @bitCast(usize, @as(isize, fd)), to_submit, min_complete, flags, @intFromPtr(sig), NSIG / 8); |
| 1671 | } | 1671 | } |
| 1672 | 1672 | ||
| 1673 | pub fn io_uring_register(fd: i32, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize { | 1673 | pub fn io_uring_register(fd: i32, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize { |
| 1674 | return syscall4(.io_uring_register, @bitCast(usize, @as(isize, fd)), @enumToInt(opcode), @ptrToInt(arg), nr_args); | 1674 | return syscall4(.io_uring_register, @bitCast(usize, @as(isize, fd)), @intFromEnum(opcode), @intFromPtr(arg), nr_args); |
| 1675 | } | 1675 | } |
| 1676 | 1676 | ||
| 1677 | pub fn memfd_create(name: [*:0]const u8, flags: u32) usize { | 1677 | pub fn memfd_create(name: [*:0]const u8, flags: u32) usize { |
| 1678 | return syscall2(.memfd_create, @ptrToInt(name), flags); | 1678 | return syscall2(.memfd_create, @intFromPtr(name), flags); |
| 1679 | } | 1679 | } |
| 1680 | 1680 | ||
| 1681 | pub fn getrusage(who: i32, usage: *rusage) usize { | 1681 | pub fn getrusage(who: i32, usage: *rusage) usize { |
| 1682 | return syscall2(.getrusage, @bitCast(usize, @as(isize, who)), @ptrToInt(usage)); | 1682 | return syscall2(.getrusage, @bitCast(usize, @as(isize, who)), @intFromPtr(usage)); |
| 1683 | } | 1683 | } |
| 1684 | 1684 | ||
| 1685 | pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { | 1685 | pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize { |
| 1686 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CGETS, @ptrToInt(termios_p)); | 1686 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CGETS, @intFromPtr(termios_p)); |
| 1687 | } | 1687 | } |
| 1688 | 1688 | ||
| 1689 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { | 1689 | pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize { |
| 1690 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CSETS + @enumToInt(optional_action), @ptrToInt(termios_p)); | 1690 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.CSETS + @intFromEnum(optional_action), @intFromPtr(termios_p)); |
| 1691 | } | 1691 | } |
| 1692 | 1692 | ||
| 1693 | pub fn tcgetpgrp(fd: fd_t, pgrp: *pid_t) usize { | 1693 | pub fn tcgetpgrp(fd: fd_t, pgrp: *pid_t) usize { |
| 1694 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.IOCGPGRP, @ptrToInt(pgrp)); | 1694 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.IOCGPGRP, @intFromPtr(pgrp)); |
| 1695 | } | 1695 | } |
| 1696 | 1696 | ||
| 1697 | pub fn tcsetpgrp(fd: fd_t, pgrp: *const pid_t) usize { | 1697 | pub fn tcsetpgrp(fd: fd_t, pgrp: *const pid_t) usize { |
| 1698 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.IOCSPGRP, @ptrToInt(pgrp)); | 1698 | return syscall3(.ioctl, @bitCast(usize, @as(isize, fd)), T.IOCSPGRP, @intFromPtr(pgrp)); |
| 1699 | } | 1699 | } |
| 1700 | 1700 | ||
| 1701 | pub fn tcdrain(fd: fd_t) usize { | 1701 | pub fn tcdrain(fd: fd_t) usize { |
| ... | @@ -1707,23 +1707,23 @@ pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize { | ... | @@ -1707,23 +1707,23 @@ pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize { |
| 1707 | } | 1707 | } |
| 1708 | 1708 | ||
| 1709 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) usize { | 1709 | pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) usize { |
| 1710 | return syscall4(.signalfd4, @bitCast(usize, @as(isize, fd)), @ptrToInt(mask), NSIG / 8, flags); | 1710 | return syscall4(.signalfd4, @bitCast(usize, @as(isize, fd)), @intFromPtr(mask), NSIG / 8, flags); |
| 1711 | } | 1711 | } |
| 1712 | 1712 | ||
| 1713 | pub fn copy_file_range(fd_in: fd_t, off_in: ?*i64, fd_out: fd_t, off_out: ?*i64, len: usize, flags: u32) usize { | 1713 | pub fn copy_file_range(fd_in: fd_t, off_in: ?*i64, fd_out: fd_t, off_out: ?*i64, len: usize, flags: u32) usize { |
| 1714 | return syscall6( | 1714 | return syscall6( |
| 1715 | .copy_file_range, | 1715 | .copy_file_range, |
| 1716 | @bitCast(usize, @as(isize, fd_in)), | 1716 | @bitCast(usize, @as(isize, fd_in)), |
| 1717 | @ptrToInt(off_in), | 1717 | @intFromPtr(off_in), |
| 1718 | @bitCast(usize, @as(isize, fd_out)), | 1718 | @bitCast(usize, @as(isize, fd_out)), |
| 1719 | @ptrToInt(off_out), | 1719 | @intFromPtr(off_out), |
| 1720 | len, | 1720 | len, |
| 1721 | flags, | 1721 | flags, |
| 1722 | ); | 1722 | ); |
| 1723 | } | 1723 | } |
| 1724 | 1724 | ||
| 1725 | pub fn bpf(cmd: BPF.Cmd, attr: *BPF.Attr, size: u32) usize { | 1725 | pub fn bpf(cmd: BPF.Cmd, attr: *BPF.Attr, size: u32) usize { |
| 1726 | return syscall3(.bpf, @enumToInt(cmd), @ptrToInt(attr), size); | 1726 | return syscall3(.bpf, @intFromEnum(cmd), @intFromPtr(attr), size); |
| 1727 | } | 1727 | } |
| 1728 | 1728 | ||
| 1729 | pub fn sync() void { | 1729 | pub fn sync() void { |
| ... | @@ -1760,18 +1760,18 @@ pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, | ... | @@ -1760,18 +1760,18 @@ pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, |
| 1760 | return syscall4( | 1760 | return syscall4( |
| 1761 | .prlimit64, | 1761 | .prlimit64, |
| 1762 | @bitCast(usize, @as(isize, pid)), | 1762 | @bitCast(usize, @as(isize, pid)), |
| 1763 | @bitCast(usize, @as(isize, @enumToInt(resource))), | 1763 | @bitCast(usize, @as(isize, @intFromEnum(resource))), |
| 1764 | @ptrToInt(new_limit), | 1764 | @intFromPtr(new_limit), |
| 1765 | @ptrToInt(old_limit), | 1765 | @intFromPtr(old_limit), |
| 1766 | ); | 1766 | ); |
| 1767 | } | 1767 | } |
| 1768 | 1768 | ||
| 1769 | pub fn mincore(address: [*]u8, len: usize, vec: [*]u8) usize { | 1769 | pub fn mincore(address: [*]u8, len: usize, vec: [*]u8) usize { |
| 1770 | return syscall3(.mincore, @ptrToInt(address), len, @ptrToInt(vec)); | 1770 | return syscall3(.mincore, @intFromPtr(address), len, @intFromPtr(vec)); |
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | pub fn madvise(address: [*]u8, len: usize, advice: u32) usize { | 1773 | pub fn madvise(address: [*]u8, len: usize, advice: u32) usize { |
| 1774 | return syscall3(.madvise, @ptrToInt(address), len, advice); | 1774 | return syscall3(.madvise, @intFromPtr(address), len, advice); |
| 1775 | } | 1775 | } |
| 1776 | 1776 | ||
| 1777 | pub fn pidfd_open(pid: pid_t, flags: u32) usize { | 1777 | pub fn pidfd_open(pid: pid_t, flags: u32) usize { |
| ... | @@ -1792,7 +1792,7 @@ pub fn pidfd_send_signal(pidfd: fd_t, sig: i32, info: ?*siginfo_t, flags: u32) u | ... | @@ -1792,7 +1792,7 @@ pub fn pidfd_send_signal(pidfd: fd_t, sig: i32, info: ?*siginfo_t, flags: u32) u |
| 1792 | .pidfd_send_signal, | 1792 | .pidfd_send_signal, |
| 1793 | @bitCast(usize, @as(isize, pidfd)), | 1793 | @bitCast(usize, @as(isize, pidfd)), |
| 1794 | @bitCast(usize, @as(isize, sig)), | 1794 | @bitCast(usize, @as(isize, sig)), |
| 1795 | @ptrToInt(info), | 1795 | @intFromPtr(info), |
| 1796 | flags, | 1796 | flags, |
| 1797 | ); | 1797 | ); |
| 1798 | } | 1798 | } |
| ... | @@ -1801,9 +1801,9 @@ pub fn process_vm_readv(pid: pid_t, local: []iovec, remote: []const iovec_const, | ... | @@ -1801,9 +1801,9 @@ pub fn process_vm_readv(pid: pid_t, local: []iovec, remote: []const iovec_const, |
| 1801 | return syscall6( | 1801 | return syscall6( |
| 1802 | .process_vm_readv, | 1802 | .process_vm_readv, |
| 1803 | @bitCast(usize, @as(isize, pid)), | 1803 | @bitCast(usize, @as(isize, pid)), |
| 1804 | @ptrToInt(local.ptr), | 1804 | @intFromPtr(local.ptr), |
| 1805 | local.len, | 1805 | local.len, |
| 1806 | @ptrToInt(remote.ptr), | 1806 | @intFromPtr(remote.ptr), |
| 1807 | remote.len, | 1807 | remote.len, |
| 1808 | flags, | 1808 | flags, |
| 1809 | ); | 1809 | ); |
| ... | @@ -1813,9 +1813,9 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const | ... | @@ -1813,9 +1813,9 @@ pub fn process_vm_writev(pid: pid_t, local: []const iovec_const, remote: []const |
| 1813 | return syscall6( | 1813 | return syscall6( |
| 1814 | .process_vm_writev, | 1814 | .process_vm_writev, |
| 1815 | @bitCast(usize, @as(isize, pid)), | 1815 | @bitCast(usize, @as(isize, pid)), |
| 1816 | @ptrToInt(local.ptr), | 1816 | @intFromPtr(local.ptr), |
| 1817 | local.len, | 1817 | local.len, |
| 1818 | @ptrToInt(remote.ptr), | 1818 | @intFromPtr(remote.ptr), |
| 1819 | remote.len, | 1819 | remote.len, |
| 1820 | flags, | 1820 | flags, |
| 1821 | ); | 1821 | ); |
| ... | @@ -1889,7 +1889,7 @@ pub fn perf_event_open( | ... | @@ -1889,7 +1889,7 @@ pub fn perf_event_open( |
| 1889 | ) usize { | 1889 | ) usize { |
| 1890 | return syscall5( | 1890 | return syscall5( |
| 1891 | .perf_event_open, | 1891 | .perf_event_open, |
| 1892 | @ptrToInt(attr), | 1892 | @intFromPtr(attr), |
| 1893 | @bitCast(usize, @as(isize, pid)), | 1893 | @bitCast(usize, @as(isize, pid)), |
| 1894 | @bitCast(usize, @as(isize, cpu)), | 1894 | @bitCast(usize, @as(isize, cpu)), |
| 1895 | @bitCast(usize, @as(isize, group_fd)), | 1895 | @bitCast(usize, @as(isize, group_fd)), |
| ... | @@ -1898,7 +1898,7 @@ pub fn perf_event_open( | ... | @@ -1898,7 +1898,7 @@ pub fn perf_event_open( |
| 1898 | } | 1898 | } |
| 1899 | 1899 | ||
| 1900 | pub fn seccomp(operation: u32, flags: u32, args: ?*const anyopaque) usize { | 1900 | pub fn seccomp(operation: u32, flags: u32, args: ?*const anyopaque) usize { |
| 1901 | return syscall3(.seccomp, operation, flags, @ptrToInt(args)); | 1901 | return syscall3(.seccomp, operation, flags, @intFromPtr(args)); |
| 1902 | } | 1902 | } |
| 1903 | 1903 | ||
| 1904 | pub fn ptrace( | 1904 | pub fn ptrace( |
| ... | @@ -2154,9 +2154,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -2154,9 +2154,9 @@ pub const SIG = if (is_mips) struct { |
| 2154 | pub const SYS = 31; | 2154 | pub const SYS = 31; |
| 2155 | pub const UNUSED = SIG.SYS; | 2155 | pub const UNUSED = SIG.SYS; |
| 2156 | 2156 | ||
| 2157 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 2157 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 2158 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 2158 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 2159 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 2159 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 2160 | } else if (is_sparc) struct { | 2160 | } else if (is_sparc) struct { |
| 2161 | pub const BLOCK = 1; | 2161 | pub const BLOCK = 1; |
| 2162 | pub const UNBLOCK = 2; | 2162 | pub const UNBLOCK = 2; |
| ... | @@ -2198,9 +2198,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -2198,9 +2198,9 @@ pub const SIG = if (is_mips) struct { |
| 2198 | pub const PWR = LOST; | 2198 | pub const PWR = LOST; |
| 2199 | pub const IO = SIG.POLL; | 2199 | pub const IO = SIG.POLL; |
| 2200 | 2200 | ||
| 2201 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 2201 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 2202 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 2202 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 2203 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 2203 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 2204 | } else struct { | 2204 | } else struct { |
| 2205 | pub const BLOCK = 0; | 2205 | pub const BLOCK = 0; |
| 2206 | pub const UNBLOCK = 1; | 2206 | pub const UNBLOCK = 1; |
| ... | @@ -2241,9 +2241,9 @@ pub const SIG = if (is_mips) struct { | ... | @@ -2241,9 +2241,9 @@ pub const SIG = if (is_mips) struct { |
| 2241 | pub const SYS = 31; | 2241 | pub const SYS = 31; |
| 2242 | pub const UNUSED = SIG.SYS; | 2242 | pub const UNUSED = SIG.SYS; |
| 2243 | 2243 | ||
| 2244 | pub const ERR = @intToPtr(?Sigaction.handler_fn, maxInt(usize)); | 2244 | pub const ERR = @ptrFromInt(?Sigaction.handler_fn, maxInt(usize)); |
| 2245 | pub const DFL = @intToPtr(?Sigaction.handler_fn, 0); | 2245 | pub const DFL = @ptrFromInt(?Sigaction.handler_fn, 0); |
| 2246 | pub const IGN = @intToPtr(?Sigaction.handler_fn, 1); | 2246 | pub const IGN = @ptrFromInt(?Sigaction.handler_fn, 1); |
| 2247 | }; | 2247 | }; |
| 2248 | 2248 | ||
| 2249 | pub const kernel_rwf = u32; | 2249 | pub const kernel_rwf = u32; |
| ... | @@ -3876,26 +3876,26 @@ pub const IOSQE_BIT = enum(u8) { | ... | @@ -3876,26 +3876,26 @@ pub const IOSQE_BIT = enum(u8) { |
| 3876 | // io_uring_sqe.flags | 3876 | // io_uring_sqe.flags |
| 3877 | 3877 | ||
| 3878 | /// use fixed fileset | 3878 | /// use fixed fileset |
| 3879 | pub const IOSQE_FIXED_FILE = 1 << @enumToInt(IOSQE_BIT.FIXED_FILE); | 3879 | pub const IOSQE_FIXED_FILE = 1 << @intFromEnum(IOSQE_BIT.FIXED_FILE); |
| 3880 | 3880 | ||
| 3881 | /// issue after inflight IO | 3881 | /// issue after inflight IO |
| 3882 | pub const IOSQE_IO_DRAIN = 1 << @enumToInt(IOSQE_BIT.IO_DRAIN); | 3882 | pub const IOSQE_IO_DRAIN = 1 << @intFromEnum(IOSQE_BIT.IO_DRAIN); |
| 3883 | 3883 | ||
| 3884 | /// links next sqe | 3884 | /// links next sqe |
| 3885 | pub const IOSQE_IO_LINK = 1 << @enumToInt(IOSQE_BIT.IO_LINK); | 3885 | pub const IOSQE_IO_LINK = 1 << @intFromEnum(IOSQE_BIT.IO_LINK); |
| 3886 | 3886 | ||
| 3887 | /// like LINK, but stronger | 3887 | /// like LINK, but stronger |
| 3888 | pub const IOSQE_IO_HARDLINK = 1 << @enumToInt(IOSQE_BIT.IO_HARDLINK); | 3888 | pub const IOSQE_IO_HARDLINK = 1 << @intFromEnum(IOSQE_BIT.IO_HARDLINK); |
| 3889 | 3889 | ||
| 3890 | /// always go async | 3890 | /// always go async |
| 3891 | pub const IOSQE_ASYNC = 1 << @enumToInt(IOSQE_BIT.ASYNC); | 3891 | pub const IOSQE_ASYNC = 1 << @intFromEnum(IOSQE_BIT.ASYNC); |
| 3892 | 3892 | ||
| 3893 | /// select buffer from buf_group | 3893 | /// select buffer from buf_group |
| 3894 | pub const IOSQE_BUFFER_SELECT = 1 << @enumToInt(IOSQE_BIT.BUFFER_SELECT); | 3894 | pub const IOSQE_BUFFER_SELECT = 1 << @intFromEnum(IOSQE_BIT.BUFFER_SELECT); |
| 3895 | 3895 | ||
| 3896 | /// don't post CQE if request succeeded | 3896 | /// don't post CQE if request succeeded |
| 3897 | /// Available since Linux 5.17 | 3897 | /// Available since Linux 5.17 |
| 3898 | pub const IOSQE_CQE_SKIP_SUCCESS = 1 << @enumToInt(IOSQE_BIT.CQE_SKIP_SUCCESS); | 3898 | pub const IOSQE_CQE_SKIP_SUCCESS = 1 << @intFromEnum(IOSQE_BIT.CQE_SKIP_SUCCESS); |
| 3899 | 3899 | ||
| 3900 | pub const IORING_OP = enum(u8) { | 3900 | pub const IORING_OP = enum(u8) { |
| 3901 | NOP, | 3901 | NOP, |
| ... | @@ -3999,7 +3999,7 @@ pub const io_uring_cqe = extern struct { | ... | @@ -3999,7 +3999,7 @@ pub const io_uring_cqe = extern struct { |
| 3999 | 3999 | ||
| 4000 | pub fn err(self: io_uring_cqe) E { | 4000 | pub fn err(self: io_uring_cqe) E { |
| 4001 | if (self.res > -4096 and self.res < 0) { | 4001 | if (self.res > -4096 and self.res < 0) { |
| 4002 | return @intToEnum(E, -self.res); | 4002 | return @enumFromInt(E, -self.res); |
| 4003 | } | 4003 | } |
| 4004 | return .SUCCESS; | 4004 | return .SUCCESS; |
| 4005 | } | 4005 | } |
| ... | @@ -5827,7 +5827,7 @@ pub const AUDIT = struct { | ... | @@ -5827,7 +5827,7 @@ pub const AUDIT = struct { |
| 5827 | ARM = toAudit(.arm), | 5827 | ARM = toAudit(.arm), |
| 5828 | ARMEB = toAudit(.armeb), | 5828 | ARMEB = toAudit(.armeb), |
| 5829 | CSKY = toAudit(.csky), | 5829 | CSKY = toAudit(.csky), |
| 5830 | HEXAGON = @enumToInt(std.elf.EM.HEXAGON), | 5830 | HEXAGON = @intFromEnum(std.elf.EM.HEXAGON), |
| 5831 | X86 = toAudit(.x86), | 5831 | X86 = toAudit(.x86), |
| 5832 | M68K = toAudit(.m68k), | 5832 | M68K = toAudit(.m68k), |
| 5833 | MIPS = toAudit(.mips), | 5833 | MIPS = toAudit(.mips), |
| ... | @@ -5845,7 +5845,7 @@ pub const AUDIT = struct { | ... | @@ -5845,7 +5845,7 @@ pub const AUDIT = struct { |
| 5845 | X86_64 = toAudit(.x86_64), | 5845 | X86_64 = toAudit(.x86_64), |
| 5846 | 5846 | ||
| 5847 | fn toAudit(arch: std.Target.Cpu.Arch) u32 { | 5847 | fn toAudit(arch: std.Target.Cpu.Arch) u32 { |
| 5848 | var res: u32 = @enumToInt(arch.toElfMachine()); | 5848 | var res: u32 = @intFromEnum(arch.toElfMachine()); |
| 5849 | if (arch.endian() == .Little) res |= LE; | 5849 | if (arch.endian() == .Little) res |= LE; |
| 5850 | switch (arch) { | 5850 | switch (arch) { |
| 5851 | .aarch64, | 5851 | .aarch64, |
lib/std/os/linux/arm-eabi.zig+9-9| ... | @@ -16,7 +16,7 @@ const timespec = linux.timespec; | ... | @@ -16,7 +16,7 @@ const timespec = linux.timespec; |
| 16 | pub fn syscall0(number: SYS) usize { | 16 | pub fn syscall0(number: SYS) usize { |
| 17 | return asm volatile ("svc #0" | 17 | return asm volatile ("svc #0" |
| 18 | : [ret] "={r0}" (-> usize), | 18 | : [ret] "={r0}" (-> usize), |
| 19 | : [number] "{r7}" (@enumToInt(number)), | 19 | : [number] "{r7}" (@intFromEnum(number)), |
| 20 | : "memory" | 20 | : "memory" |
| 21 | ); | 21 | ); |
| 22 | } | 22 | } |
| ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { |
| 24 | pub fn syscall1(number: SYS, arg1: usize) usize { | 24 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 25 | return asm volatile ("svc #0" | 25 | return asm volatile ("svc #0" |
| 26 | : [ret] "={r0}" (-> usize), | 26 | : [ret] "={r0}" (-> usize), |
| 27 | : [number] "{r7}" (@enumToInt(number)), | 27 | : [number] "{r7}" (@intFromEnum(number)), |
| 28 | [arg1] "{r0}" (arg1), | 28 | [arg1] "{r0}" (arg1), |
| 29 | : "memory" | 29 | : "memory" |
| 30 | ); | 30 | ); |
| ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 34 | return asm volatile ("svc #0" | 34 | return asm volatile ("svc #0" |
| 35 | : [ret] "={r0}" (-> usize), | 35 | : [ret] "={r0}" (-> usize), |
| 36 | : [number] "{r7}" (@enumToInt(number)), | 36 | : [number] "{r7}" (@intFromEnum(number)), |
| 37 | [arg1] "{r0}" (arg1), | 37 | [arg1] "{r0}" (arg1), |
| 38 | [arg2] "{r1}" (arg2), | 38 | [arg2] "{r1}" (arg2), |
| 39 | : "memory" | 39 | : "memory" |
| ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 44 | return asm volatile ("svc #0" | 44 | return asm volatile ("svc #0" |
| 45 | : [ret] "={r0}" (-> usize), | 45 | : [ret] "={r0}" (-> usize), |
| 46 | : [number] "{r7}" (@enumToInt(number)), | 46 | : [number] "{r7}" (@intFromEnum(number)), |
| 47 | [arg1] "{r0}" (arg1), | 47 | [arg1] "{r0}" (arg1), |
| 48 | [arg2] "{r1}" (arg2), | 48 | [arg2] "{r1}" (arg2), |
| 49 | [arg3] "{r2}" (arg3), | 49 | [arg3] "{r2}" (arg3), |
| ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 55 | return asm volatile ("svc #0" | 55 | return asm volatile ("svc #0" |
| 56 | : [ret] "={r0}" (-> usize), | 56 | : [ret] "={r0}" (-> usize), |
| 57 | : [number] "{r7}" (@enumToInt(number)), | 57 | : [number] "{r7}" (@intFromEnum(number)), |
| 58 | [arg1] "{r0}" (arg1), | 58 | [arg1] "{r0}" (arg1), |
| 59 | [arg2] "{r1}" (arg2), | 59 | [arg2] "{r1}" (arg2), |
| 60 | [arg3] "{r2}" (arg3), | 60 | [arg3] "{r2}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 67 | return asm volatile ("svc #0" | 67 | return asm volatile ("svc #0" |
| 68 | : [ret] "={r0}" (-> usize), | 68 | : [ret] "={r0}" (-> usize), |
| 69 | : [number] "{r7}" (@enumToInt(number)), | 69 | : [number] "{r7}" (@intFromEnum(number)), |
| 70 | [arg1] "{r0}" (arg1), | 70 | [arg1] "{r0}" (arg1), |
| 71 | [arg2] "{r1}" (arg2), | 71 | [arg2] "{r1}" (arg2), |
| 72 | [arg3] "{r2}" (arg3), | 72 | [arg3] "{r2}" (arg3), |
| ... | @@ -87,7 +87,7 @@ pub fn syscall6( | ... | @@ -87,7 +87,7 @@ pub fn syscall6( |
| 87 | ) usize { | 87 | ) usize { |
| 88 | return asm volatile ("svc #0" | 88 | return asm volatile ("svc #0" |
| 89 | : [ret] "={r0}" (-> usize), | 89 | : [ret] "={r0}" (-> usize), |
| 90 | : [number] "{r7}" (@enumToInt(number)), | 90 | : [number] "{r7}" (@intFromEnum(number)), |
| 91 | [arg1] "{r0}" (arg1), | 91 | [arg1] "{r0}" (arg1), |
| 92 | [arg2] "{r1}" (arg2), | 92 | [arg2] "{r1}" (arg2), |
| 93 | [arg3] "{r2}" (arg3), | 93 | [arg3] "{r2}" (arg3), |
| ... | @@ -106,7 +106,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * | ... | @@ -106,7 +106,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * |
| 106 | pub fn restore() callconv(.Naked) void { | 106 | pub fn restore() callconv(.Naked) void { |
| 107 | return asm volatile ("svc #0" | 107 | return asm volatile ("svc #0" |
| 108 | : | 108 | : |
| 109 | : [number] "{r7}" (@enumToInt(SYS.sigreturn)), | 109 | : [number] "{r7}" (@intFromEnum(SYS.sigreturn)), |
| 110 | : "memory" | 110 | : "memory" |
| 111 | ); | 111 | ); |
| 112 | } | 112 | } |
| ... | @@ -114,7 +114,7 @@ pub fn restore() callconv(.Naked) void { | ... | @@ -114,7 +114,7 @@ pub fn restore() callconv(.Naked) void { |
| 114 | pub fn restore_rt() callconv(.Naked) void { | 114 | pub fn restore_rt() callconv(.Naked) void { |
| 115 | return asm volatile ("svc #0" | 115 | return asm volatile ("svc #0" |
| 116 | : | 116 | : |
| 117 | : [number] "{r7}" (@enumToInt(SYS.rt_sigreturn)), | 117 | : [number] "{r7}" (@intFromEnum(SYS.rt_sigreturn)), |
| 118 | : "memory" | 118 | : "memory" |
| 119 | ); | 119 | ); |
| 120 | } | 120 | } |
lib/std/os/linux/arm64.zig+9-9| ... | @@ -16,7 +16,7 @@ const timespec = std.os.linux.timespec; | ... | @@ -16,7 +16,7 @@ const timespec = std.os.linux.timespec; |
| 16 | pub fn syscall0(number: SYS) usize { | 16 | pub fn syscall0(number: SYS) usize { |
| 17 | return asm volatile ("svc #0" | 17 | return asm volatile ("svc #0" |
| 18 | : [ret] "={x0}" (-> usize), | 18 | : [ret] "={x0}" (-> usize), |
| 19 | : [number] "{x8}" (@enumToInt(number)), | 19 | : [number] "{x8}" (@intFromEnum(number)), |
| 20 | : "memory", "cc" | 20 | : "memory", "cc" |
| 21 | ); | 21 | ); |
| 22 | } | 22 | } |
| ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { |
| 24 | pub fn syscall1(number: SYS, arg1: usize) usize { | 24 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 25 | return asm volatile ("svc #0" | 25 | return asm volatile ("svc #0" |
| 26 | : [ret] "={x0}" (-> usize), | 26 | : [ret] "={x0}" (-> usize), |
| 27 | : [number] "{x8}" (@enumToInt(number)), | 27 | : [number] "{x8}" (@intFromEnum(number)), |
| 28 | [arg1] "{x0}" (arg1), | 28 | [arg1] "{x0}" (arg1), |
| 29 | : "memory", "cc" | 29 | : "memory", "cc" |
| 30 | ); | 30 | ); |
| ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 34 | return asm volatile ("svc #0" | 34 | return asm volatile ("svc #0" |
| 35 | : [ret] "={x0}" (-> usize), | 35 | : [ret] "={x0}" (-> usize), |
| 36 | : [number] "{x8}" (@enumToInt(number)), | 36 | : [number] "{x8}" (@intFromEnum(number)), |
| 37 | [arg1] "{x0}" (arg1), | 37 | [arg1] "{x0}" (arg1), |
| 38 | [arg2] "{x1}" (arg2), | 38 | [arg2] "{x1}" (arg2), |
| 39 | : "memory", "cc" | 39 | : "memory", "cc" |
| ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 44 | return asm volatile ("svc #0" | 44 | return asm volatile ("svc #0" |
| 45 | : [ret] "={x0}" (-> usize), | 45 | : [ret] "={x0}" (-> usize), |
| 46 | : [number] "{x8}" (@enumToInt(number)), | 46 | : [number] "{x8}" (@intFromEnum(number)), |
| 47 | [arg1] "{x0}" (arg1), | 47 | [arg1] "{x0}" (arg1), |
| 48 | [arg2] "{x1}" (arg2), | 48 | [arg2] "{x1}" (arg2), |
| 49 | [arg3] "{x2}" (arg3), | 49 | [arg3] "{x2}" (arg3), |
| ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 55 | return asm volatile ("svc #0" | 55 | return asm volatile ("svc #0" |
| 56 | : [ret] "={x0}" (-> usize), | 56 | : [ret] "={x0}" (-> usize), |
| 57 | : [number] "{x8}" (@enumToInt(number)), | 57 | : [number] "{x8}" (@intFromEnum(number)), |
| 58 | [arg1] "{x0}" (arg1), | 58 | [arg1] "{x0}" (arg1), |
| 59 | [arg2] "{x1}" (arg2), | 59 | [arg2] "{x1}" (arg2), |
| 60 | [arg3] "{x2}" (arg3), | 60 | [arg3] "{x2}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 67 | return asm volatile ("svc #0" | 67 | return asm volatile ("svc #0" |
| 68 | : [ret] "={x0}" (-> usize), | 68 | : [ret] "={x0}" (-> usize), |
| 69 | : [number] "{x8}" (@enumToInt(number)), | 69 | : [number] "{x8}" (@intFromEnum(number)), |
| 70 | [arg1] "{x0}" (arg1), | 70 | [arg1] "{x0}" (arg1), |
| 71 | [arg2] "{x1}" (arg2), | 71 | [arg2] "{x1}" (arg2), |
| 72 | [arg3] "{x2}" (arg3), | 72 | [arg3] "{x2}" (arg3), |
| ... | @@ -87,7 +87,7 @@ pub fn syscall6( | ... | @@ -87,7 +87,7 @@ pub fn syscall6( |
| 87 | ) usize { | 87 | ) usize { |
| 88 | return asm volatile ("svc #0" | 88 | return asm volatile ("svc #0" |
| 89 | : [ret] "={x0}" (-> usize), | 89 | : [ret] "={x0}" (-> usize), |
| 90 | : [number] "{x8}" (@enumToInt(number)), | 90 | : [number] "{x8}" (@intFromEnum(number)), |
| 91 | [arg1] "{x0}" (arg1), | 91 | [arg1] "{x0}" (arg1), |
| 92 | [arg2] "{x1}" (arg2), | 92 | [arg2] "{x1}" (arg2), |
| 93 | [arg3] "{x2}" (arg3), | 93 | [arg3] "{x2}" (arg3), |
| ... | @@ -111,12 +111,12 @@ pub fn restore_rt() callconv(.Naked) void { | ... | @@ -111,12 +111,12 @@ pub fn restore_rt() callconv(.Naked) void { |
| 111 | \\ mov x8, %[number] | 111 | \\ mov x8, %[number] |
| 112 | \\ svc #0 | 112 | \\ svc #0 |
| 113 | : | 113 | : |
| 114 | : [number] "i" (@enumToInt(SYS.rt_sigreturn)), | 114 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), |
| 115 | : "memory", "cc" | 115 | : "memory", "cc" |
| 116 | ), | 116 | ), |
| 117 | else => return asm volatile ("svc #0" | 117 | else => return asm volatile ("svc #0" |
| 118 | : | 118 | : |
| 119 | : [number] "{x8}" (@enumToInt(SYS.rt_sigreturn)), | 119 | : [number] "{x8}" (@intFromEnum(SYS.rt_sigreturn)), |
| 120 | : "memory", "cc" | 120 | : "memory", "cc" |
| 121 | ), | 121 | ), |
| 122 | } | 122 | } |
lib/std/os/linux/bpf.zig+34-34| ... | @@ -472,10 +472,10 @@ pub const Insn = packed struct { | ... | @@ -472,10 +472,10 @@ pub const Insn = packed struct { |
| 472 | 472 | ||
| 473 | return Insn{ | 473 | return Insn{ |
| 474 | .code = code | src_type, | 474 | .code = code | src_type, |
| 475 | .dst = @enumToInt(dst), | 475 | .dst = @intFromEnum(dst), |
| 476 | .src = switch (imm_or_reg) { | 476 | .src = switch (imm_or_reg) { |
| 477 | .imm => 0, | 477 | .imm => 0, |
| 478 | .reg => |r| @enumToInt(r), | 478 | .reg => |r| @intFromEnum(r), |
| 479 | }, | 479 | }, |
| 480 | .off = off, | 480 | .off = off, |
| 481 | .imm = switch (imm_or_reg) { | 481 | .imm = switch (imm_or_reg) { |
| ... | @@ -492,7 +492,7 @@ pub const Insn = packed struct { | ... | @@ -492,7 +492,7 @@ pub const Insn = packed struct { |
| 492 | else => @compileError("width must be 32 or 64"), | 492 | else => @compileError("width must be 32 or 64"), |
| 493 | }; | 493 | }; |
| 494 | 494 | ||
| 495 | return imm_reg(width_bitfield | @enumToInt(op), dst, src, 0); | 495 | return imm_reg(width_bitfield | @intFromEnum(op), dst, src, 0); |
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | pub fn mov(dst: Reg, src: anytype) Insn { | 498 | pub fn mov(dst: Reg, src: anytype) Insn { |
| ... | @@ -548,7 +548,7 @@ pub const Insn = packed struct { | ... | @@ -548,7 +548,7 @@ pub const Insn = packed struct { |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | pub fn jmp(op: JmpOp, dst: Reg, src: anytype, off: i16) Insn { | 550 | pub fn jmp(op: JmpOp, dst: Reg, src: anytype, off: i16) Insn { |
| 551 | return imm_reg(JMP | @enumToInt(op), dst, src, off); | 551 | return imm_reg(JMP | @intFromEnum(op), dst, src, off); |
| 552 | } | 552 | } |
| 553 | 553 | ||
| 554 | pub fn ja(off: i16) Insn { | 554 | pub fn ja(off: i16) Insn { |
| ... | @@ -602,8 +602,8 @@ pub const Insn = packed struct { | ... | @@ -602,8 +602,8 @@ pub const Insn = packed struct { |
| 602 | pub fn xadd(dst: Reg, src: Reg) Insn { | 602 | pub fn xadd(dst: Reg, src: Reg) Insn { |
| 603 | return Insn{ | 603 | return Insn{ |
| 604 | .code = STX | XADD | DW, | 604 | .code = STX | XADD | DW, |
| 605 | .dst = @enumToInt(dst), | 605 | .dst = @intFromEnum(dst), |
| 606 | .src = @enumToInt(src), | 606 | .src = @intFromEnum(src), |
| 607 | .off = 0, | 607 | .off = 0, |
| 608 | .imm = 0, | 608 | .imm = 0, |
| 609 | }; | 609 | }; |
| ... | @@ -611,9 +611,9 @@ pub const Insn = packed struct { | ... | @@ -611,9 +611,9 @@ pub const Insn = packed struct { |
| 611 | 611 | ||
| 612 | fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn { | 612 | fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn { |
| 613 | return Insn{ | 613 | return Insn{ |
| 614 | .code = @enumToInt(mode) | @enumToInt(size) | LD, | 614 | .code = @intFromEnum(mode) | @intFromEnum(size) | LD, |
| 615 | .dst = @enumToInt(dst), | 615 | .dst = @intFromEnum(dst), |
| 616 | .src = @enumToInt(src), | 616 | .src = @intFromEnum(src), |
| 617 | .off = 0, | 617 | .off = 0, |
| 618 | .imm = imm, | 618 | .imm = imm, |
| 619 | }; | 619 | }; |
| ... | @@ -629,9 +629,9 @@ pub const Insn = packed struct { | ... | @@ -629,9 +629,9 @@ pub const Insn = packed struct { |
| 629 | 629 | ||
| 630 | pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn { | 630 | pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn { |
| 631 | return Insn{ | 631 | return Insn{ |
| 632 | .code = MEM | @enumToInt(size) | LDX, | 632 | .code = MEM | @intFromEnum(size) | LDX, |
| 633 | .dst = @enumToInt(dst), | 633 | .dst = @intFromEnum(dst), |
| 634 | .src = @enumToInt(src), | 634 | .src = @intFromEnum(src), |
| 635 | .off = off, | 635 | .off = off, |
| 636 | .imm = 0, | 636 | .imm = 0, |
| 637 | }; | 637 | }; |
| ... | @@ -640,8 +640,8 @@ pub const Insn = packed struct { | ... | @@ -640,8 +640,8 @@ pub const Insn = packed struct { |
| 640 | fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn { | 640 | fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn { |
| 641 | return Insn{ | 641 | return Insn{ |
| 642 | .code = LD | DW | IMM, | 642 | .code = LD | DW | IMM, |
| 643 | .dst = @enumToInt(dst), | 643 | .dst = @intFromEnum(dst), |
| 644 | .src = @enumToInt(src), | 644 | .src = @intFromEnum(src), |
| 645 | .off = 0, | 645 | .off = 0, |
| 646 | .imm = @intCast(i32, @truncate(u32, imm)), | 646 | .imm = @intCast(i32, @truncate(u32, imm)), |
| 647 | }; | 647 | }; |
| ... | @@ -666,7 +666,7 @@ pub const Insn = packed struct { | ... | @@ -666,7 +666,7 @@ pub const Insn = packed struct { |
| 666 | } | 666 | } |
| 667 | 667 | ||
| 668 | pub fn ld_map_fd1(dst: Reg, map_fd: fd_t) Insn { | 668 | pub fn ld_map_fd1(dst: Reg, map_fd: fd_t) Insn { |
| 669 | return ld_imm_impl1(dst, @intToEnum(Reg, PSEUDO_MAP_FD), @intCast(u64, map_fd)); | 669 | return ld_imm_impl1(dst, @enumFromInt(Reg, PSEUDO_MAP_FD), @intCast(u64, map_fd)); |
| 670 | } | 670 | } |
| 671 | 671 | ||
| 672 | pub fn ld_map_fd2(map_fd: fd_t) Insn { | 672 | pub fn ld_map_fd2(map_fd: fd_t) Insn { |
| ... | @@ -675,8 +675,8 @@ pub const Insn = packed struct { | ... | @@ -675,8 +675,8 @@ pub const Insn = packed struct { |
| 675 | 675 | ||
| 676 | pub fn st(comptime size: Size, dst: Reg, off: i16, imm: i32) Insn { | 676 | pub fn st(comptime size: Size, dst: Reg, off: i16, imm: i32) Insn { |
| 677 | return Insn{ | 677 | return Insn{ |
| 678 | .code = MEM | @enumToInt(size) | ST, | 678 | .code = MEM | @intFromEnum(size) | ST, |
| 679 | .dst = @enumToInt(dst), | 679 | .dst = @intFromEnum(dst), |
| 680 | .src = 0, | 680 | .src = 0, |
| 681 | .off = off, | 681 | .off = off, |
| 682 | .imm = imm, | 682 | .imm = imm, |
| ... | @@ -685,9 +685,9 @@ pub const Insn = packed struct { | ... | @@ -685,9 +685,9 @@ pub const Insn = packed struct { |
| 685 | 685 | ||
| 686 | pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn { | 686 | pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn { |
| 687 | return Insn{ | 687 | return Insn{ |
| 688 | .code = MEM | @enumToInt(size) | STX, | 688 | .code = MEM | @intFromEnum(size) | STX, |
| 689 | .dst = @enumToInt(dst), | 689 | .dst = @intFromEnum(dst), |
| 690 | .src = @enumToInt(src), | 690 | .src = @intFromEnum(src), |
| 691 | .off = off, | 691 | .off = off, |
| 692 | .imm = 0, | 692 | .imm = 0, |
| 693 | }; | 693 | }; |
| ... | @@ -699,7 +699,7 @@ pub const Insn = packed struct { | ... | @@ -699,7 +699,7 @@ pub const Insn = packed struct { |
| 699 | .Big => 0xdc, | 699 | .Big => 0xdc, |
| 700 | .Little => 0xd4, | 700 | .Little => 0xd4, |
| 701 | }, | 701 | }, |
| 702 | .dst = @enumToInt(dst), | 702 | .dst = @intFromEnum(dst), |
| 703 | .src = 0, | 703 | .src = 0, |
| 704 | .off = 0, | 704 | .off = 0, |
| 705 | .imm = switch (size) { | 705 | .imm = switch (size) { |
| ... | @@ -725,7 +725,7 @@ pub const Insn = packed struct { | ... | @@ -725,7 +725,7 @@ pub const Insn = packed struct { |
| 725 | .dst = 0, | 725 | .dst = 0, |
| 726 | .src = 0, | 726 | .src = 0, |
| 727 | .off = 0, | 727 | .off = 0, |
| 728 | .imm = @enumToInt(helper), | 728 | .imm = @intFromEnum(helper), |
| 729 | }; | 729 | }; |
| 730 | } | 730 | } |
| 731 | 731 | ||
| ... | @@ -1511,7 +1511,7 @@ pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries | ... | @@ -1511,7 +1511,7 @@ pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries |
| 1511 | .map_create = std.mem.zeroes(MapCreateAttr), | 1511 | .map_create = std.mem.zeroes(MapCreateAttr), |
| 1512 | }; | 1512 | }; |
| 1513 | 1513 | ||
| 1514 | attr.map_create.map_type = @enumToInt(map_type); | 1514 | attr.map_create.map_type = @intFromEnum(map_type); |
| 1515 | attr.map_create.key_size = key_size; | 1515 | attr.map_create.key_size = key_size; |
| 1516 | attr.map_create.value_size = value_size; | 1516 | attr.map_create.value_size = value_size; |
| 1517 | attr.map_create.max_entries = max_entries; | 1517 | attr.map_create.max_entries = max_entries; |
| ... | @@ -1537,8 +1537,8 @@ pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !void { | ... | @@ -1537,8 +1537,8 @@ pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !void { |
| 1537 | }; | 1537 | }; |
| 1538 | 1538 | ||
| 1539 | attr.map_elem.map_fd = fd; | 1539 | attr.map_elem.map_fd = fd; |
| 1540 | attr.map_elem.key = @ptrToInt(key.ptr); | 1540 | attr.map_elem.key = @intFromPtr(key.ptr); |
| 1541 | attr.map_elem.result.value = @ptrToInt(value.ptr); | 1541 | attr.map_elem.result.value = @intFromPtr(value.ptr); |
| 1542 | 1542 | ||
| 1543 | const rc = linux.bpf(.map_lookup_elem, &attr, @sizeOf(MapElemAttr)); | 1543 | const rc = linux.bpf(.map_lookup_elem, &attr, @sizeOf(MapElemAttr)); |
| 1544 | switch (errno(rc)) { | 1544 | switch (errno(rc)) { |
| ... | @@ -1558,8 +1558,8 @@ pub fn map_update_elem(fd: fd_t, key: []const u8, value: []const u8, flags: u64) | ... | @@ -1558,8 +1558,8 @@ pub fn map_update_elem(fd: fd_t, key: []const u8, value: []const u8, flags: u64) |
| 1558 | }; | 1558 | }; |
| 1559 | 1559 | ||
| 1560 | attr.map_elem.map_fd = fd; | 1560 | attr.map_elem.map_fd = fd; |
| 1561 | attr.map_elem.key = @ptrToInt(key.ptr); | 1561 | attr.map_elem.key = @intFromPtr(key.ptr); |
| 1562 | attr.map_elem.result = .{ .value = @ptrToInt(value.ptr) }; | 1562 | attr.map_elem.result = .{ .value = @intFromPtr(value.ptr) }; |
| 1563 | attr.map_elem.flags = flags; | 1563 | attr.map_elem.flags = flags; |
| 1564 | 1564 | ||
| 1565 | const rc = linux.bpf(.map_update_elem, &attr, @sizeOf(MapElemAttr)); | 1565 | const rc = linux.bpf(.map_update_elem, &attr, @sizeOf(MapElemAttr)); |
| ... | @@ -1581,7 +1581,7 @@ pub fn map_delete_elem(fd: fd_t, key: []const u8) !void { | ... | @@ -1581,7 +1581,7 @@ pub fn map_delete_elem(fd: fd_t, key: []const u8) !void { |
| 1581 | }; | 1581 | }; |
| 1582 | 1582 | ||
| 1583 | attr.map_elem.map_fd = fd; | 1583 | attr.map_elem.map_fd = fd; |
| 1584 | attr.map_elem.key = @ptrToInt(key.ptr); | 1584 | attr.map_elem.key = @intFromPtr(key.ptr); |
| 1585 | 1585 | ||
| 1586 | const rc = linux.bpf(.map_delete_elem, &attr, @sizeOf(MapElemAttr)); | 1586 | const rc = linux.bpf(.map_delete_elem, &attr, @sizeOf(MapElemAttr)); |
| 1587 | switch (errno(rc)) { | 1587 | switch (errno(rc)) { |
| ... | @@ -1601,8 +1601,8 @@ pub fn map_get_next_key(fd: fd_t, key: []const u8, next_key: []u8) !bool { | ... | @@ -1601,8 +1601,8 @@ pub fn map_get_next_key(fd: fd_t, key: []const u8, next_key: []u8) !bool { |
| 1601 | }; | 1601 | }; |
| 1602 | 1602 | ||
| 1603 | attr.map_elem.map_fd = fd; | 1603 | attr.map_elem.map_fd = fd; |
| 1604 | attr.map_elem.key = @ptrToInt(key.ptr); | 1604 | attr.map_elem.key = @intFromPtr(key.ptr); |
| 1605 | attr.map_elem.result.next_key = @ptrToInt(next_key.ptr); | 1605 | attr.map_elem.result.next_key = @intFromPtr(next_key.ptr); |
| 1606 | 1606 | ||
| 1607 | const rc = linux.bpf(.map_get_next_key, &attr, @sizeOf(MapElemAttr)); | 1607 | const rc = linux.bpf(.map_get_next_key, &attr, @sizeOf(MapElemAttr)); |
| 1608 | switch (errno(rc)) { | 1608 | switch (errno(rc)) { |
| ... | @@ -1666,15 +1666,15 @@ pub fn prog_load( | ... | @@ -1666,15 +1666,15 @@ pub fn prog_load( |
| 1666 | .prog_load = std.mem.zeroes(ProgLoadAttr), | 1666 | .prog_load = std.mem.zeroes(ProgLoadAttr), |
| 1667 | }; | 1667 | }; |
| 1668 | 1668 | ||
| 1669 | attr.prog_load.prog_type = @enumToInt(prog_type); | 1669 | attr.prog_load.prog_type = @intFromEnum(prog_type); |
| 1670 | attr.prog_load.insns = @ptrToInt(insns.ptr); | 1670 | attr.prog_load.insns = @intFromPtr(insns.ptr); |
| 1671 | attr.prog_load.insn_cnt = @intCast(u32, insns.len); | 1671 | attr.prog_load.insn_cnt = @intCast(u32, insns.len); |
| 1672 | attr.prog_load.license = @ptrToInt(license.ptr); | 1672 | attr.prog_load.license = @intFromPtr(license.ptr); |
| 1673 | attr.prog_load.kern_version = kern_version; | 1673 | attr.prog_load.kern_version = kern_version; |
| 1674 | attr.prog_load.prog_flags = flags; | 1674 | attr.prog_load.prog_flags = flags; |
| 1675 | 1675 | ||
| 1676 | if (log) |l| { | 1676 | if (log) |l| { |
| 1677 | attr.prog_load.log_buf = @ptrToInt(l.buf.ptr); | 1677 | attr.prog_load.log_buf = @intFromPtr(l.buf.ptr); |
| 1678 | attr.prog_load.log_size = @intCast(u32, l.buf.len); | 1678 | attr.prog_load.log_size = @intCast(u32, l.buf.len); |
| 1679 | attr.prog_load.log_level = l.level; | 1679 | attr.prog_load.log_level = l.level; |
| 1680 | } | 1680 | } |
lib/std/os/linux/bpf/helpers.zig+141-141| ... | @@ -11,147 +11,147 @@ const SkFullSock = @compileError("TODO missing os bits: SkFullSock"); | ... | @@ -11,147 +11,147 @@ const SkFullSock = @compileError("TODO missing os bits: SkFullSock"); |
| 11 | // | 11 | // |
| 12 | // Note, these function signatures were created from documentation found in | 12 | // Note, these function signatures were created from documentation found in |
| 13 | // '/usr/include/linux/bpf.h' | 13 | // '/usr/include/linux/bpf.h' |
| 14 | pub const map_lookup_elem = @intToPtr(*const fn (map: *const kern.MapDef, key: ?*const anyopaque) ?*anyopaque, 1); | 14 | pub const map_lookup_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, key: ?*const anyopaque) ?*anyopaque, 1); |
| 15 | pub const map_update_elem = @intToPtr(*const fn (map: *const kern.MapDef, key: ?*const anyopaque, value: ?*const anyopaque, flags: u64) c_long, 2); | 15 | pub const map_update_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, key: ?*const anyopaque, value: ?*const anyopaque, flags: u64) c_long, 2); |
| 16 | pub const map_delete_elem = @intToPtr(*const fn (map: *const kern.MapDef, key: ?*const anyopaque) c_long, 3); | 16 | pub const map_delete_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, key: ?*const anyopaque) c_long, 3); |
| 17 | pub const probe_read = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 4); | 17 | pub const probe_read = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 4); |
| 18 | pub const ktime_get_ns = @intToPtr(*const fn () u64, 5); | 18 | pub const ktime_get_ns = @ptrFromInt(*const fn () u64, 5); |
| 19 | pub const trace_printk = @intToPtr(*const fn (fmt: [*:0]const u8, fmt_size: u32, arg1: u64, arg2: u64, arg3: u64) c_long, 6); | 19 | pub const trace_printk = @ptrFromInt(*const fn (fmt: [*:0]const u8, fmt_size: u32, arg1: u64, arg2: u64, arg3: u64) c_long, 6); |
| 20 | pub const get_prandom_u32 = @intToPtr(*const fn () u32, 7); | 20 | pub const get_prandom_u32 = @ptrFromInt(*const fn () u32, 7); |
| 21 | pub const get_smp_processor_id = @intToPtr(*const fn () u32, 8); | 21 | pub const get_smp_processor_id = @ptrFromInt(*const fn () u32, 8); |
| 22 | pub const skb_store_bytes = @intToPtr(*const fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32, flags: u64) c_long, 9); | 22 | pub const skb_store_bytes = @ptrFromInt(*const fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32, flags: u64) c_long, 9); |
| 23 | pub const l3_csum_replace = @intToPtr(*const fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, size: u64) c_long, 10); | 23 | pub const l3_csum_replace = @ptrFromInt(*const fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, size: u64) c_long, 10); |
| 24 | pub const l4_csum_replace = @intToPtr(*const fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, flags: u64) c_long, 11); | 24 | pub const l4_csum_replace = @ptrFromInt(*const fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, flags: u64) c_long, 11); |
| 25 | pub const tail_call = @intToPtr(*const fn (ctx: ?*anyopaque, prog_array_map: *const kern.MapDef, index: u32) c_long, 12); | 25 | pub const tail_call = @ptrFromInt(*const fn (ctx: ?*anyopaque, prog_array_map: *const kern.MapDef, index: u32) c_long, 12); |
| 26 | pub const clone_redirect = @intToPtr(*const fn (skb: *kern.SkBuff, ifindex: u32, flags: u64) c_long, 13); | 26 | pub const clone_redirect = @ptrFromInt(*const fn (skb: *kern.SkBuff, ifindex: u32, flags: u64) c_long, 13); |
| 27 | pub const get_current_pid_tgid = @intToPtr(*const fn () u64, 14); | 27 | pub const get_current_pid_tgid = @ptrFromInt(*const fn () u64, 14); |
| 28 | pub const get_current_uid_gid = @intToPtr(*const fn () u64, 15); | 28 | pub const get_current_uid_gid = @ptrFromInt(*const fn () u64, 15); |
| 29 | pub const get_current_comm = @intToPtr(*const fn (buf: ?*anyopaque, size_of_buf: u32) c_long, 16); | 29 | pub const get_current_comm = @ptrFromInt(*const fn (buf: ?*anyopaque, size_of_buf: u32) c_long, 16); |
| 30 | pub const get_cgroup_classid = @intToPtr(*const fn (skb: *kern.SkBuff) u32, 17); | 30 | pub const get_cgroup_classid = @ptrFromInt(*const fn (skb: *kern.SkBuff) u32, 17); |
| 31 | // Note vlan_proto is big endian | 31 | // Note vlan_proto is big endian |
| 32 | pub const skb_vlan_push = @intToPtr(*const fn (skb: *kern.SkBuff, vlan_proto: u16, vlan_tci: u16) c_long, 18); | 32 | pub const skb_vlan_push = @ptrFromInt(*const fn (skb: *kern.SkBuff, vlan_proto: u16, vlan_tci: u16) c_long, 18); |
| 33 | pub const skb_vlan_pop = @intToPtr(*const fn (skb: *kern.SkBuff) c_long, 19); | 33 | pub const skb_vlan_pop = @ptrFromInt(*const fn (skb: *kern.SkBuff) c_long, 19); |
| 34 | pub const skb_get_tunnel_key = @intToPtr(*const fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, 20); | 34 | pub const skb_get_tunnel_key = @ptrFromInt(*const fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, 20); |
| 35 | pub const skb_set_tunnel_key = @intToPtr(*const fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, 21); | 35 | pub const skb_set_tunnel_key = @ptrFromInt(*const fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, 21); |
| 36 | pub const perf_event_read = @intToPtr(*const fn (map: *const kern.MapDef, flags: u64) u64, 22); | 36 | pub const perf_event_read = @ptrFromInt(*const fn (map: *const kern.MapDef, flags: u64) u64, 22); |
| 37 | pub const redirect = @intToPtr(*const fn (ifindex: u32, flags: u64) c_long, 23); | 37 | pub const redirect = @ptrFromInt(*const fn (ifindex: u32, flags: u64) c_long, 23); |
| 38 | pub const get_route_realm = @intToPtr(*const fn (skb: *kern.SkBuff) u32, 24); | 38 | pub const get_route_realm = @ptrFromInt(*const fn (skb: *kern.SkBuff) u32, 24); |
| 39 | pub const perf_event_output = @intToPtr(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 25); | 39 | pub const perf_event_output = @ptrFromInt(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 25); |
| 40 | pub const skb_load_bytes = @intToPtr(*const fn (skb: ?*anyopaque, offset: u32, to: ?*anyopaque, len: u32) c_long, 26); | 40 | pub const skb_load_bytes = @ptrFromInt(*const fn (skb: ?*anyopaque, offset: u32, to: ?*anyopaque, len: u32) c_long, 26); |
| 41 | pub const get_stackid = @intToPtr(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64) c_long, 27); | 41 | pub const get_stackid = @ptrFromInt(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64) c_long, 27); |
| 42 | // from and to point to __be32 | 42 | // from and to point to __be32 |
| 43 | pub const csum_diff = @intToPtr(*const fn (from: *u32, from_size: u32, to: *u32, to_size: u32, seed: u32) i64, 28); | 43 | pub const csum_diff = @ptrFromInt(*const fn (from: *u32, from_size: u32, to: *u32, to_size: u32, seed: u32) i64, 28); |
| 44 | pub const skb_get_tunnel_opt = @intToPtr(*const fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, 29); | 44 | pub const skb_get_tunnel_opt = @ptrFromInt(*const fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, 29); |
| 45 | pub const skb_set_tunnel_opt = @intToPtr(*const fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, 30); | 45 | pub const skb_set_tunnel_opt = @ptrFromInt(*const fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, 30); |
| 46 | // proto is __be16 | 46 | // proto is __be16 |
| 47 | pub const skb_change_proto = @intToPtr(*const fn (skb: *kern.SkBuff, proto: u16, flags: u64) c_long, 31); | 47 | pub const skb_change_proto = @ptrFromInt(*const fn (skb: *kern.SkBuff, proto: u16, flags: u64) c_long, 31); |
| 48 | pub const skb_change_type = @intToPtr(*const fn (skb: *kern.SkBuff, skb_type: u32) c_long, 32); | 48 | pub const skb_change_type = @ptrFromInt(*const fn (skb: *kern.SkBuff, skb_type: u32) c_long, 32); |
| 49 | pub const skb_under_cgroup = @intToPtr(*const fn (skb: *kern.SkBuff, map: ?*const anyopaque, index: u32) c_long, 33); | 49 | pub const skb_under_cgroup = @ptrFromInt(*const fn (skb: *kern.SkBuff, map: ?*const anyopaque, index: u32) c_long, 33); |
| 50 | pub const get_hash_recalc = @intToPtr(*const fn (skb: *kern.SkBuff) u32, 34); | 50 | pub const get_hash_recalc = @ptrFromInt(*const fn (skb: *kern.SkBuff) u32, 34); |
| 51 | pub const get_current_task = @intToPtr(*const fn () u64, 35); | 51 | pub const get_current_task = @ptrFromInt(*const fn () u64, 35); |
| 52 | pub const probe_write_user = @intToPtr(*const fn (dst: ?*anyopaque, src: ?*const anyopaque, len: u32) c_long, 36); | 52 | pub const probe_write_user = @ptrFromInt(*const fn (dst: ?*anyopaque, src: ?*const anyopaque, len: u32) c_long, 36); |
| 53 | pub const current_task_under_cgroup = @intToPtr(*const fn (map: *const kern.MapDef, index: u32) c_long, 37); | 53 | pub const current_task_under_cgroup = @ptrFromInt(*const fn (map: *const kern.MapDef, index: u32) c_long, 37); |
| 54 | pub const skb_change_tail = @intToPtr(*const fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, 38); | 54 | pub const skb_change_tail = @ptrFromInt(*const fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, 38); |
| 55 | pub const skb_pull_data = @intToPtr(*const fn (skb: *kern.SkBuff, len: u32) c_long, 39); | 55 | pub const skb_pull_data = @ptrFromInt(*const fn (skb: *kern.SkBuff, len: u32) c_long, 39); |
| 56 | pub const csum_update = @intToPtr(*const fn (skb: *kern.SkBuff, csum: u32) i64, 40); | 56 | pub const csum_update = @ptrFromInt(*const fn (skb: *kern.SkBuff, csum: u32) i64, 40); |
| 57 | pub const set_hash_invalid = @intToPtr(*const fn (skb: *kern.SkBuff) void, 41); | 57 | pub const set_hash_invalid = @ptrFromInt(*const fn (skb: *kern.SkBuff) void, 41); |
| 58 | pub const get_numa_node_id = @intToPtr(*const fn () c_long, 42); | 58 | pub const get_numa_node_id = @ptrFromInt(*const fn () c_long, 42); |
| 59 | pub const skb_change_head = @intToPtr(*const fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, 43); | 59 | pub const skb_change_head = @ptrFromInt(*const fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, 43); |
| 60 | pub const xdp_adjust_head = @intToPtr(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 44); | 60 | pub const xdp_adjust_head = @ptrFromInt(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 44); |
| 61 | pub const probe_read_str = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 45); | 61 | pub const probe_read_str = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 45); |
| 62 | pub const get_socket_cookie = @intToPtr(*const fn (ctx: ?*anyopaque) u64, 46); | 62 | pub const get_socket_cookie = @ptrFromInt(*const fn (ctx: ?*anyopaque) u64, 46); |
| 63 | pub const get_socket_uid = @intToPtr(*const fn (skb: *kern.SkBuff) u32, 47); | 63 | pub const get_socket_uid = @ptrFromInt(*const fn (skb: *kern.SkBuff) u32, 47); |
| 64 | pub const set_hash = @intToPtr(*const fn (skb: *kern.SkBuff, hash: u32) c_long, 48); | 64 | pub const set_hash = @ptrFromInt(*const fn (skb: *kern.SkBuff, hash: u32) c_long, 48); |
| 65 | pub const setsockopt = @intToPtr(*const fn (bpf_socket: *kern.SockOps, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, 49); | 65 | pub const setsockopt = @ptrFromInt(*const fn (bpf_socket: *kern.SockOps, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, 49); |
| 66 | pub const skb_adjust_room = @intToPtr(*const fn (skb: *kern.SkBuff, len_diff: i32, mode: u32, flags: u64) c_long, 50); | 66 | pub const skb_adjust_room = @ptrFromInt(*const fn (skb: *kern.SkBuff, len_diff: i32, mode: u32, flags: u64) c_long, 50); |
| 67 | pub const redirect_map = @intToPtr(*const fn (map: *const kern.MapDef, key: u32, flags: u64) c_long, 51); | 67 | pub const redirect_map = @ptrFromInt(*const fn (map: *const kern.MapDef, key: u32, flags: u64) c_long, 51); |
| 68 | pub const sk_redirect_map = @intToPtr(*const fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: u32, flags: u64) c_long, 52); | 68 | pub const sk_redirect_map = @ptrFromInt(*const fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: u32, flags: u64) c_long, 52); |
| 69 | pub const sock_map_update = @intToPtr(*const fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 53); | 69 | pub const sock_map_update = @ptrFromInt(*const fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 53); |
| 70 | pub const xdp_adjust_meta = @intToPtr(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 54); | 70 | pub const xdp_adjust_meta = @ptrFromInt(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 54); |
| 71 | pub const perf_event_read_value = @intToPtr(*const fn (map: *const kern.MapDef, flags: u64, buf: *kern.PerfEventValue, buf_size: u32) c_long, 55); | 71 | pub const perf_event_read_value = @ptrFromInt(*const fn (map: *const kern.MapDef, flags: u64, buf: *kern.PerfEventValue, buf_size: u32) c_long, 55); |
| 72 | pub const perf_prog_read_value = @intToPtr(*const fn (ctx: *kern.PerfEventData, buf: *kern.PerfEventValue, buf_size: u32) c_long, 56); | 72 | pub const perf_prog_read_value = @ptrFromInt(*const fn (ctx: *kern.PerfEventData, buf: *kern.PerfEventValue, buf_size: u32) c_long, 56); |
| 73 | pub const getsockopt = @intToPtr(*const fn (bpf_socket: ?*anyopaque, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, 57); | 73 | pub const getsockopt = @ptrFromInt(*const fn (bpf_socket: ?*anyopaque, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, 57); |
| 74 | pub const override_return = @intToPtr(*const fn (regs: *PtRegs, rc: u64) c_long, 58); | 74 | pub const override_return = @ptrFromInt(*const fn (regs: *PtRegs, rc: u64) c_long, 58); |
| 75 | pub const sock_ops_cb_flags_set = @intToPtr(*const fn (bpf_sock: *kern.SockOps, argval: c_int) c_long, 59); | 75 | pub const sock_ops_cb_flags_set = @ptrFromInt(*const fn (bpf_sock: *kern.SockOps, argval: c_int) c_long, 59); |
| 76 | pub const msg_redirect_map = @intToPtr(*const fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: u32, flags: u64) c_long, 60); | 76 | pub const msg_redirect_map = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: u32, flags: u64) c_long, 60); |
| 77 | pub const msg_apply_bytes = @intToPtr(*const fn (msg: *kern.SkMsgMd, bytes: u32) c_long, 61); | 77 | pub const msg_apply_bytes = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, bytes: u32) c_long, 61); |
| 78 | pub const msg_cork_bytes = @intToPtr(*const fn (msg: *kern.SkMsgMd, bytes: u32) c_long, 62); | 78 | pub const msg_cork_bytes = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, bytes: u32) c_long, 62); |
| 79 | pub const msg_pull_data = @intToPtr(*const fn (msg: *kern.SkMsgMd, start: u32, end: u32, flags: u64) c_long, 63); | 79 | pub const msg_pull_data = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, start: u32, end: u32, flags: u64) c_long, 63); |
| 80 | pub const bind = @intToPtr(*const fn (ctx: *kern.BpfSockAddr, addr: *kern.SockAddr, addr_len: c_int) c_long, 64); | 80 | pub const bind = @ptrFromInt(*const fn (ctx: *kern.BpfSockAddr, addr: *kern.SockAddr, addr_len: c_int) c_long, 64); |
| 81 | pub const xdp_adjust_tail = @intToPtr(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 65); | 81 | pub const xdp_adjust_tail = @ptrFromInt(*const fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, 65); |
| 82 | pub const skb_get_xfrm_state = @intToPtr(*const fn (skb: *kern.SkBuff, index: u32, xfrm_state: *kern.XfrmState, size: u32, flags: u64) c_long, 66); | 82 | pub const skb_get_xfrm_state = @ptrFromInt(*const fn (skb: *kern.SkBuff, index: u32, xfrm_state: *kern.XfrmState, size: u32, flags: u64) c_long, 66); |
| 83 | pub const get_stack = @intToPtr(*const fn (ctx: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, 67); | 83 | pub const get_stack = @ptrFromInt(*const fn (ctx: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, 67); |
| 84 | pub const skb_load_bytes_relative = @intToPtr(*const fn (skb: ?*const anyopaque, offset: u32, to: ?*anyopaque, len: u32, start_header: u32) c_long, 68); | 84 | pub const skb_load_bytes_relative = @ptrFromInt(*const fn (skb: ?*const anyopaque, offset: u32, to: ?*anyopaque, len: u32, start_header: u32) c_long, 68); |
| 85 | pub const fib_lookup = @intToPtr(*const fn (ctx: ?*anyopaque, params: *kern.FibLookup, plen: c_int, flags: u32) c_long, 69); | 85 | pub const fib_lookup = @ptrFromInt(*const fn (ctx: ?*anyopaque, params: *kern.FibLookup, plen: c_int, flags: u32) c_long, 69); |
| 86 | pub const sock_hash_update = @intToPtr(*const fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 70); | 86 | pub const sock_hash_update = @ptrFromInt(*const fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 70); |
| 87 | pub const msg_redirect_hash = @intToPtr(*const fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 71); | 87 | pub const msg_redirect_hash = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 71); |
| 88 | pub const sk_redirect_hash = @intToPtr(*const fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 72); | 88 | pub const sk_redirect_hash = @ptrFromInt(*const fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 72); |
| 89 | pub const lwt_push_encap = @intToPtr(*const fn (skb: *kern.SkBuff, typ: u32, hdr: ?*anyopaque, len: u32) c_long, 73); | 89 | pub const lwt_push_encap = @ptrFromInt(*const fn (skb: *kern.SkBuff, typ: u32, hdr: ?*anyopaque, len: u32) c_long, 73); |
| 90 | pub const lwt_seg6_store_bytes = @intToPtr(*const fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32) c_long, 74); | 90 | pub const lwt_seg6_store_bytes = @ptrFromInt(*const fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32) c_long, 74); |
| 91 | pub const lwt_seg6_adjust_srh = @intToPtr(*const fn (skb: *kern.SkBuff, offset: u32, delta: i32) c_long, 75); | 91 | pub const lwt_seg6_adjust_srh = @ptrFromInt(*const fn (skb: *kern.SkBuff, offset: u32, delta: i32) c_long, 75); |
| 92 | pub const lwt_seg6_action = @intToPtr(*const fn (skb: *kern.SkBuff, action: u32, param: ?*anyopaque, param_len: u32) c_long, 76); | 92 | pub const lwt_seg6_action = @ptrFromInt(*const fn (skb: *kern.SkBuff, action: u32, param: ?*anyopaque, param_len: u32) c_long, 76); |
| 93 | pub const rc_repeat = @intToPtr(*const fn (ctx: ?*anyopaque) c_long, 77); | 93 | pub const rc_repeat = @ptrFromInt(*const fn (ctx: ?*anyopaque) c_long, 77); |
| 94 | pub const rc_keydown = @intToPtr(*const fn (ctx: ?*anyopaque, protocol: u32, scancode: u64, toggle: u32) c_long, 78); | 94 | pub const rc_keydown = @ptrFromInt(*const fn (ctx: ?*anyopaque, protocol: u32, scancode: u64, toggle: u32) c_long, 78); |
| 95 | pub const skb_cgroup_id = @intToPtr(*const fn (skb: *kern.SkBuff) u64, 79); | 95 | pub const skb_cgroup_id = @ptrFromInt(*const fn (skb: *kern.SkBuff) u64, 79); |
| 96 | pub const get_current_cgroup_id = @intToPtr(*const fn () u64, 80); | 96 | pub const get_current_cgroup_id = @ptrFromInt(*const fn () u64, 80); |
| 97 | pub const get_local_storage = @intToPtr(*const fn (map: ?*anyopaque, flags: u64) ?*anyopaque, 81); | 97 | pub const get_local_storage = @ptrFromInt(*const fn (map: ?*anyopaque, flags: u64) ?*anyopaque, 81); |
| 98 | pub const sk_select_reuseport = @intToPtr(*const fn (reuse: *kern.SkReusePortMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 82); | 98 | pub const sk_select_reuseport = @ptrFromInt(*const fn (reuse: *kern.SkReusePortMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, 82); |
| 99 | pub const skb_ancestor_cgroup_id = @intToPtr(*const fn (skb: *kern.SkBuff, ancestor_level: c_int) u64, 83); | 99 | pub const skb_ancestor_cgroup_id = @ptrFromInt(*const fn (skb: *kern.SkBuff, ancestor_level: c_int) u64, 83); |
| 100 | pub const sk_lookup_tcp = @intToPtr(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 84); | 100 | pub const sk_lookup_tcp = @ptrFromInt(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 84); |
| 101 | pub const sk_lookup_udp = @intToPtr(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 85); | 101 | pub const sk_lookup_udp = @ptrFromInt(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 85); |
| 102 | pub const sk_release = @intToPtr(*const fn (sock: *kern.Sock) c_long, 86); | 102 | pub const sk_release = @ptrFromInt(*const fn (sock: *kern.Sock) c_long, 86); |
| 103 | pub const map_push_elem = @intToPtr(*const fn (map: *const kern.MapDef, value: ?*const anyopaque, flags: u64) c_long, 87); | 103 | pub const map_push_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, value: ?*const anyopaque, flags: u64) c_long, 87); |
| 104 | pub const map_pop_elem = @intToPtr(*const fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, 88); | 104 | pub const map_pop_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, 88); |
| 105 | pub const map_peek_elem = @intToPtr(*const fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, 89); | 105 | pub const map_peek_elem = @ptrFromInt(*const fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, 89); |
| 106 | pub const msg_push_data = @intToPtr(*const fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, 90); | 106 | pub const msg_push_data = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, 90); |
| 107 | pub const msg_pop_data = @intToPtr(*const fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, 91); | 107 | pub const msg_pop_data = @ptrFromInt(*const fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, 91); |
| 108 | pub const rc_pointer_rel = @intToPtr(*const fn (ctx: ?*anyopaque, rel_x: i32, rel_y: i32) c_long, 92); | 108 | pub const rc_pointer_rel = @ptrFromInt(*const fn (ctx: ?*anyopaque, rel_x: i32, rel_y: i32) c_long, 92); |
| 109 | pub const spin_lock = @intToPtr(*const fn (lock: *kern.SpinLock) c_long, 93); | 109 | pub const spin_lock = @ptrFromInt(*const fn (lock: *kern.SpinLock) c_long, 93); |
| 110 | pub const spin_unlock = @intToPtr(*const fn (lock: *kern.SpinLock) c_long, 94); | 110 | pub const spin_unlock = @ptrFromInt(*const fn (lock: *kern.SpinLock) c_long, 94); |
| 111 | pub const sk_fullsock = @intToPtr(*const fn (sk: *kern.Sock) ?*SkFullSock, 95); | 111 | pub const sk_fullsock = @ptrFromInt(*const fn (sk: *kern.Sock) ?*SkFullSock, 95); |
| 112 | pub const tcp_sock = @intToPtr(*const fn (sk: *kern.Sock) ?*kern.TcpSock, 96); | 112 | pub const tcp_sock = @ptrFromInt(*const fn (sk: *kern.Sock) ?*kern.TcpSock, 96); |
| 113 | pub const skb_ecn_set_ce = @intToPtr(*const fn (skb: *kern.SkBuff) c_long, 97); | 113 | pub const skb_ecn_set_ce = @ptrFromInt(*const fn (skb: *kern.SkBuff) c_long, 97); |
| 114 | pub const get_listener_sock = @intToPtr(*const fn (sk: *kern.Sock) ?*kern.Sock, 98); | 114 | pub const get_listener_sock = @ptrFromInt(*const fn (sk: *kern.Sock) ?*kern.Sock, 98); |
| 115 | pub const skc_lookup_tcp = @intToPtr(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 99); | 115 | pub const skc_lookup_tcp = @ptrFromInt(*const fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, 99); |
| 116 | pub const tcp_check_syncookie = @intToPtr(*const fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) c_long, 100); | 116 | pub const tcp_check_syncookie = @ptrFromInt(*const fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) c_long, 100); |
| 117 | pub const sysctl_get_name = @intToPtr(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong, flags: u64) c_long, 101); | 117 | pub const sysctl_get_name = @ptrFromInt(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong, flags: u64) c_long, 101); |
| 118 | pub const sysctl_get_current_value = @intToPtr(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, 102); | 118 | pub const sysctl_get_current_value = @ptrFromInt(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, 102); |
| 119 | pub const sysctl_get_new_value = @intToPtr(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, 103); | 119 | pub const sysctl_get_new_value = @ptrFromInt(*const fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, 103); |
| 120 | pub const sysctl_set_new_value = @intToPtr(*const fn (ctx: *kern.SysCtl, buf: ?*const u8, buf_len: c_ulong) c_long, 104); | 120 | pub const sysctl_set_new_value = @ptrFromInt(*const fn (ctx: *kern.SysCtl, buf: ?*const u8, buf_len: c_ulong) c_long, 104); |
| 121 | pub const strtol = @intToPtr(*const fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_long) c_long, 105); | 121 | pub const strtol = @ptrFromInt(*const fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_long) c_long, 105); |
| 122 | pub const strtoul = @intToPtr(*const fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_ulong) c_long, 106); | 122 | pub const strtoul = @ptrFromInt(*const fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_ulong) c_long, 106); |
| 123 | pub const sk_storage_get = @intToPtr(*const fn (map: *const kern.MapDef, sk: *kern.Sock, value: ?*anyopaque, flags: u64) ?*anyopaque, 107); | 123 | pub const sk_storage_get = @ptrFromInt(*const fn (map: *const kern.MapDef, sk: *kern.Sock, value: ?*anyopaque, flags: u64) ?*anyopaque, 107); |
| 124 | pub const sk_storage_delete = @intToPtr(*const fn (map: *const kern.MapDef, sk: *kern.Sock) c_long, 108); | 124 | pub const sk_storage_delete = @ptrFromInt(*const fn (map: *const kern.MapDef, sk: *kern.Sock) c_long, 108); |
| 125 | pub const send_signal = @intToPtr(*const fn (sig: u32) c_long, 109); | 125 | pub const send_signal = @ptrFromInt(*const fn (sig: u32) c_long, 109); |
| 126 | pub const tcp_gen_syncookie = @intToPtr(*const fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) i64, 110); | 126 | pub const tcp_gen_syncookie = @ptrFromInt(*const fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) i64, 110); |
| 127 | pub const skb_output = @intToPtr(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 111); | 127 | pub const skb_output = @ptrFromInt(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 111); |
| 128 | pub const probe_read_user = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 112); | 128 | pub const probe_read_user = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 112); |
| 129 | pub const probe_read_kernel = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 113); | 129 | pub const probe_read_kernel = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 113); |
| 130 | pub const probe_read_user_str = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 114); | 130 | pub const probe_read_user_str = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 114); |
| 131 | pub const probe_read_kernel_str = @intToPtr(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 115); | 131 | pub const probe_read_kernel_str = @ptrFromInt(*const fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, 115); |
| 132 | pub const tcp_send_ack = @intToPtr(*const fn (tp: ?*anyopaque, rcv_nxt: u32) c_long, 116); | 132 | pub const tcp_send_ack = @ptrFromInt(*const fn (tp: ?*anyopaque, rcv_nxt: u32) c_long, 116); |
| 133 | pub const send_signal_thread = @intToPtr(*const fn (sig: u32) c_long, 117); | 133 | pub const send_signal_thread = @ptrFromInt(*const fn (sig: u32) c_long, 117); |
| 134 | pub const jiffies64 = @intToPtr(*const fn () u64, 118); | 134 | pub const jiffies64 = @ptrFromInt(*const fn () u64, 118); |
| 135 | pub const read_branch_records = @intToPtr(*const fn (ctx: *kern.PerfEventData, buf: ?*anyopaque, size: u32, flags: u64) c_long, 119); | 135 | pub const read_branch_records = @ptrFromInt(*const fn (ctx: *kern.PerfEventData, buf: ?*anyopaque, size: u32, flags: u64) c_long, 119); |
| 136 | pub const get_ns_current_pid_tgid = @intToPtr(*const fn (dev: u64, ino: u64, nsdata: *kern.PidNsInfo, size: u32) c_long, 120); | 136 | pub const get_ns_current_pid_tgid = @ptrFromInt(*const fn (dev: u64, ino: u64, nsdata: *kern.PidNsInfo, size: u32) c_long, 120); |
| 137 | pub const xdp_output = @intToPtr(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 121); | 137 | pub const xdp_output = @ptrFromInt(*const fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, 121); |
| 138 | pub const get_netns_cookie = @intToPtr(*const fn (ctx: ?*anyopaque) u64, 122); | 138 | pub const get_netns_cookie = @ptrFromInt(*const fn (ctx: ?*anyopaque) u64, 122); |
| 139 | pub const get_current_ancestor_cgroup_id = @intToPtr(*const fn (ancestor_level: c_int) u64, 123); | 139 | pub const get_current_ancestor_cgroup_id = @ptrFromInt(*const fn (ancestor_level: c_int) u64, 123); |
| 140 | pub const sk_assign = @intToPtr(*const fn (skb: *kern.SkBuff, sk: *kern.Sock, flags: u64) c_long, 124); | 140 | pub const sk_assign = @ptrFromInt(*const fn (skb: *kern.SkBuff, sk: *kern.Sock, flags: u64) c_long, 124); |
| 141 | pub const ktime_get_boot_ns = @intToPtr(*const fn () u64, 125); | 141 | pub const ktime_get_boot_ns = @ptrFromInt(*const fn () u64, 125); |
| 142 | pub const seq_printf = @intToPtr(*const fn (m: *kern.SeqFile, fmt: ?*const u8, fmt_size: u32, data: ?*const anyopaque, data_len: u32) c_long, 126); | 142 | pub const seq_printf = @ptrFromInt(*const fn (m: *kern.SeqFile, fmt: ?*const u8, fmt_size: u32, data: ?*const anyopaque, data_len: u32) c_long, 126); |
| 143 | pub const seq_write = @intToPtr(*const fn (m: *kern.SeqFile, data: ?*const u8, len: u32) c_long, 127); | 143 | pub const seq_write = @ptrFromInt(*const fn (m: *kern.SeqFile, data: ?*const u8, len: u32) c_long, 127); |
| 144 | pub const sk_cgroup_id = @intToPtr(*const fn (sk: *kern.BpfSock) u64, 128); | 144 | pub const sk_cgroup_id = @ptrFromInt(*const fn (sk: *kern.BpfSock) u64, 128); |
| 145 | pub const sk_ancestor_cgroup_id = @intToPtr(*const fn (sk: *kern.BpfSock, ancestor_level: c_long) u64, 129); | 145 | pub const sk_ancestor_cgroup_id = @ptrFromInt(*const fn (sk: *kern.BpfSock, ancestor_level: c_long) u64, 129); |
| 146 | pub const ringbuf_output = @intToPtr(*const fn (ringbuf: ?*anyopaque, data: ?*anyopaque, size: u64, flags: u64) c_long, 130); | 146 | pub const ringbuf_output = @ptrFromInt(*const fn (ringbuf: ?*anyopaque, data: ?*anyopaque, size: u64, flags: u64) c_long, 130); |
| 147 | pub const ringbuf_reserve = @intToPtr(*const fn (ringbuf: ?*anyopaque, size: u64, flags: u64) ?*anyopaque, 131); | 147 | pub const ringbuf_reserve = @ptrFromInt(*const fn (ringbuf: ?*anyopaque, size: u64, flags: u64) ?*anyopaque, 131); |
| 148 | pub const ringbuf_submit = @intToPtr(*const fn (data: ?*anyopaque, flags: u64) void, 132); | 148 | pub const ringbuf_submit = @ptrFromInt(*const fn (data: ?*anyopaque, flags: u64) void, 132); |
| 149 | pub const ringbuf_discard = @intToPtr(*const fn (data: ?*anyopaque, flags: u64) void, 133); | 149 | pub const ringbuf_discard = @ptrFromInt(*const fn (data: ?*anyopaque, flags: u64) void, 133); |
| 150 | pub const ringbuf_query = @intToPtr(*const fn (ringbuf: ?*anyopaque, flags: u64) u64, 134); | 150 | pub const ringbuf_query = @ptrFromInt(*const fn (ringbuf: ?*anyopaque, flags: u64) u64, 134); |
| 151 | pub const csum_level = @intToPtr(*const fn (skb: *kern.SkBuff, level: u64) c_long, 135); | 151 | pub const csum_level = @ptrFromInt(*const fn (skb: *kern.SkBuff, level: u64) c_long, 135); |
| 152 | pub const skc_to_tcp6_sock = @intToPtr(*const fn (sk: ?*anyopaque) ?*kern.Tcp6Sock, 136); | 152 | pub const skc_to_tcp6_sock = @ptrFromInt(*const fn (sk: ?*anyopaque) ?*kern.Tcp6Sock, 136); |
| 153 | pub const skc_to_tcp_sock = @intToPtr(*const fn (sk: ?*anyopaque) ?*kern.TcpSock, 137); | 153 | pub const skc_to_tcp_sock = @ptrFromInt(*const fn (sk: ?*anyopaque) ?*kern.TcpSock, 137); |
| 154 | pub const skc_to_tcp_timewait_sock = @intToPtr(*const fn (sk: ?*anyopaque) ?*kern.TcpTimewaitSock, 138); | 154 | pub const skc_to_tcp_timewait_sock = @ptrFromInt(*const fn (sk: ?*anyopaque) ?*kern.TcpTimewaitSock, 138); |
| 155 | pub const skc_to_tcp_request_sock = @intToPtr(*const fn (sk: ?*anyopaque) ?*kern.TcpRequestSock, 139); | 155 | pub const skc_to_tcp_request_sock = @ptrFromInt(*const fn (sk: ?*anyopaque) ?*kern.TcpRequestSock, 139); |
| 156 | pub const skc_to_udp6_sock = @intToPtr(*const fn (sk: ?*anyopaque) ?*kern.Udp6Sock, 140); | 156 | pub const skc_to_udp6_sock = @ptrFromInt(*const fn (sk: ?*anyopaque) ?*kern.Udp6Sock, 140); |
| 157 | pub const get_task_stack = @intToPtr(*const fn (task: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, 141); | 157 | pub const get_task_stack = @ptrFromInt(*const fn (task: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, 141); |
lib/std/os/linux/io_uring.zig+40-40| ... | @@ -962,7 +962,7 @@ pub const IO_Uring = struct { | ... | @@ -962,7 +962,7 @@ pub const IO_Uring = struct { |
| 962 | var update = FilesUpdate{ | 962 | var update = FilesUpdate{ |
| 963 | .offset = offset, | 963 | .offset = offset, |
| 964 | .resv = @as(u32, 0), | 964 | .resv = @as(u32, 0), |
| 965 | .fds = @as(u64, @ptrToInt(fds.ptr)), | 965 | .fds = @as(u64, @intFromPtr(fds.ptr)), |
| 966 | }; | 966 | }; |
| 967 | 967 | ||
| 968 | const res = linux.io_uring_register( | 968 | const res = linux.io_uring_register( |
| ... | @@ -1244,11 +1244,11 @@ pub fn io_uring_prep_rw( | ... | @@ -1244,11 +1244,11 @@ pub fn io_uring_prep_rw( |
| 1244 | } | 1244 | } |
| 1245 | 1245 | ||
| 1246 | pub fn io_uring_prep_read(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []u8, offset: u64) void { | 1246 | pub fn io_uring_prep_read(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []u8, offset: u64) void { |
| 1247 | io_uring_prep_rw(.READ, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, offset); | 1247 | io_uring_prep_rw(.READ, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, offset); |
| 1248 | } | 1248 | } |
| 1249 | 1249 | ||
| 1250 | pub fn io_uring_prep_write(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []const u8, offset: u64) void { | 1250 | pub fn io_uring_prep_write(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []const u8, offset: u64) void { |
| 1251 | io_uring_prep_rw(.WRITE, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, offset); | 1251 | io_uring_prep_rw(.WRITE, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, offset); |
| 1252 | } | 1252 | } |
| 1253 | 1253 | ||
| 1254 | pub fn io_uring_prep_readv( | 1254 | pub fn io_uring_prep_readv( |
| ... | @@ -1257,7 +1257,7 @@ pub fn io_uring_prep_readv( | ... | @@ -1257,7 +1257,7 @@ pub fn io_uring_prep_readv( |
| 1257 | iovecs: []const os.iovec, | 1257 | iovecs: []const os.iovec, |
| 1258 | offset: u64, | 1258 | offset: u64, |
| 1259 | ) void { | 1259 | ) void { |
| 1260 | io_uring_prep_rw(.READV, sqe, fd, @ptrToInt(iovecs.ptr), iovecs.len, offset); | 1260 | io_uring_prep_rw(.READV, sqe, fd, @intFromPtr(iovecs.ptr), iovecs.len, offset); |
| 1261 | } | 1261 | } |
| 1262 | 1262 | ||
| 1263 | pub fn io_uring_prep_writev( | 1263 | pub fn io_uring_prep_writev( |
| ... | @@ -1266,16 +1266,16 @@ pub fn io_uring_prep_writev( | ... | @@ -1266,16 +1266,16 @@ pub fn io_uring_prep_writev( |
| 1266 | iovecs: []const os.iovec_const, | 1266 | iovecs: []const os.iovec_const, |
| 1267 | offset: u64, | 1267 | offset: u64, |
| 1268 | ) void { | 1268 | ) void { |
| 1269 | io_uring_prep_rw(.WRITEV, sqe, fd, @ptrToInt(iovecs.ptr), iovecs.len, offset); | 1269 | io_uring_prep_rw(.WRITEV, sqe, fd, @intFromPtr(iovecs.ptr), iovecs.len, offset); |
| 1270 | } | 1270 | } |
| 1271 | 1271 | ||
| 1272 | pub fn io_uring_prep_read_fixed(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { | 1272 | pub fn io_uring_prep_read_fixed(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { |
| 1273 | io_uring_prep_rw(.READ_FIXED, sqe, fd, @ptrToInt(buffer.iov_base), buffer.iov_len, offset); | 1273 | io_uring_prep_rw(.READ_FIXED, sqe, fd, @intFromPtr(buffer.iov_base), buffer.iov_len, offset); |
| 1274 | sqe.buf_index = buffer_index; | 1274 | sqe.buf_index = buffer_index; |
| 1275 | } | 1275 | } |
| 1276 | 1276 | ||
| 1277 | pub fn io_uring_prep_write_fixed(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { | 1277 | pub fn io_uring_prep_write_fixed(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void { |
| 1278 | io_uring_prep_rw(.WRITE_FIXED, sqe, fd, @ptrToInt(buffer.iov_base), buffer.iov_len, offset); | 1278 | io_uring_prep_rw(.WRITE_FIXED, sqe, fd, @intFromPtr(buffer.iov_base), buffer.iov_len, offset); |
| 1279 | sqe.buf_index = buffer_index; | 1279 | sqe.buf_index = buffer_index; |
| 1280 | } | 1280 | } |
| 1281 | 1281 | ||
| ... | @@ -1298,7 +1298,7 @@ pub fn io_uring_prep_accept( | ... | @@ -1298,7 +1298,7 @@ pub fn io_uring_prep_accept( |
| 1298 | ) void { | 1298 | ) void { |
| 1299 | // `addr` holds a pointer to `sockaddr`, and `addr2` holds a pointer to socklen_t`. | 1299 | // `addr` holds a pointer to `sockaddr`, and `addr2` holds a pointer to socklen_t`. |
| 1300 | // `addr2` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). | 1300 | // `addr2` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). |
| 1301 | io_uring_prep_rw(.ACCEPT, sqe, fd, @ptrToInt(addr), 0, @ptrToInt(addrlen)); | 1301 | io_uring_prep_rw(.ACCEPT, sqe, fd, @intFromPtr(addr), 0, @intFromPtr(addrlen)); |
| 1302 | sqe.rw_flags = flags; | 1302 | sqe.rw_flags = flags; |
| 1303 | } | 1303 | } |
| 1304 | 1304 | ||
| ... | @@ -1309,7 +1309,7 @@ pub fn io_uring_prep_connect( | ... | @@ -1309,7 +1309,7 @@ pub fn io_uring_prep_connect( |
| 1309 | addrlen: os.socklen_t, | 1309 | addrlen: os.socklen_t, |
| 1310 | ) void { | 1310 | ) void { |
| 1311 | // `addrlen` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). | 1311 | // `addrlen` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32). |
| 1312 | io_uring_prep_rw(.CONNECT, sqe, fd, @ptrToInt(addr), 0, addrlen); | 1312 | io_uring_prep_rw(.CONNECT, sqe, fd, @intFromPtr(addr), 0, addrlen); |
| 1313 | } | 1313 | } |
| 1314 | 1314 | ||
| 1315 | pub fn io_uring_prep_epoll_ctl( | 1315 | pub fn io_uring_prep_epoll_ctl( |
| ... | @@ -1319,16 +1319,16 @@ pub fn io_uring_prep_epoll_ctl( | ... | @@ -1319,16 +1319,16 @@ pub fn io_uring_prep_epoll_ctl( |
| 1319 | op: u32, | 1319 | op: u32, |
| 1320 | ev: ?*linux.epoll_event, | 1320 | ev: ?*linux.epoll_event, |
| 1321 | ) void { | 1321 | ) void { |
| 1322 | io_uring_prep_rw(.EPOLL_CTL, sqe, epfd, @ptrToInt(ev), op, @intCast(u64, fd)); | 1322 | io_uring_prep_rw(.EPOLL_CTL, sqe, epfd, @intFromPtr(ev), op, @intCast(u64, fd)); |
| 1323 | } | 1323 | } |
| 1324 | 1324 | ||
| 1325 | pub fn io_uring_prep_recv(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []u8, flags: u32) void { | 1325 | pub fn io_uring_prep_recv(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []u8, flags: u32) void { |
| 1326 | io_uring_prep_rw(.RECV, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, 0); | 1326 | io_uring_prep_rw(.RECV, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, 0); |
| 1327 | sqe.rw_flags = flags; | 1327 | sqe.rw_flags = flags; |
| 1328 | } | 1328 | } |
| 1329 | 1329 | ||
| 1330 | pub fn io_uring_prep_send(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []const u8, flags: u32) void { | 1330 | pub fn io_uring_prep_send(sqe: *linux.io_uring_sqe, fd: os.fd_t, buffer: []const u8, flags: u32) void { |
| 1331 | io_uring_prep_rw(.SEND, sqe, fd, @ptrToInt(buffer.ptr), buffer.len, 0); | 1331 | io_uring_prep_rw(.SEND, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, 0); |
| 1332 | sqe.rw_flags = flags; | 1332 | sqe.rw_flags = flags; |
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
| ... | @@ -1338,7 +1338,7 @@ pub fn io_uring_prep_recvmsg( | ... | @@ -1338,7 +1338,7 @@ pub fn io_uring_prep_recvmsg( |
| 1338 | msg: *os.msghdr, | 1338 | msg: *os.msghdr, |
| 1339 | flags: u32, | 1339 | flags: u32, |
| 1340 | ) void { | 1340 | ) void { |
| 1341 | linux.io_uring_prep_rw(.RECVMSG, sqe, fd, @ptrToInt(msg), 1, 0); | 1341 | linux.io_uring_prep_rw(.RECVMSG, sqe, fd, @intFromPtr(msg), 1, 0); |
| 1342 | sqe.rw_flags = flags; | 1342 | sqe.rw_flags = flags; |
| 1343 | } | 1343 | } |
| 1344 | 1344 | ||
| ... | @@ -1348,7 +1348,7 @@ pub fn io_uring_prep_sendmsg( | ... | @@ -1348,7 +1348,7 @@ pub fn io_uring_prep_sendmsg( |
| 1348 | msg: *const os.msghdr_const, | 1348 | msg: *const os.msghdr_const, |
| 1349 | flags: u32, | 1349 | flags: u32, |
| 1350 | ) void { | 1350 | ) void { |
| 1351 | linux.io_uring_prep_rw(.SENDMSG, sqe, fd, @ptrToInt(msg), 1, 0); | 1351 | linux.io_uring_prep_rw(.SENDMSG, sqe, fd, @intFromPtr(msg), 1, 0); |
| 1352 | sqe.rw_flags = flags; | 1352 | sqe.rw_flags = flags; |
| 1353 | } | 1353 | } |
| 1354 | 1354 | ||
| ... | @@ -1359,7 +1359,7 @@ pub fn io_uring_prep_openat( | ... | @@ -1359,7 +1359,7 @@ pub fn io_uring_prep_openat( |
| 1359 | flags: u32, | 1359 | flags: u32, |
| 1360 | mode: os.mode_t, | 1360 | mode: os.mode_t, |
| 1361 | ) void { | 1361 | ) void { |
| 1362 | io_uring_prep_rw(.OPENAT, sqe, fd, @ptrToInt(path), mode, 0); | 1362 | io_uring_prep_rw(.OPENAT, sqe, fd, @intFromPtr(path), mode, 0); |
| 1363 | sqe.rw_flags = flags; | 1363 | sqe.rw_flags = flags; |
| 1364 | } | 1364 | } |
| 1365 | 1365 | ||
| ... | @@ -1387,7 +1387,7 @@ pub fn io_uring_prep_timeout( | ... | @@ -1387,7 +1387,7 @@ pub fn io_uring_prep_timeout( |
| 1387 | count: u32, | 1387 | count: u32, |
| 1388 | flags: u32, | 1388 | flags: u32, |
| 1389 | ) void { | 1389 | ) void { |
| 1390 | io_uring_prep_rw(.TIMEOUT, sqe, -1, @ptrToInt(ts), 1, count); | 1390 | io_uring_prep_rw(.TIMEOUT, sqe, -1, @intFromPtr(ts), 1, count); |
| 1391 | sqe.rw_flags = flags; | 1391 | sqe.rw_flags = flags; |
| 1392 | } | 1392 | } |
| 1393 | 1393 | ||
| ... | @@ -1414,7 +1414,7 @@ pub fn io_uring_prep_link_timeout( | ... | @@ -1414,7 +1414,7 @@ pub fn io_uring_prep_link_timeout( |
| 1414 | ts: *const os.linux.kernel_timespec, | 1414 | ts: *const os.linux.kernel_timespec, |
| 1415 | flags: u32, | 1415 | flags: u32, |
| 1416 | ) void { | 1416 | ) void { |
| 1417 | linux.io_uring_prep_rw(.LINK_TIMEOUT, sqe, -1, @ptrToInt(ts), 1, 0); | 1417 | linux.io_uring_prep_rw(.LINK_TIMEOUT, sqe, -1, @intFromPtr(ts), 1, 0); |
| 1418 | sqe.rw_flags = flags; | 1418 | sqe.rw_flags = flags; |
| 1419 | } | 1419 | } |
| 1420 | 1420 | ||
| ... | @@ -1423,7 +1423,7 @@ pub fn io_uring_prep_poll_add( | ... | @@ -1423,7 +1423,7 @@ pub fn io_uring_prep_poll_add( |
| 1423 | fd: os.fd_t, | 1423 | fd: os.fd_t, |
| 1424 | poll_mask: u32, | 1424 | poll_mask: u32, |
| 1425 | ) void { | 1425 | ) void { |
| 1426 | io_uring_prep_rw(.POLL_ADD, sqe, fd, @ptrToInt(@as(?*anyopaque, null)), 0, 0); | 1426 | io_uring_prep_rw(.POLL_ADD, sqe, fd, @intFromPtr(@as(?*anyopaque, null)), 0, 0); |
| 1427 | sqe.rw_flags = __io_uring_prep_poll_mask(poll_mask); | 1427 | sqe.rw_flags = __io_uring_prep_poll_mask(poll_mask); |
| 1428 | } | 1428 | } |
| 1429 | 1429 | ||
| ... | @@ -1477,7 +1477,7 @@ pub fn io_uring_prep_statx( | ... | @@ -1477,7 +1477,7 @@ pub fn io_uring_prep_statx( |
| 1477 | mask: u32, | 1477 | mask: u32, |
| 1478 | buf: *linux.Statx, | 1478 | buf: *linux.Statx, |
| 1479 | ) void { | 1479 | ) void { |
| 1480 | io_uring_prep_rw(.STATX, sqe, fd, @ptrToInt(path), mask, @ptrToInt(buf)); | 1480 | io_uring_prep_rw(.STATX, sqe, fd, @intFromPtr(path), mask, @intFromPtr(buf)); |
| 1481 | sqe.rw_flags = flags; | 1481 | sqe.rw_flags = flags; |
| 1482 | } | 1482 | } |
| 1483 | 1483 | ||
| ... | @@ -1510,9 +1510,9 @@ pub fn io_uring_prep_renameat( | ... | @@ -1510,9 +1510,9 @@ pub fn io_uring_prep_renameat( |
| 1510 | .RENAMEAT, | 1510 | .RENAMEAT, |
| 1511 | sqe, | 1511 | sqe, |
| 1512 | old_dir_fd, | 1512 | old_dir_fd, |
| 1513 | @ptrToInt(old_path), | 1513 | @intFromPtr(old_path), |
| 1514 | 0, | 1514 | 0, |
| 1515 | @ptrToInt(new_path), | 1515 | @intFromPtr(new_path), |
| 1516 | ); | 1516 | ); |
| 1517 | sqe.len = @bitCast(u32, new_dir_fd); | 1517 | sqe.len = @bitCast(u32, new_dir_fd); |
| 1518 | sqe.rw_flags = flags; | 1518 | sqe.rw_flags = flags; |
| ... | @@ -1524,7 +1524,7 @@ pub fn io_uring_prep_unlinkat( | ... | @@ -1524,7 +1524,7 @@ pub fn io_uring_prep_unlinkat( |
| 1524 | path: [*:0]const u8, | 1524 | path: [*:0]const u8, |
| 1525 | flags: u32, | 1525 | flags: u32, |
| 1526 | ) void { | 1526 | ) void { |
| 1527 | io_uring_prep_rw(.UNLINKAT, sqe, dir_fd, @ptrToInt(path), 0, 0); | 1527 | io_uring_prep_rw(.UNLINKAT, sqe, dir_fd, @intFromPtr(path), 0, 0); |
| 1528 | sqe.rw_flags = flags; | 1528 | sqe.rw_flags = flags; |
| 1529 | } | 1529 | } |
| 1530 | 1530 | ||
| ... | @@ -1534,7 +1534,7 @@ pub fn io_uring_prep_mkdirat( | ... | @@ -1534,7 +1534,7 @@ pub fn io_uring_prep_mkdirat( |
| 1534 | path: [*:0]const u8, | 1534 | path: [*:0]const u8, |
| 1535 | mode: os.mode_t, | 1535 | mode: os.mode_t, |
| 1536 | ) void { | 1536 | ) void { |
| 1537 | io_uring_prep_rw(.MKDIRAT, sqe, dir_fd, @ptrToInt(path), mode, 0); | 1537 | io_uring_prep_rw(.MKDIRAT, sqe, dir_fd, @intFromPtr(path), mode, 0); |
| 1538 | } | 1538 | } |
| 1539 | 1539 | ||
| 1540 | pub fn io_uring_prep_symlinkat( | 1540 | pub fn io_uring_prep_symlinkat( |
| ... | @@ -1547,9 +1547,9 @@ pub fn io_uring_prep_symlinkat( | ... | @@ -1547,9 +1547,9 @@ pub fn io_uring_prep_symlinkat( |
| 1547 | .SYMLINKAT, | 1547 | .SYMLINKAT, |
| 1548 | sqe, | 1548 | sqe, |
| 1549 | new_dir_fd, | 1549 | new_dir_fd, |
| 1550 | @ptrToInt(target), | 1550 | @intFromPtr(target), |
| 1551 | 0, | 1551 | 0, |
| 1552 | @ptrToInt(link_path), | 1552 | @intFromPtr(link_path), |
| 1553 | ); | 1553 | ); |
| 1554 | } | 1554 | } |
| 1555 | 1555 | ||
| ... | @@ -1565,9 +1565,9 @@ pub fn io_uring_prep_linkat( | ... | @@ -1565,9 +1565,9 @@ pub fn io_uring_prep_linkat( |
| 1565 | .LINKAT, | 1565 | .LINKAT, |
| 1566 | sqe, | 1566 | sqe, |
| 1567 | old_dir_fd, | 1567 | old_dir_fd, |
| 1568 | @ptrToInt(old_path), | 1568 | @intFromPtr(old_path), |
| 1569 | 0, | 1569 | 0, |
| 1570 | @ptrToInt(new_path), | 1570 | @intFromPtr(new_path), |
| 1571 | ); | 1571 | ); |
| 1572 | sqe.len = @bitCast(u32, new_dir_fd); | 1572 | sqe.len = @bitCast(u32, new_dir_fd); |
| 1573 | sqe.rw_flags = flags; | 1573 | sqe.rw_flags = flags; |
| ... | @@ -1581,7 +1581,7 @@ pub fn io_uring_prep_provide_buffers( | ... | @@ -1581,7 +1581,7 @@ pub fn io_uring_prep_provide_buffers( |
| 1581 | group_id: usize, | 1581 | group_id: usize, |
| 1582 | buffer_id: usize, | 1582 | buffer_id: usize, |
| 1583 | ) void { | 1583 | ) void { |
| 1584 | const ptr = @ptrToInt(buffers); | 1584 | const ptr = @intFromPtr(buffers); |
| 1585 | io_uring_prep_rw(.PROVIDE_BUFFERS, sqe, @intCast(i32, num), ptr, buffer_len, buffer_id); | 1585 | io_uring_prep_rw(.PROVIDE_BUFFERS, sqe, @intCast(i32, num), ptr, buffer_len, buffer_id); |
| 1586 | sqe.buf_index = @intCast(u16, group_id); | 1586 | sqe.buf_index = @intCast(u16, group_id); |
| 1587 | } | 1587 | } |
| ... | @@ -1918,8 +1918,8 @@ test "openat" { | ... | @@ -1918,8 +1918,8 @@ test "openat" { |
| 1918 | // Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014 | 1918 | // Workaround for LLVM bug: https://github.com/ziglang/zig/issues/12014 |
| 1919 | const path_addr = if (builtin.zig_backend == .stage2_llvm) p: { | 1919 | const path_addr = if (builtin.zig_backend == .stage2_llvm) p: { |
| 1920 | var workaround = path; | 1920 | var workaround = path; |
| 1921 | break :p @ptrToInt(workaround); | 1921 | break :p @intFromPtr(workaround); |
| 1922 | } else @ptrToInt(path); | 1922 | } else @intFromPtr(path); |
| 1923 | 1923 | ||
| 1924 | const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT; | 1924 | const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT; |
| 1925 | const mode: os.mode_t = 0o666; | 1925 | const mode: os.mode_t = 0o666; |
| ... | @@ -2098,7 +2098,7 @@ test "sendmsg/recvmsg" { | ... | @@ -2098,7 +2098,7 @@ test "sendmsg/recvmsg" { |
| 2098 | try testing.expectEqual(@as(u32, 2), ring.cq_ready()); | 2098 | try testing.expectEqual(@as(u32, 2), ring.cq_ready()); |
| 2099 | 2099 | ||
| 2100 | const cqe_sendmsg = try ring.copy_cqe(); | 2100 | const cqe_sendmsg = try ring.copy_cqe(); |
| 2101 | if (cqe_sendmsg.res == -@as(i32, @enumToInt(linux.E.INVAL))) return error.SkipZigTest; | 2101 | if (cqe_sendmsg.res == -@as(i32, @intFromEnum(linux.E.INVAL))) return error.SkipZigTest; |
| 2102 | try testing.expectEqual(linux.io_uring_cqe{ | 2102 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2103 | .user_data = 0x11111111, | 2103 | .user_data = 0x11111111, |
| 2104 | .res = buffer_send.len, | 2104 | .res = buffer_send.len, |
| ... | @@ -2106,7 +2106,7 @@ test "sendmsg/recvmsg" { | ... | @@ -2106,7 +2106,7 @@ test "sendmsg/recvmsg" { |
| 2106 | }, cqe_sendmsg); | 2106 | }, cqe_sendmsg); |
| 2107 | 2107 | ||
| 2108 | const cqe_recvmsg = try ring.copy_cqe(); | 2108 | const cqe_recvmsg = try ring.copy_cqe(); |
| 2109 | if (cqe_recvmsg.res == -@as(i32, @enumToInt(linux.E.INVAL))) return error.SkipZigTest; | 2109 | if (cqe_recvmsg.res == -@as(i32, @intFromEnum(linux.E.INVAL))) return error.SkipZigTest; |
| 2110 | try testing.expectEqual(linux.io_uring_cqe{ | 2110 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2111 | .user_data = 0x22222222, | 2111 | .user_data = 0x22222222, |
| 2112 | .res = buffer_recv.len, | 2112 | .res = buffer_recv.len, |
| ... | @@ -2140,12 +2140,12 @@ test "timeout (after a relative time)" { | ... | @@ -2140,12 +2140,12 @@ test "timeout (after a relative time)" { |
| 2140 | 2140 | ||
| 2141 | try testing.expectEqual(linux.io_uring_cqe{ | 2141 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2142 | .user_data = 0x55555555, | 2142 | .user_data = 0x55555555, |
| 2143 | .res = -@as(i32, @enumToInt(linux.E.TIME)), | 2143 | .res = -@as(i32, @intFromEnum(linux.E.TIME)), |
| 2144 | .flags = 0, | 2144 | .flags = 0, |
| 2145 | }, cqe); | 2145 | }, cqe); |
| 2146 | 2146 | ||
| 2147 | // Tests should not depend on timings: skip test if outside margin. | 2147 | // Tests should not depend on timings: skip test if outside margin. |
| 2148 | if (!std.math.approxEqAbs(f64, ms, @intToFloat(f64, stopped - started), margin)) return error.SkipZigTest; | 2148 | if (!std.math.approxEqAbs(f64, ms, @floatFromInt(f64, stopped - started), margin)) return error.SkipZigTest; |
| 2149 | } | 2149 | } |
| 2150 | 2150 | ||
| 2151 | test "timeout (after a number of completions)" { | 2151 | test "timeout (after a number of completions)" { |
| ... | @@ -2227,7 +2227,7 @@ test "timeout_remove" { | ... | @@ -2227,7 +2227,7 @@ test "timeout_remove" { |
| 2227 | if (cqe.user_data == 0x88888888) { | 2227 | if (cqe.user_data == 0x88888888) { |
| 2228 | try testing.expectEqual(linux.io_uring_cqe{ | 2228 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2229 | .user_data = 0x88888888, | 2229 | .user_data = 0x88888888, |
| 2230 | .res = -@as(i32, @enumToInt(linux.E.CANCELED)), | 2230 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), |
| 2231 | .flags = 0, | 2231 | .flags = 0, |
| 2232 | }, cqe); | 2232 | }, cqe); |
| 2233 | } else if (cqe.user_data == 0x99999999) { | 2233 | } else if (cqe.user_data == 0x99999999) { |
| ... | @@ -2274,16 +2274,16 @@ test "accept/connect/recv/link_timeout" { | ... | @@ -2274,16 +2274,16 @@ test "accept/connect/recv/link_timeout" { |
| 2274 | const cqe = try ring.copy_cqe(); | 2274 | const cqe = try ring.copy_cqe(); |
| 2275 | switch (cqe.user_data) { | 2275 | switch (cqe.user_data) { |
| 2276 | 0xffffffff => { | 2276 | 0xffffffff => { |
| 2277 | if (cqe.res != -@as(i32, @enumToInt(linux.E.INTR)) and | 2277 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.INTR)) and |
| 2278 | cqe.res != -@as(i32, @enumToInt(linux.E.CANCELED))) | 2278 | cqe.res != -@as(i32, @intFromEnum(linux.E.CANCELED))) |
| 2279 | { | 2279 | { |
| 2280 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); | 2280 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 2281 | try testing.expect(false); | 2281 | try testing.expect(false); |
| 2282 | } | 2282 | } |
| 2283 | }, | 2283 | }, |
| 2284 | 0x22222222 => { | 2284 | 0x22222222 => { |
| 2285 | if (cqe.res != -@as(i32, @enumToInt(linux.E.ALREADY)) and | 2285 | if (cqe.res != -@as(i32, @intFromEnum(linux.E.ALREADY)) and |
| 2286 | cqe.res != -@as(i32, @enumToInt(linux.E.TIME))) | 2286 | cqe.res != -@as(i32, @intFromEnum(linux.E.TIME))) |
| 2287 | { | 2287 | { |
| 2288 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); | 2288 | std.debug.print("Req 0x{x} got {d}\n", .{ cqe.user_data, cqe.res }); |
| 2289 | try testing.expect(false); | 2289 | try testing.expect(false); |
| ... | @@ -2439,7 +2439,7 @@ test "accept/connect/recv/cancel" { | ... | @@ -2439,7 +2439,7 @@ test "accept/connect/recv/cancel" { |
| 2439 | 2439 | ||
| 2440 | try testing.expectEqual(linux.io_uring_cqe{ | 2440 | try testing.expectEqual(linux.io_uring_cqe{ |
| 2441 | .user_data = 0xffffffff, | 2441 | .user_data = 0xffffffff, |
| 2442 | .res = -@as(i32, @enumToInt(linux.E.CANCELED)), | 2442 | .res = -@as(i32, @intFromEnum(linux.E.CANCELED)), |
| 2443 | .flags = 0, | 2443 | .flags = 0, |
| 2444 | }, cqe_recv); | 2444 | }, cqe_recv); |
| 2445 | 2445 |
lib/std/os/linux/mips.zig+11-11| ... | @@ -18,7 +18,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -18,7 +18,7 @@ pub fn syscall0(number: SYS) usize { |
| 18 | \\ subu $2, $0, $2 | 18 | \\ subu $2, $0, $2 |
| 19 | \\ 1: | 19 | \\ 1: |
| 20 | : [ret] "={$2}" (-> usize), | 20 | : [ret] "={$2}" (-> usize), |
| 21 | : [number] "{$2}" (@enumToInt(number)), | 21 | : [number] "{$2}" (@intFromEnum(number)), |
| 22 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 22 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 23 | ); | 23 | ); |
| 24 | } | 24 | } |
| ... | @@ -37,7 +37,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { | ... | @@ -37,7 +37,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { |
| 37 | \\ sw $3, 4($4) | 37 | \\ sw $3, 4($4) |
| 38 | \\ 2: | 38 | \\ 2: |
| 39 | : [ret] "={$2}" (-> usize), | 39 | : [ret] "={$2}" (-> usize), |
| 40 | : [number] "{$2}" (@enumToInt(SYS.pipe)), | 40 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), |
| 41 | [fd] "{$4}" (fd), | 41 | [fd] "{$4}" (fd), |
| 42 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 42 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 43 | ); | 43 | ); |
| ... | @@ -50,7 +50,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -50,7 +50,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 50 | \\ subu $2, $0, $2 | 50 | \\ subu $2, $0, $2 |
| 51 | \\ 1: | 51 | \\ 1: |
| 52 | : [ret] "={$2}" (-> usize), | 52 | : [ret] "={$2}" (-> usize), |
| 53 | : [number] "{$2}" (@enumToInt(number)), | 53 | : [number] "{$2}" (@intFromEnum(number)), |
| 54 | [arg1] "{$4}" (arg1), | 54 | [arg1] "{$4}" (arg1), |
| 55 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 55 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 56 | ); | 56 | ); |
| ... | @@ -63,7 +63,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -63,7 +63,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 63 | \\ subu $2, $0, $2 | 63 | \\ subu $2, $0, $2 |
| 64 | \\ 1: | 64 | \\ 1: |
| 65 | : [ret] "={$2}" (-> usize), | 65 | : [ret] "={$2}" (-> usize), |
| 66 | : [number] "{$2}" (@enumToInt(number)), | 66 | : [number] "{$2}" (@intFromEnum(number)), |
| 67 | [arg1] "{$4}" (arg1), | 67 | [arg1] "{$4}" (arg1), |
| 68 | [arg2] "{$5}" (arg2), | 68 | [arg2] "{$5}" (arg2), |
| 69 | : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 69 | : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| ... | @@ -77,7 +77,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -77,7 +77,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 77 | \\ subu $2, $0, $2 | 77 | \\ subu $2, $0, $2 |
| 78 | \\ 1: | 78 | \\ 1: |
| 79 | : [ret] "={$2}" (-> usize), | 79 | : [ret] "={$2}" (-> usize), |
| 80 | : [number] "{$2}" (@enumToInt(number)), | 80 | : [number] "{$2}" (@intFromEnum(number)), |
| 81 | [arg1] "{$4}" (arg1), | 81 | [arg1] "{$4}" (arg1), |
| 82 | [arg2] "{$5}" (arg2), | 82 | [arg2] "{$5}" (arg2), |
| 83 | [arg3] "{$6}" (arg3), | 83 | [arg3] "{$6}" (arg3), |
| ... | @@ -92,7 +92,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -92,7 +92,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 92 | \\ subu $2, $0, $2 | 92 | \\ subu $2, $0, $2 |
| 93 | \\ 1: | 93 | \\ 1: |
| 94 | : [ret] "={$2}" (-> usize), | 94 | : [ret] "={$2}" (-> usize), |
| 95 | : [number] "{$2}" (@enumToInt(number)), | 95 | : [number] "{$2}" (@intFromEnum(number)), |
| 96 | [arg1] "{$4}" (arg1), | 96 | [arg1] "{$4}" (arg1), |
| 97 | [arg2] "{$5}" (arg2), | 97 | [arg2] "{$5}" (arg2), |
| 98 | [arg3] "{$6}" (arg3), | 98 | [arg3] "{$6}" (arg3), |
| ... | @@ -112,7 +112,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, | ... | @@ -112,7 +112,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, |
| 112 | \\ subu $2, $0, $2 | 112 | \\ subu $2, $0, $2 |
| 113 | \\ 1: | 113 | \\ 1: |
| 114 | : [ret] "={$2}" (-> usize), | 114 | : [ret] "={$2}" (-> usize), |
| 115 | : [number] "{$2}" (@enumToInt(number)), | 115 | : [number] "{$2}" (@intFromEnum(number)), |
| 116 | [arg1] "{$4}" (arg1), | 116 | [arg1] "{$4}" (arg1), |
| 117 | [arg2] "{$5}" (arg2), | 117 | [arg2] "{$5}" (arg2), |
| 118 | [arg3] "{$6}" (arg3), | 118 | [arg3] "{$6}" (arg3), |
| ... | @@ -145,7 +145,7 @@ pub fn syscall6( | ... | @@ -145,7 +145,7 @@ pub fn syscall6( |
| 145 | \\ subu $2, $0, $2 | 145 | \\ subu $2, $0, $2 |
| 146 | \\ 1: | 146 | \\ 1: |
| 147 | : [ret] "={$2}" (-> usize), | 147 | : [ret] "={$2}" (-> usize), |
| 148 | : [number] "{$2}" (@enumToInt(number)), | 148 | : [number] "{$2}" (@intFromEnum(number)), |
| 149 | [arg1] "{$4}" (arg1), | 149 | [arg1] "{$4}" (arg1), |
| 150 | [arg2] "{$5}" (arg2), | 150 | [arg2] "{$5}" (arg2), |
| 151 | [arg3] "{$6}" (arg3), | 151 | [arg3] "{$6}" (arg3), |
| ... | @@ -178,7 +178,7 @@ pub fn syscall7( | ... | @@ -178,7 +178,7 @@ pub fn syscall7( |
| 178 | \\ subu $2, $0, $2 | 178 | \\ subu $2, $0, $2 |
| 179 | \\ 1: | 179 | \\ 1: |
| 180 | : [ret] "={$2}" (-> usize), | 180 | : [ret] "={$2}" (-> usize), |
| 181 | : [number] "{$2}" (@enumToInt(number)), | 181 | : [number] "{$2}" (@intFromEnum(number)), |
| 182 | [arg1] "{$4}" (arg1), | 182 | [arg1] "{$4}" (arg1), |
| 183 | [arg2] "{$5}" (arg2), | 183 | [arg2] "{$5}" (arg2), |
| 184 | [arg3] "{$6}" (arg3), | 184 | [arg3] "{$6}" (arg3), |
| ... | @@ -198,7 +198,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * | ... | @@ -198,7 +198,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * |
| 198 | pub fn restore() callconv(.Naked) void { | 198 | pub fn restore() callconv(.Naked) void { |
| 199 | return asm volatile ("syscall" | 199 | return asm volatile ("syscall" |
| 200 | : | 200 | : |
| 201 | : [number] "{$2}" (@enumToInt(SYS.sigreturn)), | 201 | : [number] "{$2}" (@intFromEnum(SYS.sigreturn)), |
| 202 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 202 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 203 | ); | 203 | ); |
| 204 | } | 204 | } |
| ... | @@ -206,7 +206,7 @@ pub fn restore() callconv(.Naked) void { | ... | @@ -206,7 +206,7 @@ pub fn restore() callconv(.Naked) void { |
| 206 | pub fn restore_rt() callconv(.Naked) void { | 206 | pub fn restore_rt() callconv(.Naked) void { |
| 207 | return asm volatile ("syscall" | 207 | return asm volatile ("syscall" |
| 208 | : | 208 | : |
| 209 | : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)), | 209 | : [number] "{$2}" (@intFromEnum(SYS.rt_sigreturn)), |
| 210 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 210 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 211 | ); | 211 | ); |
| 212 | } | 212 | } |
lib/std/os/linux/mips64.zig+11-11| ... | @@ -18,7 +18,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -18,7 +18,7 @@ pub fn syscall0(number: SYS) usize { |
| 18 | \\ dsubu $2, $0, $2 | 18 | \\ dsubu $2, $0, $2 |
| 19 | \\ 1: | 19 | \\ 1: |
| 20 | : [ret] "={$2}" (-> usize), | 20 | : [ret] "={$2}" (-> usize), |
| 21 | : [number] "{$2}" (@enumToInt(number)), | 21 | : [number] "{$2}" (@intFromEnum(number)), |
| 22 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 22 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 23 | ); | 23 | ); |
| 24 | } | 24 | } |
| ... | @@ -37,7 +37,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { | ... | @@ -37,7 +37,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { |
| 37 | \\ sw $3, 4($4) | 37 | \\ sw $3, 4($4) |
| 38 | \\ 2: | 38 | \\ 2: |
| 39 | : [ret] "={$2}" (-> usize), | 39 | : [ret] "={$2}" (-> usize), |
| 40 | : [number] "{$2}" (@enumToInt(SYS.pipe)), | 40 | : [number] "{$2}" (@intFromEnum(SYS.pipe)), |
| 41 | [fd] "{$4}" (fd), | 41 | [fd] "{$4}" (fd), |
| 42 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 42 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 43 | ); | 43 | ); |
| ... | @@ -50,7 +50,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -50,7 +50,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 50 | \\ dsubu $2, $0, $2 | 50 | \\ dsubu $2, $0, $2 |
| 51 | \\ 1: | 51 | \\ 1: |
| 52 | : [ret] "={$2}" (-> usize), | 52 | : [ret] "={$2}" (-> usize), |
| 53 | : [number] "{$2}" (@enumToInt(number)), | 53 | : [number] "{$2}" (@intFromEnum(number)), |
| 54 | [arg1] "{$4}" (arg1), | 54 | [arg1] "{$4}" (arg1), |
| 55 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 55 | : "$1", "$3", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 56 | ); | 56 | ); |
| ... | @@ -63,7 +63,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -63,7 +63,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 63 | \\ dsubu $2, $0, $2 | 63 | \\ dsubu $2, $0, $2 |
| 64 | \\ 1: | 64 | \\ 1: |
| 65 | : [ret] "={$2}" (-> usize), | 65 | : [ret] "={$2}" (-> usize), |
| 66 | : [number] "{$2}" (@enumToInt(number)), | 66 | : [number] "{$2}" (@intFromEnum(number)), |
| 67 | [arg1] "{$4}" (arg1), | 67 | [arg1] "{$4}" (arg1), |
| 68 | [arg2] "{$5}" (arg2), | 68 | [arg2] "{$5}" (arg2), |
| 69 | : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 69 | : "$1", "$3", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| ... | @@ -77,7 +77,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -77,7 +77,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 77 | \\ dsubu $2, $0, $2 | 77 | \\ dsubu $2, $0, $2 |
| 78 | \\ 1: | 78 | \\ 1: |
| 79 | : [ret] "={$2}" (-> usize), | 79 | : [ret] "={$2}" (-> usize), |
| 80 | : [number] "{$2}" (@enumToInt(number)), | 80 | : [number] "{$2}" (@intFromEnum(number)), |
| 81 | [arg1] "{$4}" (arg1), | 81 | [arg1] "{$4}" (arg1), |
| 82 | [arg2] "{$5}" (arg2), | 82 | [arg2] "{$5}" (arg2), |
| 83 | [arg3] "{$6}" (arg3), | 83 | [arg3] "{$6}" (arg3), |
| ... | @@ -92,7 +92,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -92,7 +92,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 92 | \\ dsubu $2, $0, $2 | 92 | \\ dsubu $2, $0, $2 |
| 93 | \\ 1: | 93 | \\ 1: |
| 94 | : [ret] "={$2}" (-> usize), | 94 | : [ret] "={$2}" (-> usize), |
| 95 | : [number] "{$2}" (@enumToInt(number)), | 95 | : [number] "{$2}" (@intFromEnum(number)), |
| 96 | [arg1] "{$4}" (arg1), | 96 | [arg1] "{$4}" (arg1), |
| 97 | [arg2] "{$5}" (arg2), | 97 | [arg2] "{$5}" (arg2), |
| 98 | [arg3] "{$6}" (arg3), | 98 | [arg3] "{$6}" (arg3), |
| ... | @@ -108,7 +108,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, | ... | @@ -108,7 +108,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, |
| 108 | \\ dsubu $2, $0, $2 | 108 | \\ dsubu $2, $0, $2 |
| 109 | \\ 1: | 109 | \\ 1: |
| 110 | : [ret] "={$2}" (-> usize), | 110 | : [ret] "={$2}" (-> usize), |
| 111 | : [number] "{$2}" (@enumToInt(number)), | 111 | : [number] "{$2}" (@intFromEnum(number)), |
| 112 | [arg1] "{$4}" (arg1), | 112 | [arg1] "{$4}" (arg1), |
| 113 | [arg2] "{$5}" (arg2), | 113 | [arg2] "{$5}" (arg2), |
| 114 | [arg3] "{$6}" (arg3), | 114 | [arg3] "{$6}" (arg3), |
| ... | @@ -136,7 +136,7 @@ pub fn syscall6( | ... | @@ -136,7 +136,7 @@ pub fn syscall6( |
| 136 | \\ dsubu $2, $0, $2 | 136 | \\ dsubu $2, $0, $2 |
| 137 | \\ 1: | 137 | \\ 1: |
| 138 | : [ret] "={$2}" (-> usize), | 138 | : [ret] "={$2}" (-> usize), |
| 139 | : [number] "{$2}" (@enumToInt(number)), | 139 | : [number] "{$2}" (@intFromEnum(number)), |
| 140 | [arg1] "{$4}" (arg1), | 140 | [arg1] "{$4}" (arg1), |
| 141 | [arg2] "{$5}" (arg2), | 141 | [arg2] "{$5}" (arg2), |
| 142 | [arg3] "{$6}" (arg3), | 142 | [arg3] "{$6}" (arg3), |
| ... | @@ -163,7 +163,7 @@ pub fn syscall7( | ... | @@ -163,7 +163,7 @@ pub fn syscall7( |
| 163 | \\ dsubu $2, $0, $2 | 163 | \\ dsubu $2, $0, $2 |
| 164 | \\ 1: | 164 | \\ 1: |
| 165 | : [ret] "={$2}" (-> usize), | 165 | : [ret] "={$2}" (-> usize), |
| 166 | : [number] "{$2}" (@enumToInt(number)), | 166 | : [number] "{$2}" (@intFromEnum(number)), |
| 167 | [arg1] "{$4}" (arg1), | 167 | [arg1] "{$4}" (arg1), |
| 168 | [arg2] "{$5}" (arg2), | 168 | [arg2] "{$5}" (arg2), |
| 169 | [arg3] "{$6}" (arg3), | 169 | [arg3] "{$6}" (arg3), |
| ... | @@ -183,7 +183,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * | ... | @@ -183,7 +183,7 @@ pub extern fn clone(func: CloneFn, stack: usize, flags: u32, arg: usize, ptid: * |
| 183 | pub fn restore() callconv(.Naked) void { | 183 | pub fn restore() callconv(.Naked) void { |
| 184 | return asm volatile ("syscall" | 184 | return asm volatile ("syscall" |
| 185 | : | 185 | : |
| 186 | : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)), | 186 | : [number] "{$2}" (@intFromEnum(SYS.rt_sigreturn)), |
| 187 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 187 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 188 | ); | 188 | ); |
| 189 | } | 189 | } |
| ... | @@ -191,7 +191,7 @@ pub fn restore() callconv(.Naked) void { | ... | @@ -191,7 +191,7 @@ pub fn restore() callconv(.Naked) void { |
| 191 | pub fn restore_rt() callconv(.Naked) void { | 191 | pub fn restore_rt() callconv(.Naked) void { |
| 192 | return asm volatile ("syscall" | 192 | return asm volatile ("syscall" |
| 193 | : | 193 | : |
| 194 | : [number] "{$2}" (@enumToInt(SYS.rt_sigreturn)), | 194 | : [number] "{$2}" (@intFromEnum(SYS.rt_sigreturn)), |
| 195 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" | 195 | : "$1", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", "$24", "$25", "hi", "lo", "memory" |
| 196 | ); | 196 | ); |
| 197 | } | 197 | } |
lib/std/os/linux/powerpc.zig+8-8| ... | @@ -20,7 +20,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -20,7 +20,7 @@ pub fn syscall0(number: SYS) usize { |
| 20 | \\ neg 3, 3 | 20 | \\ neg 3, 3 |
| 21 | \\ 1: | 21 | \\ 1: |
| 22 | : [ret] "={r3}" (-> usize), | 22 | : [ret] "={r3}" (-> usize), |
| 23 | : [number] "{r0}" (@enumToInt(number)), | 23 | : [number] "{r0}" (@intFromEnum(number)), |
| 24 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 24 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 25 | ); | 25 | ); |
| 26 | } | 26 | } |
| ... | @@ -32,7 +32,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -32,7 +32,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 32 | \\ neg 3, 3 | 32 | \\ neg 3, 3 |
| 33 | \\ 1: | 33 | \\ 1: |
| 34 | : [ret] "={r3}" (-> usize), | 34 | : [ret] "={r3}" (-> usize), |
| 35 | : [number] "{r0}" (@enumToInt(number)), | 35 | : [number] "{r0}" (@intFromEnum(number)), |
| 36 | [arg1] "{r3}" (arg1), | 36 | [arg1] "{r3}" (arg1), |
| 37 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 37 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 38 | ); | 38 | ); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 45 | \\ neg 3, 3 | 45 | \\ neg 3, 3 |
| 46 | \\ 1: | 46 | \\ 1: |
| 47 | : [ret] "={r3}" (-> usize), | 47 | : [ret] "={r3}" (-> usize), |
| 48 | : [number] "{r0}" (@enumToInt(number)), | 48 | : [number] "{r0}" (@intFromEnum(number)), |
| 49 | [arg1] "{r3}" (arg1), | 49 | [arg1] "{r3}" (arg1), |
| 50 | [arg2] "{r4}" (arg2), | 50 | [arg2] "{r4}" (arg2), |
| 51 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 51 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| ... | @@ -59,7 +59,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -59,7 +59,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 59 | \\ neg 3, 3 | 59 | \\ neg 3, 3 |
| 60 | \\ 1: | 60 | \\ 1: |
| 61 | : [ret] "={r3}" (-> usize), | 61 | : [ret] "={r3}" (-> usize), |
| 62 | : [number] "{r0}" (@enumToInt(number)), | 62 | : [number] "{r0}" (@intFromEnum(number)), |
| 63 | [arg1] "{r3}" (arg1), | 63 | [arg1] "{r3}" (arg1), |
| 64 | [arg2] "{r4}" (arg2), | 64 | [arg2] "{r4}" (arg2), |
| 65 | [arg3] "{r5}" (arg3), | 65 | [arg3] "{r5}" (arg3), |
| ... | @@ -74,7 +74,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -74,7 +74,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 74 | \\ neg 3, 3 | 74 | \\ neg 3, 3 |
| 75 | \\ 1: | 75 | \\ 1: |
| 76 | : [ret] "={r3}" (-> usize), | 76 | : [ret] "={r3}" (-> usize), |
| 77 | : [number] "{r0}" (@enumToInt(number)), | 77 | : [number] "{r0}" (@intFromEnum(number)), |
| 78 | [arg1] "{r3}" (arg1), | 78 | [arg1] "{r3}" (arg1), |
| 79 | [arg2] "{r4}" (arg2), | 79 | [arg2] "{r4}" (arg2), |
| 80 | [arg3] "{r5}" (arg3), | 80 | [arg3] "{r5}" (arg3), |
| ... | @@ -90,7 +90,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, | ... | @@ -90,7 +90,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, |
| 90 | \\ neg 3, 3 | 90 | \\ neg 3, 3 |
| 91 | \\ 1: | 91 | \\ 1: |
| 92 | : [ret] "={r3}" (-> usize), | 92 | : [ret] "={r3}" (-> usize), |
| 93 | : [number] "{r0}" (@enumToInt(number)), | 93 | : [number] "{r0}" (@intFromEnum(number)), |
| 94 | [arg1] "{r3}" (arg1), | 94 | [arg1] "{r3}" (arg1), |
| 95 | [arg2] "{r4}" (arg2), | 95 | [arg2] "{r4}" (arg2), |
| 96 | [arg3] "{r5}" (arg3), | 96 | [arg3] "{r5}" (arg3), |
| ... | @@ -115,7 +115,7 @@ pub fn syscall6( | ... | @@ -115,7 +115,7 @@ pub fn syscall6( |
| 115 | \\ neg 3, 3 | 115 | \\ neg 3, 3 |
| 116 | \\ 1: | 116 | \\ 1: |
| 117 | : [ret] "={r3}" (-> usize), | 117 | : [ret] "={r3}" (-> usize), |
| 118 | : [number] "{r0}" (@enumToInt(number)), | 118 | : [number] "{r0}" (@intFromEnum(number)), |
| 119 | [arg1] "{r3}" (arg1), | 119 | [arg1] "{r3}" (arg1), |
| 120 | [arg2] "{r4}" (arg2), | 120 | [arg2] "{r4}" (arg2), |
| 121 | [arg3] "{r5}" (arg3), | 121 | [arg3] "{r5}" (arg3), |
| ... | @@ -136,7 +136,7 @@ pub const restore = restore_rt; | ... | @@ -136,7 +136,7 @@ pub const restore = restore_rt; |
| 136 | pub fn restore_rt() callconv(.Naked) void { | 136 | pub fn restore_rt() callconv(.Naked) void { |
| 137 | return asm volatile ("sc" | 137 | return asm volatile ("sc" |
| 138 | : | 138 | : |
| 139 | : [number] "{r0}" (@enumToInt(SYS.rt_sigreturn)), | 139 | : [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)), |
| 140 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 140 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 141 | ); | 141 | ); |
| 142 | } | 142 | } |
lib/std/os/linux/powerpc64.zig+8-8| ... | @@ -20,7 +20,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -20,7 +20,7 @@ pub fn syscall0(number: SYS) usize { |
| 20 | \\ neg 3, 3 | 20 | \\ neg 3, 3 |
| 21 | \\ 1: | 21 | \\ 1: |
| 22 | : [ret] "={r3}" (-> usize), | 22 | : [ret] "={r3}" (-> usize), |
| 23 | : [number] "{r0}" (@enumToInt(number)), | 23 | : [number] "{r0}" (@intFromEnum(number)), |
| 24 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 24 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 25 | ); | 25 | ); |
| 26 | } | 26 | } |
| ... | @@ -32,7 +32,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -32,7 +32,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 32 | \\ neg 3, 3 | 32 | \\ neg 3, 3 |
| 33 | \\ 1: | 33 | \\ 1: |
| 34 | : [ret] "={r3}" (-> usize), | 34 | : [ret] "={r3}" (-> usize), |
| 35 | : [number] "{r0}" (@enumToInt(number)), | 35 | : [number] "{r0}" (@intFromEnum(number)), |
| 36 | [arg1] "{r3}" (arg1), | 36 | [arg1] "{r3}" (arg1), |
| 37 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 37 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 38 | ); | 38 | ); |
| ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 45 | \\ neg 3, 3 | 45 | \\ neg 3, 3 |
| 46 | \\ 1: | 46 | \\ 1: |
| 47 | : [ret] "={r3}" (-> usize), | 47 | : [ret] "={r3}" (-> usize), |
| 48 | : [number] "{r0}" (@enumToInt(number)), | 48 | : [number] "{r0}" (@intFromEnum(number)), |
| 49 | [arg1] "{r3}" (arg1), | 49 | [arg1] "{r3}" (arg1), |
| 50 | [arg2] "{r4}" (arg2), | 50 | [arg2] "{r4}" (arg2), |
| 51 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 51 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| ... | @@ -59,7 +59,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -59,7 +59,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 59 | \\ neg 3, 3 | 59 | \\ neg 3, 3 |
| 60 | \\ 1: | 60 | \\ 1: |
| 61 | : [ret] "={r3}" (-> usize), | 61 | : [ret] "={r3}" (-> usize), |
| 62 | : [number] "{r0}" (@enumToInt(number)), | 62 | : [number] "{r0}" (@intFromEnum(number)), |
| 63 | [arg1] "{r3}" (arg1), | 63 | [arg1] "{r3}" (arg1), |
| 64 | [arg2] "{r4}" (arg2), | 64 | [arg2] "{r4}" (arg2), |
| 65 | [arg3] "{r5}" (arg3), | 65 | [arg3] "{r5}" (arg3), |
| ... | @@ -74,7 +74,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -74,7 +74,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 74 | \\ neg 3, 3 | 74 | \\ neg 3, 3 |
| 75 | \\ 1: | 75 | \\ 1: |
| 76 | : [ret] "={r3}" (-> usize), | 76 | : [ret] "={r3}" (-> usize), |
| 77 | : [number] "{r0}" (@enumToInt(number)), | 77 | : [number] "{r0}" (@intFromEnum(number)), |
| 78 | [arg1] "{r3}" (arg1), | 78 | [arg1] "{r3}" (arg1), |
| 79 | [arg2] "{r4}" (arg2), | 79 | [arg2] "{r4}" (arg2), |
| 80 | [arg3] "{r5}" (arg3), | 80 | [arg3] "{r5}" (arg3), |
| ... | @@ -90,7 +90,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, | ... | @@ -90,7 +90,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, |
| 90 | \\ neg 3, 3 | 90 | \\ neg 3, 3 |
| 91 | \\ 1: | 91 | \\ 1: |
| 92 | : [ret] "={r3}" (-> usize), | 92 | : [ret] "={r3}" (-> usize), |
| 93 | : [number] "{r0}" (@enumToInt(number)), | 93 | : [number] "{r0}" (@intFromEnum(number)), |
| 94 | [arg1] "{r3}" (arg1), | 94 | [arg1] "{r3}" (arg1), |
| 95 | [arg2] "{r4}" (arg2), | 95 | [arg2] "{r4}" (arg2), |
| 96 | [arg3] "{r5}" (arg3), | 96 | [arg3] "{r5}" (arg3), |
| ... | @@ -115,7 +115,7 @@ pub fn syscall6( | ... | @@ -115,7 +115,7 @@ pub fn syscall6( |
| 115 | \\ neg 3, 3 | 115 | \\ neg 3, 3 |
| 116 | \\ 1: | 116 | \\ 1: |
| 117 | : [ret] "={r3}" (-> usize), | 117 | : [ret] "={r3}" (-> usize), |
| 118 | : [number] "{r0}" (@enumToInt(number)), | 118 | : [number] "{r0}" (@intFromEnum(number)), |
| 119 | [arg1] "{r3}" (arg1), | 119 | [arg1] "{r3}" (arg1), |
| 120 | [arg2] "{r4}" (arg2), | 120 | [arg2] "{r4}" (arg2), |
| 121 | [arg3] "{r5}" (arg3), | 121 | [arg3] "{r5}" (arg3), |
| ... | @@ -136,7 +136,7 @@ pub const restore = restore_rt; | ... | @@ -136,7 +136,7 @@ pub const restore = restore_rt; |
| 136 | pub fn restore_rt() callconv(.Naked) void { | 136 | pub fn restore_rt() callconv(.Naked) void { |
| 137 | return asm volatile ("sc" | 137 | return asm volatile ("sc" |
| 138 | : | 138 | : |
| 139 | : [number] "{r0}" (@enumToInt(SYS.rt_sigreturn)), | 139 | : [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)), |
| 140 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" | 140 | : "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12" |
| 141 | ); | 141 | ); |
| 142 | } | 142 | } |
lib/std/os/linux/riscv64.zig+8-8| ... | @@ -13,7 +13,7 @@ const timespec = std.os.linux.timespec; | ... | @@ -13,7 +13,7 @@ const timespec = std.os.linux.timespec; |
| 13 | pub fn syscall0(number: SYS) usize { | 13 | pub fn syscall0(number: SYS) usize { |
| 14 | return asm volatile ("ecall" | 14 | return asm volatile ("ecall" |
| 15 | : [ret] "={x10}" (-> usize), | 15 | : [ret] "={x10}" (-> usize), |
| 16 | : [number] "{x17}" (@enumToInt(number)), | 16 | : [number] "{x17}" (@intFromEnum(number)), |
| 17 | : "memory" | 17 | : "memory" |
| 18 | ); | 18 | ); |
| 19 | } | 19 | } |
| ... | @@ -21,7 +21,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -21,7 +21,7 @@ pub fn syscall0(number: SYS) usize { |
| 21 | pub fn syscall1(number: SYS, arg1: usize) usize { | 21 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 22 | return asm volatile ("ecall" | 22 | return asm volatile ("ecall" |
| 23 | : [ret] "={x10}" (-> usize), | 23 | : [ret] "={x10}" (-> usize), |
| 24 | : [number] "{x17}" (@enumToInt(number)), | 24 | : [number] "{x17}" (@intFromEnum(number)), |
| 25 | [arg1] "{x10}" (arg1), | 25 | [arg1] "{x10}" (arg1), |
| 26 | : "memory" | 26 | : "memory" |
| 27 | ); | 27 | ); |
| ... | @@ -30,7 +30,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -30,7 +30,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 30 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 30 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 31 | return asm volatile ("ecall" | 31 | return asm volatile ("ecall" |
| 32 | : [ret] "={x10}" (-> usize), | 32 | : [ret] "={x10}" (-> usize), |
| 33 | : [number] "{x17}" (@enumToInt(number)), | 33 | : [number] "{x17}" (@intFromEnum(number)), |
| 34 | [arg1] "{x10}" (arg1), | 34 | [arg1] "{x10}" (arg1), |
| 35 | [arg2] "{x11}" (arg2), | 35 | [arg2] "{x11}" (arg2), |
| 36 | : "memory" | 36 | : "memory" |
| ... | @@ -40,7 +40,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -40,7 +40,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 40 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 40 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 41 | return asm volatile ("ecall" | 41 | return asm volatile ("ecall" |
| 42 | : [ret] "={x10}" (-> usize), | 42 | : [ret] "={x10}" (-> usize), |
| 43 | : [number] "{x17}" (@enumToInt(number)), | 43 | : [number] "{x17}" (@intFromEnum(number)), |
| 44 | [arg1] "{x10}" (arg1), | 44 | [arg1] "{x10}" (arg1), |
| 45 | [arg2] "{x11}" (arg2), | 45 | [arg2] "{x11}" (arg2), |
| 46 | [arg3] "{x12}" (arg3), | 46 | [arg3] "{x12}" (arg3), |
| ... | @@ -51,7 +51,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -51,7 +51,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 51 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 51 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 52 | return asm volatile ("ecall" | 52 | return asm volatile ("ecall" |
| 53 | : [ret] "={x10}" (-> usize), | 53 | : [ret] "={x10}" (-> usize), |
| 54 | : [number] "{x17}" (@enumToInt(number)), | 54 | : [number] "{x17}" (@intFromEnum(number)), |
| 55 | [arg1] "{x10}" (arg1), | 55 | [arg1] "{x10}" (arg1), |
| 56 | [arg2] "{x11}" (arg2), | 56 | [arg2] "{x11}" (arg2), |
| 57 | [arg3] "{x12}" (arg3), | 57 | [arg3] "{x12}" (arg3), |
| ... | @@ -63,7 +63,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -63,7 +63,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 63 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 63 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 64 | return asm volatile ("ecall" | 64 | return asm volatile ("ecall" |
| 65 | : [ret] "={x10}" (-> usize), | 65 | : [ret] "={x10}" (-> usize), |
| 66 | : [number] "{x17}" (@enumToInt(number)), | 66 | : [number] "{x17}" (@intFromEnum(number)), |
| 67 | [arg1] "{x10}" (arg1), | 67 | [arg1] "{x10}" (arg1), |
| 68 | [arg2] "{x11}" (arg2), | 68 | [arg2] "{x11}" (arg2), |
| 69 | [arg3] "{x12}" (arg3), | 69 | [arg3] "{x12}" (arg3), |
| ... | @@ -84,7 +84,7 @@ pub fn syscall6( | ... | @@ -84,7 +84,7 @@ pub fn syscall6( |
| 84 | ) usize { | 84 | ) usize { |
| 85 | return asm volatile ("ecall" | 85 | return asm volatile ("ecall" |
| 86 | : [ret] "={x10}" (-> usize), | 86 | : [ret] "={x10}" (-> usize), |
| 87 | : [number] "{x17}" (@enumToInt(number)), | 87 | : [number] "{x17}" (@intFromEnum(number)), |
| 88 | [arg1] "{x10}" (arg1), | 88 | [arg1] "{x10}" (arg1), |
| 89 | [arg2] "{x11}" (arg2), | 89 | [arg2] "{x11}" (arg2), |
| 90 | [arg3] "{x12}" (arg3), | 90 | [arg3] "{x12}" (arg3), |
| ... | @@ -104,7 +104,7 @@ pub const restore = restore_rt; | ... | @@ -104,7 +104,7 @@ pub const restore = restore_rt; |
| 104 | pub fn restore_rt() callconv(.Naked) void { | 104 | pub fn restore_rt() callconv(.Naked) void { |
| 105 | return asm volatile ("ecall" | 105 | return asm volatile ("ecall" |
| 106 | : | 106 | : |
| 107 | : [number] "{x17}" (@enumToInt(SYS.rt_sigreturn)), | 107 | : [number] "{x17}" (@intFromEnum(SYS.rt_sigreturn)), |
| 108 | : "memory" | 108 | : "memory" |
| 109 | ); | 109 | ); |
| 110 | } | 110 | } |
lib/std/os/linux/sparc64.zig+10-10| ... | @@ -29,7 +29,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { | ... | @@ -29,7 +29,7 @@ pub fn syscall_pipe(fd: *[2]i32) usize { |
| 29 | \\ clr %%o0 | 29 | \\ clr %%o0 |
| 30 | \\2: | 30 | \\2: |
| 31 | : [ret] "={o0}" (-> usize), | 31 | : [ret] "={o0}" (-> usize), |
| 32 | : [number] "{g1}" (@enumToInt(SYS.pipe)), | 32 | : [number] "{g1}" (@intFromEnum(SYS.pipe)), |
| 33 | [arg] "r" (fd), | 33 | [arg] "r" (fd), |
| 34 | : "memory", "g3" | 34 | : "memory", "g3" |
| 35 | ); | 35 | ); |
| ... | @@ -53,7 +53,7 @@ pub fn syscall_fork() usize { | ... | @@ -53,7 +53,7 @@ pub fn syscall_fork() usize { |
| 53 | \\ and %%o1, %%o0, %%o0 | 53 | \\ and %%o1, %%o0, %%o0 |
| 54 | \\ 2: | 54 | \\ 2: |
| 55 | : [ret] "={o0}" (-> usize), | 55 | : [ret] "={o0}" (-> usize), |
| 56 | : [number] "{g1}" (@enumToInt(SYS.fork)), | 56 | : [number] "{g1}" (@intFromEnum(SYS.fork)), |
| 57 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" | 57 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" |
| 58 | ); | 58 | ); |
| 59 | } | 59 | } |
| ... | @@ -66,7 +66,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -66,7 +66,7 @@ pub fn syscall0(number: SYS) usize { |
| 66 | \\ neg %%o0 | 66 | \\ neg %%o0 |
| 67 | \\ 1: | 67 | \\ 1: |
| 68 | : [ret] "={o0}" (-> usize), | 68 | : [ret] "={o0}" (-> usize), |
| 69 | : [number] "{g1}" (@enumToInt(number)), | 69 | : [number] "{g1}" (@intFromEnum(number)), |
| 70 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" | 70 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" |
| 71 | ); | 71 | ); |
| 72 | } | 72 | } |
| ... | @@ -79,7 +79,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -79,7 +79,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 79 | \\ neg %%o0 | 79 | \\ neg %%o0 |
| 80 | \\ 1: | 80 | \\ 1: |
| 81 | : [ret] "={o0}" (-> usize), | 81 | : [ret] "={o0}" (-> usize), |
| 82 | : [number] "{g1}" (@enumToInt(number)), | 82 | : [number] "{g1}" (@intFromEnum(number)), |
| 83 | [arg1] "{o0}" (arg1), | 83 | [arg1] "{o0}" (arg1), |
| 84 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" | 84 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" |
| 85 | ); | 85 | ); |
| ... | @@ -93,7 +93,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -93,7 +93,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 93 | \\ neg %%o0 | 93 | \\ neg %%o0 |
| 94 | \\ 1: | 94 | \\ 1: |
| 95 | : [ret] "={o0}" (-> usize), | 95 | : [ret] "={o0}" (-> usize), |
| 96 | : [number] "{g1}" (@enumToInt(number)), | 96 | : [number] "{g1}" (@intFromEnum(number)), |
| 97 | [arg1] "{o0}" (arg1), | 97 | [arg1] "{o0}" (arg1), |
| 98 | [arg2] "{o1}" (arg2), | 98 | [arg2] "{o1}" (arg2), |
| 99 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" | 99 | : "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7" |
| ... | @@ -108,7 +108,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -108,7 +108,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 108 | \\ neg %%o0 | 108 | \\ neg %%o0 |
| 109 | \\ 1: | 109 | \\ 1: |
| 110 | : [ret] "={o0}" (-> usize), | 110 | : [ret] "={o0}" (-> usize), |
| 111 | : [number] "{g1}" (@enumToInt(number)), | 111 | : [number] "{g1}" (@intFromEnum(number)), |
| 112 | [arg1] "{o0}" (arg1), | 112 | [arg1] "{o0}" (arg1), |
| 113 | [arg2] "{o1}" (arg2), | 113 | [arg2] "{o1}" (arg2), |
| 114 | [arg3] "{o2}" (arg3), | 114 | [arg3] "{o2}" (arg3), |
| ... | @@ -124,7 +124,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -124,7 +124,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 124 | \\ neg %%o0 | 124 | \\ neg %%o0 |
| 125 | \\ 1: | 125 | \\ 1: |
| 126 | : [ret] "={o0}" (-> usize), | 126 | : [ret] "={o0}" (-> usize), |
| 127 | : [number] "{g1}" (@enumToInt(number)), | 127 | : [number] "{g1}" (@intFromEnum(number)), |
| 128 | [arg1] "{o0}" (arg1), | 128 | [arg1] "{o0}" (arg1), |
| 129 | [arg2] "{o1}" (arg2), | 129 | [arg2] "{o1}" (arg2), |
| 130 | [arg3] "{o2}" (arg3), | 130 | [arg3] "{o2}" (arg3), |
| ... | @@ -141,7 +141,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, | ... | @@ -141,7 +141,7 @@ pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, |
| 141 | \\ neg %%o0 | 141 | \\ neg %%o0 |
| 142 | \\ 1: | 142 | \\ 1: |
| 143 | : [ret] "={o0}" (-> usize), | 143 | : [ret] "={o0}" (-> usize), |
| 144 | : [number] "{g1}" (@enumToInt(number)), | 144 | : [number] "{g1}" (@intFromEnum(number)), |
| 145 | [arg1] "{o0}" (arg1), | 145 | [arg1] "{o0}" (arg1), |
| 146 | [arg2] "{o1}" (arg2), | 146 | [arg2] "{o1}" (arg2), |
| 147 | [arg3] "{o2}" (arg3), | 147 | [arg3] "{o2}" (arg3), |
| ... | @@ -167,7 +167,7 @@ pub fn syscall6( | ... | @@ -167,7 +167,7 @@ pub fn syscall6( |
| 167 | \\ neg %%o0 | 167 | \\ neg %%o0 |
| 168 | \\ 1: | 168 | \\ 1: |
| 169 | : [ret] "={o0}" (-> usize), | 169 | : [ret] "={o0}" (-> usize), |
| 170 | : [number] "{g1}" (@enumToInt(number)), | 170 | : [number] "{g1}" (@intFromEnum(number)), |
| 171 | [arg1] "{o0}" (arg1), | 171 | [arg1] "{o0}" (arg1), |
| 172 | [arg2] "{o1}" (arg2), | 172 | [arg2] "{o1}" (arg2), |
| 173 | [arg3] "{o2}" (arg3), | 173 | [arg3] "{o2}" (arg3), |
| ... | @@ -190,7 +190,7 @@ pub const restore = restore_rt; | ... | @@ -190,7 +190,7 @@ pub const restore = restore_rt; |
| 190 | pub fn restore_rt() callconv(.C) void { | 190 | pub fn restore_rt() callconv(.C) void { |
| 191 | return asm volatile ("t 0x6d" | 191 | return asm volatile ("t 0x6d" |
| 192 | : | 192 | : |
| 193 | : [number] "{g1}" (@enumToInt(SYS.rt_sigreturn)), | 193 | : [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)), |
| 194 | : "memory", "xcc", "o0", "o1", "o2", "o3", "o4", "o5", "o7" | 194 | : "memory", "xcc", "o0", "o1", "o2", "o3", "o4", "o5", "o7" |
| 195 | ); | 195 | ); |
| 196 | } | 196 | } |
lib/std/os/linux/start_pie.zig+5-5| ... | @@ -78,7 +78,7 @@ pub fn relocate(phdrs: []elf.Phdr) void { | ... | @@ -78,7 +78,7 @@ pub fn relocate(phdrs: []elf.Phdr) void { |
| 78 | const base_addr = base: { | 78 | const base_addr = base: { |
| 79 | for (phdrs) |*phdr| { | 79 | for (phdrs) |*phdr| { |
| 80 | if (phdr.p_type != elf.PT_DYNAMIC) continue; | 80 | if (phdr.p_type != elf.PT_DYNAMIC) continue; |
| 81 | break :base @ptrToInt(dynv) - phdr.p_vaddr; | 81 | break :base @intFromPtr(dynv) - phdr.p_vaddr; |
| 82 | } | 82 | } |
| 83 | // This is not supposed to happen for well-formed binaries. | 83 | // This is not supposed to happen for well-formed binaries. |
| 84 | std.os.abort(); | 84 | std.os.abort(); |
| ... | @@ -103,17 +103,17 @@ pub fn relocate(phdrs: []elf.Phdr) void { | ... | @@ -103,17 +103,17 @@ pub fn relocate(phdrs: []elf.Phdr) void { |
| 103 | 103 | ||
| 104 | // Apply the relocations. | 104 | // Apply the relocations. |
| 105 | if (rel_addr != 0) { | 105 | if (rel_addr != 0) { |
| 106 | const rel = std.mem.bytesAsSlice(elf.Rel, @intToPtr([*]u8, rel_addr)[0..rel_size]); | 106 | const rel = std.mem.bytesAsSlice(elf.Rel, @ptrFromInt([*]u8, rel_addr)[0..rel_size]); |
| 107 | for (rel) |r| { | 107 | for (rel) |r| { |
| 108 | if (r.r_type() != R_RELATIVE) continue; | 108 | if (r.r_type() != R_RELATIVE) continue; |
| 109 | @intToPtr(*usize, base_addr + r.r_offset).* += base_addr; | 109 | @ptrFromInt(*usize, base_addr + r.r_offset).* += base_addr; |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | if (rela_addr != 0) { | 112 | if (rela_addr != 0) { |
| 113 | const rela = std.mem.bytesAsSlice(elf.Rela, @intToPtr([*]u8, rela_addr)[0..rela_size]); | 113 | const rela = std.mem.bytesAsSlice(elf.Rela, @ptrFromInt([*]u8, rela_addr)[0..rela_size]); |
| 114 | for (rela) |r| { | 114 | for (rela) |r| { |
| 115 | if (r.r_type() != R_RELATIVE) continue; | 115 | if (r.r_type() != R_RELATIVE) continue; |
| 116 | @intToPtr(*usize, base_addr + r.r_offset).* += base_addr + @bitCast(usize, r.r_addend); | 116 | @ptrFromInt(*usize, base_addr + r.r_offset).* += base_addr + @bitCast(usize, r.r_addend); |
| 117 | } | 117 | } |
| 118 | } | 118 | } |
| 119 | } | 119 | } |
lib/std/os/linux/thumb.zig+9-9| ... | @@ -10,7 +10,7 @@ const SYS = linux.SYS; | ... | @@ -10,7 +10,7 @@ const SYS = linux.SYS; |
| 10 | pub fn syscall0(number: SYS) usize { | 10 | pub fn syscall0(number: SYS) usize { |
| 11 | @setRuntimeSafety(false); | 11 | @setRuntimeSafety(false); |
| 12 | 12 | ||
| 13 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 13 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 14 | return asm volatile ( | 14 | return asm volatile ( |
| 15 | \\ str r7, [%[tmp], #4] | 15 | \\ str r7, [%[tmp], #4] |
| 16 | \\ ldr r7, [%[tmp]] | 16 | \\ ldr r7, [%[tmp]] |
| ... | @@ -25,7 +25,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -25,7 +25,7 @@ pub fn syscall0(number: SYS) usize { |
| 25 | pub fn syscall1(number: SYS, arg1: usize) usize { | 25 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 26 | @setRuntimeSafety(false); | 26 | @setRuntimeSafety(false); |
| 27 | 27 | ||
| 28 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 28 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 29 | return asm volatile ( | 29 | return asm volatile ( |
| 30 | \\ str r7, [%[tmp], #4] | 30 | \\ str r7, [%[tmp], #4] |
| 31 | \\ ldr r7, [%[tmp]] | 31 | \\ ldr r7, [%[tmp]] |
| ... | @@ -41,7 +41,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -41,7 +41,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 41 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 41 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 42 | @setRuntimeSafety(false); | 42 | @setRuntimeSafety(false); |
| 43 | 43 | ||
| 44 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 44 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 45 | return asm volatile ( | 45 | return asm volatile ( |
| 46 | \\ str r7, [%[tmp], #4] | 46 | \\ str r7, [%[tmp], #4] |
| 47 | \\ ldr r7, [%[tmp]] | 47 | \\ ldr r7, [%[tmp]] |
| ... | @@ -58,7 +58,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -58,7 +58,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 58 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 58 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 59 | @setRuntimeSafety(false); | 59 | @setRuntimeSafety(false); |
| 60 | 60 | ||
| 61 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 61 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 62 | return asm volatile ( | 62 | return asm volatile ( |
| 63 | \\ str r7, [%[tmp], #4] | 63 | \\ str r7, [%[tmp], #4] |
| 64 | \\ ldr r7, [%[tmp]] | 64 | \\ ldr r7, [%[tmp]] |
| ... | @@ -76,7 +76,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -76,7 +76,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 76 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 76 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 77 | @setRuntimeSafety(false); | 77 | @setRuntimeSafety(false); |
| 78 | 78 | ||
| 79 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 79 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 80 | return asm volatile ( | 80 | return asm volatile ( |
| 81 | \\ str r7, [%[tmp], #4] | 81 | \\ str r7, [%[tmp], #4] |
| 82 | \\ ldr r7, [%[tmp]] | 82 | \\ ldr r7, [%[tmp]] |
| ... | @@ -95,7 +95,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -95,7 +95,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 95 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 95 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 96 | @setRuntimeSafety(false); | 96 | @setRuntimeSafety(false); |
| 97 | 97 | ||
| 98 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 98 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 99 | return asm volatile ( | 99 | return asm volatile ( |
| 100 | \\ str r7, [%[tmp], #4] | 100 | \\ str r7, [%[tmp], #4] |
| 101 | \\ ldr r7, [%[tmp]] | 101 | \\ ldr r7, [%[tmp]] |
| ... | @@ -123,7 +123,7 @@ pub fn syscall6( | ... | @@ -123,7 +123,7 @@ pub fn syscall6( |
| 123 | ) usize { | 123 | ) usize { |
| 124 | @setRuntimeSafety(false); | 124 | @setRuntimeSafety(false); |
| 125 | 125 | ||
| 126 | var buf: [2]usize = .{ @enumToInt(number), undefined }; | 126 | var buf: [2]usize = .{ @intFromEnum(number), undefined }; |
| 127 | return asm volatile ( | 127 | return asm volatile ( |
| 128 | \\ str r7, [%[tmp], #4] | 128 | \\ str r7, [%[tmp], #4] |
| 129 | \\ ldr r7, [%[tmp]] | 129 | \\ ldr r7, [%[tmp]] |
| ... | @@ -146,7 +146,7 @@ pub fn restore() callconv(.Naked) void { | ... | @@ -146,7 +146,7 @@ pub fn restore() callconv(.Naked) void { |
| 146 | \\ mov r7, %[number] | 146 | \\ mov r7, %[number] |
| 147 | \\ svc #0 | 147 | \\ svc #0 |
| 148 | : | 148 | : |
| 149 | : [number] "I" (@enumToInt(SYS.sigreturn)), | 149 | : [number] "I" (@intFromEnum(SYS.sigreturn)), |
| 150 | ); | 150 | ); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| ... | @@ -155,7 +155,7 @@ pub fn restore_rt() callconv(.Naked) void { | ... | @@ -155,7 +155,7 @@ pub fn restore_rt() callconv(.Naked) void { |
| 155 | \\ mov r7, %[number] | 155 | \\ mov r7, %[number] |
| 156 | \\ svc #0 | 156 | \\ svc #0 |
| 157 | : | 157 | : |
| 158 | : [number] "I" (@enumToInt(SYS.rt_sigreturn)), | 158 | : [number] "I" (@intFromEnum(SYS.rt_sigreturn)), |
| 159 | : "memory" | 159 | : "memory" |
| 160 | ); | 160 | ); |
| 161 | } | 161 | } |
lib/std/os/linux/tls.zig+5-5| ... | @@ -122,7 +122,7 @@ pub fn setThreadPointer(addr: usize) void { | ... | @@ -122,7 +122,7 @@ pub fn setThreadPointer(addr: usize) void { |
| 122 | .seg_not_present = 0, | 122 | .seg_not_present = 0, |
| 123 | .useable = 1, | 123 | .useable = 1, |
| 124 | }; | 124 | }; |
| 125 | const rc = std.os.linux.syscall1(.set_thread_area, @ptrToInt(&user_desc)); | 125 | const rc = std.os.linux.syscall1(.set_thread_area, @intFromPtr(&user_desc)); |
| 126 | assert(rc == 0); | 126 | assert(rc == 0); |
| 127 | 127 | ||
| 128 | const gdt_entry_number = user_desc.entry_number; | 128 | const gdt_entry_number = user_desc.entry_number; |
| ... | @@ -191,7 +191,7 @@ fn initTLS(phdrs: []elf.Phdr) void { | ... | @@ -191,7 +191,7 @@ fn initTLS(phdrs: []elf.Phdr) void { |
| 191 | 191 | ||
| 192 | for (phdrs) |*phdr| { | 192 | for (phdrs) |*phdr| { |
| 193 | switch (phdr.p_type) { | 193 | switch (phdr.p_type) { |
| 194 | elf.PT_PHDR => img_base = @ptrToInt(phdrs.ptr) - phdr.p_vaddr, | 194 | elf.PT_PHDR => img_base = @intFromPtr(phdrs.ptr) - phdr.p_vaddr, |
| 195 | elf.PT_TLS => tls_phdr = phdr, | 195 | elf.PT_TLS => tls_phdr = phdr, |
| 196 | else => {}, | 196 | else => {}, |
| 197 | } | 197 | } |
| ... | @@ -205,7 +205,7 @@ fn initTLS(phdrs: []elf.Phdr) void { | ... | @@ -205,7 +205,7 @@ fn initTLS(phdrs: []elf.Phdr) void { |
| 205 | // the data stored in the PT_TLS segment is p_filesz and may be less | 205 | // the data stored in the PT_TLS segment is p_filesz and may be less |
| 206 | // than the former | 206 | // than the former |
| 207 | tls_align_factor = phdr.p_align; | 207 | tls_align_factor = phdr.p_align; |
| 208 | tls_data = @intToPtr([*]u8, img_base + phdr.p_vaddr)[0..phdr.p_filesz]; | 208 | tls_data = @ptrFromInt([*]u8, img_base + phdr.p_vaddr)[0..phdr.p_filesz]; |
| 209 | tls_data_alloc_size = phdr.p_memsz; | 209 | tls_data_alloc_size = phdr.p_memsz; |
| 210 | } else { | 210 | } else { |
| 211 | tls_align_factor = @alignOf(usize); | 211 | tls_align_factor = @alignOf(usize); |
| ... | @@ -292,7 +292,7 @@ pub fn prepareTLS(area: []u8) usize { | ... | @@ -292,7 +292,7 @@ pub fn prepareTLS(area: []u8) usize { |
| 292 | // Return the corrected value (if needed) for the tp register. | 292 | // Return the corrected value (if needed) for the tp register. |
| 293 | // Overflow here is not a problem, the pointer arithmetic involving the tp | 293 | // Overflow here is not a problem, the pointer arithmetic involving the tp |
| 294 | // is done with wrapping semantics. | 294 | // is done with wrapping semantics. |
| 295 | return @ptrToInt(area.ptr) +% tls_tp_offset +% | 295 | return @intFromPtr(area.ptr) +% tls_tp_offset +% |
| 296 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; | 296 | if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset; |
| 297 | } | 297 | } |
| 298 | 298 | ||
| ... | @@ -328,7 +328,7 @@ pub fn initStaticTLS(phdrs: []elf.Phdr) void { | ... | @@ -328,7 +328,7 @@ pub fn initStaticTLS(phdrs: []elf.Phdr) void { |
| 328 | ) catch os.abort(); | 328 | ) catch os.abort(); |
| 329 | 329 | ||
| 330 | // Make sure the slice is correctly aligned. | 330 | // Make sure the slice is correctly aligned. |
| 331 | const begin_addr = @ptrToInt(alloc_tls_area.ptr); | 331 | const begin_addr = @intFromPtr(alloc_tls_area.ptr); |
| 332 | const begin_aligned_addr = mem.alignForward(usize, begin_addr, tls_image.alloc_align); | 332 | const begin_aligned_addr = mem.alignForward(usize, begin_addr, tls_image.alloc_align); |
| 333 | const start = begin_aligned_addr - begin_addr; | 333 | const start = begin_aligned_addr - begin_addr; |
| 334 | break :blk alloc_tls_area[start .. start + tls_image.alloc_size]; | 334 | break :blk alloc_tls_area[start .. start + tls_image.alloc_size]; |
lib/std/os/linux/vdso.zig+10-10| ... | @@ -8,7 +8,7 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { | ... | @@ -8,7 +8,7 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { |
| 8 | const vdso_addr = std.os.system.getauxval(std.elf.AT_SYSINFO_EHDR); | 8 | const vdso_addr = std.os.system.getauxval(std.elf.AT_SYSINFO_EHDR); |
| 9 | if (vdso_addr == 0) return 0; | 9 | if (vdso_addr == 0) return 0; |
| 10 | 10 | ||
| 11 | const eh = @intToPtr(*elf.Ehdr, vdso_addr); | 11 | const eh = @ptrFromInt(*elf.Ehdr, vdso_addr); |
| 12 | var ph_addr: usize = vdso_addr + eh.e_phoff; | 12 | var ph_addr: usize = vdso_addr + eh.e_phoff; |
| 13 | 13 | ||
| 14 | var maybe_dynv: ?[*]usize = null; | 14 | var maybe_dynv: ?[*]usize = null; |
| ... | @@ -19,14 +19,14 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { | ... | @@ -19,14 +19,14 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { |
| 19 | i += 1; | 19 | i += 1; |
| 20 | ph_addr += eh.e_phentsize; | 20 | ph_addr += eh.e_phentsize; |
| 21 | }) { | 21 | }) { |
| 22 | const this_ph = @intToPtr(*elf.Phdr, ph_addr); | 22 | const this_ph = @ptrFromInt(*elf.Phdr, ph_addr); |
| 23 | switch (this_ph.p_type) { | 23 | switch (this_ph.p_type) { |
| 24 | // On WSL1 as well as older kernels, the VDSO ELF image is pre-linked in the upper half | 24 | // On WSL1 as well as older kernels, the VDSO ELF image is pre-linked in the upper half |
| 25 | // of the memory space (e.g. p_vaddr = 0xffffffffff700000 on WSL1). | 25 | // of the memory space (e.g. p_vaddr = 0xffffffffff700000 on WSL1). |
| 26 | // Wrapping operations are used on this line as well as subsequent calculations relative to base | 26 | // Wrapping operations are used on this line as well as subsequent calculations relative to base |
| 27 | // (lines 47, 78) to ensure no overflow check is tripped. | 27 | // (lines 47, 78) to ensure no overflow check is tripped. |
| 28 | elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr, | 28 | elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr, |
| 29 | elf.PT_DYNAMIC => maybe_dynv = @intToPtr([*]usize, vdso_addr + this_ph.p_offset), | 29 | elf.PT_DYNAMIC => maybe_dynv = @ptrFromInt([*]usize, vdso_addr + this_ph.p_offset), |
| 30 | else => {}, | 30 | else => {}, |
| 31 | } | 31 | } |
| 32 | } | 32 | } |
| ... | @@ -45,11 +45,11 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { | ... | @@ -45,11 +45,11 @@ pub fn lookup(vername: []const u8, name: []const u8) usize { |
| 45 | while (dynv[i] != 0) : (i += 2) { | 45 | while (dynv[i] != 0) : (i += 2) { |
| 46 | const p = base +% dynv[i + 1]; | 46 | const p = base +% dynv[i + 1]; |
| 47 | switch (dynv[i]) { | 47 | switch (dynv[i]) { |
| 48 | elf.DT_STRTAB => maybe_strings = @intToPtr([*]u8, p), | 48 | elf.DT_STRTAB => maybe_strings = @ptrFromInt([*]u8, p), |
| 49 | elf.DT_SYMTAB => maybe_syms = @intToPtr([*]elf.Sym, p), | 49 | elf.DT_SYMTAB => maybe_syms = @ptrFromInt([*]elf.Sym, p), |
| 50 | elf.DT_HASH => maybe_hashtab = @intToPtr([*]linux.Elf_Symndx, p), | 50 | elf.DT_HASH => maybe_hashtab = @ptrFromInt([*]linux.Elf_Symndx, p), |
| 51 | elf.DT_VERSYM => maybe_versym = @intToPtr([*]u16, p), | 51 | elf.DT_VERSYM => maybe_versym = @ptrFromInt([*]u16, p), |
| 52 | elf.DT_VERDEF => maybe_verdef = @intToPtr(*elf.Verdef, p), | 52 | elf.DT_VERDEF => maybe_verdef = @ptrFromInt(*elf.Verdef, p), |
| 53 | else => {}, | 53 | else => {}, |
| 54 | } | 54 | } |
| 55 | } | 55 | } |
| ... | @@ -88,9 +88,9 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ | ... | @@ -88,9 +88,9 @@ fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [ |
| 88 | break; | 88 | break; |
| 89 | if (def.vd_next == 0) | 89 | if (def.vd_next == 0) |
| 90 | return false; | 90 | return false; |
| 91 | def = @intToPtr(*elf.Verdef, @ptrToInt(def) + def.vd_next); | 91 | def = @ptrFromInt(*elf.Verdef, @intFromPtr(def) + def.vd_next); |
| 92 | } | 92 | } |
| 93 | const aux = @intToPtr(*elf.Verdaux, @ptrToInt(def) + def.vd_aux); | 93 | const aux = @ptrFromInt(*elf.Verdaux, @intFromPtr(def) + def.vd_aux); |
| 94 | const vda_name = @ptrCast([*:0]u8, strings + aux.vda_name); | 94 | const vda_name = @ptrCast([*:0]u8, strings + aux.vda_name); |
| 95 | return mem.eql(u8, vername, mem.sliceTo(vda_name, 0)); | 95 | return mem.eql(u8, vername, mem.sliceTo(vda_name, 0)); |
| 96 | } | 96 | } |
lib/std/os/linux/x86.zig+13-13| ... | @@ -16,7 +16,7 @@ const timespec = linux.timespec; | ... | @@ -16,7 +16,7 @@ const timespec = linux.timespec; |
| 16 | pub fn syscall0(number: SYS) usize { | 16 | pub fn syscall0(number: SYS) usize { |
| 17 | return asm volatile ("int $0x80" | 17 | return asm volatile ("int $0x80" |
| 18 | : [ret] "={eax}" (-> usize), | 18 | : [ret] "={eax}" (-> usize), |
| 19 | : [number] "{eax}" (@enumToInt(number)), | 19 | : [number] "{eax}" (@intFromEnum(number)), |
| 20 | : "memory" | 20 | : "memory" |
| 21 | ); | 21 | ); |
| 22 | } | 22 | } |
| ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -24,7 +24,7 @@ pub fn syscall0(number: SYS) usize { |
| 24 | pub fn syscall1(number: SYS, arg1: usize) usize { | 24 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 25 | return asm volatile ("int $0x80" | 25 | return asm volatile ("int $0x80" |
| 26 | : [ret] "={eax}" (-> usize), | 26 | : [ret] "={eax}" (-> usize), |
| 27 | : [number] "{eax}" (@enumToInt(number)), | 27 | : [number] "{eax}" (@intFromEnum(number)), |
| 28 | [arg1] "{ebx}" (arg1), | 28 | [arg1] "{ebx}" (arg1), |
| 29 | : "memory" | 29 | : "memory" |
| 30 | ); | 30 | ); |
| ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -33,7 +33,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 33 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 34 | return asm volatile ("int $0x80" | 34 | return asm volatile ("int $0x80" |
| 35 | : [ret] "={eax}" (-> usize), | 35 | : [ret] "={eax}" (-> usize), |
| 36 | : [number] "{eax}" (@enumToInt(number)), | 36 | : [number] "{eax}" (@intFromEnum(number)), |
| 37 | [arg1] "{ebx}" (arg1), | 37 | [arg1] "{ebx}" (arg1), |
| 38 | [arg2] "{ecx}" (arg2), | 38 | [arg2] "{ecx}" (arg2), |
| 39 | : "memory" | 39 | : "memory" |
| ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -43,7 +43,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 43 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 44 | return asm volatile ("int $0x80" | 44 | return asm volatile ("int $0x80" |
| 45 | : [ret] "={eax}" (-> usize), | 45 | : [ret] "={eax}" (-> usize), |
| 46 | : [number] "{eax}" (@enumToInt(number)), | 46 | : [number] "{eax}" (@intFromEnum(number)), |
| 47 | [arg1] "{ebx}" (arg1), | 47 | [arg1] "{ebx}" (arg1), |
| 48 | [arg2] "{ecx}" (arg2), | 48 | [arg2] "{ecx}" (arg2), |
| 49 | [arg3] "{edx}" (arg3), | 49 | [arg3] "{edx}" (arg3), |
| ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -54,7 +54,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 54 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 55 | return asm volatile ("int $0x80" | 55 | return asm volatile ("int $0x80" |
| 56 | : [ret] "={eax}" (-> usize), | 56 | : [ret] "={eax}" (-> usize), |
| 57 | : [number] "{eax}" (@enumToInt(number)), | 57 | : [number] "{eax}" (@intFromEnum(number)), |
| 58 | [arg1] "{ebx}" (arg1), | 58 | [arg1] "{ebx}" (arg1), |
| 59 | [arg2] "{ecx}" (arg2), | 59 | [arg2] "{ecx}" (arg2), |
| 60 | [arg3] "{edx}" (arg3), | 60 | [arg3] "{edx}" (arg3), |
| ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -66,7 +66,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 66 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 67 | return asm volatile ("int $0x80" | 67 | return asm volatile ("int $0x80" |
| 68 | : [ret] "={eax}" (-> usize), | 68 | : [ret] "={eax}" (-> usize), |
| 69 | : [number] "{eax}" (@enumToInt(number)), | 69 | : [number] "{eax}" (@intFromEnum(number)), |
| 70 | [arg1] "{ebx}" (arg1), | 70 | [arg1] "{ebx}" (arg1), |
| 71 | [arg2] "{ecx}" (arg2), | 71 | [arg2] "{ecx}" (arg2), |
| 72 | [arg3] "{edx}" (arg3), | 72 | [arg3] "{edx}" (arg3), |
| ... | @@ -97,7 +97,7 @@ pub fn syscall6( | ... | @@ -97,7 +97,7 @@ pub fn syscall6( |
| 97 | \\ pop %%ebp | 97 | \\ pop %%ebp |
| 98 | \\ add $4, %%esp | 98 | \\ add $4, %%esp |
| 99 | : [ret] "={eax}" (-> usize), | 99 | : [ret] "={eax}" (-> usize), |
| 100 | : [number] "{eax}" (@enumToInt(number)), | 100 | : [number] "{eax}" (@intFromEnum(number)), |
| 101 | [arg1] "{ebx}" (arg1), | 101 | [arg1] "{ebx}" (arg1), |
| 102 | [arg2] "{ecx}" (arg2), | 102 | [arg2] "{ecx}" (arg2), |
| 103 | [arg3] "{edx}" (arg3), | 103 | [arg3] "{edx}" (arg3), |
| ... | @@ -111,9 +111,9 @@ pub fn syscall6( | ... | @@ -111,9 +111,9 @@ pub fn syscall6( |
| 111 | pub fn socketcall(call: usize, args: [*]const usize) usize { | 111 | pub fn socketcall(call: usize, args: [*]const usize) usize { |
| 112 | return asm volatile ("int $0x80" | 112 | return asm volatile ("int $0x80" |
| 113 | : [ret] "={eax}" (-> usize), | 113 | : [ret] "={eax}" (-> usize), |
| 114 | : [number] "{eax}" (@enumToInt(SYS.socketcall)), | 114 | : [number] "{eax}" (@intFromEnum(SYS.socketcall)), |
| 115 | [arg1] "{ebx}" (call), | 115 | [arg1] "{ebx}" (call), |
| 116 | [arg2] "{ecx}" (@ptrToInt(args)), | 116 | [arg2] "{ecx}" (@intFromPtr(args)), |
| 117 | : "memory" | 117 | : "memory" |
| 118 | ); | 118 | ); |
| 119 | } | 119 | } |
| ... | @@ -130,14 +130,14 @@ pub fn restore() callconv(.Naked) void { | ... | @@ -130,14 +130,14 @@ pub fn restore() callconv(.Naked) void { |
| 130 | \\ int $0x80 | 130 | \\ int $0x80 |
| 131 | \\ ret | 131 | \\ ret |
| 132 | : | 132 | : |
| 133 | : [number] "i" (@enumToInt(SYS.sigreturn)), | 133 | : [number] "i" (@intFromEnum(SYS.sigreturn)), |
| 134 | : "memory" | 134 | : "memory" |
| 135 | ), | 135 | ), |
| 136 | else => asm volatile ( | 136 | else => asm volatile ( |
| 137 | \\ int $0x80 | 137 | \\ int $0x80 |
| 138 | \\ ret | 138 | \\ ret |
| 139 | : | 139 | : |
| 140 | : [number] "{eax}" (@enumToInt(SYS.sigreturn)), | 140 | : [number] "{eax}" (@intFromEnum(SYS.sigreturn)), |
| 141 | : "memory" | 141 | : "memory" |
| 142 | ), | 142 | ), |
| 143 | } | 143 | } |
| ... | @@ -151,14 +151,14 @@ pub fn restore_rt() callconv(.Naked) void { | ... | @@ -151,14 +151,14 @@ pub fn restore_rt() callconv(.Naked) void { |
| 151 | \\ int $0x80 | 151 | \\ int $0x80 |
| 152 | \\ ret | 152 | \\ ret |
| 153 | : | 153 | : |
| 154 | : [number] "i" (@enumToInt(SYS.rt_sigreturn)), | 154 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), |
| 155 | : "memory" | 155 | : "memory" |
| 156 | ), | 156 | ), |
| 157 | else => asm volatile ( | 157 | else => asm volatile ( |
| 158 | \\ int $0x80 | 158 | \\ int $0x80 |
| 159 | \\ ret | 159 | \\ ret |
| 160 | : | 160 | : |
| 161 | : [number] "{eax}" (@enumToInt(SYS.rt_sigreturn)), | 161 | : [number] "{eax}" (@intFromEnum(SYS.rt_sigreturn)), |
| 162 | : "memory" | 162 | : "memory" |
| 163 | ), | 163 | ), |
| 164 | } | 164 | } |
lib/std/os/linux/x86_64.zig+9-9| ... | @@ -18,7 +18,7 @@ const timespec = linux.timespec; | ... | @@ -18,7 +18,7 @@ const timespec = linux.timespec; |
| 18 | pub fn syscall0(number: SYS) usize { | 18 | pub fn syscall0(number: SYS) usize { |
| 19 | return asm volatile ("syscall" | 19 | return asm volatile ("syscall" |
| 20 | : [ret] "={rax}" (-> usize), | 20 | : [ret] "={rax}" (-> usize), |
| 21 | : [number] "{rax}" (@enumToInt(number)), | 21 | : [number] "{rax}" (@intFromEnum(number)), |
| 22 | : "rcx", "r11", "memory" | 22 | : "rcx", "r11", "memory" |
| 23 | ); | 23 | ); |
| 24 | } | 24 | } |
| ... | @@ -26,7 +26,7 @@ pub fn syscall0(number: SYS) usize { | ... | @@ -26,7 +26,7 @@ pub fn syscall0(number: SYS) usize { |
| 26 | pub fn syscall1(number: SYS, arg1: usize) usize { | 26 | pub fn syscall1(number: SYS, arg1: usize) usize { |
| 27 | return asm volatile ("syscall" | 27 | return asm volatile ("syscall" |
| 28 | : [ret] "={rax}" (-> usize), | 28 | : [ret] "={rax}" (-> usize), |
| 29 | : [number] "{rax}" (@enumToInt(number)), | 29 | : [number] "{rax}" (@intFromEnum(number)), |
| 30 | [arg1] "{rdi}" (arg1), | 30 | [arg1] "{rdi}" (arg1), |
| 31 | : "rcx", "r11", "memory" | 31 | : "rcx", "r11", "memory" |
| 32 | ); | 32 | ); |
| ... | @@ -35,7 +35,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { | ... | @@ -35,7 +35,7 @@ pub fn syscall1(number: SYS, arg1: usize) usize { |
| 35 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | 35 | pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 36 | return asm volatile ("syscall" | 36 | return asm volatile ("syscall" |
| 37 | : [ret] "={rax}" (-> usize), | 37 | : [ret] "={rax}" (-> usize), |
| 38 | : [number] "{rax}" (@enumToInt(number)), | 38 | : [number] "{rax}" (@intFromEnum(number)), |
| 39 | [arg1] "{rdi}" (arg1), | 39 | [arg1] "{rdi}" (arg1), |
| 40 | [arg2] "{rsi}" (arg2), | 40 | [arg2] "{rsi}" (arg2), |
| 41 | : "rcx", "r11", "memory" | 41 | : "rcx", "r11", "memory" |
| ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { | ... | @@ -45,7 +45,7 @@ pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize { |
| 45 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | 45 | pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 46 | return asm volatile ("syscall" | 46 | return asm volatile ("syscall" |
| 47 | : [ret] "={rax}" (-> usize), | 47 | : [ret] "={rax}" (-> usize), |
| 48 | : [number] "{rax}" (@enumToInt(number)), | 48 | : [number] "{rax}" (@intFromEnum(number)), |
| 49 | [arg1] "{rdi}" (arg1), | 49 | [arg1] "{rdi}" (arg1), |
| 50 | [arg2] "{rsi}" (arg2), | 50 | [arg2] "{rsi}" (arg2), |
| 51 | [arg3] "{rdx}" (arg3), | 51 | [arg3] "{rdx}" (arg3), |
| ... | @@ -56,7 +56,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { | ... | @@ -56,7 +56,7 @@ pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize { |
| 56 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { | 56 | pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize { |
| 57 | return asm volatile ("syscall" | 57 | return asm volatile ("syscall" |
| 58 | : [ret] "={rax}" (-> usize), | 58 | : [ret] "={rax}" (-> usize), |
| 59 | : [number] "{rax}" (@enumToInt(number)), | 59 | : [number] "{rax}" (@intFromEnum(number)), |
| 60 | [arg1] "{rdi}" (arg1), | 60 | [arg1] "{rdi}" (arg1), |
| 61 | [arg2] "{rsi}" (arg2), | 61 | [arg2] "{rsi}" (arg2), |
| 62 | [arg3] "{rdx}" (arg3), | 62 | [arg3] "{rdx}" (arg3), |
| ... | @@ -68,7 +68,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) | ... | @@ -68,7 +68,7 @@ pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) |
| 68 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { | 68 | pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize { |
| 69 | return asm volatile ("syscall" | 69 | return asm volatile ("syscall" |
| 70 | : [ret] "={rax}" (-> usize), | 70 | : [ret] "={rax}" (-> usize), |
| 71 | : [number] "{rax}" (@enumToInt(number)), | 71 | : [number] "{rax}" (@intFromEnum(number)), |
| 72 | [arg1] "{rdi}" (arg1), | 72 | [arg1] "{rdi}" (arg1), |
| 73 | [arg2] "{rsi}" (arg2), | 73 | [arg2] "{rsi}" (arg2), |
| 74 | [arg3] "{rdx}" (arg3), | 74 | [arg3] "{rdx}" (arg3), |
| ... | @@ -89,7 +89,7 @@ pub fn syscall6( | ... | @@ -89,7 +89,7 @@ pub fn syscall6( |
| 89 | ) usize { | 89 | ) usize { |
| 90 | return asm volatile ("syscall" | 90 | return asm volatile ("syscall" |
| 91 | : [ret] "={rax}" (-> usize), | 91 | : [ret] "={rax}" (-> usize), |
| 92 | : [number] "{rax}" (@enumToInt(number)), | 92 | : [number] "{rax}" (@intFromEnum(number)), |
| 93 | [arg1] "{rdi}" (arg1), | 93 | [arg1] "{rdi}" (arg1), |
| 94 | [arg2] "{rsi}" (arg2), | 94 | [arg2] "{rsi}" (arg2), |
| 95 | [arg3] "{rdx}" (arg3), | 95 | [arg3] "{rdx}" (arg3), |
| ... | @@ -114,14 +114,14 @@ pub fn restore_rt() callconv(.Naked) void { | ... | @@ -114,14 +114,14 @@ pub fn restore_rt() callconv(.Naked) void { |
| 114 | \\ syscall | 114 | \\ syscall |
| 115 | \\ retq | 115 | \\ retq |
| 116 | : | 116 | : |
| 117 | : [number] "i" (@enumToInt(SYS.rt_sigreturn)), | 117 | : [number] "i" (@intFromEnum(SYS.rt_sigreturn)), |
| 118 | : "rcx", "r11", "memory" | 118 | : "rcx", "r11", "memory" |
| 119 | ), | 119 | ), |
| 120 | else => asm volatile ( | 120 | else => asm volatile ( |
| 121 | \\ syscall | 121 | \\ syscall |
| 122 | \\ retq | 122 | \\ retq |
| 123 | : | 123 | : |
| 124 | : [number] "{rax}" (@enumToInt(SYS.rt_sigreturn)), | 124 | : [number] "{rax}" (@intFromEnum(SYS.rt_sigreturn)), |
| 125 | : "rcx", "r11", "memory" | 125 | : "rcx", "r11", "memory" |
| 126 | ), | 126 | ), |
| 127 | } | 127 | } |
lib/std/os/plan9.zig+6-6| ... | @@ -10,7 +10,7 @@ pub const E = @import("plan9/errno.zig").E; | ... | @@ -10,7 +10,7 @@ pub const E = @import("plan9/errno.zig").E; |
| 10 | pub fn getErrno(r: usize) E { | 10 | pub fn getErrno(r: usize) E { |
| 11 | const signed_r = @bitCast(isize, r); | 11 | const signed_r = @bitCast(isize, r); |
| 12 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; | 12 | const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0; |
| 13 | return @intToEnum(E, int); | 13 | return @enumFromInt(E, int); |
| 14 | } | 14 | } |
| 15 | pub const SIG = struct { | 15 | pub const SIG = struct { |
| 16 | /// hangup | 16 | /// hangup |
| ... | @@ -133,19 +133,19 @@ pub const SYS = enum(usize) { | ... | @@ -133,19 +133,19 @@ pub const SYS = enum(usize) { |
| 133 | }; | 133 | }; |
| 134 | 134 | ||
| 135 | pub fn pwrite(fd: usize, buf: [*]const u8, count: usize, offset: usize) usize { | 135 | pub fn pwrite(fd: usize, buf: [*]const u8, count: usize, offset: usize) usize { |
| 136 | return syscall_bits.syscall4(.PWRITE, fd, @ptrToInt(buf), count, offset); | 136 | return syscall_bits.syscall4(.PWRITE, fd, @intFromPtr(buf), count, offset); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | pub fn pread(fd: usize, buf: [*]const u8, count: usize, offset: usize) usize { | 139 | pub fn pread(fd: usize, buf: [*]const u8, count: usize, offset: usize) usize { |
| 140 | return syscall_bits.syscall4(.PREAD, fd, @ptrToInt(buf), count, offset); | 140 | return syscall_bits.syscall4(.PREAD, fd, @intFromPtr(buf), count, offset); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | pub fn open(path: [*:0]const u8, omode: OpenMode) usize { | 143 | pub fn open(path: [*:0]const u8, omode: OpenMode) usize { |
| 144 | return syscall_bits.syscall2(.OPEN, @ptrToInt(path), @enumToInt(omode)); | 144 | return syscall_bits.syscall2(.OPEN, @intFromPtr(path), @intFromEnum(omode)); |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | pub fn create(path: [*:0]const u8, omode: OpenMode, perms: usize) usize { | 147 | pub fn create(path: [*:0]const u8, omode: OpenMode, perms: usize) usize { |
| 148 | return syscall_bits.syscall3(.CREATE, @ptrToInt(path), @enumToInt(omode), perms); | 148 | return syscall_bits.syscall3(.CREATE, @intFromPtr(path), @intFromEnum(omode), perms); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | pub fn exit(status: u8) noreturn { | 151 | pub fn exit(status: u8) noreturn { |
| ... | @@ -159,7 +159,7 @@ pub fn exit(status: u8) noreturn { | ... | @@ -159,7 +159,7 @@ pub fn exit(status: u8) noreturn { |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | pub fn exits(status: ?[*:0]const u8) noreturn { | 161 | pub fn exits(status: ?[*:0]const u8) noreturn { |
| 162 | _ = syscall_bits.syscall1(.EXITS, if (status) |s| @ptrToInt(s) else 0); | 162 | _ = syscall_bits.syscall1(.EXITS, if (status) |s| @intFromPtr(s) else 0); |
| 163 | unreachable; | 163 | unreachable; |
| 164 | } | 164 | } |
| 165 | 165 |
lib/std/os/plan9/x86_64.zig+4-4| ... | @@ -10,7 +10,7 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize { | ... | @@ -10,7 +10,7 @@ pub fn syscall1(sys: plan9.SYS, arg0: usize) usize { |
| 10 | \\pop %%r11 | 10 | \\pop %%r11 |
| 11 | : [ret] "={rax}" (-> usize), | 11 | : [ret] "={rax}" (-> usize), |
| 12 | : [arg0] "{r8}" (arg0), | 12 | : [arg0] "{r8}" (arg0), |
| 13 | [syscall_number] "{rbp}" (@enumToInt(sys)), | 13 | [syscall_number] "{rbp}" (@intFromEnum(sys)), |
| 14 | : "rcx", "rax", "rbp", "r11", "memory" | 14 | : "rcx", "rax", "rbp", "r11", "memory" |
| 15 | ); | 15 | ); |
| 16 | } | 16 | } |
| ... | @@ -26,7 +26,7 @@ pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { | ... | @@ -26,7 +26,7 @@ pub fn syscall2(sys: plan9.SYS, arg0: usize, arg1: usize) usize { |
| 26 | : [ret] "={rax}" (-> usize), | 26 | : [ret] "={rax}" (-> usize), |
| 27 | : [arg0] "{r8}" (arg0), | 27 | : [arg0] "{r8}" (arg0), |
| 28 | [arg1] "{r9}" (arg1), | 28 | [arg1] "{r9}" (arg1), |
| 29 | [syscall_number] "{rbp}" (@enumToInt(sys)), | 29 | [syscall_number] "{rbp}" (@intFromEnum(sys)), |
| 30 | : "rcx", "rax", "rbp", "r11", "memory" | 30 | : "rcx", "rax", "rbp", "r11", "memory" |
| 31 | ); | 31 | ); |
| 32 | } | 32 | } |
| ... | @@ -45,7 +45,7 @@ pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { | ... | @@ -45,7 +45,7 @@ pub fn syscall3(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize) usize { |
| 45 | : [arg0] "{r8}" (arg0), | 45 | : [arg0] "{r8}" (arg0), |
| 46 | [arg1] "{r9}" (arg1), | 46 | [arg1] "{r9}" (arg1), |
| 47 | [arg2] "{r10}" (arg2), | 47 | [arg2] "{r10}" (arg2), |
| 48 | [syscall_number] "{rbp}" (@enumToInt(sys)), | 48 | [syscall_number] "{rbp}" (@intFromEnum(sys)), |
| 49 | : "rcx", "rax", "rbp", "r11", "memory" | 49 | : "rcx", "rax", "rbp", "r11", "memory" |
| 50 | ); | 50 | ); |
| 51 | } | 51 | } |
| ... | @@ -67,7 +67,7 @@ pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usi | ... | @@ -67,7 +67,7 @@ pub fn syscall4(sys: plan9.SYS, arg0: usize, arg1: usize, arg2: usize, arg3: usi |
| 67 | [arg1] "{r9}" (arg1), | 67 | [arg1] "{r9}" (arg1), |
| 68 | [arg2] "{r10}" (arg2), | 68 | [arg2] "{r10}" (arg2), |
| 69 | [arg3] "{r11}" (arg3), | 69 | [arg3] "{r11}" (arg3), |
| 70 | [syscall_number] "{rbp}" (@enumToInt(sys)), | 70 | [syscall_number] "{rbp}" (@intFromEnum(sys)), |
| 71 | : "rcx", "rax", "rbp", "r11", "memory" | 71 | : "rcx", "rax", "rbp", "r11", "memory" |
| 72 | ); | 72 | ); |
| 73 | } | 73 | } |
lib/std/os/test.zig+10-10| ... | @@ -488,7 +488,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { | ... | @@ -488,7 +488,7 @@ fn iter_fn(info: *dl_phdr_info, size: usize, counter: *usize) IterFnError!void { |
| 488 | 488 | ||
| 489 | const reloc_addr = info.dlpi_addr + phdr.p_vaddr; | 489 | const reloc_addr = info.dlpi_addr + phdr.p_vaddr; |
| 490 | // Find the ELF header | 490 | // Find the ELF header |
| 491 | const elf_header = @intToPtr(*elf.Ehdr, reloc_addr - phdr.p_offset); | 491 | const elf_header = @ptrFromInt(*elf.Ehdr, reloc_addr - phdr.p_offset); |
| 492 | // Validate the magic | 492 | // Validate the magic |
| 493 | if (!mem.eql(u8, elf_header.e_ident[0..4], elf.MAGIC)) return error.BadElfMagic; | 493 | if (!mem.eql(u8, elf_header.e_ident[0..4], elf.MAGIC)) return error.BadElfMagic; |
| 494 | // Consistency check | 494 | // Consistency check |
| ... | @@ -751,7 +751,7 @@ test "getrlimit and setrlimit" { | ... | @@ -751,7 +751,7 @@ test "getrlimit and setrlimit" { |
| 751 | } | 751 | } |
| 752 | 752 | ||
| 753 | inline for (std.meta.fields(os.rlimit_resource)) |field| { | 753 | inline for (std.meta.fields(os.rlimit_resource)) |field| { |
| 754 | const resource = @intToEnum(os.rlimit_resource, field.value); | 754 | const resource = @enumFromInt(os.rlimit_resource, field.value); |
| 755 | const limit = try os.getrlimit(resource); | 755 | const limit = try os.getrlimit(resource); |
| 756 | 756 | ||
| 757 | // On 32 bit MIPS musl includes a fix which changes limits greater than -1UL/2 to RLIM_INFINITY. | 757 | // On 32 bit MIPS musl includes a fix which changes limits greater than -1UL/2 to RLIM_INFINITY. |
| ... | @@ -931,10 +931,10 @@ test "POSIX file locking with fcntl" { | ... | @@ -931,10 +931,10 @@ test "POSIX file locking with fcntl" { |
| 931 | 931 | ||
| 932 | // Place an exclusive lock on the first byte, and a shared lock on the second byte: | 932 | // Place an exclusive lock on the first byte, and a shared lock on the second byte: |
| 933 | var struct_flock = std.mem.zeroInit(os.Flock, .{ .type = os.F.WRLCK }); | 933 | var struct_flock = std.mem.zeroInit(os.Flock, .{ .type = os.F.WRLCK }); |
| 934 | _ = try os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock)); | 934 | _ = try os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock)); |
| 935 | struct_flock.start = 1; | 935 | struct_flock.start = 1; |
| 936 | struct_flock.type = os.F.RDLCK; | 936 | struct_flock.type = os.F.RDLCK; |
| 937 | _ = try os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock)); | 937 | _ = try os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock)); |
| 938 | 938 | ||
| 939 | // Check the locks in a child process: | 939 | // Check the locks in a child process: |
| 940 | const pid = try os.fork(); | 940 | const pid = try os.fork(); |
| ... | @@ -942,15 +942,15 @@ test "POSIX file locking with fcntl" { | ... | @@ -942,15 +942,15 @@ test "POSIX file locking with fcntl" { |
| 942 | // child expects be denied the exclusive lock: | 942 | // child expects be denied the exclusive lock: |
| 943 | struct_flock.start = 0; | 943 | struct_flock.start = 0; |
| 944 | struct_flock.type = os.F.WRLCK; | 944 | struct_flock.type = os.F.WRLCK; |
| 945 | try expectError(error.Locked, os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock))); | 945 | try expectError(error.Locked, os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock))); |
| 946 | // child expects to get the shared lock: | 946 | // child expects to get the shared lock: |
| 947 | struct_flock.start = 1; | 947 | struct_flock.start = 1; |
| 948 | struct_flock.type = os.F.RDLCK; | 948 | struct_flock.type = os.F.RDLCK; |
| 949 | _ = try os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock)); | 949 | _ = try os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock)); |
| 950 | // child waits for the exclusive lock in order to test deadlock: | 950 | // child waits for the exclusive lock in order to test deadlock: |
| 951 | struct_flock.start = 0; | 951 | struct_flock.start = 0; |
| 952 | struct_flock.type = os.F.WRLCK; | 952 | struct_flock.type = os.F.WRLCK; |
| 953 | _ = try os.fcntl(fd, os.F.SETLKW, @ptrToInt(&struct_flock)); | 953 | _ = try os.fcntl(fd, os.F.SETLKW, @intFromPtr(&struct_flock)); |
| 954 | // child exits without continuing: | 954 | // child exits without continuing: |
| 955 | os.exit(0); | 955 | os.exit(0); |
| 956 | } else { | 956 | } else { |
| ... | @@ -959,15 +959,15 @@ test "POSIX file locking with fcntl" { | ... | @@ -959,15 +959,15 @@ test "POSIX file locking with fcntl" { |
| 959 | // parent expects deadlock when attempting to upgrade the shared lock to exclusive: | 959 | // parent expects deadlock when attempting to upgrade the shared lock to exclusive: |
| 960 | struct_flock.start = 1; | 960 | struct_flock.start = 1; |
| 961 | struct_flock.type = os.F.WRLCK; | 961 | struct_flock.type = os.F.WRLCK; |
| 962 | try expectError(error.DeadLock, os.fcntl(fd, os.F.SETLKW, @ptrToInt(&struct_flock))); | 962 | try expectError(error.DeadLock, os.fcntl(fd, os.F.SETLKW, @intFromPtr(&struct_flock))); |
| 963 | // parent releases exclusive lock: | 963 | // parent releases exclusive lock: |
| 964 | struct_flock.start = 0; | 964 | struct_flock.start = 0; |
| 965 | struct_flock.type = os.F.UNLCK; | 965 | struct_flock.type = os.F.UNLCK; |
| 966 | _ = try os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock)); | 966 | _ = try os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock)); |
| 967 | // parent releases shared lock: | 967 | // parent releases shared lock: |
| 968 | struct_flock.start = 1; | 968 | struct_flock.start = 1; |
| 969 | struct_flock.type = os.F.UNLCK; | 969 | struct_flock.type = os.F.UNLCK; |
| 970 | _ = try os.fcntl(fd, os.F.SETLK, @ptrToInt(&struct_flock)); | 970 | _ = try os.fcntl(fd, os.F.SETLK, @intFromPtr(&struct_flock)); |
| 971 | // parent waits for child: | 971 | // parent waits for child: |
| 972 | const result = os.waitpid(pid, 0); | 972 | const result = os.waitpid(pid, 0); |
| 973 | try expect(result.status == 0 * 256); | 973 | try expect(result.status == 0 * 256); |
lib/std/os/uefi/pool_allocator.zig+2-2| ... | @@ -9,7 +9,7 @@ const Allocator = mem.Allocator; | ... | @@ -9,7 +9,7 @@ const Allocator = mem.Allocator; |
| 9 | 9 | ||
| 10 | const UefiPoolAllocator = struct { | 10 | const UefiPoolAllocator = struct { |
| 11 | fn getHeader(ptr: [*]u8) *[*]align(8) u8 { | 11 | fn getHeader(ptr: [*]u8) *[*]align(8) u8 { |
| 12 | return @intToPtr(*[*]align(8) u8, @ptrToInt(ptr) - @sizeOf(usize)); | 12 | return @ptrFromInt(*[*]align(8) u8, @intFromPtr(ptr) - @sizeOf(usize)); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | fn alloc( | 15 | fn alloc( |
| ... | @@ -31,7 +31,7 @@ const UefiPoolAllocator = struct { | ... | @@ -31,7 +31,7 @@ const UefiPoolAllocator = struct { |
| 31 | var unaligned_ptr: [*]align(8) u8 = undefined; | 31 | var unaligned_ptr: [*]align(8) u8 = undefined; |
| 32 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .Success) return null; | 32 | if (uefi.system_table.boot_services.?.allocatePool(uefi.efi_pool_memory_type, full_len, &unaligned_ptr) != .Success) return null; |
| 33 | 33 | ||
| 34 | const unaligned_addr = @ptrToInt(unaligned_ptr); | 34 | const unaligned_addr = @intFromPtr(unaligned_ptr); |
| 35 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align); | 35 | const aligned_addr = mem.alignForward(usize, unaligned_addr + @sizeOf(usize), ptr_align); |
| 36 | 36 | ||
| 37 | var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); | 37 | var aligned_ptr = unaligned_ptr + (aligned_addr - unaligned_addr); |
lib/std/os/uefi/protocols/device_path_protocol.zig+3-3| ... | @@ -23,7 +23,7 @@ pub const DevicePathProtocol = extern struct { | ... | @@ -23,7 +23,7 @@ pub const DevicePathProtocol = extern struct { |
| 23 | 23 | ||
| 24 | /// Returns the next DevicePathProtocol node in the sequence, if any. | 24 | /// Returns the next DevicePathProtocol node in the sequence, if any. |
| 25 | pub fn next(self: *DevicePathProtocol) ?*DevicePathProtocol { | 25 | pub fn next(self: *DevicePathProtocol) ?*DevicePathProtocol { |
| 26 | if (self.type == .End and @intToEnum(EndDevicePath.Subtype, self.subtype) == .EndEntire) | 26 | if (self.type == .End and @enumFromInt(EndDevicePath.Subtype, self.subtype) == .EndEntire) |
| 27 | return null; | 27 | return null; |
| 28 | 28 | ||
| 29 | return @ptrCast(*DevicePathProtocol, @ptrCast([*]u8, self) + self.length); | 29 | return @ptrCast(*DevicePathProtocol, @ptrCast([*]u8, self) + self.length); |
| ... | @@ -37,7 +37,7 @@ pub const DevicePathProtocol = extern struct { | ... | @@ -37,7 +37,7 @@ pub const DevicePathProtocol = extern struct { |
| 37 | node = next_node; | 37 | node = next_node; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | return (@ptrToInt(node) + node.length) - @ptrToInt(self); | 40 | return (@intFromPtr(node) + node.length) - @intFromPtr(self); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | /// Creates a file device path from the existing device path and a file path. | 43 | /// Creates a file device path from the existing device path and a file path. |
| ... | @@ -99,7 +99,7 @@ pub const DevicePathProtocol = extern struct { | ... | @@ -99,7 +99,7 @@ pub const DevicePathProtocol = extern struct { |
| 99 | 99 | ||
| 100 | inline for (type_info.fields) |subtype| { | 100 | inline for (type_info.fields) |subtype| { |
| 101 | // The tag names match the union names, so just grab that off the enum | 101 | // The tag names match the union names, so just grab that off the enum |
| 102 | const tag_val: u8 = @enumToInt(@field(TTag, subtype.name)); | 102 | const tag_val: u8 = @intFromEnum(@field(TTag, subtype.name)); |
| 103 | 103 | ||
| 104 | if (self.subtype == tag_val) { | 104 | if (self.subtype == tag_val) { |
| 105 | // e.g. expr = .{ .Pci = @ptrCast(...) } | 105 | // e.g. expr = .{ .Pci = @ptrCast(...) } |
lib/std/os/windows.zig+19-19| ... | @@ -30,7 +30,7 @@ pub const gdi32 = @import("windows/gdi32.zig"); | ... | @@ -30,7 +30,7 @@ pub const gdi32 = @import("windows/gdi32.zig"); |
| 30 | pub const winmm = @import("windows/winmm.zig"); | 30 | pub const winmm = @import("windows/winmm.zig"); |
| 31 | pub const crypt32 = @import("windows/crypt32.zig"); | 31 | pub const crypt32 = @import("windows/crypt32.zig"); |
| 32 | 32 | ||
| 33 | pub const self_process_handle = @intToPtr(HANDLE, maxInt(usize)); | 33 | pub const self_process_handle = @ptrFromInt(HANDLE, maxInt(usize)); |
| 34 | 34 | ||
| 35 | const Self = @This(); | 35 | const Self = @This(); |
| 36 | 36 | ||
| ... | @@ -242,7 +242,7 @@ pub fn DeviceIoControl( | ... | @@ -242,7 +242,7 @@ pub fn DeviceIoControl( |
| 242 | 242 | ||
| 243 | pub fn GetOverlappedResult(h: HANDLE, overlapped: *OVERLAPPED, wait: bool) !DWORD { | 243 | pub fn GetOverlappedResult(h: HANDLE, overlapped: *OVERLAPPED, wait: bool) !DWORD { |
| 244 | var bytes: DWORD = undefined; | 244 | var bytes: DWORD = undefined; |
| 245 | if (kernel32.GetOverlappedResult(h, overlapped, &bytes, @boolToInt(wait)) == 0) { | 245 | if (kernel32.GetOverlappedResult(h, overlapped, &bytes, @intFromBool(wait)) == 0) { |
| 246 | switch (kernel32.GetLastError()) { | 246 | switch (kernel32.GetLastError()) { |
| 247 | .IO_INCOMPLETE => if (!wait) return error.WouldBlock else unreachable, | 247 | .IO_INCOMPLETE => if (!wait) return error.WouldBlock else unreachable, |
| 248 | else => |err| return unexpectedError(err), | 248 | else => |err| return unexpectedError(err), |
| ... | @@ -294,7 +294,7 @@ pub fn WaitForSingleObject(handle: HANDLE, milliseconds: DWORD) WaitForSingleObj | ... | @@ -294,7 +294,7 @@ pub fn WaitForSingleObject(handle: HANDLE, milliseconds: DWORD) WaitForSingleObj |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | pub fn WaitForSingleObjectEx(handle: HANDLE, milliseconds: DWORD, alertable: bool) WaitForSingleObjectError!void { | 296 | pub fn WaitForSingleObjectEx(handle: HANDLE, milliseconds: DWORD, alertable: bool) WaitForSingleObjectError!void { |
| 297 | switch (kernel32.WaitForSingleObjectEx(handle, milliseconds, @boolToInt(alertable))) { | 297 | switch (kernel32.WaitForSingleObjectEx(handle, milliseconds, @intFromBool(alertable))) { |
| 298 | WAIT_ABANDONED => return error.WaitAbandoned, | 298 | WAIT_ABANDONED => return error.WaitAbandoned, |
| 299 | WAIT_OBJECT_0 => return, | 299 | WAIT_OBJECT_0 => return, |
| 300 | WAIT_TIMEOUT => return error.WaitTimeOut, | 300 | WAIT_TIMEOUT => return error.WaitTimeOut, |
| ... | @@ -311,9 +311,9 @@ pub fn WaitForMultipleObjectsEx(handles: []const HANDLE, waitAll: bool, millisec | ... | @@ -311,9 +311,9 @@ pub fn WaitForMultipleObjectsEx(handles: []const HANDLE, waitAll: bool, millisec |
| 311 | switch (kernel32.WaitForMultipleObjectsEx( | 311 | switch (kernel32.WaitForMultipleObjectsEx( |
| 312 | nCount, | 312 | nCount, |
| 313 | handles.ptr, | 313 | handles.ptr, |
| 314 | @boolToInt(waitAll), | 314 | @intFromBool(waitAll), |
| 315 | milliseconds, | 315 | milliseconds, |
| 316 | @boolToInt(alertable), | 316 | @intFromBool(alertable), |
| 317 | )) { | 317 | )) { |
| 318 | WAIT_OBJECT_0...WAIT_OBJECT_0 + MAXIMUM_WAIT_OBJECTS => |n| { | 318 | WAIT_OBJECT_0...WAIT_OBJECT_0 + MAXIMUM_WAIT_OBJECTS => |n| { |
| 319 | const handle_index = n - WAIT_OBJECT_0; | 319 | const handle_index = n - WAIT_OBJECT_0; |
| ... | @@ -422,7 +422,7 @@ pub fn GetQueuedCompletionStatusEx( | ... | @@ -422,7 +422,7 @@ pub fn GetQueuedCompletionStatusEx( |
| 422 | @intCast(ULONG, completion_port_entries.len), | 422 | @intCast(ULONG, completion_port_entries.len), |
| 423 | &num_entries_removed, | 423 | &num_entries_removed, |
| 424 | timeout_ms orelse INFINITE, | 424 | timeout_ms orelse INFINITE, |
| 425 | @boolToInt(alertable), | 425 | @intFromBool(alertable), |
| 426 | ); | 426 | ); |
| 427 | 427 | ||
| 428 | if (success == FALSE) { | 428 | if (success == FALSE) { |
| ... | @@ -1106,7 +1106,7 @@ test "QueryObjectName" { | ... | @@ -1106,7 +1106,7 @@ test "QueryObjectName" { |
| 1106 | var out_buffer: [PATH_MAX_WIDE]u16 = undefined; | 1106 | var out_buffer: [PATH_MAX_WIDE]u16 = undefined; |
| 1107 | 1107 | ||
| 1108 | var result_path = try QueryObjectName(handle, &out_buffer); | 1108 | var result_path = try QueryObjectName(handle, &out_buffer); |
| 1109 | const required_len_in_u16 = result_path.len + @divExact(@ptrToInt(result_path.ptr) - @ptrToInt(&out_buffer), 2) + 1; | 1109 | const required_len_in_u16 = result_path.len + @divExact(@intFromPtr(result_path.ptr) - @intFromPtr(&out_buffer), 2) + 1; |
| 1110 | //insufficient size | 1110 | //insufficient size |
| 1111 | try std.testing.expectError(error.NameTooLong, QueryObjectName(handle, out_buffer[0 .. required_len_in_u16 - 1])); | 1111 | try std.testing.expectError(error.NameTooLong, QueryObjectName(handle, out_buffer[0 .. required_len_in_u16 - 1])); |
| 1112 | //exactly-sufficient size | 1112 | //exactly-sufficient size |
| ... | @@ -1263,7 +1263,7 @@ test "GetFinalPathNameByHandle" { | ... | @@ -1263,7 +1263,7 @@ test "GetFinalPathNameByHandle" { |
| 1263 | const nt_path = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, &buffer); | 1263 | const nt_path = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, &buffer); |
| 1264 | _ = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, &buffer); | 1264 | _ = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, &buffer); |
| 1265 | 1265 | ||
| 1266 | const required_len_in_u16 = nt_path.len + @divExact(@ptrToInt(nt_path.ptr) - @ptrToInt(&buffer), 2) + 1; | 1266 | const required_len_in_u16 = nt_path.len + @divExact(@intFromPtr(nt_path.ptr) - @intFromPtr(&buffer), 2) + 1; |
| 1267 | //check with insufficient size | 1267 | //check with insufficient size |
| 1268 | try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, buffer[0 .. required_len_in_u16 - 1])); | 1268 | try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, buffer[0 .. required_len_in_u16 - 1])); |
| 1269 | try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, buffer[0 .. required_len_in_u16 - 1])); | 1269 | try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, buffer[0 .. required_len_in_u16 - 1])); |
| ... | @@ -1313,7 +1313,7 @@ pub fn WSAStartup(majorVersion: u8, minorVersion: u8) !ws2_32.WSADATA { | ... | @@ -1313,7 +1313,7 @@ pub fn WSAStartup(majorVersion: u8, minorVersion: u8) !ws2_32.WSADATA { |
| 1313 | var wsadata: ws2_32.WSADATA = undefined; | 1313 | var wsadata: ws2_32.WSADATA = undefined; |
| 1314 | return switch (ws2_32.WSAStartup((@as(WORD, minorVersion) << 8) | majorVersion, &wsadata)) { | 1314 | return switch (ws2_32.WSAStartup((@as(WORD, minorVersion) << 8) | majorVersion, &wsadata)) { |
| 1315 | 0 => wsadata, | 1315 | 0 => wsadata, |
| 1316 | else => |err_int| switch (@intToEnum(ws2_32.WinsockError, @intCast(u16, err_int))) { | 1316 | else => |err_int| switch (@enumFromInt(ws2_32.WinsockError, @intCast(u16, err_int))) { |
| 1317 | .WSASYSNOTREADY => return error.SystemNotAvailable, | 1317 | .WSASYSNOTREADY => return error.SystemNotAvailable, |
| 1318 | .WSAVERNOTSUPPORTED => return error.VersionNotSupported, | 1318 | .WSAVERNOTSUPPORTED => return error.VersionNotSupported, |
| 1319 | .WSAEINPROGRESS => return error.BlockingOperationInProgress, | 1319 | .WSAEINPROGRESS => return error.BlockingOperationInProgress, |
| ... | @@ -2286,7 +2286,7 @@ pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid: | ... | @@ -2286,7 +2286,7 @@ pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid: |
| 2286 | ws2_32.SIO_GET_EXTENSION_FUNCTION_POINTER, | 2286 | ws2_32.SIO_GET_EXTENSION_FUNCTION_POINTER, |
| 2287 | @ptrCast(*const anyopaque, &guid), | 2287 | @ptrCast(*const anyopaque, &guid), |
| 2288 | @sizeOf(GUID), | 2288 | @sizeOf(GUID), |
| 2289 | @intToPtr(?*anyopaque, @ptrToInt(&function)), | 2289 | @ptrFromInt(?*anyopaque, @intFromPtr(&function)), |
| 2290 | @sizeOf(T), | 2290 | @sizeOf(T), |
| 2291 | &num_bytes, | 2291 | &num_bytes, |
| 2292 | null, | 2292 | null, |
| ... | @@ -2325,21 +2325,21 @@ pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError { | ... | @@ -2325,21 +2325,21 @@ pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError { |
| 2325 | null, | 2325 | null, |
| 2326 | ); | 2326 | ); |
| 2327 | _ = std.unicode.utf16leToUtf8(&buf_utf8, buf_wstr[0..len]) catch unreachable; | 2327 | _ = std.unicode.utf16leToUtf8(&buf_utf8, buf_wstr[0..len]) catch unreachable; |
| 2328 | std.debug.print("error.Unexpected: GetLastError({}): {s}\n", .{ @enumToInt(err), buf_utf8[0..len] }); | 2328 | std.debug.print("error.Unexpected: GetLastError({}): {s}\n", .{ @intFromEnum(err), buf_utf8[0..len] }); |
| 2329 | std.debug.dumpCurrentStackTrace(@returnAddress()); | 2329 | std.debug.dumpCurrentStackTrace(@returnAddress()); |
| 2330 | } | 2330 | } |
| 2331 | return error.Unexpected; | 2331 | return error.Unexpected; |
| 2332 | } | 2332 | } |
| 2333 | 2333 | ||
| 2334 | pub fn unexpectedWSAError(err: ws2_32.WinsockError) std.os.UnexpectedError { | 2334 | pub fn unexpectedWSAError(err: ws2_32.WinsockError) std.os.UnexpectedError { |
| 2335 | return unexpectedError(@intToEnum(Win32Error, @enumToInt(err))); | 2335 | return unexpectedError(@enumFromInt(Win32Error, @intFromEnum(err))); |
| 2336 | } | 2336 | } |
| 2337 | 2337 | ||
| 2338 | /// Call this when you made a windows NtDll call | 2338 | /// Call this when you made a windows NtDll call |
| 2339 | /// and you get an unexpected status. | 2339 | /// and you get an unexpected status. |
| 2340 | pub fn unexpectedStatus(status: NTSTATUS) std.os.UnexpectedError { | 2340 | pub fn unexpectedStatus(status: NTSTATUS) std.os.UnexpectedError { |
| 2341 | if (std.os.unexpected_error_tracing) { | 2341 | if (std.os.unexpected_error_tracing) { |
| 2342 | std.debug.print("error.Unexpected NTSTATUS=0x{x}\n", .{@enumToInt(status)}); | 2342 | std.debug.print("error.Unexpected NTSTATUS=0x{x}\n", .{@intFromEnum(status)}); |
| 2343 | std.debug.dumpCurrentStackTrace(@returnAddress()); | 2343 | std.debug.dumpCurrentStackTrace(@returnAddress()); |
| 2344 | } | 2344 | } |
| 2345 | return error.Unexpected; | 2345 | return error.Unexpected; |
| ... | @@ -2527,10 +2527,10 @@ pub fn CTL_CODE(deviceType: u16, function: u12, method: TransferType, access: u2 | ... | @@ -2527,10 +2527,10 @@ pub fn CTL_CODE(deviceType: u16, function: u12, method: TransferType, access: u2 |
| 2527 | return (@as(DWORD, deviceType) << 16) | | 2527 | return (@as(DWORD, deviceType) << 16) | |
| 2528 | (@as(DWORD, access) << 14) | | 2528 | (@as(DWORD, access) << 14) | |
| 2529 | (@as(DWORD, function) << 2) | | 2529 | (@as(DWORD, function) << 2) | |
| 2530 | @enumToInt(method); | 2530 | @intFromEnum(method); |
| 2531 | } | 2531 | } |
| 2532 | 2532 | ||
| 2533 | pub const INVALID_HANDLE_VALUE = @intToPtr(HANDLE, maxInt(usize)); | 2533 | pub const INVALID_HANDLE_VALUE = @ptrFromInt(HANDLE, maxInt(usize)); |
| 2534 | 2534 | ||
| 2535 | pub const INVALID_FILE_ATTRIBUTES = @as(DWORD, maxInt(DWORD)); | 2535 | pub const INVALID_FILE_ATTRIBUTES = @as(DWORD, maxInt(DWORD)); |
| 2536 | 2536 | ||
| ... | @@ -3221,7 +3221,7 @@ pub const LSTATUS = LONG; | ... | @@ -3221,7 +3221,7 @@ pub const LSTATUS = LONG; |
| 3221 | 3221 | ||
| 3222 | pub const HKEY = *opaque {}; | 3222 | pub const HKEY = *opaque {}; |
| 3223 | 3223 | ||
| 3224 | pub const HKEY_LOCAL_MACHINE: HKEY = @intToPtr(HKEY, 0x80000002); | 3224 | pub const HKEY_LOCAL_MACHINE: HKEY = @ptrFromInt(HKEY, 0x80000002); |
| 3225 | 3225 | ||
| 3226 | /// Combines the STANDARD_RIGHTS_REQUIRED, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, | 3226 | /// Combines the STANDARD_RIGHTS_REQUIRED, KEY_QUERY_VALUE, KEY_SET_VALUE, KEY_CREATE_SUB_KEY, |
| 3227 | /// KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, and KEY_CREATE_LINK access rights. | 3227 | /// KEY_ENUMERATE_SUB_KEYS, KEY_NOTIFY, and KEY_CREATE_LINK access rights. |
| ... | @@ -4685,11 +4685,11 @@ pub const KUSER_SHARED_DATA = extern struct { | ... | @@ -4685,11 +4685,11 @@ pub const KUSER_SHARED_DATA = extern struct { |
| 4685 | /// Read-only user-mode address for the shared data. | 4685 | /// Read-only user-mode address for the shared data. |
| 4686 | /// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm | 4686 | /// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/ntexapi_x/kuser_shared_data/index.htm |
| 4687 | /// https://msrc-blog.microsoft.com/2022/04/05/randomizing-the-kuser_shared_data-structure-on-windows/ | 4687 | /// https://msrc-blog.microsoft.com/2022/04/05/randomizing-the-kuser_shared_data-structure-on-windows/ |
| 4688 | pub const SharedUserData: *const KUSER_SHARED_DATA = @intToPtr(*const KUSER_SHARED_DATA, 0x7FFE0000); | 4688 | pub const SharedUserData: *const KUSER_SHARED_DATA = @ptrFromInt(*const KUSER_SHARED_DATA, 0x7FFE0000); |
| 4689 | 4689 | ||
| 4690 | pub fn IsProcessorFeaturePresent(feature: PF) bool { | 4690 | pub fn IsProcessorFeaturePresent(feature: PF) bool { |
| 4691 | if (@enumToInt(feature) >= PROCESSOR_FEATURE_MAX) return false; | 4691 | if (@intFromEnum(feature) >= PROCESSOR_FEATURE_MAX) return false; |
| 4692 | return SharedUserData.ProcessorFeatures[@enumToInt(feature)] == 1; | 4692 | return SharedUserData.ProcessorFeatures[@intFromEnum(feature)] == 1; |
| 4693 | } | 4693 | } |
| 4694 | 4694 | ||
| 4695 | pub const TH32CS_SNAPHEAPLIST = 0x00000001; | 4695 | pub const TH32CS_SNAPHEAPLIST = 0x00000001; |
lib/std/os/windows/user32.zig+1-1| ... | @@ -1350,7 +1350,7 @@ pub extern "user32" fn AdjustWindowRectEx(lpRect: *RECT, dwStyle: DWORD, bMenu: | ... | @@ -1350,7 +1350,7 @@ pub extern "user32" fn AdjustWindowRectEx(lpRect: *RECT, dwStyle: DWORD, bMenu: |
| 1350 | pub fn adjustWindowRectEx(lpRect: *RECT, dwStyle: u32, bMenu: bool, dwExStyle: u32) !void { | 1350 | pub fn adjustWindowRectEx(lpRect: *RECT, dwStyle: u32, bMenu: bool, dwExStyle: u32) !void { |
| 1351 | assert(dwStyle & WS_OVERLAPPED == 0); | 1351 | assert(dwStyle & WS_OVERLAPPED == 0); |
| 1352 | 1352 | ||
| 1353 | if (AdjustWindowRectEx(lpRect, dwStyle, @boolToInt(bMenu), dwExStyle) == 0) { | 1353 | if (AdjustWindowRectEx(lpRect, dwStyle, @intFromBool(bMenu), dwExStyle) == 0) { |
| 1354 | switch (GetLastError()) { | 1354 | switch (GetLastError()) { |
| 1355 | .INVALID_PARAMETER => unreachable, | 1355 | .INVALID_PARAMETER => unreachable, |
| 1356 | else => |err| return windows.unexpectedError(err), | 1356 | else => |err| return windows.unexpectedError(err), |
lib/std/os/windows/ws2_32.zig+1-1| ... | @@ -21,7 +21,7 @@ const LPARAM = windows.LPARAM; | ... | @@ -21,7 +21,7 @@ const LPARAM = windows.LPARAM; |
| 21 | const FARPROC = windows.FARPROC; | 21 | const FARPROC = windows.FARPROC; |
| 22 | 22 | ||
| 23 | pub const SOCKET = *opaque {}; | 23 | pub const SOCKET = *opaque {}; |
| 24 | pub const INVALID_SOCKET = @intToPtr(SOCKET, ~@as(usize, 0)); | 24 | pub const INVALID_SOCKET = @ptrFromInt(SOCKET, ~@as(usize, 0)); |
| 25 | 25 | ||
| 26 | pub const GROUP = u32; | 26 | pub const GROUP = u32; |
| 27 | pub const ADDRESS_FAMILY = u16; | 27 | pub const ADDRESS_FAMILY = u16; |
lib/std/pdb.zig+1-1| ... | @@ -863,7 +863,7 @@ pub const Pdb = struct { | ... | @@ -863,7 +863,7 @@ pub const Pdb = struct { |
| 863 | } | 863 | } |
| 864 | 864 | ||
| 865 | pub fn getStream(self: *Pdb, stream: StreamType) ?*MsfStream { | 865 | pub fn getStream(self: *Pdb, stream: StreamType) ?*MsfStream { |
| 866 | const id = @enumToInt(stream); | 866 | const id = @intFromEnum(stream); |
| 867 | return self.getStreamById(id); | 867 | return self.getStreamById(id); |
| 868 | } | 868 | } |
| 869 | }; | 869 | }; |
lib/std/process.zig+4-4| ... | @@ -514,9 +514,9 @@ pub const ArgIteratorWasi = struct { | ... | @@ -514,9 +514,9 @@ pub const ArgIteratorWasi = struct { |
| 514 | /// Call to free the internal buffer of the iterator. | 514 | /// Call to free the internal buffer of the iterator. |
| 515 | pub fn deinit(self: *ArgIteratorWasi) void { | 515 | pub fn deinit(self: *ArgIteratorWasi) void { |
| 516 | const last_item = self.args[self.args.len - 1]; | 516 | const last_item = self.args[self.args.len - 1]; |
| 517 | const last_byte_addr = @ptrToInt(last_item.ptr) + last_item.len + 1; // null terminated | 517 | const last_byte_addr = @intFromPtr(last_item.ptr) + last_item.len + 1; // null terminated |
| 518 | const first_item_ptr = self.args[0].ptr; | 518 | const first_item_ptr = self.args[0].ptr; |
| 519 | const len = last_byte_addr - @ptrToInt(first_item_ptr); | 519 | const len = last_byte_addr - @intFromPtr(first_item_ptr); |
| 520 | self.allocator.free(first_item_ptr[0..len]); | 520 | self.allocator.free(first_item_ptr[0..len]); |
| 521 | self.allocator.free(self.args); | 521 | self.allocator.free(self.args); |
| 522 | } | 522 | } |
| ... | @@ -1079,9 +1079,9 @@ pub fn getBaseAddress() usize { | ... | @@ -1079,9 +1079,9 @@ pub fn getBaseAddress() usize { |
| 1079 | return phdr - @sizeOf(std.elf.Ehdr); | 1079 | return phdr - @sizeOf(std.elf.Ehdr); |
| 1080 | }, | 1080 | }, |
| 1081 | .macos, .freebsd, .netbsd => { | 1081 | .macos, .freebsd, .netbsd => { |
| 1082 | return @ptrToInt(&std.c._mh_execute_header); | 1082 | return @intFromPtr(&std.c._mh_execute_header); |
| 1083 | }, | 1083 | }, |
| 1084 | .windows => return @ptrToInt(os.windows.kernel32.GetModuleHandleW(null)), | 1084 | .windows => return @intFromPtr(os.windows.kernel32.GetModuleHandleW(null)), |
| 1085 | else => @compileError("Unsupported OS"), | 1085 | else => @compileError("Unsupported OS"), |
| 1086 | } | 1086 | } |
| 1087 | } | 1087 | } |
lib/std/rand/benchmark.zig+2-2| ... | @@ -91,8 +91,8 @@ pub fn benchmark(comptime H: anytype, bytes: usize, comptime block_size: usize) | ... | @@ -91,8 +91,8 @@ pub fn benchmark(comptime H: anytype, bytes: usize, comptime block_size: usize) |
| 91 | } | 91 | } |
| 92 | const end = timer.read(); | 92 | const end = timer.read(); |
| 93 | 93 | ||
| 94 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 94 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 95 | const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); | 95 | const throughput = @intFromFloat(u64, @floatFromInt(f64, bytes) / elapsed_s); |
| 96 | 96 | ||
| 97 | std.debug.assert(rng.random().int(u64) != 0); | 97 | std.debug.assert(rng.random().int(u64) != 0); |
| 98 | 98 |
lib/std/rand/test.zig+6-6| ... | @@ -332,13 +332,13 @@ test "Random float chi-square goodness of fit" { | ... | @@ -332,13 +332,13 @@ test "Random float chi-square goodness of fit" { |
| 332 | while (i < num_numbers) : (i += 1) { | 332 | while (i < num_numbers) : (i += 1) { |
| 333 | const rand_f32 = random.float(f32); | 333 | const rand_f32 = random.float(f32); |
| 334 | const rand_f64 = random.float(f64); | 334 | const rand_f64 = random.float(f64); |
| 335 | var f32_put = try f32_hist.getOrPut(@floatToInt(u32, rand_f32 * @intToFloat(f32, num_buckets))); | 335 | var f32_put = try f32_hist.getOrPut(@intFromFloat(u32, rand_f32 * @floatFromInt(f32, num_buckets))); |
| 336 | if (f32_put.found_existing) { | 336 | if (f32_put.found_existing) { |
| 337 | f32_put.value_ptr.* += 1; | 337 | f32_put.value_ptr.* += 1; |
| 338 | } else { | 338 | } else { |
| 339 | f32_put.value_ptr.* = 1; | 339 | f32_put.value_ptr.* = 1; |
| 340 | } | 340 | } |
| 341 | var f64_put = try f64_hist.getOrPut(@floatToInt(u32, rand_f64 * @intToFloat(f64, num_buckets))); | 341 | var f64_put = try f64_hist.getOrPut(@intFromFloat(u32, rand_f64 * @floatFromInt(f64, num_buckets))); |
| 342 | if (f64_put.found_existing) { | 342 | if (f64_put.found_existing) { |
| 343 | f64_put.value_ptr.* += 1; | 343 | f64_put.value_ptr.* += 1; |
| 344 | } else { | 344 | } else { |
| ... | @@ -352,8 +352,8 @@ test "Random float chi-square goodness of fit" { | ... | @@ -352,8 +352,8 @@ test "Random float chi-square goodness of fit" { |
| 352 | { | 352 | { |
| 353 | var j: u32 = 0; | 353 | var j: u32 = 0; |
| 354 | while (j < num_buckets) : (j += 1) { | 354 | while (j < num_buckets) : (j += 1) { |
| 355 | const count = @intToFloat(f64, (if (f32_hist.get(j)) |v| v else 0)); | 355 | const count = @floatFromInt(f64, (if (f32_hist.get(j)) |v| v else 0)); |
| 356 | const expected = @intToFloat(f64, num_numbers) / @intToFloat(f64, num_buckets); | 356 | const expected = @floatFromInt(f64, num_numbers) / @floatFromInt(f64, num_buckets); |
| 357 | const delta = count - expected; | 357 | const delta = count - expected; |
| 358 | const variance = (delta * delta) / expected; | 358 | const variance = (delta * delta) / expected; |
| 359 | f32_total_variance += variance; | 359 | f32_total_variance += variance; |
| ... | @@ -363,8 +363,8 @@ test "Random float chi-square goodness of fit" { | ... | @@ -363,8 +363,8 @@ test "Random float chi-square goodness of fit" { |
| 363 | { | 363 | { |
| 364 | var j: u64 = 0; | 364 | var j: u64 = 0; |
| 365 | while (j < num_buckets) : (j += 1) { | 365 | while (j < num_buckets) : (j += 1) { |
| 366 | const count = @intToFloat(f64, (if (f64_hist.get(j)) |v| v else 0)); | 366 | const count = @floatFromInt(f64, (if (f64_hist.get(j)) |v| v else 0)); |
| 367 | const expected = @intToFloat(f64, num_numbers) / @intToFloat(f64, num_buckets); | 367 | const expected = @floatFromInt(f64, num_numbers) / @floatFromInt(f64, num_buckets); |
| 368 | const delta = count - expected; | 368 | const delta = count - expected; |
| 369 | const variance = (delta * delta) / expected; | 369 | const variance = (delta * delta) / expected; |
| 370 | f64_total_variance += variance; | 370 | f64_total_variance += variance; |
lib/std/simd.zig+2-2| ... | @@ -61,7 +61,7 @@ pub fn suggestVectorSize(comptime T: type) ?usize { | ... | @@ -61,7 +61,7 @@ pub fn suggestVectorSize(comptime T: type) ?usize { |
| 61 | 61 | ||
| 62 | test "suggestVectorSizeForCpu works with signed and unsigned values" { | 62 | test "suggestVectorSizeForCpu works with signed and unsigned values" { |
| 63 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64); | 63 | comptime var cpu = std.Target.Cpu.baseline(std.Target.Cpu.Arch.x86_64); |
| 64 | comptime cpu.features.addFeature(@enumToInt(std.Target.x86.Feature.avx512f)); | 64 | comptime cpu.features.addFeature(@intFromEnum(std.Target.x86.Feature.avx512f)); |
| 65 | const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?; | 65 | const signed_integer_size = suggestVectorSizeForCpu(i32, cpu).?; |
| 66 | const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?; | 66 | const unsigned_integer_size = suggestVectorSizeForCpu(u32, cpu).?; |
| 67 | try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size); | 67 | try std.testing.expectEqual(@as(usize, 16), unsigned_integer_size); |
| ... | @@ -94,7 +94,7 @@ pub inline fn iota(comptime T: type, comptime len: usize) @Vector(len, T) { | ... | @@ -94,7 +94,7 @@ pub inline fn iota(comptime T: type, comptime len: usize) @Vector(len, T) { |
| 94 | for (&out, 0..) |*element, i| { | 94 | for (&out, 0..) |*element, i| { |
| 95 | element.* = switch (@typeInfo(T)) { | 95 | element.* = switch (@typeInfo(T)) { |
| 96 | .Int => @intCast(T, i), | 96 | .Int => @intCast(T, i), |
| 97 | .Float => @intToFloat(T, i), | 97 | .Float => @floatFromInt(T, i), |
| 98 | else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."), | 98 | else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."), |
| 99 | }; | 99 | }; |
| 100 | } | 100 | } |
lib/std/sort.zig+1-1| ... | @@ -96,7 +96,7 @@ fn siftDown(a: usize, root: usize, n: usize, context: anytype) void { | ... | @@ -96,7 +96,7 @@ fn siftDown(a: usize, root: usize, n: usize, context: anytype) void { |
| 96 | if (child >= n) break; | 96 | if (child >= n) break; |
| 97 | 97 | ||
| 98 | // choose the greater child. | 98 | // choose the greater child. |
| 99 | child += @boolToInt(child + 1 < n and context.lessThan(child, child + 1)); | 99 | child += @intFromBool(child + 1 < n and context.lessThan(child, child + 1)); |
| 100 | 100 | ||
| 101 | // stop if the invariant holds at `node`. | 101 | // stop if the invariant holds at `node`. |
| 102 | if (!context.lessThan(node, child)) break; | 102 | if (!context.lessThan(node, child)) break; |
lib/std/start.zig+3-3| ... | @@ -248,7 +248,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv | ... | @@ -248,7 +248,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv |
| 248 | return root.main(); | 248 | return root.main(); |
| 249 | }, | 249 | }, |
| 250 | uefi.Status => { | 250 | uefi.Status => { |
| 251 | return @enumToInt(root.main()); | 251 | return @intFromEnum(root.main()); |
| 252 | }, | 252 | }, |
| 253 | else => @compileError("expected return type of main to be 'void', 'noreturn', 'usize', or 'std.os.uefi.Status'"), | 253 | else => @compileError("expected return type of main to be 'void', 'noreturn', 'usize', or 'std.os.uefi.Status'"), |
| 254 | } | 254 | } |
| ... | @@ -419,7 +419,7 @@ fn posixCallMainAndExit() callconv(.C) noreturn { | ... | @@ -419,7 +419,7 @@ fn posixCallMainAndExit() callconv(.C) noreturn { |
| 419 | else => continue, | 419 | else => continue, |
| 420 | } | 420 | } |
| 421 | } | 421 | } |
| 422 | break :init @intToPtr([*]elf.Phdr, at_phdr)[0..at_phnum]; | 422 | break :init @ptrFromInt([*]elf.Phdr, at_phdr)[0..at_phnum]; |
| 423 | }; | 423 | }; |
| 424 | 424 | ||
| 425 | // Apply the initial relocations as early as possible in the startup | 425 | // Apply the initial relocations as early as possible in the startup |
| ... | @@ -500,7 +500,7 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal | ... | @@ -500,7 +500,7 @@ fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]c_char) cal |
| 500 | if (builtin.os.tag == .linux) { | 500 | if (builtin.os.tag == .linux) { |
| 501 | const at_phdr = std.c.getauxval(elf.AT_PHDR); | 501 | const at_phdr = std.c.getauxval(elf.AT_PHDR); |
| 502 | const at_phnum = std.c.getauxval(elf.AT_PHNUM); | 502 | const at_phnum = std.c.getauxval(elf.AT_PHNUM); |
| 503 | const phdrs = (@intToPtr([*]elf.Phdr, at_phdr))[0..at_phnum]; | 503 | const phdrs = (@ptrFromInt([*]elf.Phdr, at_phdr))[0..at_phnum]; |
| 504 | expandStackSize(phdrs); | 504 | expandStackSize(phdrs); |
| 505 | } | 505 | } |
| 506 | 506 |
lib/std/start_windows_tls.zig+5-5| ... | @@ -22,14 +22,14 @@ comptime { | ... | @@ -22,14 +22,14 @@ comptime { |
| 22 | // TODO also note, ReactOS has a +1 on StartAddressOfRawData and AddressOfCallBacks. Investigate | 22 | // TODO also note, ReactOS has a +1 on StartAddressOfRawData and AddressOfCallBacks. Investigate |
| 23 | // why they do that. | 23 | // why they do that. |
| 24 | //export const _tls_used linksection(".rdata$T") = std.os.windows.IMAGE_TLS_DIRECTORY { | 24 | //export const _tls_used linksection(".rdata$T") = std.os.windows.IMAGE_TLS_DIRECTORY { |
| 25 | // .StartAddressOfRawData = @ptrToInt(&_tls_start), | 25 | // .StartAddressOfRawData = @intFromPtr(&_tls_start), |
| 26 | // .EndAddressOfRawData = @ptrToInt(&_tls_end), | 26 | // .EndAddressOfRawData = @intFromPtr(&_tls_end), |
| 27 | // .AddressOfIndex = @ptrToInt(&_tls_index), | 27 | // .AddressOfIndex = @intFromPtr(&_tls_index), |
| 28 | // .AddressOfCallBacks = @ptrToInt(__xl_a), | 28 | // .AddressOfCallBacks = @intFromPtr(__xl_a), |
| 29 | // .SizeOfZeroFill = 0, | 29 | // .SizeOfZeroFill = 0, |
| 30 | // .Characteristics = 0, | 30 | // .Characteristics = 0, |
| 31 | //}; | 31 | //}; |
| 32 | // This is the workaround because we can't do @ptrToInt at comptime like that. | 32 | // This is the workaround because we can't do @intFromPtr at comptime like that. |
| 33 | pub const IMAGE_TLS_DIRECTORY = extern struct { | 33 | pub const IMAGE_TLS_DIRECTORY = extern struct { |
| 34 | StartAddressOfRawData: *anyopaque, | 34 | StartAddressOfRawData: *anyopaque, |
| 35 | EndAddressOfRawData: *anyopaque, | 35 | EndAddressOfRawData: *anyopaque, |
lib/std/tar.zig+2-2| ... | @@ -70,8 +70,8 @@ pub const Header = struct { | ... | @@ -70,8 +70,8 @@ pub const Header = struct { |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | pub fn fileType(header: Header) FileType { | 72 | pub fn fileType(header: Header) FileType { |
| 73 | const result = @intToEnum(FileType, header.bytes[156]); | 73 | const result = @enumFromInt(FileType, header.bytes[156]); |
| 74 | return if (result == @intToEnum(FileType, 0)) .normal else result; | 74 | return if (result == @enumFromInt(FileType, 0)) .normal else result; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | fn str(header: Header, start: usize, end: usize) []const u8 { | 77 | fn str(header: Header, start: usize, end: usize) []const u8 { |
lib/std/target.zig+12-12| ... | @@ -139,7 +139,7 @@ pub const Target = struct { | ... | @@ -139,7 +139,7 @@ pub const Target = struct { |
| 139 | 139 | ||
| 140 | /// Returns whether the first version `self` is newer (greater) than or equal to the second version `ver`. | 140 | /// Returns whether the first version `self` is newer (greater) than or equal to the second version `ver`. |
| 141 | pub fn isAtLeast(self: WindowsVersion, ver: WindowsVersion) bool { | 141 | pub fn isAtLeast(self: WindowsVersion, ver: WindowsVersion) bool { |
| 142 | return @enumToInt(self) >= @enumToInt(ver); | 142 | return @intFromEnum(self) >= @intFromEnum(ver); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | pub const Range = struct { | 145 | pub const Range = struct { |
| ... | @@ -147,14 +147,14 @@ pub const Target = struct { | ... | @@ -147,14 +147,14 @@ pub const Target = struct { |
| 147 | max: WindowsVersion, | 147 | max: WindowsVersion, |
| 148 | 148 | ||
| 149 | pub fn includesVersion(self: Range, ver: WindowsVersion) bool { | 149 | pub fn includesVersion(self: Range, ver: WindowsVersion) bool { |
| 150 | return @enumToInt(ver) >= @enumToInt(self.min) and @enumToInt(ver) <= @enumToInt(self.max); | 150 | return @intFromEnum(ver) >= @intFromEnum(self.min) and @intFromEnum(ver) <= @intFromEnum(self.max); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | /// Checks if system is guaranteed to be at least `version` or older than `version`. | 153 | /// Checks if system is guaranteed to be at least `version` or older than `version`. |
| 154 | /// Returns `null` if a runtime check is required. | 154 | /// Returns `null` if a runtime check is required. |
| 155 | pub fn isAtLeast(self: Range, ver: WindowsVersion) ?bool { | 155 | pub fn isAtLeast(self: Range, ver: WindowsVersion) ?bool { |
| 156 | if (@enumToInt(self.min) >= @enumToInt(ver)) return true; | 156 | if (@intFromEnum(self.min) >= @intFromEnum(ver)) return true; |
| 157 | if (@enumToInt(self.max) < @enumToInt(ver)) return false; | 157 | if (@intFromEnum(self.max) < @intFromEnum(ver)) return false; |
| 158 | return null; | 158 | return null; |
| 159 | } | 159 | } |
| 160 | }; | 160 | }; |
| ... | @@ -168,17 +168,17 @@ pub const Target = struct { | ... | @@ -168,17 +168,17 @@ pub const Target = struct { |
| 168 | out_stream: anytype, | 168 | out_stream: anytype, |
| 169 | ) !void { | 169 | ) !void { |
| 170 | if (comptime std.mem.eql(u8, fmt, "s")) { | 170 | if (comptime std.mem.eql(u8, fmt, "s")) { |
| 171 | if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.latest)) { | 171 | if (@intFromEnum(self) >= @intFromEnum(WindowsVersion.nt4) and @intFromEnum(self) <= @intFromEnum(WindowsVersion.latest)) { |
| 172 | try std.fmt.format(out_stream, ".{s}", .{@tagName(self)}); | 172 | try std.fmt.format(out_stream, ".{s}", .{@tagName(self)}); |
| 173 | } else { | 173 | } else { |
| 174 | // TODO this code path breaks zig triples, but it is used in `builtin` | 174 | // TODO this code path breaks zig triples, but it is used in `builtin` |
| 175 | try std.fmt.format(out_stream, "@intToEnum(Target.Os.WindowsVersion, 0x{X:0>8})", .{@enumToInt(self)}); | 175 | try std.fmt.format(out_stream, "@enumFromInt(Target.Os.WindowsVersion, 0x{X:0>8})", .{@intFromEnum(self)}); |
| 176 | } | 176 | } |
| 177 | } else if (fmt.len == 0) { | 177 | } else if (fmt.len == 0) { |
| 178 | if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.latest)) { | 178 | if (@intFromEnum(self) >= @intFromEnum(WindowsVersion.nt4) and @intFromEnum(self) <= @intFromEnum(WindowsVersion.latest)) { |
| 179 | try std.fmt.format(out_stream, "WindowsVersion.{s}", .{@tagName(self)}); | 179 | try std.fmt.format(out_stream, "WindowsVersion.{s}", .{@tagName(self)}); |
| 180 | } else { | 180 | } else { |
| 181 | try std.fmt.format(out_stream, "WindowsVersion(0x{X:0>8})", .{@enumToInt(self)}); | 181 | try std.fmt.format(out_stream, "WindowsVersion(0x{X:0>8})", .{@intFromEnum(self)}); |
| 182 | } | 182 | } |
| 183 | } else { | 183 | } else { |
| 184 | std.fmt.invalidFmtError(fmt, self); | 184 | std.fmt.invalidFmtError(fmt, self); |
| ... | @@ -778,21 +778,21 @@ pub const Target = struct { | ... | @@ -778,21 +778,21 @@ pub const Target = struct { |
| 778 | pub fn featureSet(features: []const F) Set { | 778 | pub fn featureSet(features: []const F) Set { |
| 779 | var x = Set.empty; | 779 | var x = Set.empty; |
| 780 | for (features) |feature| { | 780 | for (features) |feature| { |
| 781 | x.addFeature(@enumToInt(feature)); | 781 | x.addFeature(@intFromEnum(feature)); |
| 782 | } | 782 | } |
| 783 | return x; | 783 | return x; |
| 784 | } | 784 | } |
| 785 | 785 | ||
| 786 | /// Returns true if the specified feature is enabled. | 786 | /// Returns true if the specified feature is enabled. |
| 787 | pub fn featureSetHas(set: Set, feature: F) bool { | 787 | pub fn featureSetHas(set: Set, feature: F) bool { |
| 788 | return set.isEnabled(@enumToInt(feature)); | 788 | return set.isEnabled(@intFromEnum(feature)); |
| 789 | } | 789 | } |
| 790 | 790 | ||
| 791 | /// Returns true if any specified feature is enabled. | 791 | /// Returns true if any specified feature is enabled. |
| 792 | pub fn featureSetHasAny(set: Set, features: anytype) bool { | 792 | pub fn featureSetHasAny(set: Set, features: anytype) bool { |
| 793 | comptime std.debug.assert(std.meta.trait.isIndexable(@TypeOf(features))); | 793 | comptime std.debug.assert(std.meta.trait.isIndexable(@TypeOf(features))); |
| 794 | inline for (features) |feature| { | 794 | inline for (features) |feature| { |
| 795 | if (set.isEnabled(@enumToInt(@as(F, feature)))) return true; | 795 | if (set.isEnabled(@intFromEnum(@as(F, feature)))) return true; |
| 796 | } | 796 | } |
| 797 | return false; | 797 | return false; |
| 798 | } | 798 | } |
| ... | @@ -801,7 +801,7 @@ pub const Target = struct { | ... | @@ -801,7 +801,7 @@ pub const Target = struct { |
| 801 | pub fn featureSetHasAll(set: Set, features: anytype) bool { | 801 | pub fn featureSetHasAll(set: Set, features: anytype) bool { |
| 802 | comptime std.debug.assert(std.meta.trait.isIndexable(@TypeOf(features))); | 802 | comptime std.debug.assert(std.meta.trait.isIndexable(@TypeOf(features))); |
| 803 | inline for (features) |feature| { | 803 | inline for (features) |feature| { |
| 804 | if (!set.isEnabled(@enumToInt(@as(F, feature)))) return false; | 804 | if (!set.isEnabled(@intFromEnum(@as(F, feature)))) return false; |
| 805 | } | 805 | } |
| 806 | return true; | 806 | return true; |
| 807 | } | 807 | } |
lib/std/target/aarch64.zig+198-198| ... | @@ -215,7 +215,7 @@ pub const all_features = blk: { | ... | @@ -215,7 +215,7 @@ pub const all_features = blk: { |
| 215 | const len = @typeInfo(Feature).Enum.fields.len; | 215 | const len = @typeInfo(Feature).Enum.fields.len; |
| 216 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 216 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 217 | var result: [len]CpuFeature = undefined; | 217 | var result: [len]CpuFeature = undefined; |
| 218 | result[@enumToInt(Feature.a510)] = .{ | 218 | result[@intFromEnum(Feature.a510)] = .{ |
| 219 | .llvm_name = "a510", | 219 | .llvm_name = "a510", |
| 220 | .description = "Cortex-A510 ARM processors", | 220 | .description = "Cortex-A510 ARM processors", |
| 221 | .dependencies = featureSet(&[_]Feature{ | 221 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -224,7 +224,7 @@ pub const all_features = blk: { | ... | @@ -224,7 +224,7 @@ pub const all_features = blk: { |
| 224 | .use_postra_scheduler, | 224 | .use_postra_scheduler, |
| 225 | }), | 225 | }), |
| 226 | }; | 226 | }; |
| 227 | result[@enumToInt(Feature.a65)] = .{ | 227 | result[@intFromEnum(Feature.a65)] = .{ |
| 228 | .llvm_name = "a65", | 228 | .llvm_name = "a65", |
| 229 | .description = "Cortex-A65 ARM processors", | 229 | .description = "Cortex-A65 ARM processors", |
| 230 | .dependencies = featureSet(&[_]Feature{ | 230 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -235,7 +235,7 @@ pub const all_features = blk: { | ... | @@ -235,7 +235,7 @@ pub const all_features = blk: { |
| 235 | .fuse_literals, | 235 | .fuse_literals, |
| 236 | }), | 236 | }), |
| 237 | }; | 237 | }; |
| 238 | result[@enumToInt(Feature.a710)] = .{ | 238 | result[@intFromEnum(Feature.a710)] = .{ |
| 239 | .llvm_name = "a710", | 239 | .llvm_name = "a710", |
| 240 | .description = "Cortex-A710 ARM processors", | 240 | .description = "Cortex-A710 ARM processors", |
| 241 | .dependencies = featureSet(&[_]Feature{ | 241 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -247,7 +247,7 @@ pub const all_features = blk: { | ... | @@ -247,7 +247,7 @@ pub const all_features = blk: { |
| 247 | .use_postra_scheduler, | 247 | .use_postra_scheduler, |
| 248 | }), | 248 | }), |
| 249 | }; | 249 | }; |
| 250 | result[@enumToInt(Feature.a76)] = .{ | 250 | result[@intFromEnum(Feature.a76)] = .{ |
| 251 | .llvm_name = "a76", | 251 | .llvm_name = "a76", |
| 252 | .description = "Cortex-A76 ARM processors", | 252 | .description = "Cortex-A76 ARM processors", |
| 253 | .dependencies = featureSet(&[_]Feature{ | 253 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -257,7 +257,7 @@ pub const all_features = blk: { | ... | @@ -257,7 +257,7 @@ pub const all_features = blk: { |
| 257 | .lsl_fast, | 257 | .lsl_fast, |
| 258 | }), | 258 | }), |
| 259 | }; | 259 | }; |
| 260 | result[@enumToInt(Feature.a78)] = .{ | 260 | result[@intFromEnum(Feature.a78)] = .{ |
| 261 | .llvm_name = "a78", | 261 | .llvm_name = "a78", |
| 262 | .description = "Cortex-A78 ARM processors", | 262 | .description = "Cortex-A78 ARM processors", |
| 263 | .dependencies = featureSet(&[_]Feature{ | 263 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -269,7 +269,7 @@ pub const all_features = blk: { | ... | @@ -269,7 +269,7 @@ pub const all_features = blk: { |
| 269 | .use_postra_scheduler, | 269 | .use_postra_scheduler, |
| 270 | }), | 270 | }), |
| 271 | }; | 271 | }; |
| 272 | result[@enumToInt(Feature.a78c)] = .{ | 272 | result[@intFromEnum(Feature.a78c)] = .{ |
| 273 | .llvm_name = "a78c", | 273 | .llvm_name = "a78c", |
| 274 | .description = "Cortex-A78C ARM processors", | 274 | .description = "Cortex-A78C ARM processors", |
| 275 | .dependencies = featureSet(&[_]Feature{ | 275 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -281,175 +281,175 @@ pub const all_features = blk: { | ... | @@ -281,175 +281,175 @@ pub const all_features = blk: { |
| 281 | .use_postra_scheduler, | 281 | .use_postra_scheduler, |
| 282 | }), | 282 | }), |
| 283 | }; | 283 | }; |
| 284 | result[@enumToInt(Feature.aes)] = .{ | 284 | result[@intFromEnum(Feature.aes)] = .{ |
| 285 | .llvm_name = "aes", | 285 | .llvm_name = "aes", |
| 286 | .description = "Enable AES support (FEAT_AES, FEAT_PMULL)", | 286 | .description = "Enable AES support (FEAT_AES, FEAT_PMULL)", |
| 287 | .dependencies = featureSet(&[_]Feature{ | 287 | .dependencies = featureSet(&[_]Feature{ |
| 288 | .neon, | 288 | .neon, |
| 289 | }), | 289 | }), |
| 290 | }; | 290 | }; |
| 291 | result[@enumToInt(Feature.aggressive_fma)] = .{ | 291 | result[@intFromEnum(Feature.aggressive_fma)] = .{ |
| 292 | .llvm_name = "aggressive-fma", | 292 | .llvm_name = "aggressive-fma", |
| 293 | .description = "Enable Aggressive FMA for floating-point.", | 293 | .description = "Enable Aggressive FMA for floating-point.", |
| 294 | .dependencies = featureSet(&[_]Feature{}), | 294 | .dependencies = featureSet(&[_]Feature{}), |
| 295 | }; | 295 | }; |
| 296 | result[@enumToInt(Feature.alternate_sextload_cvt_f32_pattern)] = .{ | 296 | result[@intFromEnum(Feature.alternate_sextload_cvt_f32_pattern)] = .{ |
| 297 | .llvm_name = "alternate-sextload-cvt-f32-pattern", | 297 | .llvm_name = "alternate-sextload-cvt-f32-pattern", |
| 298 | .description = "Use alternative pattern for sextload convert to f32", | 298 | .description = "Use alternative pattern for sextload convert to f32", |
| 299 | .dependencies = featureSet(&[_]Feature{}), | 299 | .dependencies = featureSet(&[_]Feature{}), |
| 300 | }; | 300 | }; |
| 301 | result[@enumToInt(Feature.altnzcv)] = .{ | 301 | result[@intFromEnum(Feature.altnzcv)] = .{ |
| 302 | .llvm_name = "altnzcv", | 302 | .llvm_name = "altnzcv", |
| 303 | .description = "Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)", | 303 | .description = "Enable alternative NZCV format for floating point comparisons (FEAT_FlagM2)", |
| 304 | .dependencies = featureSet(&[_]Feature{}), | 304 | .dependencies = featureSet(&[_]Feature{}), |
| 305 | }; | 305 | }; |
| 306 | result[@enumToInt(Feature.am)] = .{ | 306 | result[@intFromEnum(Feature.am)] = .{ |
| 307 | .llvm_name = "am", | 307 | .llvm_name = "am", |
| 308 | .description = "Enable v8.4-A Activity Monitors extension (FEAT_AMUv1)", | 308 | .description = "Enable v8.4-A Activity Monitors extension (FEAT_AMUv1)", |
| 309 | .dependencies = featureSet(&[_]Feature{}), | 309 | .dependencies = featureSet(&[_]Feature{}), |
| 310 | }; | 310 | }; |
| 311 | result[@enumToInt(Feature.amvs)] = .{ | 311 | result[@intFromEnum(Feature.amvs)] = .{ |
| 312 | .llvm_name = "amvs", | 312 | .llvm_name = "amvs", |
| 313 | .description = "Enable v8.6-A Activity Monitors Virtualization support (FEAT_AMUv1p1)", | 313 | .description = "Enable v8.6-A Activity Monitors Virtualization support (FEAT_AMUv1p1)", |
| 314 | .dependencies = featureSet(&[_]Feature{ | 314 | .dependencies = featureSet(&[_]Feature{ |
| 315 | .am, | 315 | .am, |
| 316 | }), | 316 | }), |
| 317 | }; | 317 | }; |
| 318 | result[@enumToInt(Feature.arith_bcc_fusion)] = .{ | 318 | result[@intFromEnum(Feature.arith_bcc_fusion)] = .{ |
| 319 | .llvm_name = "arith-bcc-fusion", | 319 | .llvm_name = "arith-bcc-fusion", |
| 320 | .description = "CPU fuses arithmetic+bcc operations", | 320 | .description = "CPU fuses arithmetic+bcc operations", |
| 321 | .dependencies = featureSet(&[_]Feature{}), | 321 | .dependencies = featureSet(&[_]Feature{}), |
| 322 | }; | 322 | }; |
| 323 | result[@enumToInt(Feature.arith_cbz_fusion)] = .{ | 323 | result[@intFromEnum(Feature.arith_cbz_fusion)] = .{ |
| 324 | .llvm_name = "arith-cbz-fusion", | 324 | .llvm_name = "arith-cbz-fusion", |
| 325 | .description = "CPU fuses arithmetic + cbz/cbnz operations", | 325 | .description = "CPU fuses arithmetic + cbz/cbnz operations", |
| 326 | .dependencies = featureSet(&[_]Feature{}), | 326 | .dependencies = featureSet(&[_]Feature{}), |
| 327 | }; | 327 | }; |
| 328 | result[@enumToInt(Feature.ascend_store_address)] = .{ | 328 | result[@intFromEnum(Feature.ascend_store_address)] = .{ |
| 329 | .llvm_name = "ascend-store-address", | 329 | .llvm_name = "ascend-store-address", |
| 330 | .description = "Schedule vector stores by ascending address", | 330 | .description = "Schedule vector stores by ascending address", |
| 331 | .dependencies = featureSet(&[_]Feature{}), | 331 | .dependencies = featureSet(&[_]Feature{}), |
| 332 | }; | 332 | }; |
| 333 | result[@enumToInt(Feature.b16b16)] = .{ | 333 | result[@intFromEnum(Feature.b16b16)] = .{ |
| 334 | .llvm_name = "b16b16", | 334 | .llvm_name = "b16b16", |
| 335 | .description = "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions (FEAT_B16B16)", | 335 | .description = "Enable SVE2.1 or SME2.1 non-widening BFloat16 to BFloat16 instructions (FEAT_B16B16)", |
| 336 | .dependencies = featureSet(&[_]Feature{}), | 336 | .dependencies = featureSet(&[_]Feature{}), |
| 337 | }; | 337 | }; |
| 338 | result[@enumToInt(Feature.balance_fp_ops)] = .{ | 338 | result[@intFromEnum(Feature.balance_fp_ops)] = .{ |
| 339 | .llvm_name = "balance-fp-ops", | 339 | .llvm_name = "balance-fp-ops", |
| 340 | .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", | 340 | .description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops", |
| 341 | .dependencies = featureSet(&[_]Feature{}), | 341 | .dependencies = featureSet(&[_]Feature{}), |
| 342 | }; | 342 | }; |
| 343 | result[@enumToInt(Feature.bf16)] = .{ | 343 | result[@intFromEnum(Feature.bf16)] = .{ |
| 344 | .llvm_name = "bf16", | 344 | .llvm_name = "bf16", |
| 345 | .description = "Enable BFloat16 Extension (FEAT_BF16)", | 345 | .description = "Enable BFloat16 Extension (FEAT_BF16)", |
| 346 | .dependencies = featureSet(&[_]Feature{}), | 346 | .dependencies = featureSet(&[_]Feature{}), |
| 347 | }; | 347 | }; |
| 348 | result[@enumToInt(Feature.brbe)] = .{ | 348 | result[@intFromEnum(Feature.brbe)] = .{ |
| 349 | .llvm_name = "brbe", | 349 | .llvm_name = "brbe", |
| 350 | .description = "Enable Branch Record Buffer Extension (FEAT_BRBE)", | 350 | .description = "Enable Branch Record Buffer Extension (FEAT_BRBE)", |
| 351 | .dependencies = featureSet(&[_]Feature{}), | 351 | .dependencies = featureSet(&[_]Feature{}), |
| 352 | }; | 352 | }; |
| 353 | result[@enumToInt(Feature.bti)] = .{ | 353 | result[@intFromEnum(Feature.bti)] = .{ |
| 354 | .llvm_name = "bti", | 354 | .llvm_name = "bti", |
| 355 | .description = "Enable Branch Target Identification (FEAT_BTI)", | 355 | .description = "Enable Branch Target Identification (FEAT_BTI)", |
| 356 | .dependencies = featureSet(&[_]Feature{}), | 356 | .dependencies = featureSet(&[_]Feature{}), |
| 357 | }; | 357 | }; |
| 358 | result[@enumToInt(Feature.call_saved_x10)] = .{ | 358 | result[@intFromEnum(Feature.call_saved_x10)] = .{ |
| 359 | .llvm_name = "call-saved-x10", | 359 | .llvm_name = "call-saved-x10", |
| 360 | .description = "Make X10 callee saved.", | 360 | .description = "Make X10 callee saved.", |
| 361 | .dependencies = featureSet(&[_]Feature{}), | 361 | .dependencies = featureSet(&[_]Feature{}), |
| 362 | }; | 362 | }; |
| 363 | result[@enumToInt(Feature.call_saved_x11)] = .{ | 363 | result[@intFromEnum(Feature.call_saved_x11)] = .{ |
| 364 | .llvm_name = "call-saved-x11", | 364 | .llvm_name = "call-saved-x11", |
| 365 | .description = "Make X11 callee saved.", | 365 | .description = "Make X11 callee saved.", |
| 366 | .dependencies = featureSet(&[_]Feature{}), | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | }; | 367 | }; |
| 368 | result[@enumToInt(Feature.call_saved_x12)] = .{ | 368 | result[@intFromEnum(Feature.call_saved_x12)] = .{ |
| 369 | .llvm_name = "call-saved-x12", | 369 | .llvm_name = "call-saved-x12", |
| 370 | .description = "Make X12 callee saved.", | 370 | .description = "Make X12 callee saved.", |
| 371 | .dependencies = featureSet(&[_]Feature{}), | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | }; | 372 | }; |
| 373 | result[@enumToInt(Feature.call_saved_x13)] = .{ | 373 | result[@intFromEnum(Feature.call_saved_x13)] = .{ |
| 374 | .llvm_name = "call-saved-x13", | 374 | .llvm_name = "call-saved-x13", |
| 375 | .description = "Make X13 callee saved.", | 375 | .description = "Make X13 callee saved.", |
| 376 | .dependencies = featureSet(&[_]Feature{}), | 376 | .dependencies = featureSet(&[_]Feature{}), |
| 377 | }; | 377 | }; |
| 378 | result[@enumToInt(Feature.call_saved_x14)] = .{ | 378 | result[@intFromEnum(Feature.call_saved_x14)] = .{ |
| 379 | .llvm_name = "call-saved-x14", | 379 | .llvm_name = "call-saved-x14", |
| 380 | .description = "Make X14 callee saved.", | 380 | .description = "Make X14 callee saved.", |
| 381 | .dependencies = featureSet(&[_]Feature{}), | 381 | .dependencies = featureSet(&[_]Feature{}), |
| 382 | }; | 382 | }; |
| 383 | result[@enumToInt(Feature.call_saved_x15)] = .{ | 383 | result[@intFromEnum(Feature.call_saved_x15)] = .{ |
| 384 | .llvm_name = "call-saved-x15", | 384 | .llvm_name = "call-saved-x15", |
| 385 | .description = "Make X15 callee saved.", | 385 | .description = "Make X15 callee saved.", |
| 386 | .dependencies = featureSet(&[_]Feature{}), | 386 | .dependencies = featureSet(&[_]Feature{}), |
| 387 | }; | 387 | }; |
| 388 | result[@enumToInt(Feature.call_saved_x18)] = .{ | 388 | result[@intFromEnum(Feature.call_saved_x18)] = .{ |
| 389 | .llvm_name = "call-saved-x18", | 389 | .llvm_name = "call-saved-x18", |
| 390 | .description = "Make X18 callee saved.", | 390 | .description = "Make X18 callee saved.", |
| 391 | .dependencies = featureSet(&[_]Feature{}), | 391 | .dependencies = featureSet(&[_]Feature{}), |
| 392 | }; | 392 | }; |
| 393 | result[@enumToInt(Feature.call_saved_x8)] = .{ | 393 | result[@intFromEnum(Feature.call_saved_x8)] = .{ |
| 394 | .llvm_name = "call-saved-x8", | 394 | .llvm_name = "call-saved-x8", |
| 395 | .description = "Make X8 callee saved.", | 395 | .description = "Make X8 callee saved.", |
| 396 | .dependencies = featureSet(&[_]Feature{}), | 396 | .dependencies = featureSet(&[_]Feature{}), |
| 397 | }; | 397 | }; |
| 398 | result[@enumToInt(Feature.call_saved_x9)] = .{ | 398 | result[@intFromEnum(Feature.call_saved_x9)] = .{ |
| 399 | .llvm_name = "call-saved-x9", | 399 | .llvm_name = "call-saved-x9", |
| 400 | .description = "Make X9 callee saved.", | 400 | .description = "Make X9 callee saved.", |
| 401 | .dependencies = featureSet(&[_]Feature{}), | 401 | .dependencies = featureSet(&[_]Feature{}), |
| 402 | }; | 402 | }; |
| 403 | result[@enumToInt(Feature.ccdp)] = .{ | 403 | result[@intFromEnum(Feature.ccdp)] = .{ |
| 404 | .llvm_name = "ccdp", | 404 | .llvm_name = "ccdp", |
| 405 | .description = "Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)", | 405 | .description = "Enable v8.5 Cache Clean to Point of Deep Persistence (FEAT_DPB2)", |
| 406 | .dependencies = featureSet(&[_]Feature{}), | 406 | .dependencies = featureSet(&[_]Feature{}), |
| 407 | }; | 407 | }; |
| 408 | result[@enumToInt(Feature.ccidx)] = .{ | 408 | result[@intFromEnum(Feature.ccidx)] = .{ |
| 409 | .llvm_name = "ccidx", | 409 | .llvm_name = "ccidx", |
| 410 | .description = "Enable v8.3-A Extend of the CCSIDR number of sets (FEAT_CCIDX)", | 410 | .description = "Enable v8.3-A Extend of the CCSIDR number of sets (FEAT_CCIDX)", |
| 411 | .dependencies = featureSet(&[_]Feature{}), | 411 | .dependencies = featureSet(&[_]Feature{}), |
| 412 | }; | 412 | }; |
| 413 | result[@enumToInt(Feature.ccpp)] = .{ | 413 | result[@intFromEnum(Feature.ccpp)] = .{ |
| 414 | .llvm_name = "ccpp", | 414 | .llvm_name = "ccpp", |
| 415 | .description = "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)", | 415 | .description = "Enable v8.2 data Cache Clean to Point of Persistence (FEAT_DPB)", |
| 416 | .dependencies = featureSet(&[_]Feature{}), | 416 | .dependencies = featureSet(&[_]Feature{}), |
| 417 | }; | 417 | }; |
| 418 | result[@enumToInt(Feature.clrbhb)] = .{ | 418 | result[@intFromEnum(Feature.clrbhb)] = .{ |
| 419 | .llvm_name = "clrbhb", | 419 | .llvm_name = "clrbhb", |
| 420 | .description = "Enable Clear BHB instruction (FEAT_CLRBHB)", | 420 | .description = "Enable Clear BHB instruction (FEAT_CLRBHB)", |
| 421 | .dependencies = featureSet(&[_]Feature{}), | 421 | .dependencies = featureSet(&[_]Feature{}), |
| 422 | }; | 422 | }; |
| 423 | result[@enumToInt(Feature.cmp_bcc_fusion)] = .{ | 423 | result[@intFromEnum(Feature.cmp_bcc_fusion)] = .{ |
| 424 | .llvm_name = "cmp-bcc-fusion", | 424 | .llvm_name = "cmp-bcc-fusion", |
| 425 | .description = "CPU fuses cmp+bcc operations", | 425 | .description = "CPU fuses cmp+bcc operations", |
| 426 | .dependencies = featureSet(&[_]Feature{}), | 426 | .dependencies = featureSet(&[_]Feature{}), |
| 427 | }; | 427 | }; |
| 428 | result[@enumToInt(Feature.complxnum)] = .{ | 428 | result[@intFromEnum(Feature.complxnum)] = .{ |
| 429 | .llvm_name = "complxnum", | 429 | .llvm_name = "complxnum", |
| 430 | .description = "Enable v8.3-A Floating-point complex number support (FEAT_FCMA)", | 430 | .description = "Enable v8.3-A Floating-point complex number support (FEAT_FCMA)", |
| 431 | .dependencies = featureSet(&[_]Feature{ | 431 | .dependencies = featureSet(&[_]Feature{ |
| 432 | .neon, | 432 | .neon, |
| 433 | }), | 433 | }), |
| 434 | }; | 434 | }; |
| 435 | result[@enumToInt(Feature.contextidr_el2)] = .{ | 435 | result[@intFromEnum(Feature.contextidr_el2)] = .{ |
| 436 | .llvm_name = "CONTEXTIDREL2", | 436 | .llvm_name = "CONTEXTIDREL2", |
| 437 | .description = "Enable RW operand Context ID Register (EL2)", | 437 | .description = "Enable RW operand Context ID Register (EL2)", |
| 438 | .dependencies = featureSet(&[_]Feature{}), | 438 | .dependencies = featureSet(&[_]Feature{}), |
| 439 | }; | 439 | }; |
| 440 | result[@enumToInt(Feature.cortex_r82)] = .{ | 440 | result[@intFromEnum(Feature.cortex_r82)] = .{ |
| 441 | .llvm_name = "cortex-r82", | 441 | .llvm_name = "cortex-r82", |
| 442 | .description = "Cortex-R82 ARM processors", | 442 | .description = "Cortex-R82 ARM processors", |
| 443 | .dependencies = featureSet(&[_]Feature{ | 443 | .dependencies = featureSet(&[_]Feature{ |
| 444 | .use_postra_scheduler, | 444 | .use_postra_scheduler, |
| 445 | }), | 445 | }), |
| 446 | }; | 446 | }; |
| 447 | result[@enumToInt(Feature.crc)] = .{ | 447 | result[@intFromEnum(Feature.crc)] = .{ |
| 448 | .llvm_name = "crc", | 448 | .llvm_name = "crc", |
| 449 | .description = "Enable ARMv8 CRC-32 checksum instructions (FEAT_CRC32)", | 449 | .description = "Enable ARMv8 CRC-32 checksum instructions (FEAT_CRC32)", |
| 450 | .dependencies = featureSet(&[_]Feature{}), | 450 | .dependencies = featureSet(&[_]Feature{}), |
| 451 | }; | 451 | }; |
| 452 | result[@enumToInt(Feature.crypto)] = .{ | 452 | result[@intFromEnum(Feature.crypto)] = .{ |
| 453 | .llvm_name = "crypto", | 453 | .llvm_name = "crypto", |
| 454 | .description = "Enable cryptographic instructions", | 454 | .description = "Enable cryptographic instructions", |
| 455 | .dependencies = featureSet(&[_]Feature{ | 455 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -457,560 +457,560 @@ pub const all_features = blk: { | ... | @@ -457,560 +457,560 @@ pub const all_features = blk: { |
| 457 | .sha2, | 457 | .sha2, |
| 458 | }), | 458 | }), |
| 459 | }; | 459 | }; |
| 460 | result[@enumToInt(Feature.cssc)] = .{ | 460 | result[@intFromEnum(Feature.cssc)] = .{ |
| 461 | .llvm_name = "cssc", | 461 | .llvm_name = "cssc", |
| 462 | .description = "Enable Common Short Sequence Compression (CSSC) instructions (FEAT_CSSC)", | 462 | .description = "Enable Common Short Sequence Compression (CSSC) instructions (FEAT_CSSC)", |
| 463 | .dependencies = featureSet(&[_]Feature{}), | 463 | .dependencies = featureSet(&[_]Feature{}), |
| 464 | }; | 464 | }; |
| 465 | result[@enumToInt(Feature.custom_cheap_as_move)] = .{ | 465 | result[@intFromEnum(Feature.custom_cheap_as_move)] = .{ |
| 466 | .llvm_name = "custom-cheap-as-move", | 466 | .llvm_name = "custom-cheap-as-move", |
| 467 | .description = "Use custom handling of cheap instructions", | 467 | .description = "Use custom handling of cheap instructions", |
| 468 | .dependencies = featureSet(&[_]Feature{}), | 468 | .dependencies = featureSet(&[_]Feature{}), |
| 469 | }; | 469 | }; |
| 470 | result[@enumToInt(Feature.d128)] = .{ | 470 | result[@intFromEnum(Feature.d128)] = .{ |
| 471 | .llvm_name = "d128", | 471 | .llvm_name = "d128", |
| 472 | .description = "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and Instructions (FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128)", | 472 | .description = "Enable Armv9.4-A 128-bit Page Table Descriptors, System Registers and Instructions (FEAT_D128, FEAT_LVA3, FEAT_SYSREG128, FEAT_SYSINSTR128)", |
| 473 | .dependencies = featureSet(&[_]Feature{ | 473 | .dependencies = featureSet(&[_]Feature{ |
| 474 | .lse128, | 474 | .lse128, |
| 475 | }), | 475 | }), |
| 476 | }; | 476 | }; |
| 477 | result[@enumToInt(Feature.disable_latency_sched_heuristic)] = .{ | 477 | result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{ |
| 478 | .llvm_name = "disable-latency-sched-heuristic", | 478 | .llvm_name = "disable-latency-sched-heuristic", |
| 479 | .description = "Disable latency scheduling heuristic", | 479 | .description = "Disable latency scheduling heuristic", |
| 480 | .dependencies = featureSet(&[_]Feature{}), | 480 | .dependencies = featureSet(&[_]Feature{}), |
| 481 | }; | 481 | }; |
| 482 | result[@enumToInt(Feature.dit)] = .{ | 482 | result[@intFromEnum(Feature.dit)] = .{ |
| 483 | .llvm_name = "dit", | 483 | .llvm_name = "dit", |
| 484 | .description = "Enable v8.4-A Data Independent Timing instructions (FEAT_DIT)", | 484 | .description = "Enable v8.4-A Data Independent Timing instructions (FEAT_DIT)", |
| 485 | .dependencies = featureSet(&[_]Feature{}), | 485 | .dependencies = featureSet(&[_]Feature{}), |
| 486 | }; | 486 | }; |
| 487 | result[@enumToInt(Feature.dotprod)] = .{ | 487 | result[@intFromEnum(Feature.dotprod)] = .{ |
| 488 | .llvm_name = "dotprod", | 488 | .llvm_name = "dotprod", |
| 489 | .description = "Enable dot product support (FEAT_DotProd)", | 489 | .description = "Enable dot product support (FEAT_DotProd)", |
| 490 | .dependencies = featureSet(&[_]Feature{}), | 490 | .dependencies = featureSet(&[_]Feature{}), |
| 491 | }; | 491 | }; |
| 492 | result[@enumToInt(Feature.ecv)] = .{ | 492 | result[@intFromEnum(Feature.ecv)] = .{ |
| 493 | .llvm_name = "ecv", | 493 | .llvm_name = "ecv", |
| 494 | .description = "Enable enhanced counter virtualization extension (FEAT_ECV)", | 494 | .description = "Enable enhanced counter virtualization extension (FEAT_ECV)", |
| 495 | .dependencies = featureSet(&[_]Feature{}), | 495 | .dependencies = featureSet(&[_]Feature{}), |
| 496 | }; | 496 | }; |
| 497 | result[@enumToInt(Feature.el2vmsa)] = .{ | 497 | result[@intFromEnum(Feature.el2vmsa)] = .{ |
| 498 | .llvm_name = "el2vmsa", | 498 | .llvm_name = "el2vmsa", |
| 499 | .description = "Enable Exception Level 2 Virtual Memory System Architecture", | 499 | .description = "Enable Exception Level 2 Virtual Memory System Architecture", |
| 500 | .dependencies = featureSet(&[_]Feature{}), | 500 | .dependencies = featureSet(&[_]Feature{}), |
| 501 | }; | 501 | }; |
| 502 | result[@enumToInt(Feature.el3)] = .{ | 502 | result[@intFromEnum(Feature.el3)] = .{ |
| 503 | .llvm_name = "el3", | 503 | .llvm_name = "el3", |
| 504 | .description = "Enable Exception Level 3", | 504 | .description = "Enable Exception Level 3", |
| 505 | .dependencies = featureSet(&[_]Feature{}), | 505 | .dependencies = featureSet(&[_]Feature{}), |
| 506 | }; | 506 | }; |
| 507 | result[@enumToInt(Feature.enable_select_opt)] = .{ | 507 | result[@intFromEnum(Feature.enable_select_opt)] = .{ |
| 508 | .llvm_name = "enable-select-opt", | 508 | .llvm_name = "enable-select-opt", |
| 509 | .description = "Enable the select optimize pass for select loop heuristics", | 509 | .description = "Enable the select optimize pass for select loop heuristics", |
| 510 | .dependencies = featureSet(&[_]Feature{}), | 510 | .dependencies = featureSet(&[_]Feature{}), |
| 511 | }; | 511 | }; |
| 512 | result[@enumToInt(Feature.ete)] = .{ | 512 | result[@intFromEnum(Feature.ete)] = .{ |
| 513 | .llvm_name = "ete", | 513 | .llvm_name = "ete", |
| 514 | .description = "Enable Embedded Trace Extension (FEAT_ETE)", | 514 | .description = "Enable Embedded Trace Extension (FEAT_ETE)", |
| 515 | .dependencies = featureSet(&[_]Feature{ | 515 | .dependencies = featureSet(&[_]Feature{ |
| 516 | .trbe, | 516 | .trbe, |
| 517 | }), | 517 | }), |
| 518 | }; | 518 | }; |
| 519 | result[@enumToInt(Feature.exynos_cheap_as_move)] = .{ | 519 | result[@intFromEnum(Feature.exynos_cheap_as_move)] = .{ |
| 520 | .llvm_name = "exynos-cheap-as-move", | 520 | .llvm_name = "exynos-cheap-as-move", |
| 521 | .description = "Use Exynos specific handling of cheap instructions", | 521 | .description = "Use Exynos specific handling of cheap instructions", |
| 522 | .dependencies = featureSet(&[_]Feature{ | 522 | .dependencies = featureSet(&[_]Feature{ |
| 523 | .custom_cheap_as_move, | 523 | .custom_cheap_as_move, |
| 524 | }), | 524 | }), |
| 525 | }; | 525 | }; |
| 526 | result[@enumToInt(Feature.f32mm)] = .{ | 526 | result[@intFromEnum(Feature.f32mm)] = .{ |
| 527 | .llvm_name = "f32mm", | 527 | .llvm_name = "f32mm", |
| 528 | .description = "Enable Matrix Multiply FP32 Extension (FEAT_F32MM)", | 528 | .description = "Enable Matrix Multiply FP32 Extension (FEAT_F32MM)", |
| 529 | .dependencies = featureSet(&[_]Feature{ | 529 | .dependencies = featureSet(&[_]Feature{ |
| 530 | .sve, | 530 | .sve, |
| 531 | }), | 531 | }), |
| 532 | }; | 532 | }; |
| 533 | result[@enumToInt(Feature.f64mm)] = .{ | 533 | result[@intFromEnum(Feature.f64mm)] = .{ |
| 534 | .llvm_name = "f64mm", | 534 | .llvm_name = "f64mm", |
| 535 | .description = "Enable Matrix Multiply FP64 Extension (FEAT_F64MM)", | 535 | .description = "Enable Matrix Multiply FP64 Extension (FEAT_F64MM)", |
| 536 | .dependencies = featureSet(&[_]Feature{ | 536 | .dependencies = featureSet(&[_]Feature{ |
| 537 | .sve, | 537 | .sve, |
| 538 | }), | 538 | }), |
| 539 | }; | 539 | }; |
| 540 | result[@enumToInt(Feature.fgt)] = .{ | 540 | result[@intFromEnum(Feature.fgt)] = .{ |
| 541 | .llvm_name = "fgt", | 541 | .llvm_name = "fgt", |
| 542 | .description = "Enable fine grained virtualization traps extension (FEAT_FGT)", | 542 | .description = "Enable fine grained virtualization traps extension (FEAT_FGT)", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@enumToInt(Feature.fix_cortex_a53_835769)] = .{ | 545 | result[@intFromEnum(Feature.fix_cortex_a53_835769)] = .{ |
| 546 | .llvm_name = "fix-cortex-a53-835769", | 546 | .llvm_name = "fix-cortex-a53-835769", |
| 547 | .description = "Mitigate Cortex-A53 Erratum 835769", | 547 | .description = "Mitigate Cortex-A53 Erratum 835769", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@enumToInt(Feature.flagm)] = .{ | 550 | result[@intFromEnum(Feature.flagm)] = .{ |
| 551 | .llvm_name = "flagm", | 551 | .llvm_name = "flagm", |
| 552 | .description = "Enable v8.4-A Flag Manipulation Instructions (FEAT_FlagM)", | 552 | .description = "Enable v8.4-A Flag Manipulation Instructions (FEAT_FlagM)", |
| 553 | .dependencies = featureSet(&[_]Feature{}), | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | }; | 554 | }; |
| 555 | result[@enumToInt(Feature.fmv)] = .{ | 555 | result[@intFromEnum(Feature.fmv)] = .{ |
| 556 | .llvm_name = "fmv", | 556 | .llvm_name = "fmv", |
| 557 | .description = "Enable Function Multi Versioning support.", | 557 | .description = "Enable Function Multi Versioning support.", |
| 558 | .dependencies = featureSet(&[_]Feature{}), | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | }; | 559 | }; |
| 560 | result[@enumToInt(Feature.force_32bit_jump_tables)] = .{ | 560 | result[@intFromEnum(Feature.force_32bit_jump_tables)] = .{ |
| 561 | .llvm_name = "force-32bit-jump-tables", | 561 | .llvm_name = "force-32bit-jump-tables", |
| 562 | .description = "Force jump table entries to be 32-bits wide except at MinSize", | 562 | .description = "Force jump table entries to be 32-bits wide except at MinSize", |
| 563 | .dependencies = featureSet(&[_]Feature{}), | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | }; | 564 | }; |
| 565 | result[@enumToInt(Feature.fp16fml)] = .{ | 565 | result[@intFromEnum(Feature.fp16fml)] = .{ |
| 566 | .llvm_name = "fp16fml", | 566 | .llvm_name = "fp16fml", |
| 567 | .description = "Enable FP16 FML instructions (FEAT_FHM)", | 567 | .description = "Enable FP16 FML instructions (FEAT_FHM)", |
| 568 | .dependencies = featureSet(&[_]Feature{ | 568 | .dependencies = featureSet(&[_]Feature{ |
| 569 | .fullfp16, | 569 | .fullfp16, |
| 570 | }), | 570 | }), |
| 571 | }; | 571 | }; |
| 572 | result[@enumToInt(Feature.fp_armv8)] = .{ | 572 | result[@intFromEnum(Feature.fp_armv8)] = .{ |
| 573 | .llvm_name = "fp-armv8", | 573 | .llvm_name = "fp-armv8", |
| 574 | .description = "Enable ARMv8 FP (FEAT_FP)", | 574 | .description = "Enable ARMv8 FP (FEAT_FP)", |
| 575 | .dependencies = featureSet(&[_]Feature{}), | 575 | .dependencies = featureSet(&[_]Feature{}), |
| 576 | }; | 576 | }; |
| 577 | result[@enumToInt(Feature.fptoint)] = .{ | 577 | result[@intFromEnum(Feature.fptoint)] = .{ |
| 578 | .llvm_name = "fptoint", | 578 | .llvm_name = "fptoint", |
| 579 | .description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)", | 579 | .description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int (FEAT_FRINTTS)", |
| 580 | .dependencies = featureSet(&[_]Feature{}), | 580 | .dependencies = featureSet(&[_]Feature{}), |
| 581 | }; | 581 | }; |
| 582 | result[@enumToInt(Feature.fullfp16)] = .{ | 582 | result[@intFromEnum(Feature.fullfp16)] = .{ |
| 583 | .llvm_name = "fullfp16", | 583 | .llvm_name = "fullfp16", |
| 584 | .description = "Full FP16 (FEAT_FP16)", | 584 | .description = "Full FP16 (FEAT_FP16)", |
| 585 | .dependencies = featureSet(&[_]Feature{ | 585 | .dependencies = featureSet(&[_]Feature{ |
| 586 | .fp_armv8, | 586 | .fp_armv8, |
| 587 | }), | 587 | }), |
| 588 | }; | 588 | }; |
| 589 | result[@enumToInt(Feature.fuse_address)] = .{ | 589 | result[@intFromEnum(Feature.fuse_address)] = .{ |
| 590 | .llvm_name = "fuse-address", | 590 | .llvm_name = "fuse-address", |
| 591 | .description = "CPU fuses address generation and memory operations", | 591 | .description = "CPU fuses address generation and memory operations", |
| 592 | .dependencies = featureSet(&[_]Feature{}), | 592 | .dependencies = featureSet(&[_]Feature{}), |
| 593 | }; | 593 | }; |
| 594 | result[@enumToInt(Feature.fuse_adrp_add)] = .{ | 594 | result[@intFromEnum(Feature.fuse_adrp_add)] = .{ |
| 595 | .llvm_name = "fuse-adrp-add", | 595 | .llvm_name = "fuse-adrp-add", |
| 596 | .description = "CPU fuses adrp+add operations", | 596 | .description = "CPU fuses adrp+add operations", |
| 597 | .dependencies = featureSet(&[_]Feature{}), | 597 | .dependencies = featureSet(&[_]Feature{}), |
| 598 | }; | 598 | }; |
| 599 | result[@enumToInt(Feature.fuse_aes)] = .{ | 599 | result[@intFromEnum(Feature.fuse_aes)] = .{ |
| 600 | .llvm_name = "fuse-aes", | 600 | .llvm_name = "fuse-aes", |
| 601 | .description = "CPU fuses AES crypto operations", | 601 | .description = "CPU fuses AES crypto operations", |
| 602 | .dependencies = featureSet(&[_]Feature{}), | 602 | .dependencies = featureSet(&[_]Feature{}), |
| 603 | }; | 603 | }; |
| 604 | result[@enumToInt(Feature.fuse_arith_logic)] = .{ | 604 | result[@intFromEnum(Feature.fuse_arith_logic)] = .{ |
| 605 | .llvm_name = "fuse-arith-logic", | 605 | .llvm_name = "fuse-arith-logic", |
| 606 | .description = "CPU fuses arithmetic and logic operations", | 606 | .description = "CPU fuses arithmetic and logic operations", |
| 607 | .dependencies = featureSet(&[_]Feature{}), | 607 | .dependencies = featureSet(&[_]Feature{}), |
| 608 | }; | 608 | }; |
| 609 | result[@enumToInt(Feature.fuse_crypto_eor)] = .{ | 609 | result[@intFromEnum(Feature.fuse_crypto_eor)] = .{ |
| 610 | .llvm_name = "fuse-crypto-eor", | 610 | .llvm_name = "fuse-crypto-eor", |
| 611 | .description = "CPU fuses AES/PMULL and EOR operations", | 611 | .description = "CPU fuses AES/PMULL and EOR operations", |
| 612 | .dependencies = featureSet(&[_]Feature{}), | 612 | .dependencies = featureSet(&[_]Feature{}), |
| 613 | }; | 613 | }; |
| 614 | result[@enumToInt(Feature.fuse_csel)] = .{ | 614 | result[@intFromEnum(Feature.fuse_csel)] = .{ |
| 615 | .llvm_name = "fuse-csel", | 615 | .llvm_name = "fuse-csel", |
| 616 | .description = "CPU fuses conditional select operations", | 616 | .description = "CPU fuses conditional select operations", |
| 617 | .dependencies = featureSet(&[_]Feature{}), | 617 | .dependencies = featureSet(&[_]Feature{}), |
| 618 | }; | 618 | }; |
| 619 | result[@enumToInt(Feature.fuse_literals)] = .{ | 619 | result[@intFromEnum(Feature.fuse_literals)] = .{ |
| 620 | .llvm_name = "fuse-literals", | 620 | .llvm_name = "fuse-literals", |
| 621 | .description = "CPU fuses literal generation operations", | 621 | .description = "CPU fuses literal generation operations", |
| 622 | .dependencies = featureSet(&[_]Feature{}), | 622 | .dependencies = featureSet(&[_]Feature{}), |
| 623 | }; | 623 | }; |
| 624 | result[@enumToInt(Feature.harden_sls_blr)] = .{ | 624 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ |
| 625 | .llvm_name = "harden-sls-blr", | 625 | .llvm_name = "harden-sls-blr", |
| 626 | .description = "Harden against straight line speculation across BLR instructions", | 626 | .description = "Harden against straight line speculation across BLR instructions", |
| 627 | .dependencies = featureSet(&[_]Feature{}), | 627 | .dependencies = featureSet(&[_]Feature{}), |
| 628 | }; | 628 | }; |
| 629 | result[@enumToInt(Feature.harden_sls_nocomdat)] = .{ | 629 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ |
| 630 | .llvm_name = "harden-sls-nocomdat", | 630 | .llvm_name = "harden-sls-nocomdat", |
| 631 | .description = "Generate thunk code for SLS mitigation in the normal text section", | 631 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 632 | .dependencies = featureSet(&[_]Feature{}), | 632 | .dependencies = featureSet(&[_]Feature{}), |
| 633 | }; | 633 | }; |
| 634 | result[@enumToInt(Feature.harden_sls_retbr)] = .{ | 634 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ |
| 635 | .llvm_name = "harden-sls-retbr", | 635 | .llvm_name = "harden-sls-retbr", |
| 636 | .description = "Harden against straight line speculation across RET and BR instructions", | 636 | .description = "Harden against straight line speculation across RET and BR instructions", |
| 637 | .dependencies = featureSet(&[_]Feature{}), | 637 | .dependencies = featureSet(&[_]Feature{}), |
| 638 | }; | 638 | }; |
| 639 | result[@enumToInt(Feature.hbc)] = .{ | 639 | result[@intFromEnum(Feature.hbc)] = .{ |
| 640 | .llvm_name = "hbc", | 640 | .llvm_name = "hbc", |
| 641 | .description = "Enable Armv8.8-A Hinted Conditional Branches Extension (FEAT_HBC)", | 641 | .description = "Enable Armv8.8-A Hinted Conditional Branches Extension (FEAT_HBC)", |
| 642 | .dependencies = featureSet(&[_]Feature{}), | 642 | .dependencies = featureSet(&[_]Feature{}), |
| 643 | }; | 643 | }; |
| 644 | result[@enumToInt(Feature.hcx)] = .{ | 644 | result[@intFromEnum(Feature.hcx)] = .{ |
| 645 | .llvm_name = "hcx", | 645 | .llvm_name = "hcx", |
| 646 | .description = "Enable Armv8.7-A HCRX_EL2 system register (FEAT_HCX)", | 646 | .description = "Enable Armv8.7-A HCRX_EL2 system register (FEAT_HCX)", |
| 647 | .dependencies = featureSet(&[_]Feature{}), | 647 | .dependencies = featureSet(&[_]Feature{}), |
| 648 | }; | 648 | }; |
| 649 | result[@enumToInt(Feature.i8mm)] = .{ | 649 | result[@intFromEnum(Feature.i8mm)] = .{ |
| 650 | .llvm_name = "i8mm", | 650 | .llvm_name = "i8mm", |
| 651 | .description = "Enable Matrix Multiply Int8 Extension (FEAT_I8MM)", | 651 | .description = "Enable Matrix Multiply Int8 Extension (FEAT_I8MM)", |
| 652 | .dependencies = featureSet(&[_]Feature{}), | 652 | .dependencies = featureSet(&[_]Feature{}), |
| 653 | }; | 653 | }; |
| 654 | result[@enumToInt(Feature.ite)] = .{ | 654 | result[@intFromEnum(Feature.ite)] = .{ |
| 655 | .llvm_name = "ite", | 655 | .llvm_name = "ite", |
| 656 | .description = "Enable Armv9.4-A Instrumentation Extension FEAT_ITE", | 656 | .description = "Enable Armv9.4-A Instrumentation Extension FEAT_ITE", |
| 657 | .dependencies = featureSet(&[_]Feature{ | 657 | .dependencies = featureSet(&[_]Feature{ |
| 658 | .ete, | 658 | .ete, |
| 659 | }), | 659 | }), |
| 660 | }; | 660 | }; |
| 661 | result[@enumToInt(Feature.jsconv)] = .{ | 661 | result[@intFromEnum(Feature.jsconv)] = .{ |
| 662 | .llvm_name = "jsconv", | 662 | .llvm_name = "jsconv", |
| 663 | .description = "Enable v8.3-A JavaScript FP conversion instructions (FEAT_JSCVT)", | 663 | .description = "Enable v8.3-A JavaScript FP conversion instructions (FEAT_JSCVT)", |
| 664 | .dependencies = featureSet(&[_]Feature{ | 664 | .dependencies = featureSet(&[_]Feature{ |
| 665 | .fp_armv8, | 665 | .fp_armv8, |
| 666 | }), | 666 | }), |
| 667 | }; | 667 | }; |
| 668 | result[@enumToInt(Feature.lor)] = .{ | 668 | result[@intFromEnum(Feature.lor)] = .{ |
| 669 | .llvm_name = "lor", | 669 | .llvm_name = "lor", |
| 670 | .description = "Enables ARM v8.1 Limited Ordering Regions extension (FEAT_LOR)", | 670 | .description = "Enables ARM v8.1 Limited Ordering Regions extension (FEAT_LOR)", |
| 671 | .dependencies = featureSet(&[_]Feature{}), | 671 | .dependencies = featureSet(&[_]Feature{}), |
| 672 | }; | 672 | }; |
| 673 | result[@enumToInt(Feature.ls64)] = .{ | 673 | result[@intFromEnum(Feature.ls64)] = .{ |
| 674 | .llvm_name = "ls64", | 674 | .llvm_name = "ls64", |
| 675 | .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension (FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA)", | 675 | .description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension (FEAT_LS64, FEAT_LS64_V, FEAT_LS64_ACCDATA)", |
| 676 | .dependencies = featureSet(&[_]Feature{}), | 676 | .dependencies = featureSet(&[_]Feature{}), |
| 677 | }; | 677 | }; |
| 678 | result[@enumToInt(Feature.lse)] = .{ | 678 | result[@intFromEnum(Feature.lse)] = .{ |
| 679 | .llvm_name = "lse", | 679 | .llvm_name = "lse", |
| 680 | .description = "Enable ARMv8.1 Large System Extension (LSE) atomic instructions (FEAT_LSE)", | 680 | .description = "Enable ARMv8.1 Large System Extension (LSE) atomic instructions (FEAT_LSE)", |
| 681 | .dependencies = featureSet(&[_]Feature{}), | 681 | .dependencies = featureSet(&[_]Feature{}), |
| 682 | }; | 682 | }; |
| 683 | result[@enumToInt(Feature.lse128)] = .{ | 683 | result[@intFromEnum(Feature.lse128)] = .{ |
| 684 | .llvm_name = "lse128", | 684 | .llvm_name = "lse128", |
| 685 | .description = "Enable Armv9.4-A 128-bit Atomic Instructions (FEAT_LSE128)", | 685 | .description = "Enable Armv9.4-A 128-bit Atomic Instructions (FEAT_LSE128)", |
| 686 | .dependencies = featureSet(&[_]Feature{ | 686 | .dependencies = featureSet(&[_]Feature{ |
| 687 | .lse, | 687 | .lse, |
| 688 | }), | 688 | }), |
| 689 | }; | 689 | }; |
| 690 | result[@enumToInt(Feature.lse2)] = .{ | 690 | result[@intFromEnum(Feature.lse2)] = .{ |
| 691 | .llvm_name = "lse2", | 691 | .llvm_name = "lse2", |
| 692 | .description = "Enable ARMv8.4 Large System Extension 2 (LSE2) atomicity rules (FEAT_LSE2)", | 692 | .description = "Enable ARMv8.4 Large System Extension 2 (LSE2) atomicity rules (FEAT_LSE2)", |
| 693 | .dependencies = featureSet(&[_]Feature{}), | 693 | .dependencies = featureSet(&[_]Feature{}), |
| 694 | }; | 694 | }; |
| 695 | result[@enumToInt(Feature.lsl_fast)] = .{ | 695 | result[@intFromEnum(Feature.lsl_fast)] = .{ |
| 696 | .llvm_name = "lsl-fast", | 696 | .llvm_name = "lsl-fast", |
| 697 | .description = "CPU has a fastpath logical shift of up to 3 places", | 697 | .description = "CPU has a fastpath logical shift of up to 3 places", |
| 698 | .dependencies = featureSet(&[_]Feature{}), | 698 | .dependencies = featureSet(&[_]Feature{}), |
| 699 | }; | 699 | }; |
| 700 | result[@enumToInt(Feature.mec)] = .{ | 700 | result[@intFromEnum(Feature.mec)] = .{ |
| 701 | .llvm_name = "mec", | 701 | .llvm_name = "mec", |
| 702 | .description = "Enable Memory Encryption Contexts Extension", | 702 | .description = "Enable Memory Encryption Contexts Extension", |
| 703 | .dependencies = featureSet(&[_]Feature{ | 703 | .dependencies = featureSet(&[_]Feature{ |
| 704 | .rme, | 704 | .rme, |
| 705 | }), | 705 | }), |
| 706 | }; | 706 | }; |
| 707 | result[@enumToInt(Feature.mops)] = .{ | 707 | result[@intFromEnum(Feature.mops)] = .{ |
| 708 | .llvm_name = "mops", | 708 | .llvm_name = "mops", |
| 709 | .description = "Enable Armv8.8-A memcpy and memset acceleration instructions (FEAT_MOPS)", | 709 | .description = "Enable Armv8.8-A memcpy and memset acceleration instructions (FEAT_MOPS)", |
| 710 | .dependencies = featureSet(&[_]Feature{}), | 710 | .dependencies = featureSet(&[_]Feature{}), |
| 711 | }; | 711 | }; |
| 712 | result[@enumToInt(Feature.mpam)] = .{ | 712 | result[@intFromEnum(Feature.mpam)] = .{ |
| 713 | .llvm_name = "mpam", | 713 | .llvm_name = "mpam", |
| 714 | .description = "Enable v8.4-A Memory system Partitioning and Monitoring extension (FEAT_MPAM)", | 714 | .description = "Enable v8.4-A Memory system Partitioning and Monitoring extension (FEAT_MPAM)", |
| 715 | .dependencies = featureSet(&[_]Feature{}), | 715 | .dependencies = featureSet(&[_]Feature{}), |
| 716 | }; | 716 | }; |
| 717 | result[@enumToInt(Feature.mte)] = .{ | 717 | result[@intFromEnum(Feature.mte)] = .{ |
| 718 | .llvm_name = "mte", | 718 | .llvm_name = "mte", |
| 719 | .description = "Enable Memory Tagging Extension (FEAT_MTE, FEAT_MTE2)", | 719 | .description = "Enable Memory Tagging Extension (FEAT_MTE, FEAT_MTE2)", |
| 720 | .dependencies = featureSet(&[_]Feature{}), | 720 | .dependencies = featureSet(&[_]Feature{}), |
| 721 | }; | 721 | }; |
| 722 | result[@enumToInt(Feature.neon)] = .{ | 722 | result[@intFromEnum(Feature.neon)] = .{ |
| 723 | .llvm_name = "neon", | 723 | .llvm_name = "neon", |
| 724 | .description = "Enable Advanced SIMD instructions (FEAT_AdvSIMD)", | 724 | .description = "Enable Advanced SIMD instructions (FEAT_AdvSIMD)", |
| 725 | .dependencies = featureSet(&[_]Feature{ | 725 | .dependencies = featureSet(&[_]Feature{ |
| 726 | .fp_armv8, | 726 | .fp_armv8, |
| 727 | }), | 727 | }), |
| 728 | }; | 728 | }; |
| 729 | result[@enumToInt(Feature.nmi)] = .{ | 729 | result[@intFromEnum(Feature.nmi)] = .{ |
| 730 | .llvm_name = "nmi", | 730 | .llvm_name = "nmi", |
| 731 | .description = "Enable Armv8.8-A Non-maskable Interrupts (FEAT_NMI, FEAT_GICv3_NMI)", | 731 | .description = "Enable Armv8.8-A Non-maskable Interrupts (FEAT_NMI, FEAT_GICv3_NMI)", |
| 732 | .dependencies = featureSet(&[_]Feature{}), | 732 | .dependencies = featureSet(&[_]Feature{}), |
| 733 | }; | 733 | }; |
| 734 | result[@enumToInt(Feature.no_bti_at_return_twice)] = .{ | 734 | result[@intFromEnum(Feature.no_bti_at_return_twice)] = .{ |
| 735 | .llvm_name = "no-bti-at-return-twice", | 735 | .llvm_name = "no-bti-at-return-twice", |
| 736 | .description = "Don't place a BTI instruction after a return-twice", | 736 | .description = "Don't place a BTI instruction after a return-twice", |
| 737 | .dependencies = featureSet(&[_]Feature{}), | 737 | .dependencies = featureSet(&[_]Feature{}), |
| 738 | }; | 738 | }; |
| 739 | result[@enumToInt(Feature.no_neg_immediates)] = .{ | 739 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ |
| 740 | .llvm_name = "no-neg-immediates", | 740 | .llvm_name = "no-neg-immediates", |
| 741 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", | 741 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 742 | .dependencies = featureSet(&[_]Feature{}), | 742 | .dependencies = featureSet(&[_]Feature{}), |
| 743 | }; | 743 | }; |
| 744 | result[@enumToInt(Feature.no_zcz_fp)] = .{ | 744 | result[@intFromEnum(Feature.no_zcz_fp)] = .{ |
| 745 | .llvm_name = "no-zcz-fp", | 745 | .llvm_name = "no-zcz-fp", |
| 746 | .description = "Has no zero-cycle zeroing instructions for FP registers", | 746 | .description = "Has no zero-cycle zeroing instructions for FP registers", |
| 747 | .dependencies = featureSet(&[_]Feature{}), | 747 | .dependencies = featureSet(&[_]Feature{}), |
| 748 | }; | 748 | }; |
| 749 | result[@enumToInt(Feature.nv)] = .{ | 749 | result[@intFromEnum(Feature.nv)] = .{ |
| 750 | .llvm_name = "nv", | 750 | .llvm_name = "nv", |
| 751 | .description = "Enable v8.4-A Nested Virtualization Enchancement (FEAT_NV, FEAT_NV2)", | 751 | .description = "Enable v8.4-A Nested Virtualization Enchancement (FEAT_NV, FEAT_NV2)", |
| 752 | .dependencies = featureSet(&[_]Feature{}), | 752 | .dependencies = featureSet(&[_]Feature{}), |
| 753 | }; | 753 | }; |
| 754 | result[@enumToInt(Feature.outline_atomics)] = .{ | 754 | result[@intFromEnum(Feature.outline_atomics)] = .{ |
| 755 | .llvm_name = "outline-atomics", | 755 | .llvm_name = "outline-atomics", |
| 756 | .description = "Enable out of line atomics to support LSE instructions", | 756 | .description = "Enable out of line atomics to support LSE instructions", |
| 757 | .dependencies = featureSet(&[_]Feature{}), | 757 | .dependencies = featureSet(&[_]Feature{}), |
| 758 | }; | 758 | }; |
| 759 | result[@enumToInt(Feature.pan)] = .{ | 759 | result[@intFromEnum(Feature.pan)] = .{ |
| 760 | .llvm_name = "pan", | 760 | .llvm_name = "pan", |
| 761 | .description = "Enables ARM v8.1 Privileged Access-Never extension (FEAT_PAN)", | 761 | .description = "Enables ARM v8.1 Privileged Access-Never extension (FEAT_PAN)", |
| 762 | .dependencies = featureSet(&[_]Feature{}), | 762 | .dependencies = featureSet(&[_]Feature{}), |
| 763 | }; | 763 | }; |
| 764 | result[@enumToInt(Feature.pan_rwv)] = .{ | 764 | result[@intFromEnum(Feature.pan_rwv)] = .{ |
| 765 | .llvm_name = "pan-rwv", | 765 | .llvm_name = "pan-rwv", |
| 766 | .description = "Enable v8.2 PAN s1e1R and s1e1W Variants (FEAT_PAN2)", | 766 | .description = "Enable v8.2 PAN s1e1R and s1e1W Variants (FEAT_PAN2)", |
| 767 | .dependencies = featureSet(&[_]Feature{ | 767 | .dependencies = featureSet(&[_]Feature{ |
| 768 | .pan, | 768 | .pan, |
| 769 | }), | 769 | }), |
| 770 | }; | 770 | }; |
| 771 | result[@enumToInt(Feature.pauth)] = .{ | 771 | result[@intFromEnum(Feature.pauth)] = .{ |
| 772 | .llvm_name = "pauth", | 772 | .llvm_name = "pauth", |
| 773 | .description = "Enable v8.3-A Pointer Authentication extension (FEAT_PAuth)", | 773 | .description = "Enable v8.3-A Pointer Authentication extension (FEAT_PAuth)", |
| 774 | .dependencies = featureSet(&[_]Feature{}), | 774 | .dependencies = featureSet(&[_]Feature{}), |
| 775 | }; | 775 | }; |
| 776 | result[@enumToInt(Feature.perfmon)] = .{ | 776 | result[@intFromEnum(Feature.perfmon)] = .{ |
| 777 | .llvm_name = "perfmon", | 777 | .llvm_name = "perfmon", |
| 778 | .description = "Enable Code Generation for ARMv8 PMUv3 Performance Monitors extension (FEAT_PMUv3)", | 778 | .description = "Enable Code Generation for ARMv8 PMUv3 Performance Monitors extension (FEAT_PMUv3)", |
| 779 | .dependencies = featureSet(&[_]Feature{}), | 779 | .dependencies = featureSet(&[_]Feature{}), |
| 780 | }; | 780 | }; |
| 781 | result[@enumToInt(Feature.predictable_select_expensive)] = .{ | 781 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ |
| 782 | .llvm_name = "predictable-select-expensive", | 782 | .llvm_name = "predictable-select-expensive", |
| 783 | .description = "Prefer likely predicted branches over selects", | 783 | .description = "Prefer likely predicted branches over selects", |
| 784 | .dependencies = featureSet(&[_]Feature{}), | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | }; | 785 | }; |
| 786 | result[@enumToInt(Feature.predres)] = .{ | 786 | result[@intFromEnum(Feature.predres)] = .{ |
| 787 | .llvm_name = "predres", | 787 | .llvm_name = "predres", |
| 788 | .description = "Enable v8.5a execution and data prediction invalidation instructions (FEAT_SPECRES)", | 788 | .description = "Enable v8.5a execution and data prediction invalidation instructions (FEAT_SPECRES)", |
| 789 | .dependencies = featureSet(&[_]Feature{}), | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | }; | 790 | }; |
| 791 | result[@enumToInt(Feature.prfm_slc_target)] = .{ | 791 | result[@intFromEnum(Feature.prfm_slc_target)] = .{ |
| 792 | .llvm_name = "prfm-slc-target", | 792 | .llvm_name = "prfm-slc-target", |
| 793 | .description = "Enable SLC target for PRFM instruction", | 793 | .description = "Enable SLC target for PRFM instruction", |
| 794 | .dependencies = featureSet(&[_]Feature{}), | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | }; | 795 | }; |
| 796 | result[@enumToInt(Feature.rand)] = .{ | 796 | result[@intFromEnum(Feature.rand)] = .{ |
| 797 | .llvm_name = "rand", | 797 | .llvm_name = "rand", |
| 798 | .description = "Enable Random Number generation instructions (FEAT_RNG)", | 798 | .description = "Enable Random Number generation instructions (FEAT_RNG)", |
| 799 | .dependencies = featureSet(&[_]Feature{}), | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | }; | 800 | }; |
| 801 | result[@enumToInt(Feature.ras)] = .{ | 801 | result[@intFromEnum(Feature.ras)] = .{ |
| 802 | .llvm_name = "ras", | 802 | .llvm_name = "ras", |
| 803 | .description = "Enable ARMv8 Reliability, Availability and Serviceability Extensions (FEAT_RAS, FEAT_RASv1p1)", | 803 | .description = "Enable ARMv8 Reliability, Availability and Serviceability Extensions (FEAT_RAS, FEAT_RASv1p1)", |
| 804 | .dependencies = featureSet(&[_]Feature{}), | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | }; | 805 | }; |
| 806 | result[@enumToInt(Feature.rasv2)] = .{ | 806 | result[@intFromEnum(Feature.rasv2)] = .{ |
| 807 | .llvm_name = "rasv2", | 807 | .llvm_name = "rasv2", |
| 808 | .description = "Enable ARMv8.9-A Reliability, Availability and Serviceability Extensions (FEAT_RASv2)", | 808 | .description = "Enable ARMv8.9-A Reliability, Availability and Serviceability Extensions (FEAT_RASv2)", |
| 809 | .dependencies = featureSet(&[_]Feature{ | 809 | .dependencies = featureSet(&[_]Feature{ |
| 810 | .ras, | 810 | .ras, |
| 811 | }), | 811 | }), |
| 812 | }; | 812 | }; |
| 813 | result[@enumToInt(Feature.rcpc)] = .{ | 813 | result[@intFromEnum(Feature.rcpc)] = .{ |
| 814 | .llvm_name = "rcpc", | 814 | .llvm_name = "rcpc", |
| 815 | .description = "Enable support for RCPC extension (FEAT_LRCPC)", | 815 | .description = "Enable support for RCPC extension (FEAT_LRCPC)", |
| 816 | .dependencies = featureSet(&[_]Feature{}), | 816 | .dependencies = featureSet(&[_]Feature{}), |
| 817 | }; | 817 | }; |
| 818 | result[@enumToInt(Feature.rcpc3)] = .{ | 818 | result[@intFromEnum(Feature.rcpc3)] = .{ |
| 819 | .llvm_name = "rcpc3", | 819 | .llvm_name = "rcpc3", |
| 820 | .description = "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set (FEAT_LRCPC3)", | 820 | .description = "Enable Armv8.9-A RCPC instructions for A64 and Advanced SIMD and floating-point instruction set (FEAT_LRCPC3)", |
| 821 | .dependencies = featureSet(&[_]Feature{ | 821 | .dependencies = featureSet(&[_]Feature{ |
| 822 | .rcpc_immo, | 822 | .rcpc_immo, |
| 823 | }), | 823 | }), |
| 824 | }; | 824 | }; |
| 825 | result[@enumToInt(Feature.rcpc_immo)] = .{ | 825 | result[@intFromEnum(Feature.rcpc_immo)] = .{ |
| 826 | .llvm_name = "rcpc-immo", | 826 | .llvm_name = "rcpc-immo", |
| 827 | .description = "Enable v8.4-A RCPC instructions with Immediate Offsets (FEAT_LRCPC2)", | 827 | .description = "Enable v8.4-A RCPC instructions with Immediate Offsets (FEAT_LRCPC2)", |
| 828 | .dependencies = featureSet(&[_]Feature{ | 828 | .dependencies = featureSet(&[_]Feature{ |
| 829 | .rcpc, | 829 | .rcpc, |
| 830 | }), | 830 | }), |
| 831 | }; | 831 | }; |
| 832 | result[@enumToInt(Feature.rdm)] = .{ | 832 | result[@intFromEnum(Feature.rdm)] = .{ |
| 833 | .llvm_name = "rdm", | 833 | .llvm_name = "rdm", |
| 834 | .description = "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions (FEAT_RDM)", | 834 | .description = "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions (FEAT_RDM)", |
| 835 | .dependencies = featureSet(&[_]Feature{}), | 835 | .dependencies = featureSet(&[_]Feature{}), |
| 836 | }; | 836 | }; |
| 837 | result[@enumToInt(Feature.reserve_x1)] = .{ | 837 | result[@intFromEnum(Feature.reserve_x1)] = .{ |
| 838 | .llvm_name = "reserve-x1", | 838 | .llvm_name = "reserve-x1", |
| 839 | .description = "Reserve X1, making it unavailable as a GPR", | 839 | .description = "Reserve X1, making it unavailable as a GPR", |
| 840 | .dependencies = featureSet(&[_]Feature{}), | 840 | .dependencies = featureSet(&[_]Feature{}), |
| 841 | }; | 841 | }; |
| 842 | result[@enumToInt(Feature.reserve_x10)] = .{ | 842 | result[@intFromEnum(Feature.reserve_x10)] = .{ |
| 843 | .llvm_name = "reserve-x10", | 843 | .llvm_name = "reserve-x10", |
| 844 | .description = "Reserve X10, making it unavailable as a GPR", | 844 | .description = "Reserve X10, making it unavailable as a GPR", |
| 845 | .dependencies = featureSet(&[_]Feature{}), | 845 | .dependencies = featureSet(&[_]Feature{}), |
| 846 | }; | 846 | }; |
| 847 | result[@enumToInt(Feature.reserve_x11)] = .{ | 847 | result[@intFromEnum(Feature.reserve_x11)] = .{ |
| 848 | .llvm_name = "reserve-x11", | 848 | .llvm_name = "reserve-x11", |
| 849 | .description = "Reserve X11, making it unavailable as a GPR", | 849 | .description = "Reserve X11, making it unavailable as a GPR", |
| 850 | .dependencies = featureSet(&[_]Feature{}), | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | }; | 851 | }; |
| 852 | result[@enumToInt(Feature.reserve_x12)] = .{ | 852 | result[@intFromEnum(Feature.reserve_x12)] = .{ |
| 853 | .llvm_name = "reserve-x12", | 853 | .llvm_name = "reserve-x12", |
| 854 | .description = "Reserve X12, making it unavailable as a GPR", | 854 | .description = "Reserve X12, making it unavailable as a GPR", |
| 855 | .dependencies = featureSet(&[_]Feature{}), | 855 | .dependencies = featureSet(&[_]Feature{}), |
| 856 | }; | 856 | }; |
| 857 | result[@enumToInt(Feature.reserve_x13)] = .{ | 857 | result[@intFromEnum(Feature.reserve_x13)] = .{ |
| 858 | .llvm_name = "reserve-x13", | 858 | .llvm_name = "reserve-x13", |
| 859 | .description = "Reserve X13, making it unavailable as a GPR", | 859 | .description = "Reserve X13, making it unavailable as a GPR", |
| 860 | .dependencies = featureSet(&[_]Feature{}), | 860 | .dependencies = featureSet(&[_]Feature{}), |
| 861 | }; | 861 | }; |
| 862 | result[@enumToInt(Feature.reserve_x14)] = .{ | 862 | result[@intFromEnum(Feature.reserve_x14)] = .{ |
| 863 | .llvm_name = "reserve-x14", | 863 | .llvm_name = "reserve-x14", |
| 864 | .description = "Reserve X14, making it unavailable as a GPR", | 864 | .description = "Reserve X14, making it unavailable as a GPR", |
| 865 | .dependencies = featureSet(&[_]Feature{}), | 865 | .dependencies = featureSet(&[_]Feature{}), |
| 866 | }; | 866 | }; |
| 867 | result[@enumToInt(Feature.reserve_x15)] = .{ | 867 | result[@intFromEnum(Feature.reserve_x15)] = .{ |
| 868 | .llvm_name = "reserve-x15", | 868 | .llvm_name = "reserve-x15", |
| 869 | .description = "Reserve X15, making it unavailable as a GPR", | 869 | .description = "Reserve X15, making it unavailable as a GPR", |
| 870 | .dependencies = featureSet(&[_]Feature{}), | 870 | .dependencies = featureSet(&[_]Feature{}), |
| 871 | }; | 871 | }; |
| 872 | result[@enumToInt(Feature.reserve_x18)] = .{ | 872 | result[@intFromEnum(Feature.reserve_x18)] = .{ |
| 873 | .llvm_name = "reserve-x18", | 873 | .llvm_name = "reserve-x18", |
| 874 | .description = "Reserve X18, making it unavailable as a GPR", | 874 | .description = "Reserve X18, making it unavailable as a GPR", |
| 875 | .dependencies = featureSet(&[_]Feature{}), | 875 | .dependencies = featureSet(&[_]Feature{}), |
| 876 | }; | 876 | }; |
| 877 | result[@enumToInt(Feature.reserve_x2)] = .{ | 877 | result[@intFromEnum(Feature.reserve_x2)] = .{ |
| 878 | .llvm_name = "reserve-x2", | 878 | .llvm_name = "reserve-x2", |
| 879 | .description = "Reserve X2, making it unavailable as a GPR", | 879 | .description = "Reserve X2, making it unavailable as a GPR", |
| 880 | .dependencies = featureSet(&[_]Feature{}), | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | }; | 881 | }; |
| 882 | result[@enumToInt(Feature.reserve_x20)] = .{ | 882 | result[@intFromEnum(Feature.reserve_x20)] = .{ |
| 883 | .llvm_name = "reserve-x20", | 883 | .llvm_name = "reserve-x20", |
| 884 | .description = "Reserve X20, making it unavailable as a GPR", | 884 | .description = "Reserve X20, making it unavailable as a GPR", |
| 885 | .dependencies = featureSet(&[_]Feature{}), | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | }; | 886 | }; |
| 887 | result[@enumToInt(Feature.reserve_x21)] = .{ | 887 | result[@intFromEnum(Feature.reserve_x21)] = .{ |
| 888 | .llvm_name = "reserve-x21", | 888 | .llvm_name = "reserve-x21", |
| 889 | .description = "Reserve X21, making it unavailable as a GPR", | 889 | .description = "Reserve X21, making it unavailable as a GPR", |
| 890 | .dependencies = featureSet(&[_]Feature{}), | 890 | .dependencies = featureSet(&[_]Feature{}), |
| 891 | }; | 891 | }; |
| 892 | result[@enumToInt(Feature.reserve_x22)] = .{ | 892 | result[@intFromEnum(Feature.reserve_x22)] = .{ |
| 893 | .llvm_name = "reserve-x22", | 893 | .llvm_name = "reserve-x22", |
| 894 | .description = "Reserve X22, making it unavailable as a GPR", | 894 | .description = "Reserve X22, making it unavailable as a GPR", |
| 895 | .dependencies = featureSet(&[_]Feature{}), | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | }; | 896 | }; |
| 897 | result[@enumToInt(Feature.reserve_x23)] = .{ | 897 | result[@intFromEnum(Feature.reserve_x23)] = .{ |
| 898 | .llvm_name = "reserve-x23", | 898 | .llvm_name = "reserve-x23", |
| 899 | .description = "Reserve X23, making it unavailable as a GPR", | 899 | .description = "Reserve X23, making it unavailable as a GPR", |
| 900 | .dependencies = featureSet(&[_]Feature{}), | 900 | .dependencies = featureSet(&[_]Feature{}), |
| 901 | }; | 901 | }; |
| 902 | result[@enumToInt(Feature.reserve_x24)] = .{ | 902 | result[@intFromEnum(Feature.reserve_x24)] = .{ |
| 903 | .llvm_name = "reserve-x24", | 903 | .llvm_name = "reserve-x24", |
| 904 | .description = "Reserve X24, making it unavailable as a GPR", | 904 | .description = "Reserve X24, making it unavailable as a GPR", |
| 905 | .dependencies = featureSet(&[_]Feature{}), | 905 | .dependencies = featureSet(&[_]Feature{}), |
| 906 | }; | 906 | }; |
| 907 | result[@enumToInt(Feature.reserve_x25)] = .{ | 907 | result[@intFromEnum(Feature.reserve_x25)] = .{ |
| 908 | .llvm_name = "reserve-x25", | 908 | .llvm_name = "reserve-x25", |
| 909 | .description = "Reserve X25, making it unavailable as a GPR", | 909 | .description = "Reserve X25, making it unavailable as a GPR", |
| 910 | .dependencies = featureSet(&[_]Feature{}), | 910 | .dependencies = featureSet(&[_]Feature{}), |
| 911 | }; | 911 | }; |
| 912 | result[@enumToInt(Feature.reserve_x26)] = .{ | 912 | result[@intFromEnum(Feature.reserve_x26)] = .{ |
| 913 | .llvm_name = "reserve-x26", | 913 | .llvm_name = "reserve-x26", |
| 914 | .description = "Reserve X26, making it unavailable as a GPR", | 914 | .description = "Reserve X26, making it unavailable as a GPR", |
| 915 | .dependencies = featureSet(&[_]Feature{}), | 915 | .dependencies = featureSet(&[_]Feature{}), |
| 916 | }; | 916 | }; |
| 917 | result[@enumToInt(Feature.reserve_x27)] = .{ | 917 | result[@intFromEnum(Feature.reserve_x27)] = .{ |
| 918 | .llvm_name = "reserve-x27", | 918 | .llvm_name = "reserve-x27", |
| 919 | .description = "Reserve X27, making it unavailable as a GPR", | 919 | .description = "Reserve X27, making it unavailable as a GPR", |
| 920 | .dependencies = featureSet(&[_]Feature{}), | 920 | .dependencies = featureSet(&[_]Feature{}), |
| 921 | }; | 921 | }; |
| 922 | result[@enumToInt(Feature.reserve_x28)] = .{ | 922 | result[@intFromEnum(Feature.reserve_x28)] = .{ |
| 923 | .llvm_name = "reserve-x28", | 923 | .llvm_name = "reserve-x28", |
| 924 | .description = "Reserve X28, making it unavailable as a GPR", | 924 | .description = "Reserve X28, making it unavailable as a GPR", |
| 925 | .dependencies = featureSet(&[_]Feature{}), | 925 | .dependencies = featureSet(&[_]Feature{}), |
| 926 | }; | 926 | }; |
| 927 | result[@enumToInt(Feature.reserve_x3)] = .{ | 927 | result[@intFromEnum(Feature.reserve_x3)] = .{ |
| 928 | .llvm_name = "reserve-x3", | 928 | .llvm_name = "reserve-x3", |
| 929 | .description = "Reserve X3, making it unavailable as a GPR", | 929 | .description = "Reserve X3, making it unavailable as a GPR", |
| 930 | .dependencies = featureSet(&[_]Feature{}), | 930 | .dependencies = featureSet(&[_]Feature{}), |
| 931 | }; | 931 | }; |
| 932 | result[@enumToInt(Feature.reserve_x30)] = .{ | 932 | result[@intFromEnum(Feature.reserve_x30)] = .{ |
| 933 | .llvm_name = "reserve-x30", | 933 | .llvm_name = "reserve-x30", |
| 934 | .description = "Reserve X30, making it unavailable as a GPR", | 934 | .description = "Reserve X30, making it unavailable as a GPR", |
| 935 | .dependencies = featureSet(&[_]Feature{}), | 935 | .dependencies = featureSet(&[_]Feature{}), |
| 936 | }; | 936 | }; |
| 937 | result[@enumToInt(Feature.reserve_x4)] = .{ | 937 | result[@intFromEnum(Feature.reserve_x4)] = .{ |
| 938 | .llvm_name = "reserve-x4", | 938 | .llvm_name = "reserve-x4", |
| 939 | .description = "Reserve X4, making it unavailable as a GPR", | 939 | .description = "Reserve X4, making it unavailable as a GPR", |
| 940 | .dependencies = featureSet(&[_]Feature{}), | 940 | .dependencies = featureSet(&[_]Feature{}), |
| 941 | }; | 941 | }; |
| 942 | result[@enumToInt(Feature.reserve_x5)] = .{ | 942 | result[@intFromEnum(Feature.reserve_x5)] = .{ |
| 943 | .llvm_name = "reserve-x5", | 943 | .llvm_name = "reserve-x5", |
| 944 | .description = "Reserve X5, making it unavailable as a GPR", | 944 | .description = "Reserve X5, making it unavailable as a GPR", |
| 945 | .dependencies = featureSet(&[_]Feature{}), | 945 | .dependencies = featureSet(&[_]Feature{}), |
| 946 | }; | 946 | }; |
| 947 | result[@enumToInt(Feature.reserve_x6)] = .{ | 947 | result[@intFromEnum(Feature.reserve_x6)] = .{ |
| 948 | .llvm_name = "reserve-x6", | 948 | .llvm_name = "reserve-x6", |
| 949 | .description = "Reserve X6, making it unavailable as a GPR", | 949 | .description = "Reserve X6, making it unavailable as a GPR", |
| 950 | .dependencies = featureSet(&[_]Feature{}), | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | }; | 951 | }; |
| 952 | result[@enumToInt(Feature.reserve_x7)] = .{ | 952 | result[@intFromEnum(Feature.reserve_x7)] = .{ |
| 953 | .llvm_name = "reserve-x7", | 953 | .llvm_name = "reserve-x7", |
| 954 | .description = "Reserve X7, making it unavailable as a GPR", | 954 | .description = "Reserve X7, making it unavailable as a GPR", |
| 955 | .dependencies = featureSet(&[_]Feature{}), | 955 | .dependencies = featureSet(&[_]Feature{}), |
| 956 | }; | 956 | }; |
| 957 | result[@enumToInt(Feature.reserve_x9)] = .{ | 957 | result[@intFromEnum(Feature.reserve_x9)] = .{ |
| 958 | .llvm_name = "reserve-x9", | 958 | .llvm_name = "reserve-x9", |
| 959 | .description = "Reserve X9, making it unavailable as a GPR", | 959 | .description = "Reserve X9, making it unavailable as a GPR", |
| 960 | .dependencies = featureSet(&[_]Feature{}), | 960 | .dependencies = featureSet(&[_]Feature{}), |
| 961 | }; | 961 | }; |
| 962 | result[@enumToInt(Feature.rme)] = .{ | 962 | result[@intFromEnum(Feature.rme)] = .{ |
| 963 | .llvm_name = "rme", | 963 | .llvm_name = "rme", |
| 964 | .description = "Enable Realm Management Extension (FEAT_RME)", | 964 | .description = "Enable Realm Management Extension (FEAT_RME)", |
| 965 | .dependencies = featureSet(&[_]Feature{}), | 965 | .dependencies = featureSet(&[_]Feature{}), |
| 966 | }; | 966 | }; |
| 967 | result[@enumToInt(Feature.sb)] = .{ | 967 | result[@intFromEnum(Feature.sb)] = .{ |
| 968 | .llvm_name = "sb", | 968 | .llvm_name = "sb", |
| 969 | .description = "Enable v8.5 Speculation Barrier (FEAT_SB)", | 969 | .description = "Enable v8.5 Speculation Barrier (FEAT_SB)", |
| 970 | .dependencies = featureSet(&[_]Feature{}), | 970 | .dependencies = featureSet(&[_]Feature{}), |
| 971 | }; | 971 | }; |
| 972 | result[@enumToInt(Feature.sel2)] = .{ | 972 | result[@intFromEnum(Feature.sel2)] = .{ |
| 973 | .llvm_name = "sel2", | 973 | .llvm_name = "sel2", |
| 974 | .description = "Enable v8.4-A Secure Exception Level 2 extension (FEAT_SEL2)", | 974 | .description = "Enable v8.4-A Secure Exception Level 2 extension (FEAT_SEL2)", |
| 975 | .dependencies = featureSet(&[_]Feature{}), | 975 | .dependencies = featureSet(&[_]Feature{}), |
| 976 | }; | 976 | }; |
| 977 | result[@enumToInt(Feature.sha2)] = .{ | 977 | result[@intFromEnum(Feature.sha2)] = .{ |
| 978 | .llvm_name = "sha2", | 978 | .llvm_name = "sha2", |
| 979 | .description = "Enable SHA1 and SHA256 support (FEAT_SHA1, FEAT_SHA256)", | 979 | .description = "Enable SHA1 and SHA256 support (FEAT_SHA1, FEAT_SHA256)", |
| 980 | .dependencies = featureSet(&[_]Feature{ | 980 | .dependencies = featureSet(&[_]Feature{ |
| 981 | .neon, | 981 | .neon, |
| 982 | }), | 982 | }), |
| 983 | }; | 983 | }; |
| 984 | result[@enumToInt(Feature.sha3)] = .{ | 984 | result[@intFromEnum(Feature.sha3)] = .{ |
| 985 | .llvm_name = "sha3", | 985 | .llvm_name = "sha3", |
| 986 | .description = "Enable SHA512 and SHA3 support (FEAT_SHA3, FEAT_SHA512)", | 986 | .description = "Enable SHA512 and SHA3 support (FEAT_SHA3, FEAT_SHA512)", |
| 987 | .dependencies = featureSet(&[_]Feature{ | 987 | .dependencies = featureSet(&[_]Feature{ |
| 988 | .sha2, | 988 | .sha2, |
| 989 | }), | 989 | }), |
| 990 | }; | 990 | }; |
| 991 | result[@enumToInt(Feature.slow_misaligned_128store)] = .{ | 991 | result[@intFromEnum(Feature.slow_misaligned_128store)] = .{ |
| 992 | .llvm_name = "slow-misaligned-128store", | 992 | .llvm_name = "slow-misaligned-128store", |
| 993 | .description = "Misaligned 128 bit stores are slow", | 993 | .description = "Misaligned 128 bit stores are slow", |
| 994 | .dependencies = featureSet(&[_]Feature{}), | 994 | .dependencies = featureSet(&[_]Feature{}), |
| 995 | }; | 995 | }; |
| 996 | result[@enumToInt(Feature.slow_paired_128)] = .{ | 996 | result[@intFromEnum(Feature.slow_paired_128)] = .{ |
| 997 | .llvm_name = "slow-paired-128", | 997 | .llvm_name = "slow-paired-128", |
| 998 | .description = "Paired 128 bit loads and stores are slow", | 998 | .description = "Paired 128 bit loads and stores are slow", |
| 999 | .dependencies = featureSet(&[_]Feature{}), | 999 | .dependencies = featureSet(&[_]Feature{}), |
| 1000 | }; | 1000 | }; |
| 1001 | result[@enumToInt(Feature.slow_strqro_store)] = .{ | 1001 | result[@intFromEnum(Feature.slow_strqro_store)] = .{ |
| 1002 | .llvm_name = "slow-strqro-store", | 1002 | .llvm_name = "slow-strqro-store", |
| 1003 | .description = "STR of Q register with register offset is slow", | 1003 | .description = "STR of Q register with register offset is slow", |
| 1004 | .dependencies = featureSet(&[_]Feature{}), | 1004 | .dependencies = featureSet(&[_]Feature{}), |
| 1005 | }; | 1005 | }; |
| 1006 | result[@enumToInt(Feature.sm4)] = .{ | 1006 | result[@intFromEnum(Feature.sm4)] = .{ |
| 1007 | .llvm_name = "sm4", | 1007 | .llvm_name = "sm4", |
| 1008 | .description = "Enable SM3 and SM4 support (FEAT_SM4, FEAT_SM3)", | 1008 | .description = "Enable SM3 and SM4 support (FEAT_SM4, FEAT_SM3)", |
| 1009 | .dependencies = featureSet(&[_]Feature{ | 1009 | .dependencies = featureSet(&[_]Feature{ |
| 1010 | .neon, | 1010 | .neon, |
| 1011 | }), | 1011 | }), |
| 1012 | }; | 1012 | }; |
| 1013 | result[@enumToInt(Feature.sme)] = .{ | 1013 | result[@intFromEnum(Feature.sme)] = .{ |
| 1014 | .llvm_name = "sme", | 1014 | .llvm_name = "sme", |
| 1015 | .description = "Enable Scalable Matrix Extension (SME) (FEAT_SME)", | 1015 | .description = "Enable Scalable Matrix Extension (SME) (FEAT_SME)", |
| 1016 | .dependencies = featureSet(&[_]Feature{ | 1016 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1018,79 +1018,79 @@ pub const all_features = blk: { | ... | @@ -1018,79 +1018,79 @@ pub const all_features = blk: { |
| 1018 | .use_scalar_inc_vl, | 1018 | .use_scalar_inc_vl, |
| 1019 | }), | 1019 | }), |
| 1020 | }; | 1020 | }; |
| 1021 | result[@enumToInt(Feature.sme2)] = .{ | 1021 | result[@intFromEnum(Feature.sme2)] = .{ |
| 1022 | .llvm_name = "sme2", | 1022 | .llvm_name = "sme2", |
| 1023 | .description = "Enable Scalable Matrix Extension 2 (SME2) instructions", | 1023 | .description = "Enable Scalable Matrix Extension 2 (SME2) instructions", |
| 1024 | .dependencies = featureSet(&[_]Feature{ | 1024 | .dependencies = featureSet(&[_]Feature{ |
| 1025 | .sme, | 1025 | .sme, |
| 1026 | }), | 1026 | }), |
| 1027 | }; | 1027 | }; |
| 1028 | result[@enumToInt(Feature.sme2p1)] = .{ | 1028 | result[@intFromEnum(Feature.sme2p1)] = .{ |
| 1029 | .llvm_name = "sme2p1", | 1029 | .llvm_name = "sme2p1", |
| 1030 | .description = "Enable Scalable Matrix Extension 2.1 (FEAT_SME2p1) instructions", | 1030 | .description = "Enable Scalable Matrix Extension 2.1 (FEAT_SME2p1) instructions", |
| 1031 | .dependencies = featureSet(&[_]Feature{ | 1031 | .dependencies = featureSet(&[_]Feature{ |
| 1032 | .sme2, | 1032 | .sme2, |
| 1033 | }), | 1033 | }), |
| 1034 | }; | 1034 | }; |
| 1035 | result[@enumToInt(Feature.sme_f16f16)] = .{ | 1035 | result[@intFromEnum(Feature.sme_f16f16)] = .{ |
| 1036 | .llvm_name = "sme-f16f16", | 1036 | .llvm_name = "sme-f16f16", |
| 1037 | .description = "Enable SME2.1 non-widening Float16 instructions (FEAT_SME_F16F16)", | 1037 | .description = "Enable SME2.1 non-widening Float16 instructions (FEAT_SME_F16F16)", |
| 1038 | .dependencies = featureSet(&[_]Feature{}), | 1038 | .dependencies = featureSet(&[_]Feature{}), |
| 1039 | }; | 1039 | }; |
| 1040 | result[@enumToInt(Feature.sme_f64f64)] = .{ | 1040 | result[@intFromEnum(Feature.sme_f64f64)] = .{ |
| 1041 | .llvm_name = "sme-f64f64", | 1041 | .llvm_name = "sme-f64f64", |
| 1042 | .description = "Enable Scalable Matrix Extension (SME) F64F64 instructions (FEAT_SME_F64F64)", | 1042 | .description = "Enable Scalable Matrix Extension (SME) F64F64 instructions (FEAT_SME_F64F64)", |
| 1043 | .dependencies = featureSet(&[_]Feature{ | 1043 | .dependencies = featureSet(&[_]Feature{ |
| 1044 | .sme, | 1044 | .sme, |
| 1045 | }), | 1045 | }), |
| 1046 | }; | 1046 | }; |
| 1047 | result[@enumToInt(Feature.sme_i16i64)] = .{ | 1047 | result[@intFromEnum(Feature.sme_i16i64)] = .{ |
| 1048 | .llvm_name = "sme-i16i64", | 1048 | .llvm_name = "sme-i16i64", |
| 1049 | .description = "Enable Scalable Matrix Extension (SME) I16I64 instructions (FEAT_SME_I16I64)", | 1049 | .description = "Enable Scalable Matrix Extension (SME) I16I64 instructions (FEAT_SME_I16I64)", |
| 1050 | .dependencies = featureSet(&[_]Feature{ | 1050 | .dependencies = featureSet(&[_]Feature{ |
| 1051 | .sme, | 1051 | .sme, |
| 1052 | }), | 1052 | }), |
| 1053 | }; | 1053 | }; |
| 1054 | result[@enumToInt(Feature.spe)] = .{ | 1054 | result[@intFromEnum(Feature.spe)] = .{ |
| 1055 | .llvm_name = "spe", | 1055 | .llvm_name = "spe", |
| 1056 | .description = "Enable Statistical Profiling extension (FEAT_SPE)", | 1056 | .description = "Enable Statistical Profiling extension (FEAT_SPE)", |
| 1057 | .dependencies = featureSet(&[_]Feature{}), | 1057 | .dependencies = featureSet(&[_]Feature{}), |
| 1058 | }; | 1058 | }; |
| 1059 | result[@enumToInt(Feature.spe_eef)] = .{ | 1059 | result[@intFromEnum(Feature.spe_eef)] = .{ |
| 1060 | .llvm_name = "spe-eef", | 1060 | .llvm_name = "spe-eef", |
| 1061 | .description = "Enable extra register in the Statistical Profiling Extension (FEAT_SPEv1p2)", | 1061 | .description = "Enable extra register in the Statistical Profiling Extension (FEAT_SPEv1p2)", |
| 1062 | .dependencies = featureSet(&[_]Feature{}), | 1062 | .dependencies = featureSet(&[_]Feature{}), |
| 1063 | }; | 1063 | }; |
| 1064 | result[@enumToInt(Feature.specres2)] = .{ | 1064 | result[@intFromEnum(Feature.specres2)] = .{ |
| 1065 | .llvm_name = "specres2", | 1065 | .llvm_name = "specres2", |
| 1066 | .description = "Enable Speculation Restriction Instruction (FEAT_SPECRES2)", | 1066 | .description = "Enable Speculation Restriction Instruction (FEAT_SPECRES2)", |
| 1067 | .dependencies = featureSet(&[_]Feature{ | 1067 | .dependencies = featureSet(&[_]Feature{ |
| 1068 | .predres, | 1068 | .predres, |
| 1069 | }), | 1069 | }), |
| 1070 | }; | 1070 | }; |
| 1071 | result[@enumToInt(Feature.specrestrict)] = .{ | 1071 | result[@intFromEnum(Feature.specrestrict)] = .{ |
| 1072 | .llvm_name = "specrestrict", | 1072 | .llvm_name = "specrestrict", |
| 1073 | .description = "Enable architectural speculation restriction (FEAT_CSV2_2)", | 1073 | .description = "Enable architectural speculation restriction (FEAT_CSV2_2)", |
| 1074 | .dependencies = featureSet(&[_]Feature{}), | 1074 | .dependencies = featureSet(&[_]Feature{}), |
| 1075 | }; | 1075 | }; |
| 1076 | result[@enumToInt(Feature.ssbs)] = .{ | 1076 | result[@intFromEnum(Feature.ssbs)] = .{ |
| 1077 | .llvm_name = "ssbs", | 1077 | .llvm_name = "ssbs", |
| 1078 | .description = "Enable Speculative Store Bypass Safe bit (FEAT_SSBS, FEAT_SSBS2)", | 1078 | .description = "Enable Speculative Store Bypass Safe bit (FEAT_SSBS, FEAT_SSBS2)", |
| 1079 | .dependencies = featureSet(&[_]Feature{}), | 1079 | .dependencies = featureSet(&[_]Feature{}), |
| 1080 | }; | 1080 | }; |
| 1081 | result[@enumToInt(Feature.strict_align)] = .{ | 1081 | result[@intFromEnum(Feature.strict_align)] = .{ |
| 1082 | .llvm_name = "strict-align", | 1082 | .llvm_name = "strict-align", |
| 1083 | .description = "Disallow all unaligned memory access", | 1083 | .description = "Disallow all unaligned memory access", |
| 1084 | .dependencies = featureSet(&[_]Feature{}), | 1084 | .dependencies = featureSet(&[_]Feature{}), |
| 1085 | }; | 1085 | }; |
| 1086 | result[@enumToInt(Feature.sve)] = .{ | 1086 | result[@intFromEnum(Feature.sve)] = .{ |
| 1087 | .llvm_name = "sve", | 1087 | .llvm_name = "sve", |
| 1088 | .description = "Enable Scalable Vector Extension (SVE) instructions (FEAT_SVE)", | 1088 | .description = "Enable Scalable Vector Extension (SVE) instructions (FEAT_SVE)", |
| 1089 | .dependencies = featureSet(&[_]Feature{ | 1089 | .dependencies = featureSet(&[_]Feature{ |
| 1090 | .fullfp16, | 1090 | .fullfp16, |
| 1091 | }), | 1091 | }), |
| 1092 | }; | 1092 | }; |
| 1093 | result[@enumToInt(Feature.sve2)] = .{ | 1093 | result[@intFromEnum(Feature.sve2)] = .{ |
| 1094 | .llvm_name = "sve2", | 1094 | .llvm_name = "sve2", |
| 1095 | .description = "Enable Scalable Vector Extension 2 (SVE2) instructions (FEAT_SVE2)", | 1095 | .description = "Enable Scalable Vector Extension 2 (SVE2) instructions (FEAT_SVE2)", |
| 1096 | .dependencies = featureSet(&[_]Feature{ | 1096 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1098,7 +1098,7 @@ pub const all_features = blk: { | ... | @@ -1098,7 +1098,7 @@ pub const all_features = blk: { |
| 1098 | .use_scalar_inc_vl, | 1098 | .use_scalar_inc_vl, |
| 1099 | }), | 1099 | }), |
| 1100 | }; | 1100 | }; |
| 1101 | result[@enumToInt(Feature.sve2_aes)] = .{ | 1101 | result[@intFromEnum(Feature.sve2_aes)] = .{ |
| 1102 | .llvm_name = "sve2-aes", | 1102 | .llvm_name = "sve2-aes", |
| 1103 | .description = "Enable AES SVE2 instructions (FEAT_SVE_AES, FEAT_SVE_PMULL128)", | 1103 | .description = "Enable AES SVE2 instructions (FEAT_SVE_AES, FEAT_SVE_PMULL128)", |
| 1104 | .dependencies = featureSet(&[_]Feature{ | 1104 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1106,14 +1106,14 @@ pub const all_features = blk: { | ... | @@ -1106,14 +1106,14 @@ pub const all_features = blk: { |
| 1106 | .sve2, | 1106 | .sve2, |
| 1107 | }), | 1107 | }), |
| 1108 | }; | 1108 | }; |
| 1109 | result[@enumToInt(Feature.sve2_bitperm)] = .{ | 1109 | result[@intFromEnum(Feature.sve2_bitperm)] = .{ |
| 1110 | .llvm_name = "sve2-bitperm", | 1110 | .llvm_name = "sve2-bitperm", |
| 1111 | .description = "Enable bit permutation SVE2 instructions (FEAT_SVE_BitPerm)", | 1111 | .description = "Enable bit permutation SVE2 instructions (FEAT_SVE_BitPerm)", |
| 1112 | .dependencies = featureSet(&[_]Feature{ | 1112 | .dependencies = featureSet(&[_]Feature{ |
| 1113 | .sve2, | 1113 | .sve2, |
| 1114 | }), | 1114 | }), |
| 1115 | }; | 1115 | }; |
| 1116 | result[@enumToInt(Feature.sve2_sha3)] = .{ | 1116 | result[@intFromEnum(Feature.sve2_sha3)] = .{ |
| 1117 | .llvm_name = "sve2-sha3", | 1117 | .llvm_name = "sve2-sha3", |
| 1118 | .description = "Enable SHA3 SVE2 instructions (FEAT_SVE_SHA3)", | 1118 | .description = "Enable SHA3 SVE2 instructions (FEAT_SVE_SHA3)", |
| 1119 | .dependencies = featureSet(&[_]Feature{ | 1119 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1121,7 +1121,7 @@ pub const all_features = blk: { | ... | @@ -1121,7 +1121,7 @@ pub const all_features = blk: { |
| 1121 | .sve2, | 1121 | .sve2, |
| 1122 | }), | 1122 | }), |
| 1123 | }; | 1123 | }; |
| 1124 | result[@enumToInt(Feature.sve2_sm4)] = .{ | 1124 | result[@intFromEnum(Feature.sve2_sm4)] = .{ |
| 1125 | .llvm_name = "sve2-sm4", | 1125 | .llvm_name = "sve2-sm4", |
| 1126 | .description = "Enable SM4 SVE2 instructions (FEAT_SVE_SM4)", | 1126 | .description = "Enable SM4 SVE2 instructions (FEAT_SVE_SM4)", |
| 1127 | .dependencies = featureSet(&[_]Feature{ | 1127 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1129,84 +1129,84 @@ pub const all_features = blk: { | ... | @@ -1129,84 +1129,84 @@ pub const all_features = blk: { |
| 1129 | .sve2, | 1129 | .sve2, |
| 1130 | }), | 1130 | }), |
| 1131 | }; | 1131 | }; |
| 1132 | result[@enumToInt(Feature.sve2p1)] = .{ | 1132 | result[@intFromEnum(Feature.sve2p1)] = .{ |
| 1133 | .llvm_name = "sve2p1", | 1133 | .llvm_name = "sve2p1", |
| 1134 | .description = "Enable Scalable Vector Extension 2.1 instructions", | 1134 | .description = "Enable Scalable Vector Extension 2.1 instructions", |
| 1135 | .dependencies = featureSet(&[_]Feature{ | 1135 | .dependencies = featureSet(&[_]Feature{ |
| 1136 | .sve2, | 1136 | .sve2, |
| 1137 | }), | 1137 | }), |
| 1138 | }; | 1138 | }; |
| 1139 | result[@enumToInt(Feature.tagged_globals)] = .{ | 1139 | result[@intFromEnum(Feature.tagged_globals)] = .{ |
| 1140 | .llvm_name = "tagged-globals", | 1140 | .llvm_name = "tagged-globals", |
| 1141 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", | 1141 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 1142 | .dependencies = featureSet(&[_]Feature{}), | 1142 | .dependencies = featureSet(&[_]Feature{}), |
| 1143 | }; | 1143 | }; |
| 1144 | result[@enumToInt(Feature.the)] = .{ | 1144 | result[@intFromEnum(Feature.the)] = .{ |
| 1145 | .llvm_name = "the", | 1145 | .llvm_name = "the", |
| 1146 | .description = "Enable Armv8.9-A Translation Hardening Extension (FEAT_THE)", | 1146 | .description = "Enable Armv8.9-A Translation Hardening Extension (FEAT_THE)", |
| 1147 | .dependencies = featureSet(&[_]Feature{}), | 1147 | .dependencies = featureSet(&[_]Feature{}), |
| 1148 | }; | 1148 | }; |
| 1149 | result[@enumToInt(Feature.tlb_rmi)] = .{ | 1149 | result[@intFromEnum(Feature.tlb_rmi)] = .{ |
| 1150 | .llvm_name = "tlb-rmi", | 1150 | .llvm_name = "tlb-rmi", |
| 1151 | .description = "Enable v8.4-A TLB Range and Maintenance Instructions (FEAT_TLBIOS, FEAT_TLBIRANGE)", | 1151 | .description = "Enable v8.4-A TLB Range and Maintenance Instructions (FEAT_TLBIOS, FEAT_TLBIRANGE)", |
| 1152 | .dependencies = featureSet(&[_]Feature{}), | 1152 | .dependencies = featureSet(&[_]Feature{}), |
| 1153 | }; | 1153 | }; |
| 1154 | result[@enumToInt(Feature.tme)] = .{ | 1154 | result[@intFromEnum(Feature.tme)] = .{ |
| 1155 | .llvm_name = "tme", | 1155 | .llvm_name = "tme", |
| 1156 | .description = "Enable Transactional Memory Extension (FEAT_TME)", | 1156 | .description = "Enable Transactional Memory Extension (FEAT_TME)", |
| 1157 | .dependencies = featureSet(&[_]Feature{}), | 1157 | .dependencies = featureSet(&[_]Feature{}), |
| 1158 | }; | 1158 | }; |
| 1159 | result[@enumToInt(Feature.tpidr_el1)] = .{ | 1159 | result[@intFromEnum(Feature.tpidr_el1)] = .{ |
| 1160 | .llvm_name = "tpidr-el1", | 1160 | .llvm_name = "tpidr-el1", |
| 1161 | .description = "Permit use of TPIDR_EL1 for the TLS base", | 1161 | .description = "Permit use of TPIDR_EL1 for the TLS base", |
| 1162 | .dependencies = featureSet(&[_]Feature{}), | 1162 | .dependencies = featureSet(&[_]Feature{}), |
| 1163 | }; | 1163 | }; |
| 1164 | result[@enumToInt(Feature.tpidr_el2)] = .{ | 1164 | result[@intFromEnum(Feature.tpidr_el2)] = .{ |
| 1165 | .llvm_name = "tpidr-el2", | 1165 | .llvm_name = "tpidr-el2", |
| 1166 | .description = "Permit use of TPIDR_EL2 for the TLS base", | 1166 | .description = "Permit use of TPIDR_EL2 for the TLS base", |
| 1167 | .dependencies = featureSet(&[_]Feature{}), | 1167 | .dependencies = featureSet(&[_]Feature{}), |
| 1168 | }; | 1168 | }; |
| 1169 | result[@enumToInt(Feature.tpidr_el3)] = .{ | 1169 | result[@intFromEnum(Feature.tpidr_el3)] = .{ |
| 1170 | .llvm_name = "tpidr-el3", | 1170 | .llvm_name = "tpidr-el3", |
| 1171 | .description = "Permit use of TPIDR_EL3 for the TLS base", | 1171 | .description = "Permit use of TPIDR_EL3 for the TLS base", |
| 1172 | .dependencies = featureSet(&[_]Feature{}), | 1172 | .dependencies = featureSet(&[_]Feature{}), |
| 1173 | }; | 1173 | }; |
| 1174 | result[@enumToInt(Feature.tracev8_4)] = .{ | 1174 | result[@intFromEnum(Feature.tracev8_4)] = .{ |
| 1175 | .llvm_name = "tracev8.4", | 1175 | .llvm_name = "tracev8.4", |
| 1176 | .description = "Enable v8.4-A Trace extension (FEAT_TRF)", | 1176 | .description = "Enable v8.4-A Trace extension (FEAT_TRF)", |
| 1177 | .dependencies = featureSet(&[_]Feature{}), | 1177 | .dependencies = featureSet(&[_]Feature{}), |
| 1178 | }; | 1178 | }; |
| 1179 | result[@enumToInt(Feature.trbe)] = .{ | 1179 | result[@intFromEnum(Feature.trbe)] = .{ |
| 1180 | .llvm_name = "trbe", | 1180 | .llvm_name = "trbe", |
| 1181 | .description = "Enable Trace Buffer Extension (FEAT_TRBE)", | 1181 | .description = "Enable Trace Buffer Extension (FEAT_TRBE)", |
| 1182 | .dependencies = featureSet(&[_]Feature{}), | 1182 | .dependencies = featureSet(&[_]Feature{}), |
| 1183 | }; | 1183 | }; |
| 1184 | result[@enumToInt(Feature.uaops)] = .{ | 1184 | result[@intFromEnum(Feature.uaops)] = .{ |
| 1185 | .llvm_name = "uaops", | 1185 | .llvm_name = "uaops", |
| 1186 | .description = "Enable v8.2 UAO PState (FEAT_UAO)", | 1186 | .description = "Enable v8.2 UAO PState (FEAT_UAO)", |
| 1187 | .dependencies = featureSet(&[_]Feature{}), | 1187 | .dependencies = featureSet(&[_]Feature{}), |
| 1188 | }; | 1188 | }; |
| 1189 | result[@enumToInt(Feature.use_experimental_zeroing_pseudos)] = .{ | 1189 | result[@intFromEnum(Feature.use_experimental_zeroing_pseudos)] = .{ |
| 1190 | .llvm_name = "use-experimental-zeroing-pseudos", | 1190 | .llvm_name = "use-experimental-zeroing-pseudos", |
| 1191 | .description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations", | 1191 | .description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations", |
| 1192 | .dependencies = featureSet(&[_]Feature{}), | 1192 | .dependencies = featureSet(&[_]Feature{}), |
| 1193 | }; | 1193 | }; |
| 1194 | result[@enumToInt(Feature.use_postra_scheduler)] = .{ | 1194 | result[@intFromEnum(Feature.use_postra_scheduler)] = .{ |
| 1195 | .llvm_name = "use-postra-scheduler", | 1195 | .llvm_name = "use-postra-scheduler", |
| 1196 | .description = "Schedule again after register allocation", | 1196 | .description = "Schedule again after register allocation", |
| 1197 | .dependencies = featureSet(&[_]Feature{}), | 1197 | .dependencies = featureSet(&[_]Feature{}), |
| 1198 | }; | 1198 | }; |
| 1199 | result[@enumToInt(Feature.use_reciprocal_square_root)] = .{ | 1199 | result[@intFromEnum(Feature.use_reciprocal_square_root)] = .{ |
| 1200 | .llvm_name = "use-reciprocal-square-root", | 1200 | .llvm_name = "use-reciprocal-square-root", |
| 1201 | .description = "Use the reciprocal square root approximation", | 1201 | .description = "Use the reciprocal square root approximation", |
| 1202 | .dependencies = featureSet(&[_]Feature{}), | 1202 | .dependencies = featureSet(&[_]Feature{}), |
| 1203 | }; | 1203 | }; |
| 1204 | result[@enumToInt(Feature.use_scalar_inc_vl)] = .{ | 1204 | result[@intFromEnum(Feature.use_scalar_inc_vl)] = .{ |
| 1205 | .llvm_name = "use-scalar-inc-vl", | 1205 | .llvm_name = "use-scalar-inc-vl", |
| 1206 | .description = "Prefer inc/dec over add+cnt", | 1206 | .description = "Prefer inc/dec over add+cnt", |
| 1207 | .dependencies = featureSet(&[_]Feature{}), | 1207 | .dependencies = featureSet(&[_]Feature{}), |
| 1208 | }; | 1208 | }; |
| 1209 | result[@enumToInt(Feature.v8_1a)] = .{ | 1209 | result[@intFromEnum(Feature.v8_1a)] = .{ |
| 1210 | .llvm_name = "v8.1a", | 1210 | .llvm_name = "v8.1a", |
| 1211 | .description = "Support ARM v8.1a instructions", | 1211 | .description = "Support ARM v8.1a instructions", |
| 1212 | .dependencies = featureSet(&[_]Feature{ | 1212 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1219,7 +1219,7 @@ pub const all_features = blk: { | ... | @@ -1219,7 +1219,7 @@ pub const all_features = blk: { |
| 1219 | .vh, | 1219 | .vh, |
| 1220 | }), | 1220 | }), |
| 1221 | }; | 1221 | }; |
| 1222 | result[@enumToInt(Feature.v8_2a)] = .{ | 1222 | result[@intFromEnum(Feature.v8_2a)] = .{ |
| 1223 | .llvm_name = "v8.2a", | 1223 | .llvm_name = "v8.2a", |
| 1224 | .description = "Support ARM v8.2a instructions", | 1224 | .description = "Support ARM v8.2a instructions", |
| 1225 | .dependencies = featureSet(&[_]Feature{ | 1225 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1230,7 +1230,7 @@ pub const all_features = blk: { | ... | @@ -1230,7 +1230,7 @@ pub const all_features = blk: { |
| 1230 | .v8_1a, | 1230 | .v8_1a, |
| 1231 | }), | 1231 | }), |
| 1232 | }; | 1232 | }; |
| 1233 | result[@enumToInt(Feature.v8_3a)] = .{ | 1233 | result[@intFromEnum(Feature.v8_3a)] = .{ |
| 1234 | .llvm_name = "v8.3a", | 1234 | .llvm_name = "v8.3a", |
| 1235 | .description = "Support ARM v8.3a instructions", | 1235 | .description = "Support ARM v8.3a instructions", |
| 1236 | .dependencies = featureSet(&[_]Feature{ | 1236 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1242,7 +1242,7 @@ pub const all_features = blk: { | ... | @@ -1242,7 +1242,7 @@ pub const all_features = blk: { |
| 1242 | .v8_2a, | 1242 | .v8_2a, |
| 1243 | }), | 1243 | }), |
| 1244 | }; | 1244 | }; |
| 1245 | result[@enumToInt(Feature.v8_4a)] = .{ | 1245 | result[@intFromEnum(Feature.v8_4a)] = .{ |
| 1246 | .llvm_name = "v8.4a", | 1246 | .llvm_name = "v8.4a", |
| 1247 | .description = "Support ARM v8.4a instructions", | 1247 | .description = "Support ARM v8.4a instructions", |
| 1248 | .dependencies = featureSet(&[_]Feature{ | 1248 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1260,7 +1260,7 @@ pub const all_features = blk: { | ... | @@ -1260,7 +1260,7 @@ pub const all_features = blk: { |
| 1260 | .v8_3a, | 1260 | .v8_3a, |
| 1261 | }), | 1261 | }), |
| 1262 | }; | 1262 | }; |
| 1263 | result[@enumToInt(Feature.v8_5a)] = .{ | 1263 | result[@intFromEnum(Feature.v8_5a)] = .{ |
| 1264 | .llvm_name = "v8.5a", | 1264 | .llvm_name = "v8.5a", |
| 1265 | .description = "Support ARM v8.5a instructions", | 1265 | .description = "Support ARM v8.5a instructions", |
| 1266 | .dependencies = featureSet(&[_]Feature{ | 1266 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1275,7 +1275,7 @@ pub const all_features = blk: { | ... | @@ -1275,7 +1275,7 @@ pub const all_features = blk: { |
| 1275 | .v8_4a, | 1275 | .v8_4a, |
| 1276 | }), | 1276 | }), |
| 1277 | }; | 1277 | }; |
| 1278 | result[@enumToInt(Feature.v8_6a)] = .{ | 1278 | result[@intFromEnum(Feature.v8_6a)] = .{ |
| 1279 | .llvm_name = "v8.6a", | 1279 | .llvm_name = "v8.6a", |
| 1280 | .description = "Support ARM v8.6a instructions", | 1280 | .description = "Support ARM v8.6a instructions", |
| 1281 | .dependencies = featureSet(&[_]Feature{ | 1281 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1287,7 +1287,7 @@ pub const all_features = blk: { | ... | @@ -1287,7 +1287,7 @@ pub const all_features = blk: { |
| 1287 | .v8_5a, | 1287 | .v8_5a, |
| 1288 | }), | 1288 | }), |
| 1289 | }; | 1289 | }; |
| 1290 | result[@enumToInt(Feature.v8_7a)] = .{ | 1290 | result[@intFromEnum(Feature.v8_7a)] = .{ |
| 1291 | .llvm_name = "v8.7a", | 1291 | .llvm_name = "v8.7a", |
| 1292 | .description = "Support ARM v8.7a instructions", | 1292 | .description = "Support ARM v8.7a instructions", |
| 1293 | .dependencies = featureSet(&[_]Feature{ | 1293 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1297,7 +1297,7 @@ pub const all_features = blk: { | ... | @@ -1297,7 +1297,7 @@ pub const all_features = blk: { |
| 1297 | .xs, | 1297 | .xs, |
| 1298 | }), | 1298 | }), |
| 1299 | }; | 1299 | }; |
| 1300 | result[@enumToInt(Feature.v8_8a)] = .{ | 1300 | result[@intFromEnum(Feature.v8_8a)] = .{ |
| 1301 | .llvm_name = "v8.8a", | 1301 | .llvm_name = "v8.8a", |
| 1302 | .description = "Support ARM v8.8a instructions", | 1302 | .description = "Support ARM v8.8a instructions", |
| 1303 | .dependencies = featureSet(&[_]Feature{ | 1303 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1307,7 +1307,7 @@ pub const all_features = blk: { | ... | @@ -1307,7 +1307,7 @@ pub const all_features = blk: { |
| 1307 | .v8_7a, | 1307 | .v8_7a, |
| 1308 | }), | 1308 | }), |
| 1309 | }; | 1309 | }; |
| 1310 | result[@enumToInt(Feature.v8_9a)] = .{ | 1310 | result[@intFromEnum(Feature.v8_9a)] = .{ |
| 1311 | .llvm_name = "v8.9a", | 1311 | .llvm_name = "v8.9a", |
| 1312 | .description = "Support ARM v8.9a instructions", | 1312 | .description = "Support ARM v8.9a instructions", |
| 1313 | .dependencies = featureSet(&[_]Feature{ | 1313 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1319,7 +1319,7 @@ pub const all_features = blk: { | ... | @@ -1319,7 +1319,7 @@ pub const all_features = blk: { |
| 1319 | .v8_8a, | 1319 | .v8_8a, |
| 1320 | }), | 1320 | }), |
| 1321 | }; | 1321 | }; |
| 1322 | result[@enumToInt(Feature.v8a)] = .{ | 1322 | result[@intFromEnum(Feature.v8a)] = .{ |
| 1323 | .llvm_name = "v8a", | 1323 | .llvm_name = "v8a", |
| 1324 | .description = "Support ARM v8.0a instructions", | 1324 | .description = "Support ARM v8.0a instructions", |
| 1325 | .dependencies = featureSet(&[_]Feature{ | 1325 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1328,7 +1328,7 @@ pub const all_features = blk: { | ... | @@ -1328,7 +1328,7 @@ pub const all_features = blk: { |
| 1328 | .neon, | 1328 | .neon, |
| 1329 | }), | 1329 | }), |
| 1330 | }; | 1330 | }; |
| 1331 | result[@enumToInt(Feature.v8r)] = .{ | 1331 | result[@intFromEnum(Feature.v8r)] = .{ |
| 1332 | .llvm_name = "v8r", | 1332 | .llvm_name = "v8r", |
| 1333 | .description = "Support ARM v8r instructions", | 1333 | .description = "Support ARM v8r instructions", |
| 1334 | .dependencies = featureSet(&[_]Feature{ | 1334 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1354,7 +1354,7 @@ pub const all_features = blk: { | ... | @@ -1354,7 +1354,7 @@ pub const all_features = blk: { |
| 1354 | .uaops, | 1354 | .uaops, |
| 1355 | }), | 1355 | }), |
| 1356 | }; | 1356 | }; |
| 1357 | result[@enumToInt(Feature.v9_1a)] = .{ | 1357 | result[@intFromEnum(Feature.v9_1a)] = .{ |
| 1358 | .llvm_name = "v9.1a", | 1358 | .llvm_name = "v9.1a", |
| 1359 | .description = "Support ARM v9.1a instructions", | 1359 | .description = "Support ARM v9.1a instructions", |
| 1360 | .dependencies = featureSet(&[_]Feature{ | 1360 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1362,7 +1362,7 @@ pub const all_features = blk: { | ... | @@ -1362,7 +1362,7 @@ pub const all_features = blk: { |
| 1362 | .v9a, | 1362 | .v9a, |
| 1363 | }), | 1363 | }), |
| 1364 | }; | 1364 | }; |
| 1365 | result[@enumToInt(Feature.v9_2a)] = .{ | 1365 | result[@intFromEnum(Feature.v9_2a)] = .{ |
| 1366 | .llvm_name = "v9.2a", | 1366 | .llvm_name = "v9.2a", |
| 1367 | .description = "Support ARM v9.2a instructions", | 1367 | .description = "Support ARM v9.2a instructions", |
| 1368 | .dependencies = featureSet(&[_]Feature{ | 1368 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1370,7 +1370,7 @@ pub const all_features = blk: { | ... | @@ -1370,7 +1370,7 @@ pub const all_features = blk: { |
| 1370 | .v9_1a, | 1370 | .v9_1a, |
| 1371 | }), | 1371 | }), |
| 1372 | }; | 1372 | }; |
| 1373 | result[@enumToInt(Feature.v9_3a)] = .{ | 1373 | result[@intFromEnum(Feature.v9_3a)] = .{ |
| 1374 | .llvm_name = "v9.3a", | 1374 | .llvm_name = "v9.3a", |
| 1375 | .description = "Support ARM v9.3a instructions", | 1375 | .description = "Support ARM v9.3a instructions", |
| 1376 | .dependencies = featureSet(&[_]Feature{ | 1376 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1378,7 +1378,7 @@ pub const all_features = blk: { | ... | @@ -1378,7 +1378,7 @@ pub const all_features = blk: { |
| 1378 | .v9_2a, | 1378 | .v9_2a, |
| 1379 | }), | 1379 | }), |
| 1380 | }; | 1380 | }; |
| 1381 | result[@enumToInt(Feature.v9_4a)] = .{ | 1381 | result[@intFromEnum(Feature.v9_4a)] = .{ |
| 1382 | .llvm_name = "v9.4a", | 1382 | .llvm_name = "v9.4a", |
| 1383 | .description = "Support ARM v9.4a instructions", | 1383 | .description = "Support ARM v9.4a instructions", |
| 1384 | .dependencies = featureSet(&[_]Feature{ | 1384 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1386,7 +1386,7 @@ pub const all_features = blk: { | ... | @@ -1386,7 +1386,7 @@ pub const all_features = blk: { |
| 1386 | .v9_3a, | 1386 | .v9_3a, |
| 1387 | }), | 1387 | }), |
| 1388 | }; | 1388 | }; |
| 1389 | result[@enumToInt(Feature.v9a)] = .{ | 1389 | result[@intFromEnum(Feature.v9a)] = .{ |
| 1390 | .llvm_name = "v9a", | 1390 | .llvm_name = "v9a", |
| 1391 | .description = "Support ARM v9a instructions", | 1391 | .description = "Support ARM v9a instructions", |
| 1392 | .dependencies = featureSet(&[_]Feature{ | 1392 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1395,41 +1395,41 @@ pub const all_features = blk: { | ... | @@ -1395,41 +1395,41 @@ pub const all_features = blk: { |
| 1395 | .v8_5a, | 1395 | .v8_5a, |
| 1396 | }), | 1396 | }), |
| 1397 | }; | 1397 | }; |
| 1398 | result[@enumToInt(Feature.vh)] = .{ | 1398 | result[@intFromEnum(Feature.vh)] = .{ |
| 1399 | .llvm_name = "vh", | 1399 | .llvm_name = "vh", |
| 1400 | .description = "Enables ARM v8.1 Virtual Host extension (FEAT_VHE)", | 1400 | .description = "Enables ARM v8.1 Virtual Host extension (FEAT_VHE)", |
| 1401 | .dependencies = featureSet(&[_]Feature{ | 1401 | .dependencies = featureSet(&[_]Feature{ |
| 1402 | .contextidr_el2, | 1402 | .contextidr_el2, |
| 1403 | }), | 1403 | }), |
| 1404 | }; | 1404 | }; |
| 1405 | result[@enumToInt(Feature.wfxt)] = .{ | 1405 | result[@intFromEnum(Feature.wfxt)] = .{ |
| 1406 | .llvm_name = "wfxt", | 1406 | .llvm_name = "wfxt", |
| 1407 | .description = "Enable Armv8.7-A WFET and WFIT instruction (FEAT_WFxT)", | 1407 | .description = "Enable Armv8.7-A WFET and WFIT instruction (FEAT_WFxT)", |
| 1408 | .dependencies = featureSet(&[_]Feature{}), | 1408 | .dependencies = featureSet(&[_]Feature{}), |
| 1409 | }; | 1409 | }; |
| 1410 | result[@enumToInt(Feature.xs)] = .{ | 1410 | result[@intFromEnum(Feature.xs)] = .{ |
| 1411 | .llvm_name = "xs", | 1411 | .llvm_name = "xs", |
| 1412 | .description = "Enable Armv8.7-A limited-TLB-maintenance instruction (FEAT_XS)", | 1412 | .description = "Enable Armv8.7-A limited-TLB-maintenance instruction (FEAT_XS)", |
| 1413 | .dependencies = featureSet(&[_]Feature{}), | 1413 | .dependencies = featureSet(&[_]Feature{}), |
| 1414 | }; | 1414 | }; |
| 1415 | result[@enumToInt(Feature.zcm)] = .{ | 1415 | result[@intFromEnum(Feature.zcm)] = .{ |
| 1416 | .llvm_name = "zcm", | 1416 | .llvm_name = "zcm", |
| 1417 | .description = "Has zero-cycle register moves", | 1417 | .description = "Has zero-cycle register moves", |
| 1418 | .dependencies = featureSet(&[_]Feature{}), | 1418 | .dependencies = featureSet(&[_]Feature{}), |
| 1419 | }; | 1419 | }; |
| 1420 | result[@enumToInt(Feature.zcz)] = .{ | 1420 | result[@intFromEnum(Feature.zcz)] = .{ |
| 1421 | .llvm_name = "zcz", | 1421 | .llvm_name = "zcz", |
| 1422 | .description = "Has zero-cycle zeroing instructions", | 1422 | .description = "Has zero-cycle zeroing instructions", |
| 1423 | .dependencies = featureSet(&[_]Feature{ | 1423 | .dependencies = featureSet(&[_]Feature{ |
| 1424 | .zcz_gp, | 1424 | .zcz_gp, |
| 1425 | }), | 1425 | }), |
| 1426 | }; | 1426 | }; |
| 1427 | result[@enumToInt(Feature.zcz_fp_workaround)] = .{ | 1427 | result[@intFromEnum(Feature.zcz_fp_workaround)] = .{ |
| 1428 | .llvm_name = "zcz-fp-workaround", | 1428 | .llvm_name = "zcz-fp-workaround", |
| 1429 | .description = "The zero-cycle floating-point zeroing instruction has a bug", | 1429 | .description = "The zero-cycle floating-point zeroing instruction has a bug", |
| 1430 | .dependencies = featureSet(&[_]Feature{}), | 1430 | .dependencies = featureSet(&[_]Feature{}), |
| 1431 | }; | 1431 | }; |
| 1432 | result[@enumToInt(Feature.zcz_gp)] = .{ | 1432 | result[@intFromEnum(Feature.zcz_gp)] = .{ |
| 1433 | .llvm_name = "zcz-gp", | 1433 | .llvm_name = "zcz-gp", |
| 1434 | .description = "Has zero-cycle zeroing instructions for generic registers", | 1434 | .description = "Has zero-cycle zeroing instructions for generic registers", |
| 1435 | .dependencies = featureSet(&[_]Feature{}), | 1435 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/amdgpu.zig+146-146| ... | @@ -162,248 +162,248 @@ pub const all_features = blk: { | ... | @@ -162,248 +162,248 @@ pub const all_features = blk: { |
| 162 | const len = @typeInfo(Feature).Enum.fields.len; | 162 | const len = @typeInfo(Feature).Enum.fields.len; |
| 163 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 163 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 164 | var result: [len]CpuFeature = undefined; | 164 | var result: [len]CpuFeature = undefined; |
| 165 | result[@enumToInt(Feature.@"16_bit_insts")] = .{ | 165 | result[@intFromEnum(Feature.@"16_bit_insts")] = .{ |
| 166 | .llvm_name = "16-bit-insts", | 166 | .llvm_name = "16-bit-insts", |
| 167 | .description = "Has i16/f16 instructions", | 167 | .description = "Has i16/f16 instructions", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@enumToInt(Feature.a16)] = .{ | 170 | result[@intFromEnum(Feature.a16)] = .{ |
| 171 | .llvm_name = "a16", | 171 | .llvm_name = "a16", |
| 172 | .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands", | 172 | .description = "Support A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@enumToInt(Feature.add_no_carry_insts)] = .{ | 175 | result[@intFromEnum(Feature.add_no_carry_insts)] = .{ |
| 176 | .llvm_name = "add-no-carry-insts", | 176 | .llvm_name = "add-no-carry-insts", |
| 177 | .description = "Have VALU add/sub instructions without carry out", | 177 | .description = "Have VALU add/sub instructions without carry out", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@enumToInt(Feature.aperture_regs)] = .{ | 180 | result[@intFromEnum(Feature.aperture_regs)] = .{ |
| 181 | .llvm_name = "aperture-regs", | 181 | .llvm_name = "aperture-regs", |
| 182 | .description = "Has Memory Aperture Base and Size Registers", | 182 | .description = "Has Memory Aperture Base and Size Registers", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@enumToInt(Feature.architected_flat_scratch)] = .{ | 185 | result[@intFromEnum(Feature.architected_flat_scratch)] = .{ |
| 186 | .llvm_name = "architected-flat-scratch", | 186 | .llvm_name = "architected-flat-scratch", |
| 187 | .description = "Flat Scratch register is a readonly SPI initialized architected register", | 187 | .description = "Flat Scratch register is a readonly SPI initialized architected register", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@enumToInt(Feature.atomic_fadd_no_rtn_insts)] = .{ | 190 | result[@intFromEnum(Feature.atomic_fadd_no_rtn_insts)] = .{ |
| 191 | .llvm_name = "atomic-fadd-no-rtn-insts", | 191 | .llvm_name = "atomic-fadd-no-rtn-insts", |
| 192 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that don't return original value", | 192 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that don't return original value", |
| 193 | .dependencies = featureSet(&[_]Feature{ | 193 | .dependencies = featureSet(&[_]Feature{ |
| 194 | .flat_global_insts, | 194 | .flat_global_insts, |
| 195 | }), | 195 | }), |
| 196 | }; | 196 | }; |
| 197 | result[@enumToInt(Feature.atomic_fadd_rtn_insts)] = .{ | 197 | result[@intFromEnum(Feature.atomic_fadd_rtn_insts)] = .{ |
| 198 | .llvm_name = "atomic-fadd-rtn-insts", | 198 | .llvm_name = "atomic-fadd-rtn-insts", |
| 199 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that return original value", | 199 | .description = "Has buffer_atomic_add_f32 and global_atomic_add_f32 instructions that return original value", |
| 200 | .dependencies = featureSet(&[_]Feature{ | 200 | .dependencies = featureSet(&[_]Feature{ |
| 201 | .flat_global_insts, | 201 | .flat_global_insts, |
| 202 | }), | 202 | }), |
| 203 | }; | 203 | }; |
| 204 | result[@enumToInt(Feature.atomic_pk_fadd_no_rtn_insts)] = .{ | 204 | result[@intFromEnum(Feature.atomic_pk_fadd_no_rtn_insts)] = .{ |
| 205 | .llvm_name = "atomic-pk-fadd-no-rtn-insts", | 205 | .llvm_name = "atomic-pk-fadd-no-rtn-insts", |
| 206 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that don't return original value", | 206 | .description = "Has buffer_atomic_pk_add_f16 and global_atomic_pk_add_f16 instructions that don't return original value", |
| 207 | .dependencies = featureSet(&[_]Feature{ | 207 | .dependencies = featureSet(&[_]Feature{ |
| 208 | .flat_global_insts, | 208 | .flat_global_insts, |
| 209 | }), | 209 | }), |
| 210 | }; | 210 | }; |
| 211 | result[@enumToInt(Feature.auto_waitcnt_before_barrier)] = .{ | 211 | result[@intFromEnum(Feature.auto_waitcnt_before_barrier)] = .{ |
| 212 | .llvm_name = "auto-waitcnt-before-barrier", | 212 | .llvm_name = "auto-waitcnt-before-barrier", |
| 213 | .description = "Hardware automatically inserts waitcnt before barrier", | 213 | .description = "Hardware automatically inserts waitcnt before barrier", |
| 214 | .dependencies = featureSet(&[_]Feature{}), | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | }; | 215 | }; |
| 216 | result[@enumToInt(Feature.back_off_barrier)] = .{ | 216 | result[@intFromEnum(Feature.back_off_barrier)] = .{ |
| 217 | .llvm_name = "back-off-barrier", | 217 | .llvm_name = "back-off-barrier", |
| 218 | .description = "Hardware supports backing off s_barrier if an exception occurs", | 218 | .description = "Hardware supports backing off s_barrier if an exception occurs", |
| 219 | .dependencies = featureSet(&[_]Feature{}), | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | }; | 220 | }; |
| 221 | result[@enumToInt(Feature.ci_insts)] = .{ | 221 | result[@intFromEnum(Feature.ci_insts)] = .{ |
| 222 | .llvm_name = "ci-insts", | 222 | .llvm_name = "ci-insts", |
| 223 | .description = "Additional instructions for CI+", | 223 | .description = "Additional instructions for CI+", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@enumToInt(Feature.cumode)] = .{ | 226 | result[@intFromEnum(Feature.cumode)] = .{ |
| 227 | .llvm_name = "cumode", | 227 | .llvm_name = "cumode", |
| 228 | .description = "Enable CU wavefront execution mode", | 228 | .description = "Enable CU wavefront execution mode", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@enumToInt(Feature.dl_insts)] = .{ | 231 | result[@intFromEnum(Feature.dl_insts)] = .{ |
| 232 | .llvm_name = "dl-insts", | 232 | .llvm_name = "dl-insts", |
| 233 | .description = "Has v_fmac_f32 and v_xnor_b32 instructions", | 233 | .description = "Has v_fmac_f32 and v_xnor_b32 instructions", |
| 234 | .dependencies = featureSet(&[_]Feature{}), | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | }; | 235 | }; |
| 236 | result[@enumToInt(Feature.dot1_insts)] = .{ | 236 | result[@intFromEnum(Feature.dot1_insts)] = .{ |
| 237 | .llvm_name = "dot1-insts", | 237 | .llvm_name = "dot1-insts", |
| 238 | .description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions", | 238 | .description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions", |
| 239 | .dependencies = featureSet(&[_]Feature{}), | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | }; | 240 | }; |
| 241 | result[@enumToInt(Feature.dot2_insts)] = .{ | 241 | result[@intFromEnum(Feature.dot2_insts)] = .{ |
| 242 | .llvm_name = "dot2-insts", | 242 | .llvm_name = "dot2-insts", |
| 243 | .description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions", | 243 | .description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@enumToInt(Feature.dot3_insts)] = .{ | 246 | result[@intFromEnum(Feature.dot3_insts)] = .{ |
| 247 | .llvm_name = "dot3-insts", | 247 | .llvm_name = "dot3-insts", |
| 248 | .description = "Has v_dot8c_i32_i4 instruction", | 248 | .description = "Has v_dot8c_i32_i4 instruction", |
| 249 | .dependencies = featureSet(&[_]Feature{}), | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | }; | 250 | }; |
| 251 | result[@enumToInt(Feature.dot4_insts)] = .{ | 251 | result[@intFromEnum(Feature.dot4_insts)] = .{ |
| 252 | .llvm_name = "dot4-insts", | 252 | .llvm_name = "dot4-insts", |
| 253 | .description = "Has v_dot2c_i32_i16 instruction", | 253 | .description = "Has v_dot2c_i32_i16 instruction", |
| 254 | .dependencies = featureSet(&[_]Feature{}), | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | }; | 255 | }; |
| 256 | result[@enumToInt(Feature.dot5_insts)] = .{ | 256 | result[@intFromEnum(Feature.dot5_insts)] = .{ |
| 257 | .llvm_name = "dot5-insts", | 257 | .llvm_name = "dot5-insts", |
| 258 | .description = "Has v_dot2c_f32_f16 instruction", | 258 | .description = "Has v_dot2c_f32_f16 instruction", |
| 259 | .dependencies = featureSet(&[_]Feature{}), | 259 | .dependencies = featureSet(&[_]Feature{}), |
| 260 | }; | 260 | }; |
| 261 | result[@enumToInt(Feature.dot6_insts)] = .{ | 261 | result[@intFromEnum(Feature.dot6_insts)] = .{ |
| 262 | .llvm_name = "dot6-insts", | 262 | .llvm_name = "dot6-insts", |
| 263 | .description = "Has v_dot4c_i32_i8 instruction", | 263 | .description = "Has v_dot4c_i32_i8 instruction", |
| 264 | .dependencies = featureSet(&[_]Feature{}), | 264 | .dependencies = featureSet(&[_]Feature{}), |
| 265 | }; | 265 | }; |
| 266 | result[@enumToInt(Feature.dot7_insts)] = .{ | 266 | result[@intFromEnum(Feature.dot7_insts)] = .{ |
| 267 | .llvm_name = "dot7-insts", | 267 | .llvm_name = "dot7-insts", |
| 268 | .description = "Has v_dot2_f32_f16, v_dot4_u32_u8, v_dot8_u32_u4 instructions", | 268 | .description = "Has v_dot2_f32_f16, v_dot4_u32_u8, v_dot8_u32_u4 instructions", |
| 269 | .dependencies = featureSet(&[_]Feature{}), | 269 | .dependencies = featureSet(&[_]Feature{}), |
| 270 | }; | 270 | }; |
| 271 | result[@enumToInt(Feature.dot8_insts)] = .{ | 271 | result[@intFromEnum(Feature.dot8_insts)] = .{ |
| 272 | .llvm_name = "dot8-insts", | 272 | .llvm_name = "dot8-insts", |
| 273 | .description = "Has v_dot4_i32_iu8, v_dot8_i32_iu4 instructions", | 273 | .description = "Has v_dot4_i32_iu8, v_dot8_i32_iu4 instructions", |
| 274 | .dependencies = featureSet(&[_]Feature{}), | 274 | .dependencies = featureSet(&[_]Feature{}), |
| 275 | }; | 275 | }; |
| 276 | result[@enumToInt(Feature.dot9_insts)] = .{ | 276 | result[@intFromEnum(Feature.dot9_insts)] = .{ |
| 277 | .llvm_name = "dot9-insts", | 277 | .llvm_name = "dot9-insts", |
| 278 | .description = "Has v_dot2_f16_f16, v_dot2_bf16_bf16, v_dot2_f32_bf16 instructions", | 278 | .description = "Has v_dot2_f16_f16, v_dot2_bf16_bf16, v_dot2_f32_bf16 instructions", |
| 279 | .dependencies = featureSet(&[_]Feature{}), | 279 | .dependencies = featureSet(&[_]Feature{}), |
| 280 | }; | 280 | }; |
| 281 | result[@enumToInt(Feature.dpp)] = .{ | 281 | result[@intFromEnum(Feature.dpp)] = .{ |
| 282 | .llvm_name = "dpp", | 282 | .llvm_name = "dpp", |
| 283 | .description = "Support DPP (Data Parallel Primitives) extension", | 283 | .description = "Support DPP (Data Parallel Primitives) extension", |
| 284 | .dependencies = featureSet(&[_]Feature{}), | 284 | .dependencies = featureSet(&[_]Feature{}), |
| 285 | }; | 285 | }; |
| 286 | result[@enumToInt(Feature.dpp8)] = .{ | 286 | result[@intFromEnum(Feature.dpp8)] = .{ |
| 287 | .llvm_name = "dpp8", | 287 | .llvm_name = "dpp8", |
| 288 | .description = "Support DPP8 (Data Parallel Primitives) extension", | 288 | .description = "Support DPP8 (Data Parallel Primitives) extension", |
| 289 | .dependencies = featureSet(&[_]Feature{}), | 289 | .dependencies = featureSet(&[_]Feature{}), |
| 290 | }; | 290 | }; |
| 291 | result[@enumToInt(Feature.dpp_64bit)] = .{ | 291 | result[@intFromEnum(Feature.dpp_64bit)] = .{ |
| 292 | .llvm_name = "dpp-64bit", | 292 | .llvm_name = "dpp-64bit", |
| 293 | .description = "Support DPP (Data Parallel Primitives) extension", | 293 | .description = "Support DPP (Data Parallel Primitives) extension", |
| 294 | .dependencies = featureSet(&[_]Feature{}), | 294 | .dependencies = featureSet(&[_]Feature{}), |
| 295 | }; | 295 | }; |
| 296 | result[@enumToInt(Feature.ds128)] = .{ | 296 | result[@intFromEnum(Feature.ds128)] = .{ |
| 297 | .llvm_name = "enable-ds128", | 297 | .llvm_name = "enable-ds128", |
| 298 | .description = "Use ds_{read|write}_b128", | 298 | .description = "Use ds_{read|write}_b128", |
| 299 | .dependencies = featureSet(&[_]Feature{}), | 299 | .dependencies = featureSet(&[_]Feature{}), |
| 300 | }; | 300 | }; |
| 301 | result[@enumToInt(Feature.ds_src2_insts)] = .{ | 301 | result[@intFromEnum(Feature.ds_src2_insts)] = .{ |
| 302 | .llvm_name = "ds-src2-insts", | 302 | .llvm_name = "ds-src2-insts", |
| 303 | .description = "Has ds_*_src2 instructions", | 303 | .description = "Has ds_*_src2 instructions", |
| 304 | .dependencies = featureSet(&[_]Feature{}), | 304 | .dependencies = featureSet(&[_]Feature{}), |
| 305 | }; | 305 | }; |
| 306 | result[@enumToInt(Feature.extended_image_insts)] = .{ | 306 | result[@intFromEnum(Feature.extended_image_insts)] = .{ |
| 307 | .llvm_name = "extended-image-insts", | 307 | .llvm_name = "extended-image-insts", |
| 308 | .description = "Support mips != 0, lod != 0, gather4, and get_lod", | 308 | .description = "Support mips != 0, lod != 0, gather4, and get_lod", |
| 309 | .dependencies = featureSet(&[_]Feature{}), | 309 | .dependencies = featureSet(&[_]Feature{}), |
| 310 | }; | 310 | }; |
| 311 | result[@enumToInt(Feature.fast_denormal_f32)] = .{ | 311 | result[@intFromEnum(Feature.fast_denormal_f32)] = .{ |
| 312 | .llvm_name = "fast-denormal-f32", | 312 | .llvm_name = "fast-denormal-f32", |
| 313 | .description = "Enabling denormals does not cause f32 instructions to run at f64 rates", | 313 | .description = "Enabling denormals does not cause f32 instructions to run at f64 rates", |
| 314 | .dependencies = featureSet(&[_]Feature{}), | 314 | .dependencies = featureSet(&[_]Feature{}), |
| 315 | }; | 315 | }; |
| 316 | result[@enumToInt(Feature.fast_fmaf)] = .{ | 316 | result[@intFromEnum(Feature.fast_fmaf)] = .{ |
| 317 | .llvm_name = "fast-fmaf", | 317 | .llvm_name = "fast-fmaf", |
| 318 | .description = "Assuming f32 fma is at least as fast as mul + add", | 318 | .description = "Assuming f32 fma is at least as fast as mul + add", |
| 319 | .dependencies = featureSet(&[_]Feature{}), | 319 | .dependencies = featureSet(&[_]Feature{}), |
| 320 | }; | 320 | }; |
| 321 | result[@enumToInt(Feature.flat_address_space)] = .{ | 321 | result[@intFromEnum(Feature.flat_address_space)] = .{ |
| 322 | .llvm_name = "flat-address-space", | 322 | .llvm_name = "flat-address-space", |
| 323 | .description = "Support flat address space", | 323 | .description = "Support flat address space", |
| 324 | .dependencies = featureSet(&[_]Feature{}), | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | }; | 325 | }; |
| 326 | result[@enumToInt(Feature.flat_atomic_fadd_f32_inst)] = .{ | 326 | result[@intFromEnum(Feature.flat_atomic_fadd_f32_inst)] = .{ |
| 327 | .llvm_name = "flat-atomic-fadd-f32-inst", | 327 | .llvm_name = "flat-atomic-fadd-f32-inst", |
| 328 | .description = "Has flat_atomic_add_f32 instruction", | 328 | .description = "Has flat_atomic_add_f32 instruction", |
| 329 | .dependencies = featureSet(&[_]Feature{}), | 329 | .dependencies = featureSet(&[_]Feature{}), |
| 330 | }; | 330 | }; |
| 331 | result[@enumToInt(Feature.flat_for_global)] = .{ | 331 | result[@intFromEnum(Feature.flat_for_global)] = .{ |
| 332 | .llvm_name = "flat-for-global", | 332 | .llvm_name = "flat-for-global", |
| 333 | .description = "Force to generate flat instruction for global", | 333 | .description = "Force to generate flat instruction for global", |
| 334 | .dependencies = featureSet(&[_]Feature{}), | 334 | .dependencies = featureSet(&[_]Feature{}), |
| 335 | }; | 335 | }; |
| 336 | result[@enumToInt(Feature.flat_global_insts)] = .{ | 336 | result[@intFromEnum(Feature.flat_global_insts)] = .{ |
| 337 | .llvm_name = "flat-global-insts", | 337 | .llvm_name = "flat-global-insts", |
| 338 | .description = "Have global_* flat memory instructions", | 338 | .description = "Have global_* flat memory instructions", |
| 339 | .dependencies = featureSet(&[_]Feature{}), | 339 | .dependencies = featureSet(&[_]Feature{}), |
| 340 | }; | 340 | }; |
| 341 | result[@enumToInt(Feature.flat_inst_offsets)] = .{ | 341 | result[@intFromEnum(Feature.flat_inst_offsets)] = .{ |
| 342 | .llvm_name = "flat-inst-offsets", | 342 | .llvm_name = "flat-inst-offsets", |
| 343 | .description = "Flat instructions have immediate offset addressing mode", | 343 | .description = "Flat instructions have immediate offset addressing mode", |
| 344 | .dependencies = featureSet(&[_]Feature{}), | 344 | .dependencies = featureSet(&[_]Feature{}), |
| 345 | }; | 345 | }; |
| 346 | result[@enumToInt(Feature.flat_scratch)] = .{ | 346 | result[@intFromEnum(Feature.flat_scratch)] = .{ |
| 347 | .llvm_name = "enable-flat-scratch", | 347 | .llvm_name = "enable-flat-scratch", |
| 348 | .description = "Use scratch_* flat memory instructions to access scratch", | 348 | .description = "Use scratch_* flat memory instructions to access scratch", |
| 349 | .dependencies = featureSet(&[_]Feature{}), | 349 | .dependencies = featureSet(&[_]Feature{}), |
| 350 | }; | 350 | }; |
| 351 | result[@enumToInt(Feature.flat_scratch_insts)] = .{ | 351 | result[@intFromEnum(Feature.flat_scratch_insts)] = .{ |
| 352 | .llvm_name = "flat-scratch-insts", | 352 | .llvm_name = "flat-scratch-insts", |
| 353 | .description = "Have scratch_* flat memory instructions", | 353 | .description = "Have scratch_* flat memory instructions", |
| 354 | .dependencies = featureSet(&[_]Feature{}), | 354 | .dependencies = featureSet(&[_]Feature{}), |
| 355 | }; | 355 | }; |
| 356 | result[@enumToInt(Feature.flat_segment_offset_bug)] = .{ | 356 | result[@intFromEnum(Feature.flat_segment_offset_bug)] = .{ |
| 357 | .llvm_name = "flat-segment-offset-bug", | 357 | .llvm_name = "flat-segment-offset-bug", |
| 358 | .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory", | 358 | .description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory", |
| 359 | .dependencies = featureSet(&[_]Feature{}), | 359 | .dependencies = featureSet(&[_]Feature{}), |
| 360 | }; | 360 | }; |
| 361 | result[@enumToInt(Feature.fma_mix_insts)] = .{ | 361 | result[@intFromEnum(Feature.fma_mix_insts)] = .{ |
| 362 | .llvm_name = "fma-mix-insts", | 362 | .llvm_name = "fma-mix-insts", |
| 363 | .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions", | 363 | .description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions", |
| 364 | .dependencies = featureSet(&[_]Feature{}), | 364 | .dependencies = featureSet(&[_]Feature{}), |
| 365 | }; | 365 | }; |
| 366 | result[@enumToInt(Feature.fmacf64_inst)] = .{ | 366 | result[@intFromEnum(Feature.fmacf64_inst)] = .{ |
| 367 | .llvm_name = "fmacf64-inst", | 367 | .llvm_name = "fmacf64-inst", |
| 368 | .description = "Has v_fmac_f64 instruction", | 368 | .description = "Has v_fmac_f64 instruction", |
| 369 | .dependencies = featureSet(&[_]Feature{}), | 369 | .dependencies = featureSet(&[_]Feature{}), |
| 370 | }; | 370 | }; |
| 371 | result[@enumToInt(Feature.fmaf)] = .{ | 371 | result[@intFromEnum(Feature.fmaf)] = .{ |
| 372 | .llvm_name = "fmaf", | 372 | .llvm_name = "fmaf", |
| 373 | .description = "Enable single precision FMA (not as fast as mul+add, but fused)", | 373 | .description = "Enable single precision FMA (not as fast as mul+add, but fused)", |
| 374 | .dependencies = featureSet(&[_]Feature{}), | 374 | .dependencies = featureSet(&[_]Feature{}), |
| 375 | }; | 375 | }; |
| 376 | result[@enumToInt(Feature.fp64)] = .{ | 376 | result[@intFromEnum(Feature.fp64)] = .{ |
| 377 | .llvm_name = "fp64", | 377 | .llvm_name = "fp64", |
| 378 | .description = "Enable double precision operations", | 378 | .description = "Enable double precision operations", |
| 379 | .dependencies = featureSet(&[_]Feature{}), | 379 | .dependencies = featureSet(&[_]Feature{}), |
| 380 | }; | 380 | }; |
| 381 | result[@enumToInt(Feature.fp8_insts)] = .{ | 381 | result[@intFromEnum(Feature.fp8_insts)] = .{ |
| 382 | .llvm_name = "fp8-insts", | 382 | .llvm_name = "fp8-insts", |
| 383 | .description = "Has fp8 and bf8 instructions", | 383 | .description = "Has fp8 and bf8 instructions", |
| 384 | .dependencies = featureSet(&[_]Feature{}), | 384 | .dependencies = featureSet(&[_]Feature{}), |
| 385 | }; | 385 | }; |
| 386 | result[@enumToInt(Feature.full_rate_64_ops)] = .{ | 386 | result[@intFromEnum(Feature.full_rate_64_ops)] = .{ |
| 387 | .llvm_name = "full-rate-64-ops", | 387 | .llvm_name = "full-rate-64-ops", |
| 388 | .description = "Most fp64 instructions are full rate", | 388 | .description = "Most fp64 instructions are full rate", |
| 389 | .dependencies = featureSet(&[_]Feature{}), | 389 | .dependencies = featureSet(&[_]Feature{}), |
| 390 | }; | 390 | }; |
| 391 | result[@enumToInt(Feature.g16)] = .{ | 391 | result[@intFromEnum(Feature.g16)] = .{ |
| 392 | .llvm_name = "g16", | 392 | .llvm_name = "g16", |
| 393 | .description = "Support G16 for 16-bit gradient image operands", | 393 | .description = "Support G16 for 16-bit gradient image operands", |
| 394 | .dependencies = featureSet(&[_]Feature{}), | 394 | .dependencies = featureSet(&[_]Feature{}), |
| 395 | }; | 395 | }; |
| 396 | result[@enumToInt(Feature.gcn3_encoding)] = .{ | 396 | result[@intFromEnum(Feature.gcn3_encoding)] = .{ |
| 397 | .llvm_name = "gcn3-encoding", | 397 | .llvm_name = "gcn3-encoding", |
| 398 | .description = "Encoding format for VI", | 398 | .description = "Encoding format for VI", |
| 399 | .dependencies = featureSet(&[_]Feature{}), | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | }; | 400 | }; |
| 401 | result[@enumToInt(Feature.get_wave_id_inst)] = .{ | 401 | result[@intFromEnum(Feature.get_wave_id_inst)] = .{ |
| 402 | .llvm_name = "get-wave-id-inst", | 402 | .llvm_name = "get-wave-id-inst", |
| 403 | .description = "Has s_get_waveid_in_workgroup instruction", | 403 | .description = "Has s_get_waveid_in_workgroup instruction", |
| 404 | .dependencies = featureSet(&[_]Feature{}), | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | }; | 405 | }; |
| 406 | result[@enumToInt(Feature.gfx10)] = .{ | 406 | result[@intFromEnum(Feature.gfx10)] = .{ |
| 407 | .llvm_name = "gfx10", | 407 | .llvm_name = "gfx10", |
| 408 | .description = "GFX10 GPU generation", | 408 | .description = "GFX10 GPU generation", |
| 409 | .dependencies = featureSet(&[_]Feature{ | 409 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -449,27 +449,27 @@ pub const all_features = blk: { | ... | @@ -449,27 +449,27 @@ pub const all_features = blk: { |
| 449 | .vscnt, | 449 | .vscnt, |
| 450 | }), | 450 | }), |
| 451 | }; | 451 | }; |
| 452 | result[@enumToInt(Feature.gfx10_3_insts)] = .{ | 452 | result[@intFromEnum(Feature.gfx10_3_insts)] = .{ |
| 453 | .llvm_name = "gfx10-3-insts", | 453 | .llvm_name = "gfx10-3-insts", |
| 454 | .description = "Additional instructions for GFX10.3", | 454 | .description = "Additional instructions for GFX10.3", |
| 455 | .dependencies = featureSet(&[_]Feature{}), | 455 | .dependencies = featureSet(&[_]Feature{}), |
| 456 | }; | 456 | }; |
| 457 | result[@enumToInt(Feature.gfx10_a_encoding)] = .{ | 457 | result[@intFromEnum(Feature.gfx10_a_encoding)] = .{ |
| 458 | .llvm_name = "gfx10_a-encoding", | 458 | .llvm_name = "gfx10_a-encoding", |
| 459 | .description = "Has BVH ray tracing instructions", | 459 | .description = "Has BVH ray tracing instructions", |
| 460 | .dependencies = featureSet(&[_]Feature{}), | 460 | .dependencies = featureSet(&[_]Feature{}), |
| 461 | }; | 461 | }; |
| 462 | result[@enumToInt(Feature.gfx10_b_encoding)] = .{ | 462 | result[@intFromEnum(Feature.gfx10_b_encoding)] = .{ |
| 463 | .llvm_name = "gfx10_b-encoding", | 463 | .llvm_name = "gfx10_b-encoding", |
| 464 | .description = "Encoding format GFX10_B", | 464 | .description = "Encoding format GFX10_B", |
| 465 | .dependencies = featureSet(&[_]Feature{}), | 465 | .dependencies = featureSet(&[_]Feature{}), |
| 466 | }; | 466 | }; |
| 467 | result[@enumToInt(Feature.gfx10_insts)] = .{ | 467 | result[@intFromEnum(Feature.gfx10_insts)] = .{ |
| 468 | .llvm_name = "gfx10-insts", | 468 | .llvm_name = "gfx10-insts", |
| 469 | .description = "Additional instructions for GFX10+", | 469 | .description = "Additional instructions for GFX10+", |
| 470 | .dependencies = featureSet(&[_]Feature{}), | 470 | .dependencies = featureSet(&[_]Feature{}), |
| 471 | }; | 471 | }; |
| 472 | result[@enumToInt(Feature.gfx11)] = .{ | 472 | result[@intFromEnum(Feature.gfx11)] = .{ |
| 473 | .llvm_name = "gfx11", | 473 | .llvm_name = "gfx11", |
| 474 | .description = "GFX11 GPU generation", | 474 | .description = "GFX11 GPU generation", |
| 475 | .dependencies = featureSet(&[_]Feature{ | 475 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -514,27 +514,27 @@ pub const all_features = blk: { | ... | @@ -514,27 +514,27 @@ pub const all_features = blk: { |
| 514 | .vscnt, | 514 | .vscnt, |
| 515 | }), | 515 | }), |
| 516 | }; | 516 | }; |
| 517 | result[@enumToInt(Feature.gfx11_full_vgprs)] = .{ | 517 | result[@intFromEnum(Feature.gfx11_full_vgprs)] = .{ |
| 518 | .llvm_name = "gfx11-full-vgprs", | 518 | .llvm_name = "gfx11-full-vgprs", |
| 519 | .description = "GFX11 with 50% more physical VGPRs and 50% larger allocation granule than GFX10", | 519 | .description = "GFX11 with 50% more physical VGPRs and 50% larger allocation granule than GFX10", |
| 520 | .dependencies = featureSet(&[_]Feature{}), | 520 | .dependencies = featureSet(&[_]Feature{}), |
| 521 | }; | 521 | }; |
| 522 | result[@enumToInt(Feature.gfx11_insts)] = .{ | 522 | result[@intFromEnum(Feature.gfx11_insts)] = .{ |
| 523 | .llvm_name = "gfx11-insts", | 523 | .llvm_name = "gfx11-insts", |
| 524 | .description = "Additional instructions for GFX11+", | 524 | .description = "Additional instructions for GFX11+", |
| 525 | .dependencies = featureSet(&[_]Feature{}), | 525 | .dependencies = featureSet(&[_]Feature{}), |
| 526 | }; | 526 | }; |
| 527 | result[@enumToInt(Feature.gfx7_gfx8_gfx9_insts)] = .{ | 527 | result[@intFromEnum(Feature.gfx7_gfx8_gfx9_insts)] = .{ |
| 528 | .llvm_name = "gfx7-gfx8-gfx9-insts", | 528 | .llvm_name = "gfx7-gfx8-gfx9-insts", |
| 529 | .description = "Instructions shared in GFX7, GFX8, GFX9", | 529 | .description = "Instructions shared in GFX7, GFX8, GFX9", |
| 530 | .dependencies = featureSet(&[_]Feature{}), | 530 | .dependencies = featureSet(&[_]Feature{}), |
| 531 | }; | 531 | }; |
| 532 | result[@enumToInt(Feature.gfx8_insts)] = .{ | 532 | result[@intFromEnum(Feature.gfx8_insts)] = .{ |
| 533 | .llvm_name = "gfx8-insts", | 533 | .llvm_name = "gfx8-insts", |
| 534 | .description = "Additional instructions for GFX8+", | 534 | .description = "Additional instructions for GFX8+", |
| 535 | .dependencies = featureSet(&[_]Feature{}), | 535 | .dependencies = featureSet(&[_]Feature{}), |
| 536 | }; | 536 | }; |
| 537 | result[@enumToInt(Feature.gfx9)] = .{ | 537 | result[@intFromEnum(Feature.gfx9)] = .{ |
| 538 | .llvm_name = "gfx9", | 538 | .llvm_name = "gfx9", |
| 539 | .description = "GFX9 GPU generation", | 539 | .description = "GFX9 GPU generation", |
| 540 | .dependencies = featureSet(&[_]Feature{ | 540 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -577,277 +577,277 @@ pub const all_features = blk: { | ... | @@ -577,277 +577,277 @@ pub const all_features = blk: { |
| 577 | .xnack_support, | 577 | .xnack_support, |
| 578 | }), | 578 | }), |
| 579 | }; | 579 | }; |
| 580 | result[@enumToInt(Feature.gfx90a_insts)] = .{ | 580 | result[@intFromEnum(Feature.gfx90a_insts)] = .{ |
| 581 | .llvm_name = "gfx90a-insts", | 581 | .llvm_name = "gfx90a-insts", |
| 582 | .description = "Additional instructions for GFX90A+", | 582 | .description = "Additional instructions for GFX90A+", |
| 583 | .dependencies = featureSet(&[_]Feature{}), | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | }; | 584 | }; |
| 585 | result[@enumToInt(Feature.gfx940_insts)] = .{ | 585 | result[@intFromEnum(Feature.gfx940_insts)] = .{ |
| 586 | .llvm_name = "gfx940-insts", | 586 | .llvm_name = "gfx940-insts", |
| 587 | .description = "Additional instructions for GFX940+", | 587 | .description = "Additional instructions for GFX940+", |
| 588 | .dependencies = featureSet(&[_]Feature{}), | 588 | .dependencies = featureSet(&[_]Feature{}), |
| 589 | }; | 589 | }; |
| 590 | result[@enumToInt(Feature.gfx9_insts)] = .{ | 590 | result[@intFromEnum(Feature.gfx9_insts)] = .{ |
| 591 | .llvm_name = "gfx9-insts", | 591 | .llvm_name = "gfx9-insts", |
| 592 | .description = "Additional instructions for GFX9+", | 592 | .description = "Additional instructions for GFX9+", |
| 593 | .dependencies = featureSet(&[_]Feature{}), | 593 | .dependencies = featureSet(&[_]Feature{}), |
| 594 | }; | 594 | }; |
| 595 | result[@enumToInt(Feature.half_rate_64_ops)] = .{ | 595 | result[@intFromEnum(Feature.half_rate_64_ops)] = .{ |
| 596 | .llvm_name = "half-rate-64-ops", | 596 | .llvm_name = "half-rate-64-ops", |
| 597 | .description = "Most fp64 instructions are half rate instead of quarter", | 597 | .description = "Most fp64 instructions are half rate instead of quarter", |
| 598 | .dependencies = featureSet(&[_]Feature{}), | 598 | .dependencies = featureSet(&[_]Feature{}), |
| 599 | }; | 599 | }; |
| 600 | result[@enumToInt(Feature.image_gather4_d16_bug)] = .{ | 600 | result[@intFromEnum(Feature.image_gather4_d16_bug)] = .{ |
| 601 | .llvm_name = "image-gather4-d16-bug", | 601 | .llvm_name = "image-gather4-d16-bug", |
| 602 | .description = "Image Gather4 D16 hardware bug", | 602 | .description = "Image Gather4 D16 hardware bug", |
| 603 | .dependencies = featureSet(&[_]Feature{}), | 603 | .dependencies = featureSet(&[_]Feature{}), |
| 604 | }; | 604 | }; |
| 605 | result[@enumToInt(Feature.image_insts)] = .{ | 605 | result[@intFromEnum(Feature.image_insts)] = .{ |
| 606 | .llvm_name = "image-insts", | 606 | .llvm_name = "image-insts", |
| 607 | .description = "Support image instructions", | 607 | .description = "Support image instructions", |
| 608 | .dependencies = featureSet(&[_]Feature{}), | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | }; | 609 | }; |
| 610 | result[@enumToInt(Feature.image_store_d16_bug)] = .{ | 610 | result[@intFromEnum(Feature.image_store_d16_bug)] = .{ |
| 611 | .llvm_name = "image-store-d16-bug", | 611 | .llvm_name = "image-store-d16-bug", |
| 612 | .description = "Image Store D16 hardware bug", | 612 | .description = "Image Store D16 hardware bug", |
| 613 | .dependencies = featureSet(&[_]Feature{}), | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | }; | 614 | }; |
| 615 | result[@enumToInt(Feature.inst_fwd_prefetch_bug)] = .{ | 615 | result[@intFromEnum(Feature.inst_fwd_prefetch_bug)] = .{ |
| 616 | .llvm_name = "inst-fwd-prefetch-bug", | 616 | .llvm_name = "inst-fwd-prefetch-bug", |
| 617 | .description = "S_INST_PREFETCH instruction causes shader to hang", | 617 | .description = "S_INST_PREFETCH instruction causes shader to hang", |
| 618 | .dependencies = featureSet(&[_]Feature{}), | 618 | .dependencies = featureSet(&[_]Feature{}), |
| 619 | }; | 619 | }; |
| 620 | result[@enumToInt(Feature.int_clamp_insts)] = .{ | 620 | result[@intFromEnum(Feature.int_clamp_insts)] = .{ |
| 621 | .llvm_name = "int-clamp-insts", | 621 | .llvm_name = "int-clamp-insts", |
| 622 | .description = "Support clamp for integer destination", | 622 | .description = "Support clamp for integer destination", |
| 623 | .dependencies = featureSet(&[_]Feature{}), | 623 | .dependencies = featureSet(&[_]Feature{}), |
| 624 | }; | 624 | }; |
| 625 | result[@enumToInt(Feature.inv_2pi_inline_imm)] = .{ | 625 | result[@intFromEnum(Feature.inv_2pi_inline_imm)] = .{ |
| 626 | .llvm_name = "inv-2pi-inline-imm", | 626 | .llvm_name = "inv-2pi-inline-imm", |
| 627 | .description = "Has 1 / (2 * pi) as inline immediate", | 627 | .description = "Has 1 / (2 * pi) as inline immediate", |
| 628 | .dependencies = featureSet(&[_]Feature{}), | 628 | .dependencies = featureSet(&[_]Feature{}), |
| 629 | }; | 629 | }; |
| 630 | result[@enumToInt(Feature.lds_branch_vmem_war_hazard)] = .{ | 630 | result[@intFromEnum(Feature.lds_branch_vmem_war_hazard)] = .{ |
| 631 | .llvm_name = "lds-branch-vmem-war-hazard", | 631 | .llvm_name = "lds-branch-vmem-war-hazard", |
| 632 | .description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0", | 632 | .description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0", |
| 633 | .dependencies = featureSet(&[_]Feature{}), | 633 | .dependencies = featureSet(&[_]Feature{}), |
| 634 | }; | 634 | }; |
| 635 | result[@enumToInt(Feature.lds_misaligned_bug)] = .{ | 635 | result[@intFromEnum(Feature.lds_misaligned_bug)] = .{ |
| 636 | .llvm_name = "lds-misaligned-bug", | 636 | .llvm_name = "lds-misaligned-bug", |
| 637 | .description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode", | 637 | .description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode", |
| 638 | .dependencies = featureSet(&[_]Feature{}), | 638 | .dependencies = featureSet(&[_]Feature{}), |
| 639 | }; | 639 | }; |
| 640 | result[@enumToInt(Feature.ldsbankcount16)] = .{ | 640 | result[@intFromEnum(Feature.ldsbankcount16)] = .{ |
| 641 | .llvm_name = "ldsbankcount16", | 641 | .llvm_name = "ldsbankcount16", |
| 642 | .description = "The number of LDS banks per compute unit.", | 642 | .description = "The number of LDS banks per compute unit.", |
| 643 | .dependencies = featureSet(&[_]Feature{}), | 643 | .dependencies = featureSet(&[_]Feature{}), |
| 644 | }; | 644 | }; |
| 645 | result[@enumToInt(Feature.ldsbankcount32)] = .{ | 645 | result[@intFromEnum(Feature.ldsbankcount32)] = .{ |
| 646 | .llvm_name = "ldsbankcount32", | 646 | .llvm_name = "ldsbankcount32", |
| 647 | .description = "The number of LDS banks per compute unit.", | 647 | .description = "The number of LDS banks per compute unit.", |
| 648 | .dependencies = featureSet(&[_]Feature{}), | 648 | .dependencies = featureSet(&[_]Feature{}), |
| 649 | }; | 649 | }; |
| 650 | result[@enumToInt(Feature.load_store_opt)] = .{ | 650 | result[@intFromEnum(Feature.load_store_opt)] = .{ |
| 651 | .llvm_name = "load-store-opt", | 651 | .llvm_name = "load-store-opt", |
| 652 | .description = "Enable SI load/store optimizer pass", | 652 | .description = "Enable SI load/store optimizer pass", |
| 653 | .dependencies = featureSet(&[_]Feature{}), | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | }; | 654 | }; |
| 655 | result[@enumToInt(Feature.localmemorysize32768)] = .{ | 655 | result[@intFromEnum(Feature.localmemorysize32768)] = .{ |
| 656 | .llvm_name = "localmemorysize32768", | 656 | .llvm_name = "localmemorysize32768", |
| 657 | .description = "The size of local memory in bytes", | 657 | .description = "The size of local memory in bytes", |
| 658 | .dependencies = featureSet(&[_]Feature{}), | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | }; | 659 | }; |
| 660 | result[@enumToInt(Feature.localmemorysize65536)] = .{ | 660 | result[@intFromEnum(Feature.localmemorysize65536)] = .{ |
| 661 | .llvm_name = "localmemorysize65536", | 661 | .llvm_name = "localmemorysize65536", |
| 662 | .description = "The size of local memory in bytes", | 662 | .description = "The size of local memory in bytes", |
| 663 | .dependencies = featureSet(&[_]Feature{}), | 663 | .dependencies = featureSet(&[_]Feature{}), |
| 664 | }; | 664 | }; |
| 665 | result[@enumToInt(Feature.mad_intra_fwd_bug)] = .{ | 665 | result[@intFromEnum(Feature.mad_intra_fwd_bug)] = .{ |
| 666 | .llvm_name = "mad-intra-fwd-bug", | 666 | .llvm_name = "mad-intra-fwd-bug", |
| 667 | .description = "MAD_U64/I64 intra instruction forwarding bug", | 667 | .description = "MAD_U64/I64 intra instruction forwarding bug", |
| 668 | .dependencies = featureSet(&[_]Feature{}), | 668 | .dependencies = featureSet(&[_]Feature{}), |
| 669 | }; | 669 | }; |
| 670 | result[@enumToInt(Feature.mad_mac_f32_insts)] = .{ | 670 | result[@intFromEnum(Feature.mad_mac_f32_insts)] = .{ |
| 671 | .llvm_name = "mad-mac-f32-insts", | 671 | .llvm_name = "mad-mac-f32-insts", |
| 672 | .description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions", | 672 | .description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions", |
| 673 | .dependencies = featureSet(&[_]Feature{}), | 673 | .dependencies = featureSet(&[_]Feature{}), |
| 674 | }; | 674 | }; |
| 675 | result[@enumToInt(Feature.mad_mix_insts)] = .{ | 675 | result[@intFromEnum(Feature.mad_mix_insts)] = .{ |
| 676 | .llvm_name = "mad-mix-insts", | 676 | .llvm_name = "mad-mix-insts", |
| 677 | .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions", | 677 | .description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions", |
| 678 | .dependencies = featureSet(&[_]Feature{}), | 678 | .dependencies = featureSet(&[_]Feature{}), |
| 679 | }; | 679 | }; |
| 680 | result[@enumToInt(Feature.mai_insts)] = .{ | 680 | result[@intFromEnum(Feature.mai_insts)] = .{ |
| 681 | .llvm_name = "mai-insts", | 681 | .llvm_name = "mai-insts", |
| 682 | .description = "Has mAI instructions", | 682 | .description = "Has mAI instructions", |
| 683 | .dependencies = featureSet(&[_]Feature{}), | 683 | .dependencies = featureSet(&[_]Feature{}), |
| 684 | }; | 684 | }; |
| 685 | result[@enumToInt(Feature.max_private_element_size_16)] = .{ | 685 | result[@intFromEnum(Feature.max_private_element_size_16)] = .{ |
| 686 | .llvm_name = "max-private-element-size-16", | 686 | .llvm_name = "max-private-element-size-16", |
| 687 | .description = "Maximum private access size may be 16", | 687 | .description = "Maximum private access size may be 16", |
| 688 | .dependencies = featureSet(&[_]Feature{}), | 688 | .dependencies = featureSet(&[_]Feature{}), |
| 689 | }; | 689 | }; |
| 690 | result[@enumToInt(Feature.max_private_element_size_4)] = .{ | 690 | result[@intFromEnum(Feature.max_private_element_size_4)] = .{ |
| 691 | .llvm_name = "max-private-element-size-4", | 691 | .llvm_name = "max-private-element-size-4", |
| 692 | .description = "Maximum private access size may be 4", | 692 | .description = "Maximum private access size may be 4", |
| 693 | .dependencies = featureSet(&[_]Feature{}), | 693 | .dependencies = featureSet(&[_]Feature{}), |
| 694 | }; | 694 | }; |
| 695 | result[@enumToInt(Feature.max_private_element_size_8)] = .{ | 695 | result[@intFromEnum(Feature.max_private_element_size_8)] = .{ |
| 696 | .llvm_name = "max-private-element-size-8", | 696 | .llvm_name = "max-private-element-size-8", |
| 697 | .description = "Maximum private access size may be 8", | 697 | .description = "Maximum private access size may be 8", |
| 698 | .dependencies = featureSet(&[_]Feature{}), | 698 | .dependencies = featureSet(&[_]Feature{}), |
| 699 | }; | 699 | }; |
| 700 | result[@enumToInt(Feature.mfma_inline_literal_bug)] = .{ | 700 | result[@intFromEnum(Feature.mfma_inline_literal_bug)] = .{ |
| 701 | .llvm_name = "mfma-inline-literal-bug", | 701 | .llvm_name = "mfma-inline-literal-bug", |
| 702 | .description = "MFMA cannot use inline literal as SrcC", | 702 | .description = "MFMA cannot use inline literal as SrcC", |
| 703 | .dependencies = featureSet(&[_]Feature{}), | 703 | .dependencies = featureSet(&[_]Feature{}), |
| 704 | }; | 704 | }; |
| 705 | result[@enumToInt(Feature.mimg_r128)] = .{ | 705 | result[@intFromEnum(Feature.mimg_r128)] = .{ |
| 706 | .llvm_name = "mimg-r128", | 706 | .llvm_name = "mimg-r128", |
| 707 | .description = "Support 128-bit texture resources", | 707 | .description = "Support 128-bit texture resources", |
| 708 | .dependencies = featureSet(&[_]Feature{}), | 708 | .dependencies = featureSet(&[_]Feature{}), |
| 709 | }; | 709 | }; |
| 710 | result[@enumToInt(Feature.movrel)] = .{ | 710 | result[@intFromEnum(Feature.movrel)] = .{ |
| 711 | .llvm_name = "movrel", | 711 | .llvm_name = "movrel", |
| 712 | .description = "Has v_movrel*_b32 instructions", | 712 | .description = "Has v_movrel*_b32 instructions", |
| 713 | .dependencies = featureSet(&[_]Feature{}), | 713 | .dependencies = featureSet(&[_]Feature{}), |
| 714 | }; | 714 | }; |
| 715 | result[@enumToInt(Feature.negative_scratch_offset_bug)] = .{ | 715 | result[@intFromEnum(Feature.negative_scratch_offset_bug)] = .{ |
| 716 | .llvm_name = "negative-scratch-offset-bug", | 716 | .llvm_name = "negative-scratch-offset-bug", |
| 717 | .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9", | 717 | .description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9", |
| 718 | .dependencies = featureSet(&[_]Feature{}), | 718 | .dependencies = featureSet(&[_]Feature{}), |
| 719 | }; | 719 | }; |
| 720 | result[@enumToInt(Feature.negative_unaligned_scratch_offset_bug)] = .{ | 720 | result[@intFromEnum(Feature.negative_unaligned_scratch_offset_bug)] = .{ |
| 721 | .llvm_name = "negative-unaligned-scratch-offset-bug", | 721 | .llvm_name = "negative-unaligned-scratch-offset-bug", |
| 722 | .description = "Scratch instructions with a VGPR offset and a negative immediate offset that is not a multiple of 4 read wrong memory on GFX10", | 722 | .description = "Scratch instructions with a VGPR offset and a negative immediate offset that is not a multiple of 4 read wrong memory on GFX10", |
| 723 | .dependencies = featureSet(&[_]Feature{}), | 723 | .dependencies = featureSet(&[_]Feature{}), |
| 724 | }; | 724 | }; |
| 725 | result[@enumToInt(Feature.no_data_dep_hazard)] = .{ | 725 | result[@intFromEnum(Feature.no_data_dep_hazard)] = .{ |
| 726 | .llvm_name = "no-data-dep-hazard", | 726 | .llvm_name = "no-data-dep-hazard", |
| 727 | .description = "Does not need SW waitstates", | 727 | .description = "Does not need SW waitstates", |
| 728 | .dependencies = featureSet(&[_]Feature{}), | 728 | .dependencies = featureSet(&[_]Feature{}), |
| 729 | }; | 729 | }; |
| 730 | result[@enumToInt(Feature.no_sdst_cmpx)] = .{ | 730 | result[@intFromEnum(Feature.no_sdst_cmpx)] = .{ |
| 731 | .llvm_name = "no-sdst-cmpx", | 731 | .llvm_name = "no-sdst-cmpx", |
| 732 | .description = "V_CMPX does not write VCC/SGPR in addition to EXEC", | 732 | .description = "V_CMPX does not write VCC/SGPR in addition to EXEC", |
| 733 | .dependencies = featureSet(&[_]Feature{}), | 733 | .dependencies = featureSet(&[_]Feature{}), |
| 734 | }; | 734 | }; |
| 735 | result[@enumToInt(Feature.nsa_clause_bug)] = .{ | 735 | result[@intFromEnum(Feature.nsa_clause_bug)] = .{ |
| 736 | .llvm_name = "nsa-clause-bug", | 736 | .llvm_name = "nsa-clause-bug", |
| 737 | .description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1", | 737 | .description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1", |
| 738 | .dependencies = featureSet(&[_]Feature{}), | 738 | .dependencies = featureSet(&[_]Feature{}), |
| 739 | }; | 739 | }; |
| 740 | result[@enumToInt(Feature.nsa_encoding)] = .{ | 740 | result[@intFromEnum(Feature.nsa_encoding)] = .{ |
| 741 | .llvm_name = "nsa-encoding", | 741 | .llvm_name = "nsa-encoding", |
| 742 | .description = "Support NSA encoding for image instructions", | 742 | .description = "Support NSA encoding for image instructions", |
| 743 | .dependencies = featureSet(&[_]Feature{}), | 743 | .dependencies = featureSet(&[_]Feature{}), |
| 744 | }; | 744 | }; |
| 745 | result[@enumToInt(Feature.nsa_max_size_13)] = .{ | 745 | result[@intFromEnum(Feature.nsa_max_size_13)] = .{ |
| 746 | .llvm_name = "nsa-max-size-13", | 746 | .llvm_name = "nsa-max-size-13", |
| 747 | .description = "The maximum non-sequential address size in VGPRs.", | 747 | .description = "The maximum non-sequential address size in VGPRs.", |
| 748 | .dependencies = featureSet(&[_]Feature{}), | 748 | .dependencies = featureSet(&[_]Feature{}), |
| 749 | }; | 749 | }; |
| 750 | result[@enumToInt(Feature.nsa_max_size_5)] = .{ | 750 | result[@intFromEnum(Feature.nsa_max_size_5)] = .{ |
| 751 | .llvm_name = "nsa-max-size-5", | 751 | .llvm_name = "nsa-max-size-5", |
| 752 | .description = "The maximum non-sequential address size in VGPRs.", | 752 | .description = "The maximum non-sequential address size in VGPRs.", |
| 753 | .dependencies = featureSet(&[_]Feature{}), | 753 | .dependencies = featureSet(&[_]Feature{}), |
| 754 | }; | 754 | }; |
| 755 | result[@enumToInt(Feature.nsa_to_vmem_bug)] = .{ | 755 | result[@intFromEnum(Feature.nsa_to_vmem_bug)] = .{ |
| 756 | .llvm_name = "nsa-to-vmem-bug", | 756 | .llvm_name = "nsa-to-vmem-bug", |
| 757 | .description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero", | 757 | .description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero", |
| 758 | .dependencies = featureSet(&[_]Feature{}), | 758 | .dependencies = featureSet(&[_]Feature{}), |
| 759 | }; | 759 | }; |
| 760 | result[@enumToInt(Feature.offset_3f_bug)] = .{ | 760 | result[@intFromEnum(Feature.offset_3f_bug)] = .{ |
| 761 | .llvm_name = "offset-3f-bug", | 761 | .llvm_name = "offset-3f-bug", |
| 762 | .description = "Branch offset of 3f hardware bug", | 762 | .description = "Branch offset of 3f hardware bug", |
| 763 | .dependencies = featureSet(&[_]Feature{}), | 763 | .dependencies = featureSet(&[_]Feature{}), |
| 764 | }; | 764 | }; |
| 765 | result[@enumToInt(Feature.packed_fp32_ops)] = .{ | 765 | result[@intFromEnum(Feature.packed_fp32_ops)] = .{ |
| 766 | .llvm_name = "packed-fp32-ops", | 766 | .llvm_name = "packed-fp32-ops", |
| 767 | .description = "Support packed fp32 instructions", | 767 | .description = "Support packed fp32 instructions", |
| 768 | .dependencies = featureSet(&[_]Feature{}), | 768 | .dependencies = featureSet(&[_]Feature{}), |
| 769 | }; | 769 | }; |
| 770 | result[@enumToInt(Feature.packed_tid)] = .{ | 770 | result[@intFromEnum(Feature.packed_tid)] = .{ |
| 771 | .llvm_name = "packed-tid", | 771 | .llvm_name = "packed-tid", |
| 772 | .description = "Workitem IDs are packed into v0 at kernel launch", | 772 | .description = "Workitem IDs are packed into v0 at kernel launch", |
| 773 | .dependencies = featureSet(&[_]Feature{}), | 773 | .dependencies = featureSet(&[_]Feature{}), |
| 774 | }; | 774 | }; |
| 775 | result[@enumToInt(Feature.pk_fmac_f16_inst)] = .{ | 775 | result[@intFromEnum(Feature.pk_fmac_f16_inst)] = .{ |
| 776 | .llvm_name = "pk-fmac-f16-inst", | 776 | .llvm_name = "pk-fmac-f16-inst", |
| 777 | .description = "Has v_pk_fmac_f16 instruction", | 777 | .description = "Has v_pk_fmac_f16 instruction", |
| 778 | .dependencies = featureSet(&[_]Feature{}), | 778 | .dependencies = featureSet(&[_]Feature{}), |
| 779 | }; | 779 | }; |
| 780 | result[@enumToInt(Feature.promote_alloca)] = .{ | 780 | result[@intFromEnum(Feature.promote_alloca)] = .{ |
| 781 | .llvm_name = "promote-alloca", | 781 | .llvm_name = "promote-alloca", |
| 782 | .description = "Enable promote alloca pass", | 782 | .description = "Enable promote alloca pass", |
| 783 | .dependencies = featureSet(&[_]Feature{}), | 783 | .dependencies = featureSet(&[_]Feature{}), |
| 784 | }; | 784 | }; |
| 785 | result[@enumToInt(Feature.prt_strict_null)] = .{ | 785 | result[@intFromEnum(Feature.prt_strict_null)] = .{ |
| 786 | .llvm_name = "enable-prt-strict-null", | 786 | .llvm_name = "enable-prt-strict-null", |
| 787 | .description = "Enable zeroing of result registers for sparse texture fetches", | 787 | .description = "Enable zeroing of result registers for sparse texture fetches", |
| 788 | .dependencies = featureSet(&[_]Feature{}), | 788 | .dependencies = featureSet(&[_]Feature{}), |
| 789 | }; | 789 | }; |
| 790 | result[@enumToInt(Feature.r128_a16)] = .{ | 790 | result[@intFromEnum(Feature.r128_a16)] = .{ |
| 791 | .llvm_name = "r128-a16", | 791 | .llvm_name = "r128-a16", |
| 792 | .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128", | 792 | .description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128", |
| 793 | .dependencies = featureSet(&[_]Feature{}), | 793 | .dependencies = featureSet(&[_]Feature{}), |
| 794 | }; | 794 | }; |
| 795 | result[@enumToInt(Feature.s_memrealtime)] = .{ | 795 | result[@intFromEnum(Feature.s_memrealtime)] = .{ |
| 796 | .llvm_name = "s-memrealtime", | 796 | .llvm_name = "s-memrealtime", |
| 797 | .description = "Has s_memrealtime instruction", | 797 | .description = "Has s_memrealtime instruction", |
| 798 | .dependencies = featureSet(&[_]Feature{}), | 798 | .dependencies = featureSet(&[_]Feature{}), |
| 799 | }; | 799 | }; |
| 800 | result[@enumToInt(Feature.s_memtime_inst)] = .{ | 800 | result[@intFromEnum(Feature.s_memtime_inst)] = .{ |
| 801 | .llvm_name = "s-memtime-inst", | 801 | .llvm_name = "s-memtime-inst", |
| 802 | .description = "Has s_memtime instruction", | 802 | .description = "Has s_memtime instruction", |
| 803 | .dependencies = featureSet(&[_]Feature{}), | 803 | .dependencies = featureSet(&[_]Feature{}), |
| 804 | }; | 804 | }; |
| 805 | result[@enumToInt(Feature.scalar_atomics)] = .{ | 805 | result[@intFromEnum(Feature.scalar_atomics)] = .{ |
| 806 | .llvm_name = "scalar-atomics", | 806 | .llvm_name = "scalar-atomics", |
| 807 | .description = "Has atomic scalar memory instructions", | 807 | .description = "Has atomic scalar memory instructions", |
| 808 | .dependencies = featureSet(&[_]Feature{}), | 808 | .dependencies = featureSet(&[_]Feature{}), |
| 809 | }; | 809 | }; |
| 810 | result[@enumToInt(Feature.scalar_flat_scratch_insts)] = .{ | 810 | result[@intFromEnum(Feature.scalar_flat_scratch_insts)] = .{ |
| 811 | .llvm_name = "scalar-flat-scratch-insts", | 811 | .llvm_name = "scalar-flat-scratch-insts", |
| 812 | .description = "Have s_scratch_* flat memory instructions", | 812 | .description = "Have s_scratch_* flat memory instructions", |
| 813 | .dependencies = featureSet(&[_]Feature{}), | 813 | .dependencies = featureSet(&[_]Feature{}), |
| 814 | }; | 814 | }; |
| 815 | result[@enumToInt(Feature.scalar_stores)] = .{ | 815 | result[@intFromEnum(Feature.scalar_stores)] = .{ |
| 816 | .llvm_name = "scalar-stores", | 816 | .llvm_name = "scalar-stores", |
| 817 | .description = "Has store scalar memory instructions", | 817 | .description = "Has store scalar memory instructions", |
| 818 | .dependencies = featureSet(&[_]Feature{}), | 818 | .dependencies = featureSet(&[_]Feature{}), |
| 819 | }; | 819 | }; |
| 820 | result[@enumToInt(Feature.sdwa)] = .{ | 820 | result[@intFromEnum(Feature.sdwa)] = .{ |
| 821 | .llvm_name = "sdwa", | 821 | .llvm_name = "sdwa", |
| 822 | .description = "Support SDWA (Sub-DWORD Addressing) extension", | 822 | .description = "Support SDWA (Sub-DWORD Addressing) extension", |
| 823 | .dependencies = featureSet(&[_]Feature{}), | 823 | .dependencies = featureSet(&[_]Feature{}), |
| 824 | }; | 824 | }; |
| 825 | result[@enumToInt(Feature.sdwa_mav)] = .{ | 825 | result[@intFromEnum(Feature.sdwa_mav)] = .{ |
| 826 | .llvm_name = "sdwa-mav", | 826 | .llvm_name = "sdwa-mav", |
| 827 | .description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension", | 827 | .description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension", |
| 828 | .dependencies = featureSet(&[_]Feature{}), | 828 | .dependencies = featureSet(&[_]Feature{}), |
| 829 | }; | 829 | }; |
| 830 | result[@enumToInt(Feature.sdwa_omod)] = .{ | 830 | result[@intFromEnum(Feature.sdwa_omod)] = .{ |
| 831 | .llvm_name = "sdwa-omod", | 831 | .llvm_name = "sdwa-omod", |
| 832 | .description = "Support OMod with SDWA (Sub-DWORD Addressing) extension", | 832 | .description = "Support OMod with SDWA (Sub-DWORD Addressing) extension", |
| 833 | .dependencies = featureSet(&[_]Feature{}), | 833 | .dependencies = featureSet(&[_]Feature{}), |
| 834 | }; | 834 | }; |
| 835 | result[@enumToInt(Feature.sdwa_out_mods_vopc)] = .{ | 835 | result[@intFromEnum(Feature.sdwa_out_mods_vopc)] = .{ |
| 836 | .llvm_name = "sdwa-out-mods-vopc", | 836 | .llvm_name = "sdwa-out-mods-vopc", |
| 837 | .description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension", | 837 | .description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 838 | .dependencies = featureSet(&[_]Feature{}), | 838 | .dependencies = featureSet(&[_]Feature{}), |
| 839 | }; | 839 | }; |
| 840 | result[@enumToInt(Feature.sdwa_scalar)] = .{ | 840 | result[@intFromEnum(Feature.sdwa_scalar)] = .{ |
| 841 | .llvm_name = "sdwa-scalar", | 841 | .llvm_name = "sdwa-scalar", |
| 842 | .description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension", | 842 | .description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension", |
| 843 | .dependencies = featureSet(&[_]Feature{}), | 843 | .dependencies = featureSet(&[_]Feature{}), |
| 844 | }; | 844 | }; |
| 845 | result[@enumToInt(Feature.sdwa_sdst)] = .{ | 845 | result[@intFromEnum(Feature.sdwa_sdst)] = .{ |
| 846 | .llvm_name = "sdwa-sdst", | 846 | .llvm_name = "sdwa-sdst", |
| 847 | .description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension", | 847 | .description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension", |
| 848 | .dependencies = featureSet(&[_]Feature{}), | 848 | .dependencies = featureSet(&[_]Feature{}), |
| 849 | }; | 849 | }; |
| 850 | result[@enumToInt(Feature.sea_islands)] = .{ | 850 | result[@intFromEnum(Feature.sea_islands)] = .{ |
| 851 | .llvm_name = "sea-islands", | 851 | .llvm_name = "sea-islands", |
| 852 | .description = "SEA_ISLANDS GPU generation", | 852 | .description = "SEA_ISLANDS GPU generation", |
| 853 | .dependencies = featureSet(&[_]Feature{ | 853 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -868,27 +868,27 @@ pub const all_features = blk: { | ... | @@ -868,27 +868,27 @@ pub const all_features = blk: { |
| 868 | .wavefrontsize64, | 868 | .wavefrontsize64, |
| 869 | }), | 869 | }), |
| 870 | }; | 870 | }; |
| 871 | result[@enumToInt(Feature.sgpr_init_bug)] = .{ | 871 | result[@intFromEnum(Feature.sgpr_init_bug)] = .{ |
| 872 | .llvm_name = "sgpr-init-bug", | 872 | .llvm_name = "sgpr-init-bug", |
| 873 | .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size", | 873 | .description = "VI SGPR initialization bug requiring a fixed SGPR allocation size", |
| 874 | .dependencies = featureSet(&[_]Feature{}), | 874 | .dependencies = featureSet(&[_]Feature{}), |
| 875 | }; | 875 | }; |
| 876 | result[@enumToInt(Feature.shader_cycles_register)] = .{ | 876 | result[@intFromEnum(Feature.shader_cycles_register)] = .{ |
| 877 | .llvm_name = "shader-cycles-register", | 877 | .llvm_name = "shader-cycles-register", |
| 878 | .description = "Has SHADER_CYCLES hardware register", | 878 | .description = "Has SHADER_CYCLES hardware register", |
| 879 | .dependencies = featureSet(&[_]Feature{}), | 879 | .dependencies = featureSet(&[_]Feature{}), |
| 880 | }; | 880 | }; |
| 881 | result[@enumToInt(Feature.si_scheduler)] = .{ | 881 | result[@intFromEnum(Feature.si_scheduler)] = .{ |
| 882 | .llvm_name = "si-scheduler", | 882 | .llvm_name = "si-scheduler", |
| 883 | .description = "Enable SI Machine Scheduler", | 883 | .description = "Enable SI Machine Scheduler", |
| 884 | .dependencies = featureSet(&[_]Feature{}), | 884 | .dependencies = featureSet(&[_]Feature{}), |
| 885 | }; | 885 | }; |
| 886 | result[@enumToInt(Feature.smem_to_vector_write_hazard)] = .{ | 886 | result[@intFromEnum(Feature.smem_to_vector_write_hazard)] = .{ |
| 887 | .llvm_name = "smem-to-vector-write-hazard", | 887 | .llvm_name = "smem-to-vector-write-hazard", |
| 888 | .description = "s_load_dword followed by v_cmp page faults", | 888 | .description = "s_load_dword followed by v_cmp page faults", |
| 889 | .dependencies = featureSet(&[_]Feature{}), | 889 | .dependencies = featureSet(&[_]Feature{}), |
| 890 | }; | 890 | }; |
| 891 | result[@enumToInt(Feature.southern_islands)] = .{ | 891 | result[@intFromEnum(Feature.southern_islands)] = .{ |
| 892 | .llvm_name = "southern-islands", | 892 | .llvm_name = "southern-islands", |
| 893 | .description = "SOUTHERN_ISLANDS GPU generation", | 893 | .description = "SOUTHERN_ISLANDS GPU generation", |
| 894 | .dependencies = featureSet(&[_]Feature{ | 894 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -906,97 +906,97 @@ pub const all_features = blk: { | ... | @@ -906,97 +906,97 @@ pub const all_features = blk: { |
| 906 | .wavefrontsize64, | 906 | .wavefrontsize64, |
| 907 | }), | 907 | }), |
| 908 | }; | 908 | }; |
| 909 | result[@enumToInt(Feature.sramecc)] = .{ | 909 | result[@intFromEnum(Feature.sramecc)] = .{ |
| 910 | .llvm_name = "sramecc", | 910 | .llvm_name = "sramecc", |
| 911 | .description = "Enable SRAMECC", | 911 | .description = "Enable SRAMECC", |
| 912 | .dependencies = featureSet(&[_]Feature{}), | 912 | .dependencies = featureSet(&[_]Feature{}), |
| 913 | }; | 913 | }; |
| 914 | result[@enumToInt(Feature.sramecc_support)] = .{ | 914 | result[@intFromEnum(Feature.sramecc_support)] = .{ |
| 915 | .llvm_name = "sramecc-support", | 915 | .llvm_name = "sramecc-support", |
| 916 | .description = "Hardware supports SRAMECC", | 916 | .description = "Hardware supports SRAMECC", |
| 917 | .dependencies = featureSet(&[_]Feature{}), | 917 | .dependencies = featureSet(&[_]Feature{}), |
| 918 | }; | 918 | }; |
| 919 | result[@enumToInt(Feature.tgsplit)] = .{ | 919 | result[@intFromEnum(Feature.tgsplit)] = .{ |
| 920 | .llvm_name = "tgsplit", | 920 | .llvm_name = "tgsplit", |
| 921 | .description = "Enable threadgroup split execution", | 921 | .description = "Enable threadgroup split execution", |
| 922 | .dependencies = featureSet(&[_]Feature{}), | 922 | .dependencies = featureSet(&[_]Feature{}), |
| 923 | }; | 923 | }; |
| 924 | result[@enumToInt(Feature.trap_handler)] = .{ | 924 | result[@intFromEnum(Feature.trap_handler)] = .{ |
| 925 | .llvm_name = "trap-handler", | 925 | .llvm_name = "trap-handler", |
| 926 | .description = "Trap handler support", | 926 | .description = "Trap handler support", |
| 927 | .dependencies = featureSet(&[_]Feature{}), | 927 | .dependencies = featureSet(&[_]Feature{}), |
| 928 | }; | 928 | }; |
| 929 | result[@enumToInt(Feature.trig_reduced_range)] = .{ | 929 | result[@intFromEnum(Feature.trig_reduced_range)] = .{ |
| 930 | .llvm_name = "trig-reduced-range", | 930 | .llvm_name = "trig-reduced-range", |
| 931 | .description = "Requires use of fract on arguments to trig instructions", | 931 | .description = "Requires use of fract on arguments to trig instructions", |
| 932 | .dependencies = featureSet(&[_]Feature{}), | 932 | .dependencies = featureSet(&[_]Feature{}), |
| 933 | }; | 933 | }; |
| 934 | result[@enumToInt(Feature.true16)] = .{ | 934 | result[@intFromEnum(Feature.true16)] = .{ |
| 935 | .llvm_name = "true16", | 935 | .llvm_name = "true16", |
| 936 | .description = "True 16-bit operand instructions", | 936 | .description = "True 16-bit operand instructions", |
| 937 | .dependencies = featureSet(&[_]Feature{}), | 937 | .dependencies = featureSet(&[_]Feature{}), |
| 938 | }; | 938 | }; |
| 939 | result[@enumToInt(Feature.unaligned_access_mode)] = .{ | 939 | result[@intFromEnum(Feature.unaligned_access_mode)] = .{ |
| 940 | .llvm_name = "unaligned-access-mode", | 940 | .llvm_name = "unaligned-access-mode", |
| 941 | .description = "Enable unaligned global, local and region loads and stores if the hardware supports it", | 941 | .description = "Enable unaligned global, local and region loads and stores if the hardware supports it", |
| 942 | .dependencies = featureSet(&[_]Feature{}), | 942 | .dependencies = featureSet(&[_]Feature{}), |
| 943 | }; | 943 | }; |
| 944 | result[@enumToInt(Feature.unaligned_buffer_access)] = .{ | 944 | result[@intFromEnum(Feature.unaligned_buffer_access)] = .{ |
| 945 | .llvm_name = "unaligned-buffer-access", | 945 | .llvm_name = "unaligned-buffer-access", |
| 946 | .description = "Hardware supports unaligned global loads and stores", | 946 | .description = "Hardware supports unaligned global loads and stores", |
| 947 | .dependencies = featureSet(&[_]Feature{}), | 947 | .dependencies = featureSet(&[_]Feature{}), |
| 948 | }; | 948 | }; |
| 949 | result[@enumToInt(Feature.unaligned_ds_access)] = .{ | 949 | result[@intFromEnum(Feature.unaligned_ds_access)] = .{ |
| 950 | .llvm_name = "unaligned-ds-access", | 950 | .llvm_name = "unaligned-ds-access", |
| 951 | .description = "Hardware supports unaligned local and region loads and stores", | 951 | .description = "Hardware supports unaligned local and region loads and stores", |
| 952 | .dependencies = featureSet(&[_]Feature{}), | 952 | .dependencies = featureSet(&[_]Feature{}), |
| 953 | }; | 953 | }; |
| 954 | result[@enumToInt(Feature.unaligned_scratch_access)] = .{ | 954 | result[@intFromEnum(Feature.unaligned_scratch_access)] = .{ |
| 955 | .llvm_name = "unaligned-scratch-access", | 955 | .llvm_name = "unaligned-scratch-access", |
| 956 | .description = "Support unaligned scratch loads and stores", | 956 | .description = "Support unaligned scratch loads and stores", |
| 957 | .dependencies = featureSet(&[_]Feature{}), | 957 | .dependencies = featureSet(&[_]Feature{}), |
| 958 | }; | 958 | }; |
| 959 | result[@enumToInt(Feature.unpacked_d16_vmem)] = .{ | 959 | result[@intFromEnum(Feature.unpacked_d16_vmem)] = .{ |
| 960 | .llvm_name = "unpacked-d16-vmem", | 960 | .llvm_name = "unpacked-d16-vmem", |
| 961 | .description = "Has unpacked d16 vmem instructions", | 961 | .description = "Has unpacked d16 vmem instructions", |
| 962 | .dependencies = featureSet(&[_]Feature{}), | 962 | .dependencies = featureSet(&[_]Feature{}), |
| 963 | }; | 963 | }; |
| 964 | result[@enumToInt(Feature.unsafe_ds_offset_folding)] = .{ | 964 | result[@intFromEnum(Feature.unsafe_ds_offset_folding)] = .{ |
| 965 | .llvm_name = "unsafe-ds-offset-folding", | 965 | .llvm_name = "unsafe-ds-offset-folding", |
| 966 | .description = "Force using DS instruction immediate offsets on SI", | 966 | .description = "Force using DS instruction immediate offsets on SI", |
| 967 | .dependencies = featureSet(&[_]Feature{}), | 967 | .dependencies = featureSet(&[_]Feature{}), |
| 968 | }; | 968 | }; |
| 969 | result[@enumToInt(Feature.user_sgpr_init16_bug)] = .{ | 969 | result[@intFromEnum(Feature.user_sgpr_init16_bug)] = .{ |
| 970 | .llvm_name = "user-sgpr-init16-bug", | 970 | .llvm_name = "user-sgpr-init16-bug", |
| 971 | .description = "Bug requiring at least 16 user+system SGPRs to be enabled", | 971 | .description = "Bug requiring at least 16 user+system SGPRs to be enabled", |
| 972 | .dependencies = featureSet(&[_]Feature{}), | 972 | .dependencies = featureSet(&[_]Feature{}), |
| 973 | }; | 973 | }; |
| 974 | result[@enumToInt(Feature.valu_trans_use_hazard)] = .{ | 974 | result[@intFromEnum(Feature.valu_trans_use_hazard)] = .{ |
| 975 | .llvm_name = "valu-trans-use-hazard", | 975 | .llvm_name = "valu-trans-use-hazard", |
| 976 | .description = "Hazard when TRANS instructions are closely followed by a use of the result", | 976 | .description = "Hazard when TRANS instructions are closely followed by a use of the result", |
| 977 | .dependencies = featureSet(&[_]Feature{}), | 977 | .dependencies = featureSet(&[_]Feature{}), |
| 978 | }; | 978 | }; |
| 979 | result[@enumToInt(Feature.vcmpx_exec_war_hazard)] = .{ | 979 | result[@intFromEnum(Feature.vcmpx_exec_war_hazard)] = .{ |
| 980 | .llvm_name = "vcmpx-exec-war-hazard", | 980 | .llvm_name = "vcmpx-exec-war-hazard", |
| 981 | .description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)", | 981 | .description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)", |
| 982 | .dependencies = featureSet(&[_]Feature{}), | 982 | .dependencies = featureSet(&[_]Feature{}), |
| 983 | }; | 983 | }; |
| 984 | result[@enumToInt(Feature.vcmpx_permlane_hazard)] = .{ | 984 | result[@intFromEnum(Feature.vcmpx_permlane_hazard)] = .{ |
| 985 | .llvm_name = "vcmpx-permlane-hazard", | 985 | .llvm_name = "vcmpx-permlane-hazard", |
| 986 | .description = "TODO: describe me", | 986 | .description = "TODO: describe me", |
| 987 | .dependencies = featureSet(&[_]Feature{}), | 987 | .dependencies = featureSet(&[_]Feature{}), |
| 988 | }; | 988 | }; |
| 989 | result[@enumToInt(Feature.vgpr_index_mode)] = .{ | 989 | result[@intFromEnum(Feature.vgpr_index_mode)] = .{ |
| 990 | .llvm_name = "vgpr-index-mode", | 990 | .llvm_name = "vgpr-index-mode", |
| 991 | .description = "Has VGPR mode register indexing", | 991 | .description = "Has VGPR mode register indexing", |
| 992 | .dependencies = featureSet(&[_]Feature{}), | 992 | .dependencies = featureSet(&[_]Feature{}), |
| 993 | }; | 993 | }; |
| 994 | result[@enumToInt(Feature.vmem_to_scalar_write_hazard)] = .{ | 994 | result[@intFromEnum(Feature.vmem_to_scalar_write_hazard)] = .{ |
| 995 | .llvm_name = "vmem-to-scalar-write-hazard", | 995 | .llvm_name = "vmem-to-scalar-write-hazard", |
| 996 | .description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.", | 996 | .description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.", |
| 997 | .dependencies = featureSet(&[_]Feature{}), | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | }; | 998 | }; |
| 999 | result[@enumToInt(Feature.volcanic_islands)] = .{ | 999 | result[@intFromEnum(Feature.volcanic_islands)] = .{ |
| 1000 | .llvm_name = "volcanic-islands", | 1000 | .llvm_name = "volcanic-islands", |
| 1001 | .description = "VOLCANIC_ISLANDS GPU generation", | 1001 | .description = "VOLCANIC_ISLANDS GPU generation", |
| 1002 | .dependencies = featureSet(&[_]Feature{ | 1002 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1030,47 +1030,47 @@ pub const all_features = blk: { | ... | @@ -1030,47 +1030,47 @@ pub const all_features = blk: { |
| 1030 | .wavefrontsize64, | 1030 | .wavefrontsize64, |
| 1031 | }), | 1031 | }), |
| 1032 | }; | 1032 | }; |
| 1033 | result[@enumToInt(Feature.vop3_literal)] = .{ | 1033 | result[@intFromEnum(Feature.vop3_literal)] = .{ |
| 1034 | .llvm_name = "vop3-literal", | 1034 | .llvm_name = "vop3-literal", |
| 1035 | .description = "Can use one literal in VOP3", | 1035 | .description = "Can use one literal in VOP3", |
| 1036 | .dependencies = featureSet(&[_]Feature{}), | 1036 | .dependencies = featureSet(&[_]Feature{}), |
| 1037 | }; | 1037 | }; |
| 1038 | result[@enumToInt(Feature.vop3p)] = .{ | 1038 | result[@intFromEnum(Feature.vop3p)] = .{ |
| 1039 | .llvm_name = "vop3p", | 1039 | .llvm_name = "vop3p", |
| 1040 | .description = "Has VOP3P packed instructions", | 1040 | .description = "Has VOP3P packed instructions", |
| 1041 | .dependencies = featureSet(&[_]Feature{}), | 1041 | .dependencies = featureSet(&[_]Feature{}), |
| 1042 | }; | 1042 | }; |
| 1043 | result[@enumToInt(Feature.vopd)] = .{ | 1043 | result[@intFromEnum(Feature.vopd)] = .{ |
| 1044 | .llvm_name = "vopd", | 1044 | .llvm_name = "vopd", |
| 1045 | .description = "Has VOPD dual issue wave32 instructions", | 1045 | .description = "Has VOPD dual issue wave32 instructions", |
| 1046 | .dependencies = featureSet(&[_]Feature{}), | 1046 | .dependencies = featureSet(&[_]Feature{}), |
| 1047 | }; | 1047 | }; |
| 1048 | result[@enumToInt(Feature.vscnt)] = .{ | 1048 | result[@intFromEnum(Feature.vscnt)] = .{ |
| 1049 | .llvm_name = "vscnt", | 1049 | .llvm_name = "vscnt", |
| 1050 | .description = "Has separate store vscnt counter", | 1050 | .description = "Has separate store vscnt counter", |
| 1051 | .dependencies = featureSet(&[_]Feature{}), | 1051 | .dependencies = featureSet(&[_]Feature{}), |
| 1052 | }; | 1052 | }; |
| 1053 | result[@enumToInt(Feature.wavefrontsize16)] = .{ | 1053 | result[@intFromEnum(Feature.wavefrontsize16)] = .{ |
| 1054 | .llvm_name = "wavefrontsize16", | 1054 | .llvm_name = "wavefrontsize16", |
| 1055 | .description = "The number of threads per wavefront", | 1055 | .description = "The number of threads per wavefront", |
| 1056 | .dependencies = featureSet(&[_]Feature{}), | 1056 | .dependencies = featureSet(&[_]Feature{}), |
| 1057 | }; | 1057 | }; |
| 1058 | result[@enumToInt(Feature.wavefrontsize32)] = .{ | 1058 | result[@intFromEnum(Feature.wavefrontsize32)] = .{ |
| 1059 | .llvm_name = "wavefrontsize32", | 1059 | .llvm_name = "wavefrontsize32", |
| 1060 | .description = "The number of threads per wavefront", | 1060 | .description = "The number of threads per wavefront", |
| 1061 | .dependencies = featureSet(&[_]Feature{}), | 1061 | .dependencies = featureSet(&[_]Feature{}), |
| 1062 | }; | 1062 | }; |
| 1063 | result[@enumToInt(Feature.wavefrontsize64)] = .{ | 1063 | result[@intFromEnum(Feature.wavefrontsize64)] = .{ |
| 1064 | .llvm_name = "wavefrontsize64", | 1064 | .llvm_name = "wavefrontsize64", |
| 1065 | .description = "The number of threads per wavefront", | 1065 | .description = "The number of threads per wavefront", |
| 1066 | .dependencies = featureSet(&[_]Feature{}), | 1066 | .dependencies = featureSet(&[_]Feature{}), |
| 1067 | }; | 1067 | }; |
| 1068 | result[@enumToInt(Feature.xnack)] = .{ | 1068 | result[@intFromEnum(Feature.xnack)] = .{ |
| 1069 | .llvm_name = "xnack", | 1069 | .llvm_name = "xnack", |
| 1070 | .description = "Enable XNACK support", | 1070 | .description = "Enable XNACK support", |
| 1071 | .dependencies = featureSet(&[_]Feature{}), | 1071 | .dependencies = featureSet(&[_]Feature{}), |
| 1072 | }; | 1072 | }; |
| 1073 | result[@enumToInt(Feature.xnack_support)] = .{ | 1073 | result[@intFromEnum(Feature.xnack_support)] = .{ |
| 1074 | .llvm_name = "xnack-support", | 1074 | .llvm_name = "xnack-support", |
| 1075 | .description = "Hardware supports XNACK", | 1075 | .description = "Hardware supports XNACK", |
| 1076 | .dependencies = featureSet(&[_]Feature{}), | 1076 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/arc.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).Enum.fields.len; | 17 | const len = @typeInfo(Feature).Enum.fields.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@enumToInt(Feature.norm)] = .{ | 20 | result[@intFromEnum(Feature.norm)] = .{ |
| 21 | .llvm_name = "norm", | 21 | .llvm_name = "norm", |
| 22 | .description = "Enable support for norm instruction.", | 22 | .description = "Enable support for norm instruction.", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/arm.zig+197-197| ... | @@ -214,156 +214,156 @@ pub const all_features = blk: { | ... | @@ -214,156 +214,156 @@ pub const all_features = blk: { |
| 214 | const len = @typeInfo(Feature).Enum.fields.len; | 214 | const len = @typeInfo(Feature).Enum.fields.len; |
| 215 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 215 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 216 | var result: [len]CpuFeature = undefined; | 216 | var result: [len]CpuFeature = undefined; |
| 217 | result[@enumToInt(Feature.@"32bit")] = .{ | 217 | result[@intFromEnum(Feature.@"32bit")] = .{ |
| 218 | .llvm_name = "32bit", | 218 | .llvm_name = "32bit", |
| 219 | .description = "Prefer 32-bit Thumb instrs", | 219 | .description = "Prefer 32-bit Thumb instrs", |
| 220 | .dependencies = featureSet(&[_]Feature{}), | 220 | .dependencies = featureSet(&[_]Feature{}), |
| 221 | }; | 221 | }; |
| 222 | result[@enumToInt(Feature.@"8msecext")] = .{ | 222 | result[@intFromEnum(Feature.@"8msecext")] = .{ |
| 223 | .llvm_name = "8msecext", | 223 | .llvm_name = "8msecext", |
| 224 | .description = "Enable support for ARMv8-M Security Extensions", | 224 | .description = "Enable support for ARMv8-M Security Extensions", |
| 225 | .dependencies = featureSet(&[_]Feature{}), | 225 | .dependencies = featureSet(&[_]Feature{}), |
| 226 | }; | 226 | }; |
| 227 | result[@enumToInt(Feature.a76)] = .{ | 227 | result[@intFromEnum(Feature.a76)] = .{ |
| 228 | .llvm_name = "a76", | 228 | .llvm_name = "a76", |
| 229 | .description = "Cortex-A76 ARM processors", | 229 | .description = "Cortex-A76 ARM processors", |
| 230 | .dependencies = featureSet(&[_]Feature{}), | 230 | .dependencies = featureSet(&[_]Feature{}), |
| 231 | }; | 231 | }; |
| 232 | result[@enumToInt(Feature.aapcs_frame_chain)] = .{ | 232 | result[@intFromEnum(Feature.aapcs_frame_chain)] = .{ |
| 233 | .llvm_name = "aapcs-frame-chain", | 233 | .llvm_name = "aapcs-frame-chain", |
| 234 | .description = "Create an AAPCS compliant frame chain", | 234 | .description = "Create an AAPCS compliant frame chain", |
| 235 | .dependencies = featureSet(&[_]Feature{}), | 235 | .dependencies = featureSet(&[_]Feature{}), |
| 236 | }; | 236 | }; |
| 237 | result[@enumToInt(Feature.aapcs_frame_chain_leaf)] = .{ | 237 | result[@intFromEnum(Feature.aapcs_frame_chain_leaf)] = .{ |
| 238 | .llvm_name = "aapcs-frame-chain-leaf", | 238 | .llvm_name = "aapcs-frame-chain-leaf", |
| 239 | .description = "Create an AAPCS compliant frame chain for leaf functions", | 239 | .description = "Create an AAPCS compliant frame chain for leaf functions", |
| 240 | .dependencies = featureSet(&[_]Feature{ | 240 | .dependencies = featureSet(&[_]Feature{ |
| 241 | .aapcs_frame_chain, | 241 | .aapcs_frame_chain, |
| 242 | }), | 242 | }), |
| 243 | }; | 243 | }; |
| 244 | result[@enumToInt(Feature.aclass)] = .{ | 244 | result[@intFromEnum(Feature.aclass)] = .{ |
| 245 | .llvm_name = "aclass", | 245 | .llvm_name = "aclass", |
| 246 | .description = "Is application profile ('A' series)", | 246 | .description = "Is application profile ('A' series)", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@enumToInt(Feature.acquire_release)] = .{ | 249 | result[@intFromEnum(Feature.acquire_release)] = .{ |
| 250 | .llvm_name = "acquire-release", | 250 | .llvm_name = "acquire-release", |
| 251 | .description = "Has v8 acquire/release (lda/ldaex etc) instructions", | 251 | .description = "Has v8 acquire/release (lda/ldaex etc) instructions", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@enumToInt(Feature.aes)] = .{ | 254 | result[@intFromEnum(Feature.aes)] = .{ |
| 255 | .llvm_name = "aes", | 255 | .llvm_name = "aes", |
| 256 | .description = "Enable AES support", | 256 | .description = "Enable AES support", |
| 257 | .dependencies = featureSet(&[_]Feature{ | 257 | .dependencies = featureSet(&[_]Feature{ |
| 258 | .neon, | 258 | .neon, |
| 259 | }), | 259 | }), |
| 260 | }; | 260 | }; |
| 261 | result[@enumToInt(Feature.atomics_32)] = .{ | 261 | result[@intFromEnum(Feature.atomics_32)] = .{ |
| 262 | .llvm_name = "atomics-32", | 262 | .llvm_name = "atomics-32", |
| 263 | .description = "Assume that lock-free 32-bit atomics are available", | 263 | .description = "Assume that lock-free 32-bit atomics are available", |
| 264 | .dependencies = featureSet(&[_]Feature{}), | 264 | .dependencies = featureSet(&[_]Feature{}), |
| 265 | }; | 265 | }; |
| 266 | result[@enumToInt(Feature.avoid_movs_shop)] = .{ | 266 | result[@intFromEnum(Feature.avoid_movs_shop)] = .{ |
| 267 | .llvm_name = "avoid-movs-shop", | 267 | .llvm_name = "avoid-movs-shop", |
| 268 | .description = "Avoid movs instructions with shifter operand", | 268 | .description = "Avoid movs instructions with shifter operand", |
| 269 | .dependencies = featureSet(&[_]Feature{}), | 269 | .dependencies = featureSet(&[_]Feature{}), |
| 270 | }; | 270 | }; |
| 271 | result[@enumToInt(Feature.avoid_partial_cpsr)] = .{ | 271 | result[@intFromEnum(Feature.avoid_partial_cpsr)] = .{ |
| 272 | .llvm_name = "avoid-partial-cpsr", | 272 | .llvm_name = "avoid-partial-cpsr", |
| 273 | .description = "Avoid CPSR partial update for OOO execution", | 273 | .description = "Avoid CPSR partial update for OOO execution", |
| 274 | .dependencies = featureSet(&[_]Feature{}), | 274 | .dependencies = featureSet(&[_]Feature{}), |
| 275 | }; | 275 | }; |
| 276 | result[@enumToInt(Feature.bf16)] = .{ | 276 | result[@intFromEnum(Feature.bf16)] = .{ |
| 277 | .llvm_name = "bf16", | 277 | .llvm_name = "bf16", |
| 278 | .description = "Enable support for BFloat16 instructions", | 278 | .description = "Enable support for BFloat16 instructions", |
| 279 | .dependencies = featureSet(&[_]Feature{ | 279 | .dependencies = featureSet(&[_]Feature{ |
| 280 | .neon, | 280 | .neon, |
| 281 | }), | 281 | }), |
| 282 | }; | 282 | }; |
| 283 | result[@enumToInt(Feature.big_endian_instructions)] = .{ | 283 | result[@intFromEnum(Feature.big_endian_instructions)] = .{ |
| 284 | .llvm_name = "big-endian-instructions", | 284 | .llvm_name = "big-endian-instructions", |
| 285 | .description = "Expect instructions to be stored big-endian.", | 285 | .description = "Expect instructions to be stored big-endian.", |
| 286 | .dependencies = featureSet(&[_]Feature{}), | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | }; | 287 | }; |
| 288 | result[@enumToInt(Feature.cde)] = .{ | 288 | result[@intFromEnum(Feature.cde)] = .{ |
| 289 | .llvm_name = "cde", | 289 | .llvm_name = "cde", |
| 290 | .description = "Support CDE instructions", | 290 | .description = "Support CDE instructions", |
| 291 | .dependencies = featureSet(&[_]Feature{ | 291 | .dependencies = featureSet(&[_]Feature{ |
| 292 | .has_v8m_main, | 292 | .has_v8m_main, |
| 293 | }), | 293 | }), |
| 294 | }; | 294 | }; |
| 295 | result[@enumToInt(Feature.cdecp0)] = .{ | 295 | result[@intFromEnum(Feature.cdecp0)] = .{ |
| 296 | .llvm_name = "cdecp0", | 296 | .llvm_name = "cdecp0", |
| 297 | .description = "Coprocessor 0 ISA is CDEv1", | 297 | .description = "Coprocessor 0 ISA is CDEv1", |
| 298 | .dependencies = featureSet(&[_]Feature{ | 298 | .dependencies = featureSet(&[_]Feature{ |
| 299 | .cde, | 299 | .cde, |
| 300 | }), | 300 | }), |
| 301 | }; | 301 | }; |
| 302 | result[@enumToInt(Feature.cdecp1)] = .{ | 302 | result[@intFromEnum(Feature.cdecp1)] = .{ |
| 303 | .llvm_name = "cdecp1", | 303 | .llvm_name = "cdecp1", |
| 304 | .description = "Coprocessor 1 ISA is CDEv1", | 304 | .description = "Coprocessor 1 ISA is CDEv1", |
| 305 | .dependencies = featureSet(&[_]Feature{ | 305 | .dependencies = featureSet(&[_]Feature{ |
| 306 | .cde, | 306 | .cde, |
| 307 | }), | 307 | }), |
| 308 | }; | 308 | }; |
| 309 | result[@enumToInt(Feature.cdecp2)] = .{ | 309 | result[@intFromEnum(Feature.cdecp2)] = .{ |
| 310 | .llvm_name = "cdecp2", | 310 | .llvm_name = "cdecp2", |
| 311 | .description = "Coprocessor 2 ISA is CDEv1", | 311 | .description = "Coprocessor 2 ISA is CDEv1", |
| 312 | .dependencies = featureSet(&[_]Feature{ | 312 | .dependencies = featureSet(&[_]Feature{ |
| 313 | .cde, | 313 | .cde, |
| 314 | }), | 314 | }), |
| 315 | }; | 315 | }; |
| 316 | result[@enumToInt(Feature.cdecp3)] = .{ | 316 | result[@intFromEnum(Feature.cdecp3)] = .{ |
| 317 | .llvm_name = "cdecp3", | 317 | .llvm_name = "cdecp3", |
| 318 | .description = "Coprocessor 3 ISA is CDEv1", | 318 | .description = "Coprocessor 3 ISA is CDEv1", |
| 319 | .dependencies = featureSet(&[_]Feature{ | 319 | .dependencies = featureSet(&[_]Feature{ |
| 320 | .cde, | 320 | .cde, |
| 321 | }), | 321 | }), |
| 322 | }; | 322 | }; |
| 323 | result[@enumToInt(Feature.cdecp4)] = .{ | 323 | result[@intFromEnum(Feature.cdecp4)] = .{ |
| 324 | .llvm_name = "cdecp4", | 324 | .llvm_name = "cdecp4", |
| 325 | .description = "Coprocessor 4 ISA is CDEv1", | 325 | .description = "Coprocessor 4 ISA is CDEv1", |
| 326 | .dependencies = featureSet(&[_]Feature{ | 326 | .dependencies = featureSet(&[_]Feature{ |
| 327 | .cde, | 327 | .cde, |
| 328 | }), | 328 | }), |
| 329 | }; | 329 | }; |
| 330 | result[@enumToInt(Feature.cdecp5)] = .{ | 330 | result[@intFromEnum(Feature.cdecp5)] = .{ |
| 331 | .llvm_name = "cdecp5", | 331 | .llvm_name = "cdecp5", |
| 332 | .description = "Coprocessor 5 ISA is CDEv1", | 332 | .description = "Coprocessor 5 ISA is CDEv1", |
| 333 | .dependencies = featureSet(&[_]Feature{ | 333 | .dependencies = featureSet(&[_]Feature{ |
| 334 | .cde, | 334 | .cde, |
| 335 | }), | 335 | }), |
| 336 | }; | 336 | }; |
| 337 | result[@enumToInt(Feature.cdecp6)] = .{ | 337 | result[@intFromEnum(Feature.cdecp6)] = .{ |
| 338 | .llvm_name = "cdecp6", | 338 | .llvm_name = "cdecp6", |
| 339 | .description = "Coprocessor 6 ISA is CDEv1", | 339 | .description = "Coprocessor 6 ISA is CDEv1", |
| 340 | .dependencies = featureSet(&[_]Feature{ | 340 | .dependencies = featureSet(&[_]Feature{ |
| 341 | .cde, | 341 | .cde, |
| 342 | }), | 342 | }), |
| 343 | }; | 343 | }; |
| 344 | result[@enumToInt(Feature.cdecp7)] = .{ | 344 | result[@intFromEnum(Feature.cdecp7)] = .{ |
| 345 | .llvm_name = "cdecp7", | 345 | .llvm_name = "cdecp7", |
| 346 | .description = "Coprocessor 7 ISA is CDEv1", | 346 | .description = "Coprocessor 7 ISA is CDEv1", |
| 347 | .dependencies = featureSet(&[_]Feature{ | 347 | .dependencies = featureSet(&[_]Feature{ |
| 348 | .cde, | 348 | .cde, |
| 349 | }), | 349 | }), |
| 350 | }; | 350 | }; |
| 351 | result[@enumToInt(Feature.cheap_predicable_cpsr)] = .{ | 351 | result[@intFromEnum(Feature.cheap_predicable_cpsr)] = .{ |
| 352 | .llvm_name = "cheap-predicable-cpsr", | 352 | .llvm_name = "cheap-predicable-cpsr", |
| 353 | .description = "Disable +1 predication cost for instructions updating CPSR", | 353 | .description = "Disable +1 predication cost for instructions updating CPSR", |
| 354 | .dependencies = featureSet(&[_]Feature{}), | 354 | .dependencies = featureSet(&[_]Feature{}), |
| 355 | }; | 355 | }; |
| 356 | result[@enumToInt(Feature.clrbhb)] = .{ | 356 | result[@intFromEnum(Feature.clrbhb)] = .{ |
| 357 | .llvm_name = "clrbhb", | 357 | .llvm_name = "clrbhb", |
| 358 | .description = "Enable Clear BHB instruction", | 358 | .description = "Enable Clear BHB instruction", |
| 359 | .dependencies = featureSet(&[_]Feature{}), | 359 | .dependencies = featureSet(&[_]Feature{}), |
| 360 | }; | 360 | }; |
| 361 | result[@enumToInt(Feature.crc)] = .{ | 361 | result[@intFromEnum(Feature.crc)] = .{ |
| 362 | .llvm_name = "crc", | 362 | .llvm_name = "crc", |
| 363 | .description = "Enable support for CRC instructions", | 363 | .description = "Enable support for CRC instructions", |
| 364 | .dependencies = featureSet(&[_]Feature{}), | 364 | .dependencies = featureSet(&[_]Feature{}), |
| 365 | }; | 365 | }; |
| 366 | result[@enumToInt(Feature.crypto)] = .{ | 366 | result[@intFromEnum(Feature.crypto)] = .{ |
| 367 | .llvm_name = "crypto", | 367 | .llvm_name = "crypto", |
| 368 | .description = "Enable support for Cryptography extensions", | 368 | .description = "Enable support for Cryptography extensions", |
| 369 | .dependencies = featureSet(&[_]Feature{ | 369 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -371,54 +371,54 @@ pub const all_features = blk: { | ... | @@ -371,54 +371,54 @@ pub const all_features = blk: { |
| 371 | .sha2, | 371 | .sha2, |
| 372 | }), | 372 | }), |
| 373 | }; | 373 | }; |
| 374 | result[@enumToInt(Feature.d32)] = .{ | 374 | result[@intFromEnum(Feature.d32)] = .{ |
| 375 | .llvm_name = "d32", | 375 | .llvm_name = "d32", |
| 376 | .description = "Extend FP to 32 double registers", | 376 | .description = "Extend FP to 32 double registers", |
| 377 | .dependencies = featureSet(&[_]Feature{}), | 377 | .dependencies = featureSet(&[_]Feature{}), |
| 378 | }; | 378 | }; |
| 379 | result[@enumToInt(Feature.db)] = .{ | 379 | result[@intFromEnum(Feature.db)] = .{ |
| 380 | .llvm_name = "db", | 380 | .llvm_name = "db", |
| 381 | .description = "Has data barrier (dmb/dsb) instructions", | 381 | .description = "Has data barrier (dmb/dsb) instructions", |
| 382 | .dependencies = featureSet(&[_]Feature{}), | 382 | .dependencies = featureSet(&[_]Feature{}), |
| 383 | }; | 383 | }; |
| 384 | result[@enumToInt(Feature.dfb)] = .{ | 384 | result[@intFromEnum(Feature.dfb)] = .{ |
| 385 | .llvm_name = "dfb", | 385 | .llvm_name = "dfb", |
| 386 | .description = "Has full data barrier (dfb) instruction", | 386 | .description = "Has full data barrier (dfb) instruction", |
| 387 | .dependencies = featureSet(&[_]Feature{}), | 387 | .dependencies = featureSet(&[_]Feature{}), |
| 388 | }; | 388 | }; |
| 389 | result[@enumToInt(Feature.disable_postra_scheduler)] = .{ | 389 | result[@intFromEnum(Feature.disable_postra_scheduler)] = .{ |
| 390 | .llvm_name = "disable-postra-scheduler", | 390 | .llvm_name = "disable-postra-scheduler", |
| 391 | .description = "Don't schedule again after register allocation", | 391 | .description = "Don't schedule again after register allocation", |
| 392 | .dependencies = featureSet(&[_]Feature{}), | 392 | .dependencies = featureSet(&[_]Feature{}), |
| 393 | }; | 393 | }; |
| 394 | result[@enumToInt(Feature.dont_widen_vmovs)] = .{ | 394 | result[@intFromEnum(Feature.dont_widen_vmovs)] = .{ |
| 395 | .llvm_name = "dont-widen-vmovs", | 395 | .llvm_name = "dont-widen-vmovs", |
| 396 | .description = "Don't widen VMOVS to VMOVD", | 396 | .description = "Don't widen VMOVS to VMOVD", |
| 397 | .dependencies = featureSet(&[_]Feature{}), | 397 | .dependencies = featureSet(&[_]Feature{}), |
| 398 | }; | 398 | }; |
| 399 | result[@enumToInt(Feature.dotprod)] = .{ | 399 | result[@intFromEnum(Feature.dotprod)] = .{ |
| 400 | .llvm_name = "dotprod", | 400 | .llvm_name = "dotprod", |
| 401 | .description = "Enable support for dot product instructions", | 401 | .description = "Enable support for dot product instructions", |
| 402 | .dependencies = featureSet(&[_]Feature{ | 402 | .dependencies = featureSet(&[_]Feature{ |
| 403 | .neon, | 403 | .neon, |
| 404 | }), | 404 | }), |
| 405 | }; | 405 | }; |
| 406 | result[@enumToInt(Feature.dsp)] = .{ | 406 | result[@intFromEnum(Feature.dsp)] = .{ |
| 407 | .llvm_name = "dsp", | 407 | .llvm_name = "dsp", |
| 408 | .description = "Supports DSP instructions in ARM and/or Thumb2", | 408 | .description = "Supports DSP instructions in ARM and/or Thumb2", |
| 409 | .dependencies = featureSet(&[_]Feature{}), | 409 | .dependencies = featureSet(&[_]Feature{}), |
| 410 | }; | 410 | }; |
| 411 | result[@enumToInt(Feature.execute_only)] = .{ | 411 | result[@intFromEnum(Feature.execute_only)] = .{ |
| 412 | .llvm_name = "execute-only", | 412 | .llvm_name = "execute-only", |
| 413 | .description = "Enable the generation of execute only code.", | 413 | .description = "Enable the generation of execute only code.", |
| 414 | .dependencies = featureSet(&[_]Feature{}), | 414 | .dependencies = featureSet(&[_]Feature{}), |
| 415 | }; | 415 | }; |
| 416 | result[@enumToInt(Feature.expand_fp_mlx)] = .{ | 416 | result[@intFromEnum(Feature.expand_fp_mlx)] = .{ |
| 417 | .llvm_name = "expand-fp-mlx", | 417 | .llvm_name = "expand-fp-mlx", |
| 418 | .description = "Expand VFP/NEON MLA/MLS instructions", | 418 | .description = "Expand VFP/NEON MLA/MLS instructions", |
| 419 | .dependencies = featureSet(&[_]Feature{}), | 419 | .dependencies = featureSet(&[_]Feature{}), |
| 420 | }; | 420 | }; |
| 421 | result[@enumToInt(Feature.exynos)] = .{ | 421 | result[@intFromEnum(Feature.exynos)] = .{ |
| 422 | .llvm_name = "exynos", | 422 | .llvm_name = "exynos", |
| 423 | .description = "Samsung Exynos processors", | 423 | .description = "Samsung Exynos processors", |
| 424 | .dependencies = featureSet(&[_]Feature{ | 424 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -441,36 +441,36 @@ pub const all_features = blk: { | ... | @@ -441,36 +441,36 @@ pub const all_features = blk: { |
| 441 | .zcz, | 441 | .zcz, |
| 442 | }), | 442 | }), |
| 443 | }; | 443 | }; |
| 444 | result[@enumToInt(Feature.fix_cmse_cve_2021_35465)] = .{ | 444 | result[@intFromEnum(Feature.fix_cmse_cve_2021_35465)] = .{ |
| 445 | .llvm_name = "fix-cmse-cve-2021-35465", | 445 | .llvm_name = "fix-cmse-cve-2021-35465", |
| 446 | .description = "Mitigate against the cve-2021-35465 security vulnurability", | 446 | .description = "Mitigate against the cve-2021-35465 security vulnurability", |
| 447 | .dependencies = featureSet(&[_]Feature{}), | 447 | .dependencies = featureSet(&[_]Feature{}), |
| 448 | }; | 448 | }; |
| 449 | result[@enumToInt(Feature.fix_cortex_a57_aes_1742098)] = .{ | 449 | result[@intFromEnum(Feature.fix_cortex_a57_aes_1742098)] = .{ |
| 450 | .llvm_name = "fix-cortex-a57-aes-1742098", | 450 | .llvm_name = "fix-cortex-a57-aes-1742098", |
| 451 | .description = "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)", | 451 | .description = "Work around Cortex-A57 Erratum 1742098 / Cortex-A72 Erratum 1655431 (AES)", |
| 452 | .dependencies = featureSet(&[_]Feature{}), | 452 | .dependencies = featureSet(&[_]Feature{}), |
| 453 | }; | 453 | }; |
| 454 | result[@enumToInt(Feature.fp16)] = .{ | 454 | result[@intFromEnum(Feature.fp16)] = .{ |
| 455 | .llvm_name = "fp16", | 455 | .llvm_name = "fp16", |
| 456 | .description = "Enable half-precision floating point", | 456 | .description = "Enable half-precision floating point", |
| 457 | .dependencies = featureSet(&[_]Feature{}), | 457 | .dependencies = featureSet(&[_]Feature{}), |
| 458 | }; | 458 | }; |
| 459 | result[@enumToInt(Feature.fp16fml)] = .{ | 459 | result[@intFromEnum(Feature.fp16fml)] = .{ |
| 460 | .llvm_name = "fp16fml", | 460 | .llvm_name = "fp16fml", |
| 461 | .description = "Enable full half-precision floating point fml instructions", | 461 | .description = "Enable full half-precision floating point fml instructions", |
| 462 | .dependencies = featureSet(&[_]Feature{ | 462 | .dependencies = featureSet(&[_]Feature{ |
| 463 | .fullfp16, | 463 | .fullfp16, |
| 464 | }), | 464 | }), |
| 465 | }; | 465 | }; |
| 466 | result[@enumToInt(Feature.fp64)] = .{ | 466 | result[@intFromEnum(Feature.fp64)] = .{ |
| 467 | .llvm_name = "fp64", | 467 | .llvm_name = "fp64", |
| 468 | .description = "Floating point unit supports double precision", | 468 | .description = "Floating point unit supports double precision", |
| 469 | .dependencies = featureSet(&[_]Feature{ | 469 | .dependencies = featureSet(&[_]Feature{ |
| 470 | .fpregs64, | 470 | .fpregs64, |
| 471 | }), | 471 | }), |
| 472 | }; | 472 | }; |
| 473 | result[@enumToInt(Feature.fp_armv8)] = .{ | 473 | result[@intFromEnum(Feature.fp_armv8)] = .{ |
| 474 | .llvm_name = "fp-armv8", | 474 | .llvm_name = "fp-armv8", |
| 475 | .description = "Enable ARMv8 FP", | 475 | .description = "Enable ARMv8 FP", |
| 476 | .dependencies = featureSet(&[_]Feature{ | 476 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -479,7 +479,7 @@ pub const all_features = blk: { | ... | @@ -479,7 +479,7 @@ pub const all_features = blk: { |
| 479 | .vfp4, | 479 | .vfp4, |
| 480 | }), | 480 | }), |
| 481 | }; | 481 | }; |
| 482 | result[@enumToInt(Feature.fp_armv8d16)] = .{ | 482 | result[@intFromEnum(Feature.fp_armv8d16)] = .{ |
| 483 | .llvm_name = "fp-armv8d16", | 483 | .llvm_name = "fp-armv8d16", |
| 484 | .description = "Enable ARMv8 FP with only 16 d-registers", | 484 | .description = "Enable ARMv8 FP with only 16 d-registers", |
| 485 | .dependencies = featureSet(&[_]Feature{ | 485 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -487,14 +487,14 @@ pub const all_features = blk: { | ... | @@ -487,14 +487,14 @@ pub const all_features = blk: { |
| 487 | .vfp4d16, | 487 | .vfp4d16, |
| 488 | }), | 488 | }), |
| 489 | }; | 489 | }; |
| 490 | result[@enumToInt(Feature.fp_armv8d16sp)] = .{ | 490 | result[@intFromEnum(Feature.fp_armv8d16sp)] = .{ |
| 491 | .llvm_name = "fp-armv8d16sp", | 491 | .llvm_name = "fp-armv8d16sp", |
| 492 | .description = "Enable ARMv8 FP with only 16 d-registers and no double precision", | 492 | .description = "Enable ARMv8 FP with only 16 d-registers and no double precision", |
| 493 | .dependencies = featureSet(&[_]Feature{ | 493 | .dependencies = featureSet(&[_]Feature{ |
| 494 | .vfp4d16sp, | 494 | .vfp4d16sp, |
| 495 | }), | 495 | }), |
| 496 | }; | 496 | }; |
| 497 | result[@enumToInt(Feature.fp_armv8sp)] = .{ | 497 | result[@intFromEnum(Feature.fp_armv8sp)] = .{ |
| 498 | .llvm_name = "fp-armv8sp", | 498 | .llvm_name = "fp-armv8sp", |
| 499 | .description = "Enable ARMv8 FP with no double precision", | 499 | .description = "Enable ARMv8 FP with no double precision", |
| 500 | .dependencies = featureSet(&[_]Feature{ | 500 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -502,31 +502,31 @@ pub const all_features = blk: { | ... | @@ -502,31 +502,31 @@ pub const all_features = blk: { |
| 502 | .vfp4sp, | 502 | .vfp4sp, |
| 503 | }), | 503 | }), |
| 504 | }; | 504 | }; |
| 505 | result[@enumToInt(Feature.fpao)] = .{ | 505 | result[@intFromEnum(Feature.fpao)] = .{ |
| 506 | .llvm_name = "fpao", | 506 | .llvm_name = "fpao", |
| 507 | .description = "Enable fast computation of positive address offsets", | 507 | .description = "Enable fast computation of positive address offsets", |
| 508 | .dependencies = featureSet(&[_]Feature{}), | 508 | .dependencies = featureSet(&[_]Feature{}), |
| 509 | }; | 509 | }; |
| 510 | result[@enumToInt(Feature.fpregs)] = .{ | 510 | result[@intFromEnum(Feature.fpregs)] = .{ |
| 511 | .llvm_name = "fpregs", | 511 | .llvm_name = "fpregs", |
| 512 | .description = "Enable FP registers", | 512 | .description = "Enable FP registers", |
| 513 | .dependencies = featureSet(&[_]Feature{}), | 513 | .dependencies = featureSet(&[_]Feature{}), |
| 514 | }; | 514 | }; |
| 515 | result[@enumToInt(Feature.fpregs16)] = .{ | 515 | result[@intFromEnum(Feature.fpregs16)] = .{ |
| 516 | .llvm_name = "fpregs16", | 516 | .llvm_name = "fpregs16", |
| 517 | .description = "Enable 16-bit FP registers", | 517 | .description = "Enable 16-bit FP registers", |
| 518 | .dependencies = featureSet(&[_]Feature{ | 518 | .dependencies = featureSet(&[_]Feature{ |
| 519 | .fpregs, | 519 | .fpregs, |
| 520 | }), | 520 | }), |
| 521 | }; | 521 | }; |
| 522 | result[@enumToInt(Feature.fpregs64)] = .{ | 522 | result[@intFromEnum(Feature.fpregs64)] = .{ |
| 523 | .llvm_name = "fpregs64", | 523 | .llvm_name = "fpregs64", |
| 524 | .description = "Enable 64-bit FP registers", | 524 | .description = "Enable 64-bit FP registers", |
| 525 | .dependencies = featureSet(&[_]Feature{ | 525 | .dependencies = featureSet(&[_]Feature{ |
| 526 | .fpregs, | 526 | .fpregs, |
| 527 | }), | 527 | }), |
| 528 | }; | 528 | }; |
| 529 | result[@enumToInt(Feature.fullfp16)] = .{ | 529 | result[@intFromEnum(Feature.fullfp16)] = .{ |
| 530 | .llvm_name = "fullfp16", | 530 | .llvm_name = "fullfp16", |
| 531 | .description = "Enable full half-precision floating point", | 531 | .description = "Enable full half-precision floating point", |
| 532 | .dependencies = featureSet(&[_]Feature{ | 532 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -534,72 +534,72 @@ pub const all_features = blk: { | ... | @@ -534,72 +534,72 @@ pub const all_features = blk: { |
| 534 | .fpregs16, | 534 | .fpregs16, |
| 535 | }), | 535 | }), |
| 536 | }; | 536 | }; |
| 537 | result[@enumToInt(Feature.fuse_aes)] = .{ | 537 | result[@intFromEnum(Feature.fuse_aes)] = .{ |
| 538 | .llvm_name = "fuse-aes", | 538 | .llvm_name = "fuse-aes", |
| 539 | .description = "CPU fuses AES crypto operations", | 539 | .description = "CPU fuses AES crypto operations", |
| 540 | .dependencies = featureSet(&[_]Feature{}), | 540 | .dependencies = featureSet(&[_]Feature{}), |
| 541 | }; | 541 | }; |
| 542 | result[@enumToInt(Feature.fuse_literals)] = .{ | 542 | result[@intFromEnum(Feature.fuse_literals)] = .{ |
| 543 | .llvm_name = "fuse-literals", | 543 | .llvm_name = "fuse-literals", |
| 544 | .description = "CPU fuses literal generation operations", | 544 | .description = "CPU fuses literal generation operations", |
| 545 | .dependencies = featureSet(&[_]Feature{}), | 545 | .dependencies = featureSet(&[_]Feature{}), |
| 546 | }; | 546 | }; |
| 547 | result[@enumToInt(Feature.harden_sls_blr)] = .{ | 547 | result[@intFromEnum(Feature.harden_sls_blr)] = .{ |
| 548 | .llvm_name = "harden-sls-blr", | 548 | .llvm_name = "harden-sls-blr", |
| 549 | .description = "Harden against straight line speculation across indirect calls", | 549 | .description = "Harden against straight line speculation across indirect calls", |
| 550 | .dependencies = featureSet(&[_]Feature{}), | 550 | .dependencies = featureSet(&[_]Feature{}), |
| 551 | }; | 551 | }; |
| 552 | result[@enumToInt(Feature.harden_sls_nocomdat)] = .{ | 552 | result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{ |
| 553 | .llvm_name = "harden-sls-nocomdat", | 553 | .llvm_name = "harden-sls-nocomdat", |
| 554 | .description = "Generate thunk code for SLS mitigation in the normal text section", | 554 | .description = "Generate thunk code for SLS mitigation in the normal text section", |
| 555 | .dependencies = featureSet(&[_]Feature{}), | 555 | .dependencies = featureSet(&[_]Feature{}), |
| 556 | }; | 556 | }; |
| 557 | result[@enumToInt(Feature.harden_sls_retbr)] = .{ | 557 | result[@intFromEnum(Feature.harden_sls_retbr)] = .{ |
| 558 | .llvm_name = "harden-sls-retbr", | 558 | .llvm_name = "harden-sls-retbr", |
| 559 | .description = "Harden against straight line speculation across RETurn and BranchRegister instructions", | 559 | .description = "Harden against straight line speculation across RETurn and BranchRegister instructions", |
| 560 | .dependencies = featureSet(&[_]Feature{}), | 560 | .dependencies = featureSet(&[_]Feature{}), |
| 561 | }; | 561 | }; |
| 562 | result[@enumToInt(Feature.has_v4t)] = .{ | 562 | result[@intFromEnum(Feature.has_v4t)] = .{ |
| 563 | .llvm_name = "v4t", | 563 | .llvm_name = "v4t", |
| 564 | .description = "Support ARM v4T instructions", | 564 | .description = "Support ARM v4T instructions", |
| 565 | .dependencies = featureSet(&[_]Feature{}), | 565 | .dependencies = featureSet(&[_]Feature{}), |
| 566 | }; | 566 | }; |
| 567 | result[@enumToInt(Feature.has_v5t)] = .{ | 567 | result[@intFromEnum(Feature.has_v5t)] = .{ |
| 568 | .llvm_name = "v5t", | 568 | .llvm_name = "v5t", |
| 569 | .description = "Support ARM v5T instructions", | 569 | .description = "Support ARM v5T instructions", |
| 570 | .dependencies = featureSet(&[_]Feature{ | 570 | .dependencies = featureSet(&[_]Feature{ |
| 571 | .has_v4t, | 571 | .has_v4t, |
| 572 | }), | 572 | }), |
| 573 | }; | 573 | }; |
| 574 | result[@enumToInt(Feature.has_v5te)] = .{ | 574 | result[@intFromEnum(Feature.has_v5te)] = .{ |
| 575 | .llvm_name = "v5te", | 575 | .llvm_name = "v5te", |
| 576 | .description = "Support ARM v5TE, v5TEj, and v5TExp instructions", | 576 | .description = "Support ARM v5TE, v5TEj, and v5TExp instructions", |
| 577 | .dependencies = featureSet(&[_]Feature{ | 577 | .dependencies = featureSet(&[_]Feature{ |
| 578 | .has_v5t, | 578 | .has_v5t, |
| 579 | }), | 579 | }), |
| 580 | }; | 580 | }; |
| 581 | result[@enumToInt(Feature.has_v6)] = .{ | 581 | result[@intFromEnum(Feature.has_v6)] = .{ |
| 582 | .llvm_name = "v6", | 582 | .llvm_name = "v6", |
| 583 | .description = "Support ARM v6 instructions", | 583 | .description = "Support ARM v6 instructions", |
| 584 | .dependencies = featureSet(&[_]Feature{ | 584 | .dependencies = featureSet(&[_]Feature{ |
| 585 | .has_v5te, | 585 | .has_v5te, |
| 586 | }), | 586 | }), |
| 587 | }; | 587 | }; |
| 588 | result[@enumToInt(Feature.has_v6k)] = .{ | 588 | result[@intFromEnum(Feature.has_v6k)] = .{ |
| 589 | .llvm_name = "v6k", | 589 | .llvm_name = "v6k", |
| 590 | .description = "Support ARM v6k instructions", | 590 | .description = "Support ARM v6k instructions", |
| 591 | .dependencies = featureSet(&[_]Feature{ | 591 | .dependencies = featureSet(&[_]Feature{ |
| 592 | .has_v6, | 592 | .has_v6, |
| 593 | }), | 593 | }), |
| 594 | }; | 594 | }; |
| 595 | result[@enumToInt(Feature.has_v6m)] = .{ | 595 | result[@intFromEnum(Feature.has_v6m)] = .{ |
| 596 | .llvm_name = "v6m", | 596 | .llvm_name = "v6m", |
| 597 | .description = "Support ARM v6M instructions", | 597 | .description = "Support ARM v6M instructions", |
| 598 | .dependencies = featureSet(&[_]Feature{ | 598 | .dependencies = featureSet(&[_]Feature{ |
| 599 | .has_v6, | 599 | .has_v6, |
| 600 | }), | 600 | }), |
| 601 | }; | 601 | }; |
| 602 | result[@enumToInt(Feature.has_v6t2)] = .{ | 602 | result[@intFromEnum(Feature.has_v6t2)] = .{ |
| 603 | .llvm_name = "v6t2", | 603 | .llvm_name = "v6t2", |
| 604 | .description = "Support ARM v6t2 instructions", | 604 | .description = "Support ARM v6t2 instructions", |
| 605 | .dependencies = featureSet(&[_]Feature{ | 605 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -608,7 +608,7 @@ pub const all_features = blk: { | ... | @@ -608,7 +608,7 @@ pub const all_features = blk: { |
| 608 | .thumb2, | 608 | .thumb2, |
| 609 | }), | 609 | }), |
| 610 | }; | 610 | }; |
| 611 | result[@enumToInt(Feature.has_v7)] = .{ | 611 | result[@intFromEnum(Feature.has_v7)] = .{ |
| 612 | .llvm_name = "v7", | 612 | .llvm_name = "v7", |
| 613 | .description = "Support ARM v7 instructions", | 613 | .description = "Support ARM v7 instructions", |
| 614 | .dependencies = featureSet(&[_]Feature{ | 614 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -616,12 +616,12 @@ pub const all_features = blk: { | ... | @@ -616,12 +616,12 @@ pub const all_features = blk: { |
| 616 | .has_v7clrex, | 616 | .has_v7clrex, |
| 617 | }), | 617 | }), |
| 618 | }; | 618 | }; |
| 619 | result[@enumToInt(Feature.has_v7clrex)] = .{ | 619 | result[@intFromEnum(Feature.has_v7clrex)] = .{ |
| 620 | .llvm_name = "v7clrex", | 620 | .llvm_name = "v7clrex", |
| 621 | .description = "Has v7 clrex instruction", | 621 | .description = "Has v7 clrex instruction", |
| 622 | .dependencies = featureSet(&[_]Feature{}), | 622 | .dependencies = featureSet(&[_]Feature{}), |
| 623 | }; | 623 | }; |
| 624 | result[@enumToInt(Feature.has_v8)] = .{ | 624 | result[@intFromEnum(Feature.has_v8)] = .{ |
| 625 | .llvm_name = "v8", | 625 | .llvm_name = "v8", |
| 626 | .description = "Support ARM v8 instructions", | 626 | .description = "Support ARM v8 instructions", |
| 627 | .dependencies = featureSet(&[_]Feature{ | 627 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -630,35 +630,35 @@ pub const all_features = blk: { | ... | @@ -630,35 +630,35 @@ pub const all_features = blk: { |
| 630 | .perfmon, | 630 | .perfmon, |
| 631 | }), | 631 | }), |
| 632 | }; | 632 | }; |
| 633 | result[@enumToInt(Feature.has_v8_1a)] = .{ | 633 | result[@intFromEnum(Feature.has_v8_1a)] = .{ |
| 634 | .llvm_name = "v8.1a", | 634 | .llvm_name = "v8.1a", |
| 635 | .description = "Support ARM v8.1a instructions", | 635 | .description = "Support ARM v8.1a instructions", |
| 636 | .dependencies = featureSet(&[_]Feature{ | 636 | .dependencies = featureSet(&[_]Feature{ |
| 637 | .has_v8, | 637 | .has_v8, |
| 638 | }), | 638 | }), |
| 639 | }; | 639 | }; |
| 640 | result[@enumToInt(Feature.has_v8_1m_main)] = .{ | 640 | result[@intFromEnum(Feature.has_v8_1m_main)] = .{ |
| 641 | .llvm_name = "v8.1m.main", | 641 | .llvm_name = "v8.1m.main", |
| 642 | .description = "Support ARM v8-1M Mainline instructions", | 642 | .description = "Support ARM v8-1M Mainline instructions", |
| 643 | .dependencies = featureSet(&[_]Feature{ | 643 | .dependencies = featureSet(&[_]Feature{ |
| 644 | .has_v8m_main, | 644 | .has_v8m_main, |
| 645 | }), | 645 | }), |
| 646 | }; | 646 | }; |
| 647 | result[@enumToInt(Feature.has_v8_2a)] = .{ | 647 | result[@intFromEnum(Feature.has_v8_2a)] = .{ |
| 648 | .llvm_name = "v8.2a", | 648 | .llvm_name = "v8.2a", |
| 649 | .description = "Support ARM v8.2a instructions", | 649 | .description = "Support ARM v8.2a instructions", |
| 650 | .dependencies = featureSet(&[_]Feature{ | 650 | .dependencies = featureSet(&[_]Feature{ |
| 651 | .has_v8_1a, | 651 | .has_v8_1a, |
| 652 | }), | 652 | }), |
| 653 | }; | 653 | }; |
| 654 | result[@enumToInt(Feature.has_v8_3a)] = .{ | 654 | result[@intFromEnum(Feature.has_v8_3a)] = .{ |
| 655 | .llvm_name = "v8.3a", | 655 | .llvm_name = "v8.3a", |
| 656 | .description = "Support ARM v8.3a instructions", | 656 | .description = "Support ARM v8.3a instructions", |
| 657 | .dependencies = featureSet(&[_]Feature{ | 657 | .dependencies = featureSet(&[_]Feature{ |
| 658 | .has_v8_2a, | 658 | .has_v8_2a, |
| 659 | }), | 659 | }), |
| 660 | }; | 660 | }; |
| 661 | result[@enumToInt(Feature.has_v8_4a)] = .{ | 661 | result[@intFromEnum(Feature.has_v8_4a)] = .{ |
| 662 | .llvm_name = "v8.4a", | 662 | .llvm_name = "v8.4a", |
| 663 | .description = "Support ARM v8.4a instructions", | 663 | .description = "Support ARM v8.4a instructions", |
| 664 | .dependencies = featureSet(&[_]Feature{ | 664 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -666,7 +666,7 @@ pub const all_features = blk: { | ... | @@ -666,7 +666,7 @@ pub const all_features = blk: { |
| 666 | .has_v8_3a, | 666 | .has_v8_3a, |
| 667 | }), | 667 | }), |
| 668 | }; | 668 | }; |
| 669 | result[@enumToInt(Feature.has_v8_5a)] = .{ | 669 | result[@intFromEnum(Feature.has_v8_5a)] = .{ |
| 670 | .llvm_name = "v8.5a", | 670 | .llvm_name = "v8.5a", |
| 671 | .description = "Support ARM v8.5a instructions", | 671 | .description = "Support ARM v8.5a instructions", |
| 672 | .dependencies = featureSet(&[_]Feature{ | 672 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -674,7 +674,7 @@ pub const all_features = blk: { | ... | @@ -674,7 +674,7 @@ pub const all_features = blk: { |
| 674 | .sb, | 674 | .sb, |
| 675 | }), | 675 | }), |
| 676 | }; | 676 | }; |
| 677 | result[@enumToInt(Feature.has_v8_6a)] = .{ | 677 | result[@intFromEnum(Feature.has_v8_6a)] = .{ |
| 678 | .llvm_name = "v8.6a", | 678 | .llvm_name = "v8.6a", |
| 679 | .description = "Support ARM v8.6a instructions", | 679 | .description = "Support ARM v8.6a instructions", |
| 680 | .dependencies = featureSet(&[_]Feature{ | 680 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -683,21 +683,21 @@ pub const all_features = blk: { | ... | @@ -683,21 +683,21 @@ pub const all_features = blk: { |
| 683 | .i8mm, | 683 | .i8mm, |
| 684 | }), | 684 | }), |
| 685 | }; | 685 | }; |
| 686 | result[@enumToInt(Feature.has_v8_7a)] = .{ | 686 | result[@intFromEnum(Feature.has_v8_7a)] = .{ |
| 687 | .llvm_name = "v8.7a", | 687 | .llvm_name = "v8.7a", |
| 688 | .description = "Support ARM v8.7a instructions", | 688 | .description = "Support ARM v8.7a instructions", |
| 689 | .dependencies = featureSet(&[_]Feature{ | 689 | .dependencies = featureSet(&[_]Feature{ |
| 690 | .has_v8_6a, | 690 | .has_v8_6a, |
| 691 | }), | 691 | }), |
| 692 | }; | 692 | }; |
| 693 | result[@enumToInt(Feature.has_v8_8a)] = .{ | 693 | result[@intFromEnum(Feature.has_v8_8a)] = .{ |
| 694 | .llvm_name = "v8.8a", | 694 | .llvm_name = "v8.8a", |
| 695 | .description = "Support ARM v8.8a instructions", | 695 | .description = "Support ARM v8.8a instructions", |
| 696 | .dependencies = featureSet(&[_]Feature{ | 696 | .dependencies = featureSet(&[_]Feature{ |
| 697 | .has_v8_7a, | 697 | .has_v8_7a, |
| 698 | }), | 698 | }), |
| 699 | }; | 699 | }; |
| 700 | result[@enumToInt(Feature.has_v8_9a)] = .{ | 700 | result[@intFromEnum(Feature.has_v8_9a)] = .{ |
| 701 | .llvm_name = "v8.9a", | 701 | .llvm_name = "v8.9a", |
| 702 | .description = "Support ARM v8.9a instructions", | 702 | .description = "Support ARM v8.9a instructions", |
| 703 | .dependencies = featureSet(&[_]Feature{ | 703 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -705,21 +705,21 @@ pub const all_features = blk: { | ... | @@ -705,21 +705,21 @@ pub const all_features = blk: { |
| 705 | .has_v8_8a, | 705 | .has_v8_8a, |
| 706 | }), | 706 | }), |
| 707 | }; | 707 | }; |
| 708 | result[@enumToInt(Feature.has_v8m)] = .{ | 708 | result[@intFromEnum(Feature.has_v8m)] = .{ |
| 709 | .llvm_name = "v8m", | 709 | .llvm_name = "v8m", |
| 710 | .description = "Support ARM v8M Baseline instructions", | 710 | .description = "Support ARM v8M Baseline instructions", |
| 711 | .dependencies = featureSet(&[_]Feature{ | 711 | .dependencies = featureSet(&[_]Feature{ |
| 712 | .has_v6m, | 712 | .has_v6m, |
| 713 | }), | 713 | }), |
| 714 | }; | 714 | }; |
| 715 | result[@enumToInt(Feature.has_v8m_main)] = .{ | 715 | result[@intFromEnum(Feature.has_v8m_main)] = .{ |
| 716 | .llvm_name = "v8m.main", | 716 | .llvm_name = "v8m.main", |
| 717 | .description = "Support ARM v8M Mainline instructions", | 717 | .description = "Support ARM v8M Mainline instructions", |
| 718 | .dependencies = featureSet(&[_]Feature{ | 718 | .dependencies = featureSet(&[_]Feature{ |
| 719 | .has_v7, | 719 | .has_v7, |
| 720 | }), | 720 | }), |
| 721 | }; | 721 | }; |
| 722 | result[@enumToInt(Feature.has_v9_1a)] = .{ | 722 | result[@intFromEnum(Feature.has_v9_1a)] = .{ |
| 723 | .llvm_name = "v9.1a", | 723 | .llvm_name = "v9.1a", |
| 724 | .description = "Support ARM v9.1a instructions", | 724 | .description = "Support ARM v9.1a instructions", |
| 725 | .dependencies = featureSet(&[_]Feature{ | 725 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -727,7 +727,7 @@ pub const all_features = blk: { | ... | @@ -727,7 +727,7 @@ pub const all_features = blk: { |
| 727 | .has_v9a, | 727 | .has_v9a, |
| 728 | }), | 728 | }), |
| 729 | }; | 729 | }; |
| 730 | result[@enumToInt(Feature.has_v9_2a)] = .{ | 730 | result[@intFromEnum(Feature.has_v9_2a)] = .{ |
| 731 | .llvm_name = "v9.2a", | 731 | .llvm_name = "v9.2a", |
| 732 | .description = "Support ARM v9.2a instructions", | 732 | .description = "Support ARM v9.2a instructions", |
| 733 | .dependencies = featureSet(&[_]Feature{ | 733 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -735,7 +735,7 @@ pub const all_features = blk: { | ... | @@ -735,7 +735,7 @@ pub const all_features = blk: { |
| 735 | .has_v9_1a, | 735 | .has_v9_1a, |
| 736 | }), | 736 | }), |
| 737 | }; | 737 | }; |
| 738 | result[@enumToInt(Feature.has_v9_3a)] = .{ | 738 | result[@intFromEnum(Feature.has_v9_3a)] = .{ |
| 739 | .llvm_name = "v9.3a", | 739 | .llvm_name = "v9.3a", |
| 740 | .description = "Support ARM v9.3a instructions", | 740 | .description = "Support ARM v9.3a instructions", |
| 741 | .dependencies = featureSet(&[_]Feature{ | 741 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -743,7 +743,7 @@ pub const all_features = blk: { | ... | @@ -743,7 +743,7 @@ pub const all_features = blk: { |
| 743 | .has_v9_2a, | 743 | .has_v9_2a, |
| 744 | }), | 744 | }), |
| 745 | }; | 745 | }; |
| 746 | result[@enumToInt(Feature.has_v9_4a)] = .{ | 746 | result[@intFromEnum(Feature.has_v9_4a)] = .{ |
| 747 | .llvm_name = "v9.4a", | 747 | .llvm_name = "v9.4a", |
| 748 | .description = "Support ARM v9.4a instructions", | 748 | .description = "Support ARM v9.4a instructions", |
| 749 | .dependencies = featureSet(&[_]Feature{ | 749 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -751,80 +751,80 @@ pub const all_features = blk: { | ... | @@ -751,80 +751,80 @@ pub const all_features = blk: { |
| 751 | .has_v9_3a, | 751 | .has_v9_3a, |
| 752 | }), | 752 | }), |
| 753 | }; | 753 | }; |
| 754 | result[@enumToInt(Feature.has_v9a)] = .{ | 754 | result[@intFromEnum(Feature.has_v9a)] = .{ |
| 755 | .llvm_name = "v9a", | 755 | .llvm_name = "v9a", |
| 756 | .description = "Support ARM v9a instructions", | 756 | .description = "Support ARM v9a instructions", |
| 757 | .dependencies = featureSet(&[_]Feature{ | 757 | .dependencies = featureSet(&[_]Feature{ |
| 758 | .has_v8_5a, | 758 | .has_v8_5a, |
| 759 | }), | 759 | }), |
| 760 | }; | 760 | }; |
| 761 | result[@enumToInt(Feature.hwdiv)] = .{ | 761 | result[@intFromEnum(Feature.hwdiv)] = .{ |
| 762 | .llvm_name = "hwdiv", | 762 | .llvm_name = "hwdiv", |
| 763 | .description = "Enable divide instructions in Thumb", | 763 | .description = "Enable divide instructions in Thumb", |
| 764 | .dependencies = featureSet(&[_]Feature{}), | 764 | .dependencies = featureSet(&[_]Feature{}), |
| 765 | }; | 765 | }; |
| 766 | result[@enumToInt(Feature.hwdiv_arm)] = .{ | 766 | result[@intFromEnum(Feature.hwdiv_arm)] = .{ |
| 767 | .llvm_name = "hwdiv-arm", | 767 | .llvm_name = "hwdiv-arm", |
| 768 | .description = "Enable divide instructions in ARM mode", | 768 | .description = "Enable divide instructions in ARM mode", |
| 769 | .dependencies = featureSet(&[_]Feature{}), | 769 | .dependencies = featureSet(&[_]Feature{}), |
| 770 | }; | 770 | }; |
| 771 | result[@enumToInt(Feature.i8mm)] = .{ | 771 | result[@intFromEnum(Feature.i8mm)] = .{ |
| 772 | .llvm_name = "i8mm", | 772 | .llvm_name = "i8mm", |
| 773 | .description = "Enable Matrix Multiply Int8 Extension", | 773 | .description = "Enable Matrix Multiply Int8 Extension", |
| 774 | .dependencies = featureSet(&[_]Feature{ | 774 | .dependencies = featureSet(&[_]Feature{ |
| 775 | .neon, | 775 | .neon, |
| 776 | }), | 776 | }), |
| 777 | }; | 777 | }; |
| 778 | result[@enumToInt(Feature.iwmmxt)] = .{ | 778 | result[@intFromEnum(Feature.iwmmxt)] = .{ |
| 779 | .llvm_name = "iwmmxt", | 779 | .llvm_name = "iwmmxt", |
| 780 | .description = "ARMv5te architecture", | 780 | .description = "ARMv5te architecture", |
| 781 | .dependencies = featureSet(&[_]Feature{ | 781 | .dependencies = featureSet(&[_]Feature{ |
| 782 | .v5te, | 782 | .v5te, |
| 783 | }), | 783 | }), |
| 784 | }; | 784 | }; |
| 785 | result[@enumToInt(Feature.iwmmxt2)] = .{ | 785 | result[@intFromEnum(Feature.iwmmxt2)] = .{ |
| 786 | .llvm_name = "iwmmxt2", | 786 | .llvm_name = "iwmmxt2", |
| 787 | .description = "ARMv5te architecture", | 787 | .description = "ARMv5te architecture", |
| 788 | .dependencies = featureSet(&[_]Feature{ | 788 | .dependencies = featureSet(&[_]Feature{ |
| 789 | .v5te, | 789 | .v5te, |
| 790 | }), | 790 | }), |
| 791 | }; | 791 | }; |
| 792 | result[@enumToInt(Feature.lob)] = .{ | 792 | result[@intFromEnum(Feature.lob)] = .{ |
| 793 | .llvm_name = "lob", | 793 | .llvm_name = "lob", |
| 794 | .description = "Enable Low Overhead Branch extensions", | 794 | .description = "Enable Low Overhead Branch extensions", |
| 795 | .dependencies = featureSet(&[_]Feature{}), | 795 | .dependencies = featureSet(&[_]Feature{}), |
| 796 | }; | 796 | }; |
| 797 | result[@enumToInt(Feature.long_calls)] = .{ | 797 | result[@intFromEnum(Feature.long_calls)] = .{ |
| 798 | .llvm_name = "long-calls", | 798 | .llvm_name = "long-calls", |
| 799 | .description = "Generate calls via indirect call instructions", | 799 | .description = "Generate calls via indirect call instructions", |
| 800 | .dependencies = featureSet(&[_]Feature{}), | 800 | .dependencies = featureSet(&[_]Feature{}), |
| 801 | }; | 801 | }; |
| 802 | result[@enumToInt(Feature.loop_align)] = .{ | 802 | result[@intFromEnum(Feature.loop_align)] = .{ |
| 803 | .llvm_name = "loop-align", | 803 | .llvm_name = "loop-align", |
| 804 | .description = "Prefer 32-bit alignment for loops", | 804 | .description = "Prefer 32-bit alignment for loops", |
| 805 | .dependencies = featureSet(&[_]Feature{}), | 805 | .dependencies = featureSet(&[_]Feature{}), |
| 806 | }; | 806 | }; |
| 807 | result[@enumToInt(Feature.m3)] = .{ | 807 | result[@intFromEnum(Feature.m3)] = .{ |
| 808 | .llvm_name = "m3", | 808 | .llvm_name = "m3", |
| 809 | .description = "Cortex-M3 ARM processors", | 809 | .description = "Cortex-M3 ARM processors", |
| 810 | .dependencies = featureSet(&[_]Feature{}), | 810 | .dependencies = featureSet(&[_]Feature{}), |
| 811 | }; | 811 | }; |
| 812 | result[@enumToInt(Feature.mclass)] = .{ | 812 | result[@intFromEnum(Feature.mclass)] = .{ |
| 813 | .llvm_name = "mclass", | 813 | .llvm_name = "mclass", |
| 814 | .description = "Is microcontroller profile ('M' series)", | 814 | .description = "Is microcontroller profile ('M' series)", |
| 815 | .dependencies = featureSet(&[_]Feature{}), | 815 | .dependencies = featureSet(&[_]Feature{}), |
| 816 | }; | 816 | }; |
| 817 | result[@enumToInt(Feature.mp)] = .{ | 817 | result[@intFromEnum(Feature.mp)] = .{ |
| 818 | .llvm_name = "mp", | 818 | .llvm_name = "mp", |
| 819 | .description = "Supports Multiprocessing extension", | 819 | .description = "Supports Multiprocessing extension", |
| 820 | .dependencies = featureSet(&[_]Feature{}), | 820 | .dependencies = featureSet(&[_]Feature{}), |
| 821 | }; | 821 | }; |
| 822 | result[@enumToInt(Feature.muxed_units)] = .{ | 822 | result[@intFromEnum(Feature.muxed_units)] = .{ |
| 823 | .llvm_name = "muxed-units", | 823 | .llvm_name = "muxed-units", |
| 824 | .description = "Has muxed AGU and NEON/FPU", | 824 | .description = "Has muxed AGU and NEON/FPU", |
| 825 | .dependencies = featureSet(&[_]Feature{}), | 825 | .dependencies = featureSet(&[_]Feature{}), |
| 826 | }; | 826 | }; |
| 827 | result[@enumToInt(Feature.mve)] = .{ | 827 | result[@intFromEnum(Feature.mve)] = .{ |
| 828 | .llvm_name = "mve", | 828 | .llvm_name = "mve", |
| 829 | .description = "Support M-Class Vector Extension with integer ops", | 829 | .description = "Support M-Class Vector Extension with integer ops", |
| 830 | .dependencies = featureSet(&[_]Feature{ | 830 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -834,22 +834,22 @@ pub const all_features = blk: { | ... | @@ -834,22 +834,22 @@ pub const all_features = blk: { |
| 834 | .has_v8_1m_main, | 834 | .has_v8_1m_main, |
| 835 | }), | 835 | }), |
| 836 | }; | 836 | }; |
| 837 | result[@enumToInt(Feature.mve1beat)] = .{ | 837 | result[@intFromEnum(Feature.mve1beat)] = .{ |
| 838 | .llvm_name = "mve1beat", | 838 | .llvm_name = "mve1beat", |
| 839 | .description = "Model MVE instructions as a 1 beat per tick architecture", | 839 | .description = "Model MVE instructions as a 1 beat per tick architecture", |
| 840 | .dependencies = featureSet(&[_]Feature{}), | 840 | .dependencies = featureSet(&[_]Feature{}), |
| 841 | }; | 841 | }; |
| 842 | result[@enumToInt(Feature.mve2beat)] = .{ | 842 | result[@intFromEnum(Feature.mve2beat)] = .{ |
| 843 | .llvm_name = "mve2beat", | 843 | .llvm_name = "mve2beat", |
| 844 | .description = "Model MVE instructions as a 2 beats per tick architecture", | 844 | .description = "Model MVE instructions as a 2 beats per tick architecture", |
| 845 | .dependencies = featureSet(&[_]Feature{}), | 845 | .dependencies = featureSet(&[_]Feature{}), |
| 846 | }; | 846 | }; |
| 847 | result[@enumToInt(Feature.mve4beat)] = .{ | 847 | result[@intFromEnum(Feature.mve4beat)] = .{ |
| 848 | .llvm_name = "mve4beat", | 848 | .llvm_name = "mve4beat", |
| 849 | .description = "Model MVE instructions as a 4 beats per tick architecture", | 849 | .description = "Model MVE instructions as a 4 beats per tick architecture", |
| 850 | .dependencies = featureSet(&[_]Feature{}), | 850 | .dependencies = featureSet(&[_]Feature{}), |
| 851 | }; | 851 | }; |
| 852 | result[@enumToInt(Feature.mve_fp)] = .{ | 852 | result[@intFromEnum(Feature.mve_fp)] = .{ |
| 853 | .llvm_name = "mve.fp", | 853 | .llvm_name = "mve.fp", |
| 854 | .description = "Support M-Class Vector Extension with integer and floating ops", | 854 | .description = "Support M-Class Vector Extension with integer and floating ops", |
| 855 | .dependencies = featureSet(&[_]Feature{ | 855 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -857,243 +857,243 @@ pub const all_features = blk: { | ... | @@ -857,243 +857,243 @@ pub const all_features = blk: { |
| 857 | .mve, | 857 | .mve, |
| 858 | }), | 858 | }), |
| 859 | }; | 859 | }; |
| 860 | result[@enumToInt(Feature.nacl_trap)] = .{ | 860 | result[@intFromEnum(Feature.nacl_trap)] = .{ |
| 861 | .llvm_name = "nacl-trap", | 861 | .llvm_name = "nacl-trap", |
| 862 | .description = "NaCl trap", | 862 | .description = "NaCl trap", |
| 863 | .dependencies = featureSet(&[_]Feature{}), | 863 | .dependencies = featureSet(&[_]Feature{}), |
| 864 | }; | 864 | }; |
| 865 | result[@enumToInt(Feature.neon)] = .{ | 865 | result[@intFromEnum(Feature.neon)] = .{ |
| 866 | .llvm_name = "neon", | 866 | .llvm_name = "neon", |
| 867 | .description = "Enable NEON instructions", | 867 | .description = "Enable NEON instructions", |
| 868 | .dependencies = featureSet(&[_]Feature{ | 868 | .dependencies = featureSet(&[_]Feature{ |
| 869 | .vfp3, | 869 | .vfp3, |
| 870 | }), | 870 | }), |
| 871 | }; | 871 | }; |
| 872 | result[@enumToInt(Feature.neon_fpmovs)] = .{ | 872 | result[@intFromEnum(Feature.neon_fpmovs)] = .{ |
| 873 | .llvm_name = "neon-fpmovs", | 873 | .llvm_name = "neon-fpmovs", |
| 874 | .description = "Convert VMOVSR, VMOVRS, VMOVS to NEON", | 874 | .description = "Convert VMOVSR, VMOVRS, VMOVS to NEON", |
| 875 | .dependencies = featureSet(&[_]Feature{}), | 875 | .dependencies = featureSet(&[_]Feature{}), |
| 876 | }; | 876 | }; |
| 877 | result[@enumToInt(Feature.neonfp)] = .{ | 877 | result[@intFromEnum(Feature.neonfp)] = .{ |
| 878 | .llvm_name = "neonfp", | 878 | .llvm_name = "neonfp", |
| 879 | .description = "Use NEON for single precision FP", | 879 | .description = "Use NEON for single precision FP", |
| 880 | .dependencies = featureSet(&[_]Feature{}), | 880 | .dependencies = featureSet(&[_]Feature{}), |
| 881 | }; | 881 | }; |
| 882 | result[@enumToInt(Feature.no_branch_predictor)] = .{ | 882 | result[@intFromEnum(Feature.no_branch_predictor)] = .{ |
| 883 | .llvm_name = "no-branch-predictor", | 883 | .llvm_name = "no-branch-predictor", |
| 884 | .description = "Has no branch predictor", | 884 | .description = "Has no branch predictor", |
| 885 | .dependencies = featureSet(&[_]Feature{}), | 885 | .dependencies = featureSet(&[_]Feature{}), |
| 886 | }; | 886 | }; |
| 887 | result[@enumToInt(Feature.no_bti_at_return_twice)] = .{ | 887 | result[@intFromEnum(Feature.no_bti_at_return_twice)] = .{ |
| 888 | .llvm_name = "no-bti-at-return-twice", | 888 | .llvm_name = "no-bti-at-return-twice", |
| 889 | .description = "Don't place a BTI instruction after a return-twice", | 889 | .description = "Don't place a BTI instruction after a return-twice", |
| 890 | .dependencies = featureSet(&[_]Feature{}), | 890 | .dependencies = featureSet(&[_]Feature{}), |
| 891 | }; | 891 | }; |
| 892 | result[@enumToInt(Feature.no_movt)] = .{ | 892 | result[@intFromEnum(Feature.no_movt)] = .{ |
| 893 | .llvm_name = "no-movt", | 893 | .llvm_name = "no-movt", |
| 894 | .description = "Don't use movt/movw pairs for 32-bit imms", | 894 | .description = "Don't use movt/movw pairs for 32-bit imms", |
| 895 | .dependencies = featureSet(&[_]Feature{}), | 895 | .dependencies = featureSet(&[_]Feature{}), |
| 896 | }; | 896 | }; |
| 897 | result[@enumToInt(Feature.no_neg_immediates)] = .{ | 897 | result[@intFromEnum(Feature.no_neg_immediates)] = .{ |
| 898 | .llvm_name = "no-neg-immediates", | 898 | .llvm_name = "no-neg-immediates", |
| 899 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", | 899 | .description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.", |
| 900 | .dependencies = featureSet(&[_]Feature{}), | 900 | .dependencies = featureSet(&[_]Feature{}), |
| 901 | }; | 901 | }; |
| 902 | result[@enumToInt(Feature.noarm)] = .{ | 902 | result[@intFromEnum(Feature.noarm)] = .{ |
| 903 | .llvm_name = "noarm", | 903 | .llvm_name = "noarm", |
| 904 | .description = "Does not support ARM mode execution", | 904 | .description = "Does not support ARM mode execution", |
| 905 | .dependencies = featureSet(&[_]Feature{}), | 905 | .dependencies = featureSet(&[_]Feature{}), |
| 906 | }; | 906 | }; |
| 907 | result[@enumToInt(Feature.nonpipelined_vfp)] = .{ | 907 | result[@intFromEnum(Feature.nonpipelined_vfp)] = .{ |
| 908 | .llvm_name = "nonpipelined-vfp", | 908 | .llvm_name = "nonpipelined-vfp", |
| 909 | .description = "VFP instructions are not pipelined", | 909 | .description = "VFP instructions are not pipelined", |
| 910 | .dependencies = featureSet(&[_]Feature{}), | 910 | .dependencies = featureSet(&[_]Feature{}), |
| 911 | }; | 911 | }; |
| 912 | result[@enumToInt(Feature.pacbti)] = .{ | 912 | result[@intFromEnum(Feature.pacbti)] = .{ |
| 913 | .llvm_name = "pacbti", | 913 | .llvm_name = "pacbti", |
| 914 | .description = "Enable Pointer Authentication and Branch Target Identification", | 914 | .description = "Enable Pointer Authentication and Branch Target Identification", |
| 915 | .dependencies = featureSet(&[_]Feature{}), | 915 | .dependencies = featureSet(&[_]Feature{}), |
| 916 | }; | 916 | }; |
| 917 | result[@enumToInt(Feature.perfmon)] = .{ | 917 | result[@intFromEnum(Feature.perfmon)] = .{ |
| 918 | .llvm_name = "perfmon", | 918 | .llvm_name = "perfmon", |
| 919 | .description = "Enable support for Performance Monitor extensions", | 919 | .description = "Enable support for Performance Monitor extensions", |
| 920 | .dependencies = featureSet(&[_]Feature{}), | 920 | .dependencies = featureSet(&[_]Feature{}), |
| 921 | }; | 921 | }; |
| 922 | result[@enumToInt(Feature.prefer_ishst)] = .{ | 922 | result[@intFromEnum(Feature.prefer_ishst)] = .{ |
| 923 | .llvm_name = "prefer-ishst", | 923 | .llvm_name = "prefer-ishst", |
| 924 | .description = "Prefer ISHST barriers", | 924 | .description = "Prefer ISHST barriers", |
| 925 | .dependencies = featureSet(&[_]Feature{}), | 925 | .dependencies = featureSet(&[_]Feature{}), |
| 926 | }; | 926 | }; |
| 927 | result[@enumToInt(Feature.prefer_vmovsr)] = .{ | 927 | result[@intFromEnum(Feature.prefer_vmovsr)] = .{ |
| 928 | .llvm_name = "prefer-vmovsr", | 928 | .llvm_name = "prefer-vmovsr", |
| 929 | .description = "Prefer VMOVSR", | 929 | .description = "Prefer VMOVSR", |
| 930 | .dependencies = featureSet(&[_]Feature{}), | 930 | .dependencies = featureSet(&[_]Feature{}), |
| 931 | }; | 931 | }; |
| 932 | result[@enumToInt(Feature.prof_unpr)] = .{ | 932 | result[@intFromEnum(Feature.prof_unpr)] = .{ |
| 933 | .llvm_name = "prof-unpr", | 933 | .llvm_name = "prof-unpr", |
| 934 | .description = "Is profitable to unpredicate", | 934 | .description = "Is profitable to unpredicate", |
| 935 | .dependencies = featureSet(&[_]Feature{}), | 935 | .dependencies = featureSet(&[_]Feature{}), |
| 936 | }; | 936 | }; |
| 937 | result[@enumToInt(Feature.r4)] = .{ | 937 | result[@intFromEnum(Feature.r4)] = .{ |
| 938 | .llvm_name = "r4", | 938 | .llvm_name = "r4", |
| 939 | .description = "Cortex-R4 ARM processors", | 939 | .description = "Cortex-R4 ARM processors", |
| 940 | .dependencies = featureSet(&[_]Feature{}), | 940 | .dependencies = featureSet(&[_]Feature{}), |
| 941 | }; | 941 | }; |
| 942 | result[@enumToInt(Feature.ras)] = .{ | 942 | result[@intFromEnum(Feature.ras)] = .{ |
| 943 | .llvm_name = "ras", | 943 | .llvm_name = "ras", |
| 944 | .description = "Enable Reliability, Availability and Serviceability extensions", | 944 | .description = "Enable Reliability, Availability and Serviceability extensions", |
| 945 | .dependencies = featureSet(&[_]Feature{}), | 945 | .dependencies = featureSet(&[_]Feature{}), |
| 946 | }; | 946 | }; |
| 947 | result[@enumToInt(Feature.rclass)] = .{ | 947 | result[@intFromEnum(Feature.rclass)] = .{ |
| 948 | .llvm_name = "rclass", | 948 | .llvm_name = "rclass", |
| 949 | .description = "Is realtime profile ('R' series)", | 949 | .description = "Is realtime profile ('R' series)", |
| 950 | .dependencies = featureSet(&[_]Feature{}), | 950 | .dependencies = featureSet(&[_]Feature{}), |
| 951 | }; | 951 | }; |
| 952 | result[@enumToInt(Feature.read_tp_hard)] = .{ | 952 | result[@intFromEnum(Feature.read_tp_hard)] = .{ |
| 953 | .llvm_name = "read-tp-hard", | 953 | .llvm_name = "read-tp-hard", |
| 954 | .description = "Reading thread pointer from register", | 954 | .description = "Reading thread pointer from register", |
| 955 | .dependencies = featureSet(&[_]Feature{}), | 955 | .dependencies = featureSet(&[_]Feature{}), |
| 956 | }; | 956 | }; |
| 957 | result[@enumToInt(Feature.reserve_r9)] = .{ | 957 | result[@intFromEnum(Feature.reserve_r9)] = .{ |
| 958 | .llvm_name = "reserve-r9", | 958 | .llvm_name = "reserve-r9", |
| 959 | .description = "Reserve R9, making it unavailable as GPR", | 959 | .description = "Reserve R9, making it unavailable as GPR", |
| 960 | .dependencies = featureSet(&[_]Feature{}), | 960 | .dependencies = featureSet(&[_]Feature{}), |
| 961 | }; | 961 | }; |
| 962 | result[@enumToInt(Feature.ret_addr_stack)] = .{ | 962 | result[@intFromEnum(Feature.ret_addr_stack)] = .{ |
| 963 | .llvm_name = "ret-addr-stack", | 963 | .llvm_name = "ret-addr-stack", |
| 964 | .description = "Has return address stack", | 964 | .description = "Has return address stack", |
| 965 | .dependencies = featureSet(&[_]Feature{}), | 965 | .dependencies = featureSet(&[_]Feature{}), |
| 966 | }; | 966 | }; |
| 967 | result[@enumToInt(Feature.sb)] = .{ | 967 | result[@intFromEnum(Feature.sb)] = .{ |
| 968 | .llvm_name = "sb", | 968 | .llvm_name = "sb", |
| 969 | .description = "Enable v8.5a Speculation Barrier", | 969 | .description = "Enable v8.5a Speculation Barrier", |
| 970 | .dependencies = featureSet(&[_]Feature{}), | 970 | .dependencies = featureSet(&[_]Feature{}), |
| 971 | }; | 971 | }; |
| 972 | result[@enumToInt(Feature.sha2)] = .{ | 972 | result[@intFromEnum(Feature.sha2)] = .{ |
| 973 | .llvm_name = "sha2", | 973 | .llvm_name = "sha2", |
| 974 | .description = "Enable SHA1 and SHA256 support", | 974 | .description = "Enable SHA1 and SHA256 support", |
| 975 | .dependencies = featureSet(&[_]Feature{ | 975 | .dependencies = featureSet(&[_]Feature{ |
| 976 | .neon, | 976 | .neon, |
| 977 | }), | 977 | }), |
| 978 | }; | 978 | }; |
| 979 | result[@enumToInt(Feature.slow_fp_brcc)] = .{ | 979 | result[@intFromEnum(Feature.slow_fp_brcc)] = .{ |
| 980 | .llvm_name = "slow-fp-brcc", | 980 | .llvm_name = "slow-fp-brcc", |
| 981 | .description = "FP compare + branch is slow", | 981 | .description = "FP compare + branch is slow", |
| 982 | .dependencies = featureSet(&[_]Feature{}), | 982 | .dependencies = featureSet(&[_]Feature{}), |
| 983 | }; | 983 | }; |
| 984 | result[@enumToInt(Feature.slow_load_D_subreg)] = .{ | 984 | result[@intFromEnum(Feature.slow_load_D_subreg)] = .{ |
| 985 | .llvm_name = "slow-load-D-subreg", | 985 | .llvm_name = "slow-load-D-subreg", |
| 986 | .description = "Loading into D subregs is slow", | 986 | .description = "Loading into D subregs is slow", |
| 987 | .dependencies = featureSet(&[_]Feature{}), | 987 | .dependencies = featureSet(&[_]Feature{}), |
| 988 | }; | 988 | }; |
| 989 | result[@enumToInt(Feature.slow_odd_reg)] = .{ | 989 | result[@intFromEnum(Feature.slow_odd_reg)] = .{ |
| 990 | .llvm_name = "slow-odd-reg", | 990 | .llvm_name = "slow-odd-reg", |
| 991 | .description = "VLDM/VSTM starting with an odd register is slow", | 991 | .description = "VLDM/VSTM starting with an odd register is slow", |
| 992 | .dependencies = featureSet(&[_]Feature{}), | 992 | .dependencies = featureSet(&[_]Feature{}), |
| 993 | }; | 993 | }; |
| 994 | result[@enumToInt(Feature.slow_vdup32)] = .{ | 994 | result[@intFromEnum(Feature.slow_vdup32)] = .{ |
| 995 | .llvm_name = "slow-vdup32", | 995 | .llvm_name = "slow-vdup32", |
| 996 | .description = "Has slow VDUP32 - prefer VMOV", | 996 | .description = "Has slow VDUP32 - prefer VMOV", |
| 997 | .dependencies = featureSet(&[_]Feature{}), | 997 | .dependencies = featureSet(&[_]Feature{}), |
| 998 | }; | 998 | }; |
| 999 | result[@enumToInt(Feature.slow_vgetlni32)] = .{ | 999 | result[@intFromEnum(Feature.slow_vgetlni32)] = .{ |
| 1000 | .llvm_name = "slow-vgetlni32", | 1000 | .llvm_name = "slow-vgetlni32", |
| 1001 | .description = "Has slow VGETLNi32 - prefer VMOV", | 1001 | .description = "Has slow VGETLNi32 - prefer VMOV", |
| 1002 | .dependencies = featureSet(&[_]Feature{}), | 1002 | .dependencies = featureSet(&[_]Feature{}), |
| 1003 | }; | 1003 | }; |
| 1004 | result[@enumToInt(Feature.slowfpvfmx)] = .{ | 1004 | result[@intFromEnum(Feature.slowfpvfmx)] = .{ |
| 1005 | .llvm_name = "slowfpvfmx", | 1005 | .llvm_name = "slowfpvfmx", |
| 1006 | .description = "Disable VFP / NEON FMA instructions", | 1006 | .description = "Disable VFP / NEON FMA instructions", |
| 1007 | .dependencies = featureSet(&[_]Feature{}), | 1007 | .dependencies = featureSet(&[_]Feature{}), |
| 1008 | }; | 1008 | }; |
| 1009 | result[@enumToInt(Feature.slowfpvmlx)] = .{ | 1009 | result[@intFromEnum(Feature.slowfpvmlx)] = .{ |
| 1010 | .llvm_name = "slowfpvmlx", | 1010 | .llvm_name = "slowfpvmlx", |
| 1011 | .description = "Disable VFP / NEON MAC instructions", | 1011 | .description = "Disable VFP / NEON MAC instructions", |
| 1012 | .dependencies = featureSet(&[_]Feature{}), | 1012 | .dependencies = featureSet(&[_]Feature{}), |
| 1013 | }; | 1013 | }; |
| 1014 | result[@enumToInt(Feature.soft_float)] = .{ | 1014 | result[@intFromEnum(Feature.soft_float)] = .{ |
| 1015 | .llvm_name = "soft-float", | 1015 | .llvm_name = "soft-float", |
| 1016 | .description = "Use software floating point features.", | 1016 | .description = "Use software floating point features.", |
| 1017 | .dependencies = featureSet(&[_]Feature{}), | 1017 | .dependencies = featureSet(&[_]Feature{}), |
| 1018 | }; | 1018 | }; |
| 1019 | result[@enumToInt(Feature.splat_vfp_neon)] = .{ | 1019 | result[@intFromEnum(Feature.splat_vfp_neon)] = .{ |
| 1020 | .llvm_name = "splat-vfp-neon", | 1020 | .llvm_name = "splat-vfp-neon", |
| 1021 | .description = "Splat register from VFP to NEON", | 1021 | .description = "Splat register from VFP to NEON", |
| 1022 | .dependencies = featureSet(&[_]Feature{ | 1022 | .dependencies = featureSet(&[_]Feature{ |
| 1023 | .dont_widen_vmovs, | 1023 | .dont_widen_vmovs, |
| 1024 | }), | 1024 | }), |
| 1025 | }; | 1025 | }; |
| 1026 | result[@enumToInt(Feature.strict_align)] = .{ | 1026 | result[@intFromEnum(Feature.strict_align)] = .{ |
| 1027 | .llvm_name = "strict-align", | 1027 | .llvm_name = "strict-align", |
| 1028 | .description = "Disallow all unaligned memory access", | 1028 | .description = "Disallow all unaligned memory access", |
| 1029 | .dependencies = featureSet(&[_]Feature{}), | 1029 | .dependencies = featureSet(&[_]Feature{}), |
| 1030 | }; | 1030 | }; |
| 1031 | result[@enumToInt(Feature.swift)] = .{ | 1031 | result[@intFromEnum(Feature.swift)] = .{ |
| 1032 | .llvm_name = "swift", | 1032 | .llvm_name = "swift", |
| 1033 | .description = "Swift ARM processors", | 1033 | .description = "Swift ARM processors", |
| 1034 | .dependencies = featureSet(&[_]Feature{}), | 1034 | .dependencies = featureSet(&[_]Feature{}), |
| 1035 | }; | 1035 | }; |
| 1036 | result[@enumToInt(Feature.thumb2)] = .{ | 1036 | result[@intFromEnum(Feature.thumb2)] = .{ |
| 1037 | .llvm_name = "thumb2", | 1037 | .llvm_name = "thumb2", |
| 1038 | .description = "Enable Thumb2 instructions", | 1038 | .description = "Enable Thumb2 instructions", |
| 1039 | .dependencies = featureSet(&[_]Feature{}), | 1039 | .dependencies = featureSet(&[_]Feature{}), |
| 1040 | }; | 1040 | }; |
| 1041 | result[@enumToInt(Feature.thumb_mode)] = .{ | 1041 | result[@intFromEnum(Feature.thumb_mode)] = .{ |
| 1042 | .llvm_name = "thumb-mode", | 1042 | .llvm_name = "thumb-mode", |
| 1043 | .description = "Thumb mode", | 1043 | .description = "Thumb mode", |
| 1044 | .dependencies = featureSet(&[_]Feature{}), | 1044 | .dependencies = featureSet(&[_]Feature{}), |
| 1045 | }; | 1045 | }; |
| 1046 | result[@enumToInt(Feature.trustzone)] = .{ | 1046 | result[@intFromEnum(Feature.trustzone)] = .{ |
| 1047 | .llvm_name = "trustzone", | 1047 | .llvm_name = "trustzone", |
| 1048 | .description = "Enable support for TrustZone security extensions", | 1048 | .description = "Enable support for TrustZone security extensions", |
| 1049 | .dependencies = featureSet(&[_]Feature{}), | 1049 | .dependencies = featureSet(&[_]Feature{}), |
| 1050 | }; | 1050 | }; |
| 1051 | result[@enumToInt(Feature.use_mipipeliner)] = .{ | 1051 | result[@intFromEnum(Feature.use_mipipeliner)] = .{ |
| 1052 | .llvm_name = "use-mipipeliner", | 1052 | .llvm_name = "use-mipipeliner", |
| 1053 | .description = "Use the MachinePipeliner", | 1053 | .description = "Use the MachinePipeliner", |
| 1054 | .dependencies = featureSet(&[_]Feature{}), | 1054 | .dependencies = featureSet(&[_]Feature{}), |
| 1055 | }; | 1055 | }; |
| 1056 | result[@enumToInt(Feature.use_misched)] = .{ | 1056 | result[@intFromEnum(Feature.use_misched)] = .{ |
| 1057 | .llvm_name = "use-misched", | 1057 | .llvm_name = "use-misched", |
| 1058 | .description = "Use the MachineScheduler", | 1058 | .description = "Use the MachineScheduler", |
| 1059 | .dependencies = featureSet(&[_]Feature{}), | 1059 | .dependencies = featureSet(&[_]Feature{}), |
| 1060 | }; | 1060 | }; |
| 1061 | result[@enumToInt(Feature.v2)] = .{ | 1061 | result[@intFromEnum(Feature.v2)] = .{ |
| 1062 | .llvm_name = null, | 1062 | .llvm_name = null, |
| 1063 | .description = "ARMv2 architecture", | 1063 | .description = "ARMv2 architecture", |
| 1064 | .dependencies = featureSet(&[_]Feature{ | 1064 | .dependencies = featureSet(&[_]Feature{ |
| 1065 | .strict_align, | 1065 | .strict_align, |
| 1066 | }), | 1066 | }), |
| 1067 | }; | 1067 | }; |
| 1068 | result[@enumToInt(Feature.v2a)] = .{ | 1068 | result[@intFromEnum(Feature.v2a)] = .{ |
| 1069 | .llvm_name = null, | 1069 | .llvm_name = null, |
| 1070 | .description = "ARMv2a architecture", | 1070 | .description = "ARMv2a architecture", |
| 1071 | .dependencies = featureSet(&[_]Feature{ | 1071 | .dependencies = featureSet(&[_]Feature{ |
| 1072 | .strict_align, | 1072 | .strict_align, |
| 1073 | }), | 1073 | }), |
| 1074 | }; | 1074 | }; |
| 1075 | result[@enumToInt(Feature.v3)] = .{ | 1075 | result[@intFromEnum(Feature.v3)] = .{ |
| 1076 | .llvm_name = null, | 1076 | .llvm_name = null, |
| 1077 | .description = "ARMv3 architecture", | 1077 | .description = "ARMv3 architecture", |
| 1078 | .dependencies = featureSet(&[_]Feature{ | 1078 | .dependencies = featureSet(&[_]Feature{ |
| 1079 | .strict_align, | 1079 | .strict_align, |
| 1080 | }), | 1080 | }), |
| 1081 | }; | 1081 | }; |
| 1082 | result[@enumToInt(Feature.v3m)] = .{ | 1082 | result[@intFromEnum(Feature.v3m)] = .{ |
| 1083 | .llvm_name = null, | 1083 | .llvm_name = null, |
| 1084 | .description = "ARMv3m architecture", | 1084 | .description = "ARMv3m architecture", |
| 1085 | .dependencies = featureSet(&[_]Feature{ | 1085 | .dependencies = featureSet(&[_]Feature{ |
| 1086 | .strict_align, | 1086 | .strict_align, |
| 1087 | }), | 1087 | }), |
| 1088 | }; | 1088 | }; |
| 1089 | result[@enumToInt(Feature.v4)] = .{ | 1089 | result[@intFromEnum(Feature.v4)] = .{ |
| 1090 | .llvm_name = "armv4", | 1090 | .llvm_name = "armv4", |
| 1091 | .description = "ARMv4 architecture", | 1091 | .description = "ARMv4 architecture", |
| 1092 | .dependencies = featureSet(&[_]Feature{ | 1092 | .dependencies = featureSet(&[_]Feature{ |
| 1093 | .strict_align, | 1093 | .strict_align, |
| 1094 | }), | 1094 | }), |
| 1095 | }; | 1095 | }; |
| 1096 | result[@enumToInt(Feature.v4t)] = .{ | 1096 | result[@intFromEnum(Feature.v4t)] = .{ |
| 1097 | .llvm_name = "armv4t", | 1097 | .llvm_name = "armv4t", |
| 1098 | .description = "ARMv4t architecture", | 1098 | .description = "ARMv4t architecture", |
| 1099 | .dependencies = featureSet(&[_]Feature{ | 1099 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1101,7 +1101,7 @@ pub const all_features = blk: { | ... | @@ -1101,7 +1101,7 @@ pub const all_features = blk: { |
| 1101 | .strict_align, | 1101 | .strict_align, |
| 1102 | }), | 1102 | }), |
| 1103 | }; | 1103 | }; |
| 1104 | result[@enumToInt(Feature.v5t)] = .{ | 1104 | result[@intFromEnum(Feature.v5t)] = .{ |
| 1105 | .llvm_name = "armv5t", | 1105 | .llvm_name = "armv5t", |
| 1106 | .description = "ARMv5t architecture", | 1106 | .description = "ARMv5t architecture", |
| 1107 | .dependencies = featureSet(&[_]Feature{ | 1107 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1109,7 +1109,7 @@ pub const all_features = blk: { | ... | @@ -1109,7 +1109,7 @@ pub const all_features = blk: { |
| 1109 | .strict_align, | 1109 | .strict_align, |
| 1110 | }), | 1110 | }), |
| 1111 | }; | 1111 | }; |
| 1112 | result[@enumToInt(Feature.v5te)] = .{ | 1112 | result[@intFromEnum(Feature.v5te)] = .{ |
| 1113 | .llvm_name = "armv5te", | 1113 | .llvm_name = "armv5te", |
| 1114 | .description = "ARMv5te architecture", | 1114 | .description = "ARMv5te architecture", |
| 1115 | .dependencies = featureSet(&[_]Feature{ | 1115 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1117,7 +1117,7 @@ pub const all_features = blk: { | ... | @@ -1117,7 +1117,7 @@ pub const all_features = blk: { |
| 1117 | .strict_align, | 1117 | .strict_align, |
| 1118 | }), | 1118 | }), |
| 1119 | }; | 1119 | }; |
| 1120 | result[@enumToInt(Feature.v5tej)] = .{ | 1120 | result[@intFromEnum(Feature.v5tej)] = .{ |
| 1121 | .llvm_name = "armv5tej", | 1121 | .llvm_name = "armv5tej", |
| 1122 | .description = "ARMv5tej architecture", | 1122 | .description = "ARMv5tej architecture", |
| 1123 | .dependencies = featureSet(&[_]Feature{ | 1123 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1125,7 +1125,7 @@ pub const all_features = blk: { | ... | @@ -1125,7 +1125,7 @@ pub const all_features = blk: { |
| 1125 | .strict_align, | 1125 | .strict_align, |
| 1126 | }), | 1126 | }), |
| 1127 | }; | 1127 | }; |
| 1128 | result[@enumToInt(Feature.v6)] = .{ | 1128 | result[@intFromEnum(Feature.v6)] = .{ |
| 1129 | .llvm_name = "armv6", | 1129 | .llvm_name = "armv6", |
| 1130 | .description = "ARMv6 architecture", | 1130 | .description = "ARMv6 architecture", |
| 1131 | .dependencies = featureSet(&[_]Feature{ | 1131 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1133,21 +1133,21 @@ pub const all_features = blk: { | ... | @@ -1133,21 +1133,21 @@ pub const all_features = blk: { |
| 1133 | .has_v6, | 1133 | .has_v6, |
| 1134 | }), | 1134 | }), |
| 1135 | }; | 1135 | }; |
| 1136 | result[@enumToInt(Feature.v6j)] = .{ | 1136 | result[@intFromEnum(Feature.v6j)] = .{ |
| 1137 | .llvm_name = "armv6j", | 1137 | .llvm_name = "armv6j", |
| 1138 | .description = "ARMv7a architecture", | 1138 | .description = "ARMv7a architecture", |
| 1139 | .dependencies = featureSet(&[_]Feature{ | 1139 | .dependencies = featureSet(&[_]Feature{ |
| 1140 | .v6, | 1140 | .v6, |
| 1141 | }), | 1141 | }), |
| 1142 | }; | 1142 | }; |
| 1143 | result[@enumToInt(Feature.v6k)] = .{ | 1143 | result[@intFromEnum(Feature.v6k)] = .{ |
| 1144 | .llvm_name = "armv6k", | 1144 | .llvm_name = "armv6k", |
| 1145 | .description = "ARMv6k architecture", | 1145 | .description = "ARMv6k architecture", |
| 1146 | .dependencies = featureSet(&[_]Feature{ | 1146 | .dependencies = featureSet(&[_]Feature{ |
| 1147 | .has_v6k, | 1147 | .has_v6k, |
| 1148 | }), | 1148 | }), |
| 1149 | }; | 1149 | }; |
| 1150 | result[@enumToInt(Feature.v6kz)] = .{ | 1150 | result[@intFromEnum(Feature.v6kz)] = .{ |
| 1151 | .llvm_name = "armv6kz", | 1151 | .llvm_name = "armv6kz", |
| 1152 | .description = "ARMv6kz architecture", | 1152 | .description = "ARMv6kz architecture", |
| 1153 | .dependencies = featureSet(&[_]Feature{ | 1153 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1155,7 +1155,7 @@ pub const all_features = blk: { | ... | @@ -1155,7 +1155,7 @@ pub const all_features = blk: { |
| 1155 | .trustzone, | 1155 | .trustzone, |
| 1156 | }), | 1156 | }), |
| 1157 | }; | 1157 | }; |
| 1158 | result[@enumToInt(Feature.v6m)] = .{ | 1158 | result[@intFromEnum(Feature.v6m)] = .{ |
| 1159 | .llvm_name = "armv6-m", | 1159 | .llvm_name = "armv6-m", |
| 1160 | .description = "ARMv6m architecture", | 1160 | .description = "ARMv6m architecture", |
| 1161 | .dependencies = featureSet(&[_]Feature{ | 1161 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1167,7 +1167,7 @@ pub const all_features = blk: { | ... | @@ -1167,7 +1167,7 @@ pub const all_features = blk: { |
| 1167 | .thumb_mode, | 1167 | .thumb_mode, |
| 1168 | }), | 1168 | }), |
| 1169 | }; | 1169 | }; |
| 1170 | result[@enumToInt(Feature.v6sm)] = .{ | 1170 | result[@intFromEnum(Feature.v6sm)] = .{ |
| 1171 | .llvm_name = "armv6s-m", | 1171 | .llvm_name = "armv6s-m", |
| 1172 | .description = "ARMv6sm architecture", | 1172 | .description = "ARMv6sm architecture", |
| 1173 | .dependencies = featureSet(&[_]Feature{ | 1173 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1179,7 +1179,7 @@ pub const all_features = blk: { | ... | @@ -1179,7 +1179,7 @@ pub const all_features = blk: { |
| 1179 | .thumb_mode, | 1179 | .thumb_mode, |
| 1180 | }), | 1180 | }), |
| 1181 | }; | 1181 | }; |
| 1182 | result[@enumToInt(Feature.v6t2)] = .{ | 1182 | result[@intFromEnum(Feature.v6t2)] = .{ |
| 1183 | .llvm_name = "armv6t2", | 1183 | .llvm_name = "armv6t2", |
| 1184 | .description = "ARMv6t2 architecture", | 1184 | .description = "ARMv6t2 architecture", |
| 1185 | .dependencies = featureSet(&[_]Feature{ | 1185 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1187,7 +1187,7 @@ pub const all_features = blk: { | ... | @@ -1187,7 +1187,7 @@ pub const all_features = blk: { |
| 1187 | .has_v6t2, | 1187 | .has_v6t2, |
| 1188 | }), | 1188 | }), |
| 1189 | }; | 1189 | }; |
| 1190 | result[@enumToInt(Feature.v7a)] = .{ | 1190 | result[@intFromEnum(Feature.v7a)] = .{ |
| 1191 | .llvm_name = "armv7-a", | 1191 | .llvm_name = "armv7-a", |
| 1192 | .description = "ARMv7a architecture", | 1192 | .description = "ARMv7a architecture", |
| 1193 | .dependencies = featureSet(&[_]Feature{ | 1193 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1199,7 +1199,7 @@ pub const all_features = blk: { | ... | @@ -1199,7 +1199,7 @@ pub const all_features = blk: { |
| 1199 | .perfmon, | 1199 | .perfmon, |
| 1200 | }), | 1200 | }), |
| 1201 | }; | 1201 | }; |
| 1202 | result[@enumToInt(Feature.v7em)] = .{ | 1202 | result[@intFromEnum(Feature.v7em)] = .{ |
| 1203 | .llvm_name = "armv7e-m", | 1203 | .llvm_name = "armv7e-m", |
| 1204 | .description = "ARMv7em architecture", | 1204 | .description = "ARMv7em architecture", |
| 1205 | .dependencies = featureSet(&[_]Feature{ | 1205 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1212,14 +1212,14 @@ pub const all_features = blk: { | ... | @@ -1212,14 +1212,14 @@ pub const all_features = blk: { |
| 1212 | .thumb_mode, | 1212 | .thumb_mode, |
| 1213 | }), | 1213 | }), |
| 1214 | }; | 1214 | }; |
| 1215 | result[@enumToInt(Feature.v7k)] = .{ | 1215 | result[@intFromEnum(Feature.v7k)] = .{ |
| 1216 | .llvm_name = "armv7k", | 1216 | .llvm_name = "armv7k", |
| 1217 | .description = "ARMv7a architecture", | 1217 | .description = "ARMv7a architecture", |
| 1218 | .dependencies = featureSet(&[_]Feature{ | 1218 | .dependencies = featureSet(&[_]Feature{ |
| 1219 | .v7a, | 1219 | .v7a, |
| 1220 | }), | 1220 | }), |
| 1221 | }; | 1221 | }; |
| 1222 | result[@enumToInt(Feature.v7m)] = .{ | 1222 | result[@intFromEnum(Feature.v7m)] = .{ |
| 1223 | .llvm_name = "armv7-m", | 1223 | .llvm_name = "armv7-m", |
| 1224 | .description = "ARMv7m architecture", | 1224 | .description = "ARMv7m architecture", |
| 1225 | .dependencies = featureSet(&[_]Feature{ | 1225 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1231,7 +1231,7 @@ pub const all_features = blk: { | ... | @@ -1231,7 +1231,7 @@ pub const all_features = blk: { |
| 1231 | .thumb_mode, | 1231 | .thumb_mode, |
| 1232 | }), | 1232 | }), |
| 1233 | }; | 1233 | }; |
| 1234 | result[@enumToInt(Feature.v7r)] = .{ | 1234 | result[@intFromEnum(Feature.v7r)] = .{ |
| 1235 | .llvm_name = "armv7-r", | 1235 | .llvm_name = "armv7-r", |
| 1236 | .description = "ARMv7r architecture", | 1236 | .description = "ARMv7r architecture", |
| 1237 | .dependencies = featureSet(&[_]Feature{ | 1237 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1243,14 +1243,14 @@ pub const all_features = blk: { | ... | @@ -1243,14 +1243,14 @@ pub const all_features = blk: { |
| 1243 | .rclass, | 1243 | .rclass, |
| 1244 | }), | 1244 | }), |
| 1245 | }; | 1245 | }; |
| 1246 | result[@enumToInt(Feature.v7s)] = .{ | 1246 | result[@intFromEnum(Feature.v7s)] = .{ |
| 1247 | .llvm_name = "armv7s", | 1247 | .llvm_name = "armv7s", |
| 1248 | .description = "ARMv7a architecture", | 1248 | .description = "ARMv7a architecture", |
| 1249 | .dependencies = featureSet(&[_]Feature{ | 1249 | .dependencies = featureSet(&[_]Feature{ |
| 1250 | .v7a, | 1250 | .v7a, |
| 1251 | }), | 1251 | }), |
| 1252 | }; | 1252 | }; |
| 1253 | result[@enumToInt(Feature.v7ve)] = .{ | 1253 | result[@intFromEnum(Feature.v7ve)] = .{ |
| 1254 | .llvm_name = "armv7ve", | 1254 | .llvm_name = "armv7ve", |
| 1255 | .description = "ARMv7ve architecture", | 1255 | .description = "ARMv7ve architecture", |
| 1256 | .dependencies = featureSet(&[_]Feature{ | 1256 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1265,7 +1265,7 @@ pub const all_features = blk: { | ... | @@ -1265,7 +1265,7 @@ pub const all_features = blk: { |
| 1265 | .virtualization, | 1265 | .virtualization, |
| 1266 | }), | 1266 | }), |
| 1267 | }; | 1267 | }; |
| 1268 | result[@enumToInt(Feature.v8_1a)] = .{ | 1268 | result[@intFromEnum(Feature.v8_1a)] = .{ |
| 1269 | .llvm_name = "armv8.1-a", | 1269 | .llvm_name = "armv8.1-a", |
| 1270 | .description = "ARMv81a architecture", | 1270 | .description = "ARMv81a architecture", |
| 1271 | .dependencies = featureSet(&[_]Feature{ | 1271 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1281,7 +1281,7 @@ pub const all_features = blk: { | ... | @@ -1281,7 +1281,7 @@ pub const all_features = blk: { |
| 1281 | .virtualization, | 1281 | .virtualization, |
| 1282 | }), | 1282 | }), |
| 1283 | }; | 1283 | }; |
| 1284 | result[@enumToInt(Feature.v8_1m_main)] = .{ | 1284 | result[@intFromEnum(Feature.v8_1m_main)] = .{ |
| 1285 | .llvm_name = "armv8.1-m.main", | 1285 | .llvm_name = "armv8.1-m.main", |
| 1286 | .description = "ARMv81mMainline architecture", | 1286 | .description = "ARMv81mMainline architecture", |
| 1287 | .dependencies = featureSet(&[_]Feature{ | 1287 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1297,7 +1297,7 @@ pub const all_features = blk: { | ... | @@ -1297,7 +1297,7 @@ pub const all_features = blk: { |
| 1297 | .thumb_mode, | 1297 | .thumb_mode, |
| 1298 | }), | 1298 | }), |
| 1299 | }; | 1299 | }; |
| 1300 | result[@enumToInt(Feature.v8_2a)] = .{ | 1300 | result[@intFromEnum(Feature.v8_2a)] = .{ |
| 1301 | .llvm_name = "armv8.2-a", | 1301 | .llvm_name = "armv8.2-a", |
| 1302 | .description = "ARMv82a architecture", | 1302 | .description = "ARMv82a architecture", |
| 1303 | .dependencies = featureSet(&[_]Feature{ | 1303 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1314,7 +1314,7 @@ pub const all_features = blk: { | ... | @@ -1314,7 +1314,7 @@ pub const all_features = blk: { |
| 1314 | .virtualization, | 1314 | .virtualization, |
| 1315 | }), | 1315 | }), |
| 1316 | }; | 1316 | }; |
| 1317 | result[@enumToInt(Feature.v8_3a)] = .{ | 1317 | result[@intFromEnum(Feature.v8_3a)] = .{ |
| 1318 | .llvm_name = "armv8.3-a", | 1318 | .llvm_name = "armv8.3-a", |
| 1319 | .description = "ARMv83a architecture", | 1319 | .description = "ARMv83a architecture", |
| 1320 | .dependencies = featureSet(&[_]Feature{ | 1320 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1331,7 +1331,7 @@ pub const all_features = blk: { | ... | @@ -1331,7 +1331,7 @@ pub const all_features = blk: { |
| 1331 | .virtualization, | 1331 | .virtualization, |
| 1332 | }), | 1332 | }), |
| 1333 | }; | 1333 | }; |
| 1334 | result[@enumToInt(Feature.v8_4a)] = .{ | 1334 | result[@intFromEnum(Feature.v8_4a)] = .{ |
| 1335 | .llvm_name = "armv8.4-a", | 1335 | .llvm_name = "armv8.4-a", |
| 1336 | .description = "ARMv84a architecture", | 1336 | .description = "ARMv84a architecture", |
| 1337 | .dependencies = featureSet(&[_]Feature{ | 1337 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1348,7 +1348,7 @@ pub const all_features = blk: { | ... | @@ -1348,7 +1348,7 @@ pub const all_features = blk: { |
| 1348 | .virtualization, | 1348 | .virtualization, |
| 1349 | }), | 1349 | }), |
| 1350 | }; | 1350 | }; |
| 1351 | result[@enumToInt(Feature.v8_5a)] = .{ | 1351 | result[@intFromEnum(Feature.v8_5a)] = .{ |
| 1352 | .llvm_name = "armv8.5-a", | 1352 | .llvm_name = "armv8.5-a", |
| 1353 | .description = "ARMv85a architecture", | 1353 | .description = "ARMv85a architecture", |
| 1354 | .dependencies = featureSet(&[_]Feature{ | 1354 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1365,7 +1365,7 @@ pub const all_features = blk: { | ... | @@ -1365,7 +1365,7 @@ pub const all_features = blk: { |
| 1365 | .virtualization, | 1365 | .virtualization, |
| 1366 | }), | 1366 | }), |
| 1367 | }; | 1367 | }; |
| 1368 | result[@enumToInt(Feature.v8_6a)] = .{ | 1368 | result[@intFromEnum(Feature.v8_6a)] = .{ |
| 1369 | .llvm_name = "armv8.6-a", | 1369 | .llvm_name = "armv8.6-a", |
| 1370 | .description = "ARMv86a architecture", | 1370 | .description = "ARMv86a architecture", |
| 1371 | .dependencies = featureSet(&[_]Feature{ | 1371 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1382,7 +1382,7 @@ pub const all_features = blk: { | ... | @@ -1382,7 +1382,7 @@ pub const all_features = blk: { |
| 1382 | .virtualization, | 1382 | .virtualization, |
| 1383 | }), | 1383 | }), |
| 1384 | }; | 1384 | }; |
| 1385 | result[@enumToInt(Feature.v8_7a)] = .{ | 1385 | result[@intFromEnum(Feature.v8_7a)] = .{ |
| 1386 | .llvm_name = "armv8.7-a", | 1386 | .llvm_name = "armv8.7-a", |
| 1387 | .description = "ARMv87a architecture", | 1387 | .description = "ARMv87a architecture", |
| 1388 | .dependencies = featureSet(&[_]Feature{ | 1388 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1399,7 +1399,7 @@ pub const all_features = blk: { | ... | @@ -1399,7 +1399,7 @@ pub const all_features = blk: { |
| 1399 | .virtualization, | 1399 | .virtualization, |
| 1400 | }), | 1400 | }), |
| 1401 | }; | 1401 | }; |
| 1402 | result[@enumToInt(Feature.v8_8a)] = .{ | 1402 | result[@intFromEnum(Feature.v8_8a)] = .{ |
| 1403 | .llvm_name = "armv8.8-a", | 1403 | .llvm_name = "armv8.8-a", |
| 1404 | .description = "ARMv88a architecture", | 1404 | .description = "ARMv88a architecture", |
| 1405 | .dependencies = featureSet(&[_]Feature{ | 1405 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1416,7 +1416,7 @@ pub const all_features = blk: { | ... | @@ -1416,7 +1416,7 @@ pub const all_features = blk: { |
| 1416 | .virtualization, | 1416 | .virtualization, |
| 1417 | }), | 1417 | }), |
| 1418 | }; | 1418 | }; |
| 1419 | result[@enumToInt(Feature.v8_9a)] = .{ | 1419 | result[@intFromEnum(Feature.v8_9a)] = .{ |
| 1420 | .llvm_name = "armv8.9-a", | 1420 | .llvm_name = "armv8.9-a", |
| 1421 | .description = "ARMv89a architecture", | 1421 | .description = "ARMv89a architecture", |
| 1422 | .dependencies = featureSet(&[_]Feature{ | 1422 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1433,7 +1433,7 @@ pub const all_features = blk: { | ... | @@ -1433,7 +1433,7 @@ pub const all_features = blk: { |
| 1433 | .virtualization, | 1433 | .virtualization, |
| 1434 | }), | 1434 | }), |
| 1435 | }; | 1435 | }; |
| 1436 | result[@enumToInt(Feature.v8a)] = .{ | 1436 | result[@intFromEnum(Feature.v8a)] = .{ |
| 1437 | .llvm_name = "armv8-a", | 1437 | .llvm_name = "armv8-a", |
| 1438 | .description = "ARMv8a architecture", | 1438 | .description = "ARMv8a architecture", |
| 1439 | .dependencies = featureSet(&[_]Feature{ | 1439 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1449,7 +1449,7 @@ pub const all_features = blk: { | ... | @@ -1449,7 +1449,7 @@ pub const all_features = blk: { |
| 1449 | .virtualization, | 1449 | .virtualization, |
| 1450 | }), | 1450 | }), |
| 1451 | }; | 1451 | }; |
| 1452 | result[@enumToInt(Feature.v8m)] = .{ | 1452 | result[@intFromEnum(Feature.v8m)] = .{ |
| 1453 | .llvm_name = "armv8-m.base", | 1453 | .llvm_name = "armv8-m.base", |
| 1454 | .description = "ARMv8mBaseline architecture", | 1454 | .description = "ARMv8mBaseline architecture", |
| 1455 | .dependencies = featureSet(&[_]Feature{ | 1455 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1465,7 +1465,7 @@ pub const all_features = blk: { | ... | @@ -1465,7 +1465,7 @@ pub const all_features = blk: { |
| 1465 | .thumb_mode, | 1465 | .thumb_mode, |
| 1466 | }), | 1466 | }), |
| 1467 | }; | 1467 | }; |
| 1468 | result[@enumToInt(Feature.v8m_main)] = .{ | 1468 | result[@intFromEnum(Feature.v8m_main)] = .{ |
| 1469 | .llvm_name = "armv8-m.main", | 1469 | .llvm_name = "armv8-m.main", |
| 1470 | .description = "ARMv8mMainline architecture", | 1470 | .description = "ARMv8mMainline architecture", |
| 1471 | .dependencies = featureSet(&[_]Feature{ | 1471 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1479,7 +1479,7 @@ pub const all_features = blk: { | ... | @@ -1479,7 +1479,7 @@ pub const all_features = blk: { |
| 1479 | .thumb_mode, | 1479 | .thumb_mode, |
| 1480 | }), | 1480 | }), |
| 1481 | }; | 1481 | }; |
| 1482 | result[@enumToInt(Feature.v8r)] = .{ | 1482 | result[@intFromEnum(Feature.v8r)] = .{ |
| 1483 | .llvm_name = "armv8-r", | 1483 | .llvm_name = "armv8-r", |
| 1484 | .description = "ARMv8r architecture", | 1484 | .description = "ARMv8r architecture", |
| 1485 | .dependencies = featureSet(&[_]Feature{ | 1485 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1495,7 +1495,7 @@ pub const all_features = blk: { | ... | @@ -1495,7 +1495,7 @@ pub const all_features = blk: { |
| 1495 | .virtualization, | 1495 | .virtualization, |
| 1496 | }), | 1496 | }), |
| 1497 | }; | 1497 | }; |
| 1498 | result[@enumToInt(Feature.v9_1a)] = .{ | 1498 | result[@intFromEnum(Feature.v9_1a)] = .{ |
| 1499 | .llvm_name = "armv9.1-a", | 1499 | .llvm_name = "armv9.1-a", |
| 1500 | .description = "ARMv91a architecture", | 1500 | .description = "ARMv91a architecture", |
| 1501 | .dependencies = featureSet(&[_]Feature{ | 1501 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1511,7 +1511,7 @@ pub const all_features = blk: { | ... | @@ -1511,7 +1511,7 @@ pub const all_features = blk: { |
| 1511 | .virtualization, | 1511 | .virtualization, |
| 1512 | }), | 1512 | }), |
| 1513 | }; | 1513 | }; |
| 1514 | result[@enumToInt(Feature.v9_2a)] = .{ | 1514 | result[@intFromEnum(Feature.v9_2a)] = .{ |
| 1515 | .llvm_name = "armv9.2-a", | 1515 | .llvm_name = "armv9.2-a", |
| 1516 | .description = "ARMv92a architecture", | 1516 | .description = "ARMv92a architecture", |
| 1517 | .dependencies = featureSet(&[_]Feature{ | 1517 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1527,7 +1527,7 @@ pub const all_features = blk: { | ... | @@ -1527,7 +1527,7 @@ pub const all_features = blk: { |
| 1527 | .virtualization, | 1527 | .virtualization, |
| 1528 | }), | 1528 | }), |
| 1529 | }; | 1529 | }; |
| 1530 | result[@enumToInt(Feature.v9_3a)] = .{ | 1530 | result[@intFromEnum(Feature.v9_3a)] = .{ |
| 1531 | .llvm_name = "armv9.3-a", | 1531 | .llvm_name = "armv9.3-a", |
| 1532 | .description = "ARMv93a architecture", | 1532 | .description = "ARMv93a architecture", |
| 1533 | .dependencies = featureSet(&[_]Feature{ | 1533 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1544,7 +1544,7 @@ pub const all_features = blk: { | ... | @@ -1544,7 +1544,7 @@ pub const all_features = blk: { |
| 1544 | .virtualization, | 1544 | .virtualization, |
| 1545 | }), | 1545 | }), |
| 1546 | }; | 1546 | }; |
| 1547 | result[@enumToInt(Feature.v9_4a)] = .{ | 1547 | result[@intFromEnum(Feature.v9_4a)] = .{ |
| 1548 | .llvm_name = "armv9.4-a", | 1548 | .llvm_name = "armv9.4-a", |
| 1549 | .description = "ARMv94a architecture", | 1549 | .description = "ARMv94a architecture", |
| 1550 | .dependencies = featureSet(&[_]Feature{ | 1550 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1560,7 +1560,7 @@ pub const all_features = blk: { | ... | @@ -1560,7 +1560,7 @@ pub const all_features = blk: { |
| 1560 | .virtualization, | 1560 | .virtualization, |
| 1561 | }), | 1561 | }), |
| 1562 | }; | 1562 | }; |
| 1563 | result[@enumToInt(Feature.v9a)] = .{ | 1563 | result[@intFromEnum(Feature.v9a)] = .{ |
| 1564 | .llvm_name = "armv9-a", | 1564 | .llvm_name = "armv9-a", |
| 1565 | .description = "ARMv9a architecture", | 1565 | .description = "ARMv9a architecture", |
| 1566 | .dependencies = featureSet(&[_]Feature{ | 1566 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1576,7 +1576,7 @@ pub const all_features = blk: { | ... | @@ -1576,7 +1576,7 @@ pub const all_features = blk: { |
| 1576 | .virtualization, | 1576 | .virtualization, |
| 1577 | }), | 1577 | }), |
| 1578 | }; | 1578 | }; |
| 1579 | result[@enumToInt(Feature.vfp2)] = .{ | 1579 | result[@intFromEnum(Feature.vfp2)] = .{ |
| 1580 | .llvm_name = "vfp2", | 1580 | .llvm_name = "vfp2", |
| 1581 | .description = "Enable VFP2 instructions", | 1581 | .description = "Enable VFP2 instructions", |
| 1582 | .dependencies = featureSet(&[_]Feature{ | 1582 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1584,14 +1584,14 @@ pub const all_features = blk: { | ... | @@ -1584,14 +1584,14 @@ pub const all_features = blk: { |
| 1584 | .vfp2sp, | 1584 | .vfp2sp, |
| 1585 | }), | 1585 | }), |
| 1586 | }; | 1586 | }; |
| 1587 | result[@enumToInt(Feature.vfp2sp)] = .{ | 1587 | result[@intFromEnum(Feature.vfp2sp)] = .{ |
| 1588 | .llvm_name = "vfp2sp", | 1588 | .llvm_name = "vfp2sp", |
| 1589 | .description = "Enable VFP2 instructions with no double precision", | 1589 | .description = "Enable VFP2 instructions with no double precision", |
| 1590 | .dependencies = featureSet(&[_]Feature{ | 1590 | .dependencies = featureSet(&[_]Feature{ |
| 1591 | .fpregs, | 1591 | .fpregs, |
| 1592 | }), | 1592 | }), |
| 1593 | }; | 1593 | }; |
| 1594 | result[@enumToInt(Feature.vfp3)] = .{ | 1594 | result[@intFromEnum(Feature.vfp3)] = .{ |
| 1595 | .llvm_name = "vfp3", | 1595 | .llvm_name = "vfp3", |
| 1596 | .description = "Enable VFP3 instructions", | 1596 | .description = "Enable VFP3 instructions", |
| 1597 | .dependencies = featureSet(&[_]Feature{ | 1597 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1599,7 +1599,7 @@ pub const all_features = blk: { | ... | @@ -1599,7 +1599,7 @@ pub const all_features = blk: { |
| 1599 | .vfp3sp, | 1599 | .vfp3sp, |
| 1600 | }), | 1600 | }), |
| 1601 | }; | 1601 | }; |
| 1602 | result[@enumToInt(Feature.vfp3d16)] = .{ | 1602 | result[@intFromEnum(Feature.vfp3d16)] = .{ |
| 1603 | .llvm_name = "vfp3d16", | 1603 | .llvm_name = "vfp3d16", |
| 1604 | .description = "Enable VFP3 instructions with only 16 d-registers", | 1604 | .description = "Enable VFP3 instructions with only 16 d-registers", |
| 1605 | .dependencies = featureSet(&[_]Feature{ | 1605 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1607,14 +1607,14 @@ pub const all_features = blk: { | ... | @@ -1607,14 +1607,14 @@ pub const all_features = blk: { |
| 1607 | .vfp3d16sp, | 1607 | .vfp3d16sp, |
| 1608 | }), | 1608 | }), |
| 1609 | }; | 1609 | }; |
| 1610 | result[@enumToInt(Feature.vfp3d16sp)] = .{ | 1610 | result[@intFromEnum(Feature.vfp3d16sp)] = .{ |
| 1611 | .llvm_name = "vfp3d16sp", | 1611 | .llvm_name = "vfp3d16sp", |
| 1612 | .description = "Enable VFP3 instructions with only 16 d-registers and no double precision", | 1612 | .description = "Enable VFP3 instructions with only 16 d-registers and no double precision", |
| 1613 | .dependencies = featureSet(&[_]Feature{ | 1613 | .dependencies = featureSet(&[_]Feature{ |
| 1614 | .vfp2sp, | 1614 | .vfp2sp, |
| 1615 | }), | 1615 | }), |
| 1616 | }; | 1616 | }; |
| 1617 | result[@enumToInt(Feature.vfp3sp)] = .{ | 1617 | result[@intFromEnum(Feature.vfp3sp)] = .{ |
| 1618 | .llvm_name = "vfp3sp", | 1618 | .llvm_name = "vfp3sp", |
| 1619 | .description = "Enable VFP3 instructions with no double precision", | 1619 | .description = "Enable VFP3 instructions with no double precision", |
| 1620 | .dependencies = featureSet(&[_]Feature{ | 1620 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1622,7 +1622,7 @@ pub const all_features = blk: { | ... | @@ -1622,7 +1622,7 @@ pub const all_features = blk: { |
| 1622 | .vfp3d16sp, | 1622 | .vfp3d16sp, |
| 1623 | }), | 1623 | }), |
| 1624 | }; | 1624 | }; |
| 1625 | result[@enumToInt(Feature.vfp4)] = .{ | 1625 | result[@intFromEnum(Feature.vfp4)] = .{ |
| 1626 | .llvm_name = "vfp4", | 1626 | .llvm_name = "vfp4", |
| 1627 | .description = "Enable VFP4 instructions", | 1627 | .description = "Enable VFP4 instructions", |
| 1628 | .dependencies = featureSet(&[_]Feature{ | 1628 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1631,7 +1631,7 @@ pub const all_features = blk: { | ... | @@ -1631,7 +1631,7 @@ pub const all_features = blk: { |
| 1631 | .vfp4sp, | 1631 | .vfp4sp, |
| 1632 | }), | 1632 | }), |
| 1633 | }; | 1633 | }; |
| 1634 | result[@enumToInt(Feature.vfp4d16)] = .{ | 1634 | result[@intFromEnum(Feature.vfp4d16)] = .{ |
| 1635 | .llvm_name = "vfp4d16", | 1635 | .llvm_name = "vfp4d16", |
| 1636 | .description = "Enable VFP4 instructions with only 16 d-registers", | 1636 | .description = "Enable VFP4 instructions with only 16 d-registers", |
| 1637 | .dependencies = featureSet(&[_]Feature{ | 1637 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1639,7 +1639,7 @@ pub const all_features = blk: { | ... | @@ -1639,7 +1639,7 @@ pub const all_features = blk: { |
| 1639 | .vfp4d16sp, | 1639 | .vfp4d16sp, |
| 1640 | }), | 1640 | }), |
| 1641 | }; | 1641 | }; |
| 1642 | result[@enumToInt(Feature.vfp4d16sp)] = .{ | 1642 | result[@intFromEnum(Feature.vfp4d16sp)] = .{ |
| 1643 | .llvm_name = "vfp4d16sp", | 1643 | .llvm_name = "vfp4d16sp", |
| 1644 | .description = "Enable VFP4 instructions with only 16 d-registers and no double precision", | 1644 | .description = "Enable VFP4 instructions with only 16 d-registers and no double precision", |
| 1645 | .dependencies = featureSet(&[_]Feature{ | 1645 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1647,7 +1647,7 @@ pub const all_features = blk: { | ... | @@ -1647,7 +1647,7 @@ pub const all_features = blk: { |
| 1647 | .vfp3d16sp, | 1647 | .vfp3d16sp, |
| 1648 | }), | 1648 | }), |
| 1649 | }; | 1649 | }; |
| 1650 | result[@enumToInt(Feature.vfp4sp)] = .{ | 1650 | result[@intFromEnum(Feature.vfp4sp)] = .{ |
| 1651 | .llvm_name = "vfp4sp", | 1651 | .llvm_name = "vfp4sp", |
| 1652 | .description = "Enable VFP4 instructions with no double precision", | 1652 | .description = "Enable VFP4 instructions with no double precision", |
| 1653 | .dependencies = featureSet(&[_]Feature{ | 1653 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1655,7 +1655,7 @@ pub const all_features = blk: { | ... | @@ -1655,7 +1655,7 @@ pub const all_features = blk: { |
| 1655 | .vfp4d16sp, | 1655 | .vfp4d16sp, |
| 1656 | }), | 1656 | }), |
| 1657 | }; | 1657 | }; |
| 1658 | result[@enumToInt(Feature.virtualization)] = .{ | 1658 | result[@intFromEnum(Feature.virtualization)] = .{ |
| 1659 | .llvm_name = "virtualization", | 1659 | .llvm_name = "virtualization", |
| 1660 | .description = "Supports Virtualization extension", | 1660 | .description = "Supports Virtualization extension", |
| 1661 | .dependencies = featureSet(&[_]Feature{ | 1661 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1663,34 +1663,34 @@ pub const all_features = blk: { | ... | @@ -1663,34 +1663,34 @@ pub const all_features = blk: { |
| 1663 | .hwdiv_arm, | 1663 | .hwdiv_arm, |
| 1664 | }), | 1664 | }), |
| 1665 | }; | 1665 | }; |
| 1666 | result[@enumToInt(Feature.vldn_align)] = .{ | 1666 | result[@intFromEnum(Feature.vldn_align)] = .{ |
| 1667 | .llvm_name = "vldn-align", | 1667 | .llvm_name = "vldn-align", |
| 1668 | .description = "Check for VLDn unaligned access", | 1668 | .description = "Check for VLDn unaligned access", |
| 1669 | .dependencies = featureSet(&[_]Feature{}), | 1669 | .dependencies = featureSet(&[_]Feature{}), |
| 1670 | }; | 1670 | }; |
| 1671 | result[@enumToInt(Feature.vmlx_forwarding)] = .{ | 1671 | result[@intFromEnum(Feature.vmlx_forwarding)] = .{ |
| 1672 | .llvm_name = "vmlx-forwarding", | 1672 | .llvm_name = "vmlx-forwarding", |
| 1673 | .description = "Has multiplier accumulator forwarding", | 1673 | .description = "Has multiplier accumulator forwarding", |
| 1674 | .dependencies = featureSet(&[_]Feature{}), | 1674 | .dependencies = featureSet(&[_]Feature{}), |
| 1675 | }; | 1675 | }; |
| 1676 | result[@enumToInt(Feature.vmlx_hazards)] = .{ | 1676 | result[@intFromEnum(Feature.vmlx_hazards)] = .{ |
| 1677 | .llvm_name = "vmlx-hazards", | 1677 | .llvm_name = "vmlx-hazards", |
| 1678 | .description = "Has VMLx hazards", | 1678 | .description = "Has VMLx hazards", |
| 1679 | .dependencies = featureSet(&[_]Feature{}), | 1679 | .dependencies = featureSet(&[_]Feature{}), |
| 1680 | }; | 1680 | }; |
| 1681 | result[@enumToInt(Feature.wide_stride_vfp)] = .{ | 1681 | result[@intFromEnum(Feature.wide_stride_vfp)] = .{ |
| 1682 | .llvm_name = "wide-stride-vfp", | 1682 | .llvm_name = "wide-stride-vfp", |
| 1683 | .description = "Use a wide stride when allocating VFP registers", | 1683 | .description = "Use a wide stride when allocating VFP registers", |
| 1684 | .dependencies = featureSet(&[_]Feature{}), | 1684 | .dependencies = featureSet(&[_]Feature{}), |
| 1685 | }; | 1685 | }; |
| 1686 | result[@enumToInt(Feature.xscale)] = .{ | 1686 | result[@intFromEnum(Feature.xscale)] = .{ |
| 1687 | .llvm_name = "xscale", | 1687 | .llvm_name = "xscale", |
| 1688 | .description = "ARMv5te architecture", | 1688 | .description = "ARMv5te architecture", |
| 1689 | .dependencies = featureSet(&[_]Feature{ | 1689 | .dependencies = featureSet(&[_]Feature{ |
| 1690 | .v5te, | 1690 | .v5te, |
| 1691 | }), | 1691 | }), |
| 1692 | }; | 1692 | }; |
| 1693 | result[@enumToInt(Feature.zcz)] = .{ | 1693 | result[@intFromEnum(Feature.zcz)] = .{ |
| 1694 | .llvm_name = "zcz", | 1694 | .llvm_name = "zcz", |
| 1695 | .description = "Has zero-cycle zeroing instructions", | 1695 | .description = "Has zero-cycle zeroing instructions", |
| 1696 | .dependencies = featureSet(&[_]Feature{}), | 1696 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/avr.zig+36-36| ... | @@ -52,17 +52,17 @@ pub const all_features = blk: { | ... | @@ -52,17 +52,17 @@ pub const all_features = blk: { |
| 52 | const len = @typeInfo(Feature).Enum.fields.len; | 52 | const len = @typeInfo(Feature).Enum.fields.len; |
| 53 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 53 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 54 | var result: [len]CpuFeature = undefined; | 54 | var result: [len]CpuFeature = undefined; |
| 55 | result[@enumToInt(Feature.addsubiw)] = .{ | 55 | result[@intFromEnum(Feature.addsubiw)] = .{ |
| 56 | .llvm_name = "addsubiw", | 56 | .llvm_name = "addsubiw", |
| 57 | .description = "Enable 16-bit register-immediate addition and subtraction instructions", | 57 | .description = "Enable 16-bit register-immediate addition and subtraction instructions", |
| 58 | .dependencies = featureSet(&[_]Feature{}), | 58 | .dependencies = featureSet(&[_]Feature{}), |
| 59 | }; | 59 | }; |
| 60 | result[@enumToInt(Feature.avr0)] = .{ | 60 | result[@intFromEnum(Feature.avr0)] = .{ |
| 61 | .llvm_name = "avr0", | 61 | .llvm_name = "avr0", |
| 62 | .description = "The device is a part of the avr0 family", | 62 | .description = "The device is a part of the avr0 family", |
| 63 | .dependencies = featureSet(&[_]Feature{}), | 63 | .dependencies = featureSet(&[_]Feature{}), |
| 64 | }; | 64 | }; |
| 65 | result[@enumToInt(Feature.avr1)] = .{ | 65 | result[@intFromEnum(Feature.avr1)] = .{ |
| 66 | .llvm_name = "avr1", | 66 | .llvm_name = "avr1", |
| 67 | .description = "The device is a part of the avr1 family", | 67 | .description = "The device is a part of the avr1 family", |
| 68 | .dependencies = featureSet(&[_]Feature{ | 68 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -72,7 +72,7 @@ pub const all_features = blk: { | ... | @@ -72,7 +72,7 @@ pub const all_features = blk: { |
| 72 | .progmem, | 72 | .progmem, |
| 73 | }), | 73 | }), |
| 74 | }; | 74 | }; |
| 75 | result[@enumToInt(Feature.avr2)] = .{ | 75 | result[@intFromEnum(Feature.avr2)] = .{ |
| 76 | .llvm_name = "avr2", | 76 | .llvm_name = "avr2", |
| 77 | .description = "The device is a part of the avr2 family", | 77 | .description = "The device is a part of the avr2 family", |
| 78 | .dependencies = featureSet(&[_]Feature{ | 78 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -82,7 +82,7 @@ pub const all_features = blk: { | ... | @@ -82,7 +82,7 @@ pub const all_features = blk: { |
| 82 | .sram, | 82 | .sram, |
| 83 | }), | 83 | }), |
| 84 | }; | 84 | }; |
| 85 | result[@enumToInt(Feature.avr25)] = .{ | 85 | result[@intFromEnum(Feature.avr25)] = .{ |
| 86 | .llvm_name = "avr25", | 86 | .llvm_name = "avr25", |
| 87 | .description = "The device is a part of the avr25 family", | 87 | .description = "The device is a part of the avr25 family", |
| 88 | .dependencies = featureSet(&[_]Feature{ | 88 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -93,7 +93,7 @@ pub const all_features = blk: { | ... | @@ -93,7 +93,7 @@ pub const all_features = blk: { |
| 93 | .spm, | 93 | .spm, |
| 94 | }), | 94 | }), |
| 95 | }; | 95 | }; |
| 96 | result[@enumToInt(Feature.avr3)] = .{ | 96 | result[@intFromEnum(Feature.avr3)] = .{ |
| 97 | .llvm_name = "avr3", | 97 | .llvm_name = "avr3", |
| 98 | .description = "The device is a part of the avr3 family", | 98 | .description = "The device is a part of the avr3 family", |
| 99 | .dependencies = featureSet(&[_]Feature{ | 99 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -101,7 +101,7 @@ pub const all_features = blk: { | ... | @@ -101,7 +101,7 @@ pub const all_features = blk: { |
| 101 | .jmpcall, | 101 | .jmpcall, |
| 102 | }), | 102 | }), |
| 103 | }; | 103 | }; |
| 104 | result[@enumToInt(Feature.avr31)] = .{ | 104 | result[@intFromEnum(Feature.avr31)] = .{ |
| 105 | .llvm_name = "avr31", | 105 | .llvm_name = "avr31", |
| 106 | .description = "The device is a part of the avr31 family", | 106 | .description = "The device is a part of the avr31 family", |
| 107 | .dependencies = featureSet(&[_]Feature{ | 107 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -109,7 +109,7 @@ pub const all_features = blk: { | ... | @@ -109,7 +109,7 @@ pub const all_features = blk: { |
| 109 | .elpm, | 109 | .elpm, |
| 110 | }), | 110 | }), |
| 111 | }; | 111 | }; |
| 112 | result[@enumToInt(Feature.avr35)] = .{ | 112 | result[@intFromEnum(Feature.avr35)] = .{ |
| 113 | .llvm_name = "avr35", | 113 | .llvm_name = "avr35", |
| 114 | .description = "The device is a part of the avr35 family", | 114 | .description = "The device is a part of the avr35 family", |
| 115 | .dependencies = featureSet(&[_]Feature{ | 115 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -120,7 +120,7 @@ pub const all_features = blk: { | ... | @@ -120,7 +120,7 @@ pub const all_features = blk: { |
| 120 | .spm, | 120 | .spm, |
| 121 | }), | 121 | }), |
| 122 | }; | 122 | }; |
| 123 | result[@enumToInt(Feature.avr4)] = .{ | 123 | result[@intFromEnum(Feature.avr4)] = .{ |
| 124 | .llvm_name = "avr4", | 124 | .llvm_name = "avr4", |
| 125 | .description = "The device is a part of the avr4 family", | 125 | .description = "The device is a part of the avr4 family", |
| 126 | .dependencies = featureSet(&[_]Feature{ | 126 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -132,7 +132,7 @@ pub const all_features = blk: { | ... | @@ -132,7 +132,7 @@ pub const all_features = blk: { |
| 132 | .spm, | 132 | .spm, |
| 133 | }), | 133 | }), |
| 134 | }; | 134 | }; |
| 135 | result[@enumToInt(Feature.avr5)] = .{ | 135 | result[@intFromEnum(Feature.avr5)] = .{ |
| 136 | .llvm_name = "avr5", | 136 | .llvm_name = "avr5", |
| 137 | .description = "The device is a part of the avr5 family", | 137 | .description = "The device is a part of the avr5 family", |
| 138 | .dependencies = featureSet(&[_]Feature{ | 138 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -144,7 +144,7 @@ pub const all_features = blk: { | ... | @@ -144,7 +144,7 @@ pub const all_features = blk: { |
| 144 | .spm, | 144 | .spm, |
| 145 | }), | 145 | }), |
| 146 | }; | 146 | }; |
| 147 | result[@enumToInt(Feature.avr51)] = .{ | 147 | result[@intFromEnum(Feature.avr51)] = .{ |
| 148 | .llvm_name = "avr51", | 148 | .llvm_name = "avr51", |
| 149 | .description = "The device is a part of the avr51 family", | 149 | .description = "The device is a part of the avr51 family", |
| 150 | .dependencies = featureSet(&[_]Feature{ | 150 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -153,7 +153,7 @@ pub const all_features = blk: { | ... | @@ -153,7 +153,7 @@ pub const all_features = blk: { |
| 153 | .elpmx, | 153 | .elpmx, |
| 154 | }), | 154 | }), |
| 155 | }; | 155 | }; |
| 156 | result[@enumToInt(Feature.avr6)] = .{ | 156 | result[@intFromEnum(Feature.avr6)] = .{ |
| 157 | .llvm_name = "avr6", | 157 | .llvm_name = "avr6", |
| 158 | .description = "The device is a part of the avr6 family", | 158 | .description = "The device is a part of the avr6 family", |
| 159 | .dependencies = featureSet(&[_]Feature{ | 159 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -161,7 +161,7 @@ pub const all_features = blk: { | ... | @@ -161,7 +161,7 @@ pub const all_features = blk: { |
| 161 | .eijmpcall, | 161 | .eijmpcall, |
| 162 | }), | 162 | }), |
| 163 | }; | 163 | }; |
| 164 | result[@enumToInt(Feature.avrtiny)] = .{ | 164 | result[@intFromEnum(Feature.avrtiny)] = .{ |
| 165 | .llvm_name = "avrtiny", | 165 | .llvm_name = "avrtiny", |
| 166 | .description = "The device is a part of the avrtiny family", | 166 | .description = "The device is a part of the avrtiny family", |
| 167 | .dependencies = featureSet(&[_]Feature{ | 167 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -172,82 +172,82 @@ pub const all_features = blk: { | ... | @@ -172,82 +172,82 @@ pub const all_features = blk: { |
| 172 | .tinyencoding, | 172 | .tinyencoding, |
| 173 | }), | 173 | }), |
| 174 | }; | 174 | }; |
| 175 | result[@enumToInt(Feature.@"break")] = .{ | 175 | result[@intFromEnum(Feature.@"break")] = .{ |
| 176 | .llvm_name = "break", | 176 | .llvm_name = "break", |
| 177 | .description = "The device supports the `BREAK` debugging instruction", | 177 | .description = "The device supports the `BREAK` debugging instruction", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@enumToInt(Feature.des)] = .{ | 180 | result[@intFromEnum(Feature.des)] = .{ |
| 181 | .llvm_name = "des", | 181 | .llvm_name = "des", |
| 182 | .description = "The device supports the `DES k` encryption instruction", | 182 | .description = "The device supports the `DES k` encryption instruction", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@enumToInt(Feature.eijmpcall)] = .{ | 185 | result[@intFromEnum(Feature.eijmpcall)] = .{ |
| 186 | .llvm_name = "eijmpcall", | 186 | .llvm_name = "eijmpcall", |
| 187 | .description = "The device supports the `EIJMP`/`EICALL` instructions", | 187 | .description = "The device supports the `EIJMP`/`EICALL` instructions", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@enumToInt(Feature.elpm)] = .{ | 190 | result[@intFromEnum(Feature.elpm)] = .{ |
| 191 | .llvm_name = "elpm", | 191 | .llvm_name = "elpm", |
| 192 | .description = "The device supports the ELPM instruction", | 192 | .description = "The device supports the ELPM instruction", |
| 193 | .dependencies = featureSet(&[_]Feature{}), | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | }; | 194 | }; |
| 195 | result[@enumToInt(Feature.elpmx)] = .{ | 195 | result[@intFromEnum(Feature.elpmx)] = .{ |
| 196 | .llvm_name = "elpmx", | 196 | .llvm_name = "elpmx", |
| 197 | .description = "The device supports the `ELPM Rd, Z[+]` instructions", | 197 | .description = "The device supports the `ELPM Rd, Z[+]` instructions", |
| 198 | .dependencies = featureSet(&[_]Feature{}), | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | }; | 199 | }; |
| 200 | result[@enumToInt(Feature.ijmpcall)] = .{ | 200 | result[@intFromEnum(Feature.ijmpcall)] = .{ |
| 201 | .llvm_name = "ijmpcall", | 201 | .llvm_name = "ijmpcall", |
| 202 | .description = "The device supports `IJMP`/`ICALL`instructions", | 202 | .description = "The device supports `IJMP`/`ICALL`instructions", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@enumToInt(Feature.jmpcall)] = .{ | 205 | result[@intFromEnum(Feature.jmpcall)] = .{ |
| 206 | .llvm_name = "jmpcall", | 206 | .llvm_name = "jmpcall", |
| 207 | .description = "The device supports the `JMP` and `CALL` instructions", | 207 | .description = "The device supports the `JMP` and `CALL` instructions", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@enumToInt(Feature.lpm)] = .{ | 210 | result[@intFromEnum(Feature.lpm)] = .{ |
| 211 | .llvm_name = "lpm", | 211 | .llvm_name = "lpm", |
| 212 | .description = "The device supports the `LPM` instruction", | 212 | .description = "The device supports the `LPM` instruction", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@enumToInt(Feature.lpmx)] = .{ | 215 | result[@intFromEnum(Feature.lpmx)] = .{ |
| 216 | .llvm_name = "lpmx", | 216 | .llvm_name = "lpmx", |
| 217 | .description = "The device supports the `LPM Rd, Z[+]` instruction", | 217 | .description = "The device supports the `LPM Rd, Z[+]` instruction", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@enumToInt(Feature.memmappedregs)] = .{ | 220 | result[@intFromEnum(Feature.memmappedregs)] = .{ |
| 221 | .llvm_name = "memmappedregs", | 221 | .llvm_name = "memmappedregs", |
| 222 | .description = "The device has CPU registers mapped in data address space", | 222 | .description = "The device has CPU registers mapped in data address space", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@enumToInt(Feature.movw)] = .{ | 225 | result[@intFromEnum(Feature.movw)] = .{ |
| 226 | .llvm_name = "movw", | 226 | .llvm_name = "movw", |
| 227 | .description = "The device supports the 16-bit MOVW instruction", | 227 | .description = "The device supports the 16-bit MOVW instruction", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@enumToInt(Feature.mul)] = .{ | 230 | result[@intFromEnum(Feature.mul)] = .{ |
| 231 | .llvm_name = "mul", | 231 | .llvm_name = "mul", |
| 232 | .description = "The device supports the multiplication instructions", | 232 | .description = "The device supports the multiplication instructions", |
| 233 | .dependencies = featureSet(&[_]Feature{}), | 233 | .dependencies = featureSet(&[_]Feature{}), |
| 234 | }; | 234 | }; |
| 235 | result[@enumToInt(Feature.progmem)] = .{ | 235 | result[@intFromEnum(Feature.progmem)] = .{ |
| 236 | .llvm_name = "progmem", | 236 | .llvm_name = "progmem", |
| 237 | .description = "The device has a separate flash namespace", | 237 | .description = "The device has a separate flash namespace", |
| 238 | .dependencies = featureSet(&[_]Feature{}), | 238 | .dependencies = featureSet(&[_]Feature{}), |
| 239 | }; | 239 | }; |
| 240 | result[@enumToInt(Feature.rmw)] = .{ | 240 | result[@intFromEnum(Feature.rmw)] = .{ |
| 241 | .llvm_name = "rmw", | 241 | .llvm_name = "rmw", |
| 242 | .description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT", | 242 | .description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT", |
| 243 | .dependencies = featureSet(&[_]Feature{}), | 243 | .dependencies = featureSet(&[_]Feature{}), |
| 244 | }; | 244 | }; |
| 245 | result[@enumToInt(Feature.smallstack)] = .{ | 245 | result[@intFromEnum(Feature.smallstack)] = .{ |
| 246 | .llvm_name = "smallstack", | 246 | .llvm_name = "smallstack", |
| 247 | .description = "The device has an 8-bit stack pointer", | 247 | .description = "The device has an 8-bit stack pointer", |
| 248 | .dependencies = featureSet(&[_]Feature{}), | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | }; | 249 | }; |
| 250 | result[@enumToInt(Feature.special)] = .{ | 250 | result[@intFromEnum(Feature.special)] = .{ |
| 251 | .llvm_name = "special", | 251 | .llvm_name = "special", |
| 252 | .description = "Enable use of the entire instruction set - used for debugging", | 252 | .description = "Enable use of the entire instruction set - used for debugging", |
| 253 | .dependencies = featureSet(&[_]Feature{ | 253 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -270,27 +270,27 @@ pub const all_features = blk: { | ... | @@ -270,27 +270,27 @@ pub const all_features = blk: { |
| 270 | .sram, | 270 | .sram, |
| 271 | }), | 271 | }), |
| 272 | }; | 272 | }; |
| 273 | result[@enumToInt(Feature.spm)] = .{ | 273 | result[@intFromEnum(Feature.spm)] = .{ |
| 274 | .llvm_name = "spm", | 274 | .llvm_name = "spm", |
| 275 | .description = "The device supports the `SPM` instruction", | 275 | .description = "The device supports the `SPM` instruction", |
| 276 | .dependencies = featureSet(&[_]Feature{}), | 276 | .dependencies = featureSet(&[_]Feature{}), |
| 277 | }; | 277 | }; |
| 278 | result[@enumToInt(Feature.spmx)] = .{ | 278 | result[@intFromEnum(Feature.spmx)] = .{ |
| 279 | .llvm_name = "spmx", | 279 | .llvm_name = "spmx", |
| 280 | .description = "The device supports the `SPM Z+` instruction", | 280 | .description = "The device supports the `SPM Z+` instruction", |
| 281 | .dependencies = featureSet(&[_]Feature{}), | 281 | .dependencies = featureSet(&[_]Feature{}), |
| 282 | }; | 282 | }; |
| 283 | result[@enumToInt(Feature.sram)] = .{ | 283 | result[@intFromEnum(Feature.sram)] = .{ |
| 284 | .llvm_name = "sram", | 284 | .llvm_name = "sram", |
| 285 | .description = "The device has random access memory", | 285 | .description = "The device has random access memory", |
| 286 | .dependencies = featureSet(&[_]Feature{}), | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | }; | 287 | }; |
| 288 | result[@enumToInt(Feature.tinyencoding)] = .{ | 288 | result[@intFromEnum(Feature.tinyencoding)] = .{ |
| 289 | .llvm_name = "tinyencoding", | 289 | .llvm_name = "tinyencoding", |
| 290 | .description = "The device has Tiny core specific instruction encodings", | 290 | .description = "The device has Tiny core specific instruction encodings", |
| 291 | .dependencies = featureSet(&[_]Feature{}), | 291 | .dependencies = featureSet(&[_]Feature{}), |
| 292 | }; | 292 | }; |
| 293 | result[@enumToInt(Feature.xmega)] = .{ | 293 | result[@intFromEnum(Feature.xmega)] = .{ |
| 294 | .llvm_name = "xmega", | 294 | .llvm_name = "xmega", |
| 295 | .description = "The device is a part of the xmega family", | 295 | .description = "The device is a part of the xmega family", |
| 296 | .dependencies = featureSet(&[_]Feature{ | 296 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -313,7 +313,7 @@ pub const all_features = blk: { | ... | @@ -313,7 +313,7 @@ pub const all_features = blk: { |
| 313 | .sram, | 313 | .sram, |
| 314 | }), | 314 | }), |
| 315 | }; | 315 | }; |
| 316 | result[@enumToInt(Feature.xmega3)] = .{ | 316 | result[@intFromEnum(Feature.xmega3)] = .{ |
| 317 | .llvm_name = "xmega3", | 317 | .llvm_name = "xmega3", |
| 318 | .description = "The device is a part of the xmega3 family", | 318 | .description = "The device is a part of the xmega3 family", |
| 319 | .dependencies = featureSet(&[_]Feature{ | 319 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -330,7 +330,7 @@ pub const all_features = blk: { | ... | @@ -330,7 +330,7 @@ pub const all_features = blk: { |
| 330 | .sram, | 330 | .sram, |
| 331 | }), | 331 | }), |
| 332 | }; | 332 | }; |
| 333 | result[@enumToInt(Feature.xmegau)] = .{ | 333 | result[@intFromEnum(Feature.xmegau)] = .{ |
| 334 | .llvm_name = "xmegau", | 334 | .llvm_name = "xmegau", |
| 335 | .description = "The device is a part of the xmegau family", | 335 | .description = "The device is a part of the xmegau family", |
| 336 | .dependencies = featureSet(&[_]Feature{ | 336 | .dependencies = featureSet(&[_]Feature{ |
lib/std/target/bpf.zig+3-3| ... | @@ -19,17 +19,17 @@ pub const all_features = blk: { | ... | @@ -19,17 +19,17 @@ pub const all_features = blk: { |
| 19 | const len = @typeInfo(Feature).Enum.fields.len; | 19 | const len = @typeInfo(Feature).Enum.fields.len; |
| 20 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 20 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 21 | var result: [len]CpuFeature = undefined; | 21 | var result: [len]CpuFeature = undefined; |
| 22 | result[@enumToInt(Feature.alu32)] = .{ | 22 | result[@intFromEnum(Feature.alu32)] = .{ |
| 23 | .llvm_name = "alu32", | 23 | .llvm_name = "alu32", |
| 24 | .description = "Enable ALU32 instructions", | 24 | .description = "Enable ALU32 instructions", |
| 25 | .dependencies = featureSet(&[_]Feature{}), | 25 | .dependencies = featureSet(&[_]Feature{}), |
| 26 | }; | 26 | }; |
| 27 | result[@enumToInt(Feature.dummy)] = .{ | 27 | result[@intFromEnum(Feature.dummy)] = .{ |
| 28 | .llvm_name = "dummy", | 28 | .llvm_name = "dummy", |
| 29 | .description = "unused feature", | 29 | .description = "unused feature", |
| 30 | .dependencies = featureSet(&[_]Feature{}), | 30 | .dependencies = featureSet(&[_]Feature{}), |
| 31 | }; | 31 | }; |
| 32 | result[@enumToInt(Feature.dwarfris)] = .{ | 32 | result[@intFromEnum(Feature.dwarfris)] = .{ |
| 33 | .llvm_name = "dwarfris", | 33 | .llvm_name = "dwarfris", |
| 34 | .description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections", | 34 | .description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections", |
| 35 | .dependencies = featureSet(&[_]Feature{}), | 35 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/csky.zig+63-63| ... | @@ -79,26 +79,26 @@ pub const all_features = blk: { | ... | @@ -79,26 +79,26 @@ pub const all_features = blk: { |
| 79 | const len = @typeInfo(Feature).Enum.fields.len; | 79 | const len = @typeInfo(Feature).Enum.fields.len; |
| 80 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 80 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 81 | var result: [len]CpuFeature = undefined; | 81 | var result: [len]CpuFeature = undefined; |
| 82 | result[@enumToInt(Feature.@"10e60")] = .{ | 82 | result[@intFromEnum(Feature.@"10e60")] = .{ |
| 83 | .llvm_name = "10e60", | 83 | .llvm_name = "10e60", |
| 84 | .description = "Support CSKY 10e60 instructions", | 84 | .description = "Support CSKY 10e60 instructions", |
| 85 | .dependencies = featureSet(&[_]Feature{ | 85 | .dependencies = featureSet(&[_]Feature{ |
| 86 | .@"7e10", | 86 | .@"7e10", |
| 87 | }), | 87 | }), |
| 88 | }; | 88 | }; |
| 89 | result[@enumToInt(Feature.@"2e3")] = .{ | 89 | result[@intFromEnum(Feature.@"2e3")] = .{ |
| 90 | .llvm_name = "2e3", | 90 | .llvm_name = "2e3", |
| 91 | .description = "Support CSKY 2e3 instructions", | 91 | .description = "Support CSKY 2e3 instructions", |
| 92 | .dependencies = featureSet(&[_]Feature{ | 92 | .dependencies = featureSet(&[_]Feature{ |
| 93 | .e2, | 93 | .e2, |
| 94 | }), | 94 | }), |
| 95 | }; | 95 | }; |
| 96 | result[@enumToInt(Feature.@"3e3r1")] = .{ | 96 | result[@intFromEnum(Feature.@"3e3r1")] = .{ |
| 97 | .llvm_name = "3e3r1", | 97 | .llvm_name = "3e3r1", |
| 98 | .description = "Support CSKY 3e3r1 instructions", | 98 | .description = "Support CSKY 3e3r1 instructions", |
| 99 | .dependencies = featureSet(&[_]Feature{}), | 99 | .dependencies = featureSet(&[_]Feature{}), |
| 100 | }; | 100 | }; |
| 101 | result[@enumToInt(Feature.@"3e3r2")] = .{ | 101 | result[@intFromEnum(Feature.@"3e3r2")] = .{ |
| 102 | .llvm_name = "3e3r2", | 102 | .llvm_name = "3e3r2", |
| 103 | .description = "Support CSKY 3e3r2 instructions", | 103 | .description = "Support CSKY 3e3r2 instructions", |
| 104 | .dependencies = featureSet(&[_]Feature{ | 104 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -106,311 +106,311 @@ pub const all_features = blk: { | ... | @@ -106,311 +106,311 @@ pub const all_features = blk: { |
| 106 | .doloop, | 106 | .doloop, |
| 107 | }), | 107 | }), |
| 108 | }; | 108 | }; |
| 109 | result[@enumToInt(Feature.@"3e3r3")] = .{ | 109 | result[@intFromEnum(Feature.@"3e3r3")] = .{ |
| 110 | .llvm_name = "3e3r3", | 110 | .llvm_name = "3e3r3", |
| 111 | .description = "Support CSKY 3e3r3 instructions", | 111 | .description = "Support CSKY 3e3r3 instructions", |
| 112 | .dependencies = featureSet(&[_]Feature{ | 112 | .dependencies = featureSet(&[_]Feature{ |
| 113 | .doloop, | 113 | .doloop, |
| 114 | }), | 114 | }), |
| 115 | }; | 115 | }; |
| 116 | result[@enumToInt(Feature.@"3e7")] = .{ | 116 | result[@intFromEnum(Feature.@"3e7")] = .{ |
| 117 | .llvm_name = "3e7", | 117 | .llvm_name = "3e7", |
| 118 | .description = "Support CSKY 3e7 instructions", | 118 | .description = "Support CSKY 3e7 instructions", |
| 119 | .dependencies = featureSet(&[_]Feature{ | 119 | .dependencies = featureSet(&[_]Feature{ |
| 120 | .@"2e3", | 120 | .@"2e3", |
| 121 | }), | 121 | }), |
| 122 | }; | 122 | }; |
| 123 | result[@enumToInt(Feature.@"7e10")] = .{ | 123 | result[@intFromEnum(Feature.@"7e10")] = .{ |
| 124 | .llvm_name = "7e10", | 124 | .llvm_name = "7e10", |
| 125 | .description = "Support CSKY 7e10 instructions", | 125 | .description = "Support CSKY 7e10 instructions", |
| 126 | .dependencies = featureSet(&[_]Feature{ | 126 | .dependencies = featureSet(&[_]Feature{ |
| 127 | .@"3e7", | 127 | .@"3e7", |
| 128 | }), | 128 | }), |
| 129 | }; | 129 | }; |
| 130 | result[@enumToInt(Feature.btst16)] = .{ | 130 | result[@intFromEnum(Feature.btst16)] = .{ |
| 131 | .llvm_name = "btst16", | 131 | .llvm_name = "btst16", |
| 132 | .description = "Use the 16-bit btsti instruction", | 132 | .description = "Use the 16-bit btsti instruction", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@enumToInt(Feature.cache)] = .{ | 135 | result[@intFromEnum(Feature.cache)] = .{ |
| 136 | .llvm_name = "cache", | 136 | .llvm_name = "cache", |
| 137 | .description = "Enable cache", | 137 | .description = "Enable cache", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@enumToInt(Feature.ccrt)] = .{ | 140 | result[@intFromEnum(Feature.ccrt)] = .{ |
| 141 | .llvm_name = "ccrt", | 141 | .llvm_name = "ccrt", |
| 142 | .description = "Use CSKY compiler runtime", | 142 | .description = "Use CSKY compiler runtime", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@enumToInt(Feature.ck801)] = .{ | 145 | result[@intFromEnum(Feature.ck801)] = .{ |
| 146 | .llvm_name = "ck801", | 146 | .llvm_name = "ck801", |
| 147 | .description = "CSKY ck801 processors", | 147 | .description = "CSKY ck801 processors", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@enumToInt(Feature.ck802)] = .{ | 150 | result[@intFromEnum(Feature.ck802)] = .{ |
| 151 | .llvm_name = "ck802", | 151 | .llvm_name = "ck802", |
| 152 | .description = "CSKY ck802 processors", | 152 | .description = "CSKY ck802 processors", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | }; | 154 | }; |
| 155 | result[@enumToInt(Feature.ck803)] = .{ | 155 | result[@intFromEnum(Feature.ck803)] = .{ |
| 156 | .llvm_name = "ck803", | 156 | .llvm_name = "ck803", |
| 157 | .description = "CSKY ck803 processors", | 157 | .description = "CSKY ck803 processors", |
| 158 | .dependencies = featureSet(&[_]Feature{}), | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | }; | 159 | }; |
| 160 | result[@enumToInt(Feature.ck803s)] = .{ | 160 | result[@intFromEnum(Feature.ck803s)] = .{ |
| 161 | .llvm_name = "ck803s", | 161 | .llvm_name = "ck803s", |
| 162 | .description = "CSKY ck803s processors", | 162 | .description = "CSKY ck803s processors", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@enumToInt(Feature.ck804)] = .{ | 165 | result[@intFromEnum(Feature.ck804)] = .{ |
| 166 | .llvm_name = "ck804", | 166 | .llvm_name = "ck804", |
| 167 | .description = "CSKY ck804 processors", | 167 | .description = "CSKY ck804 processors", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@enumToInt(Feature.ck805)] = .{ | 170 | result[@intFromEnum(Feature.ck805)] = .{ |
| 171 | .llvm_name = "ck805", | 171 | .llvm_name = "ck805", |
| 172 | .description = "CSKY ck805 processors", | 172 | .description = "CSKY ck805 processors", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@enumToInt(Feature.ck807)] = .{ | 175 | result[@intFromEnum(Feature.ck807)] = .{ |
| 176 | .llvm_name = "ck807", | 176 | .llvm_name = "ck807", |
| 177 | .description = "CSKY ck807 processors", | 177 | .description = "CSKY ck807 processors", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@enumToInt(Feature.ck810)] = .{ | 180 | result[@intFromEnum(Feature.ck810)] = .{ |
| 181 | .llvm_name = "ck810", | 181 | .llvm_name = "ck810", |
| 182 | .description = "CSKY ck810 processors", | 182 | .description = "CSKY ck810 processors", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@enumToInt(Feature.ck810v)] = .{ | 185 | result[@intFromEnum(Feature.ck810v)] = .{ |
| 186 | .llvm_name = "ck810v", | 186 | .llvm_name = "ck810v", |
| 187 | .description = "CSKY ck810v processors", | 187 | .description = "CSKY ck810v processors", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@enumToInt(Feature.ck860)] = .{ | 190 | result[@intFromEnum(Feature.ck860)] = .{ |
| 191 | .llvm_name = "ck860", | 191 | .llvm_name = "ck860", |
| 192 | .description = "CSKY ck860 processors", | 192 | .description = "CSKY ck860 processors", |
| 193 | .dependencies = featureSet(&[_]Feature{}), | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | }; | 194 | }; |
| 195 | result[@enumToInt(Feature.ck860v)] = .{ | 195 | result[@intFromEnum(Feature.ck860v)] = .{ |
| 196 | .llvm_name = "ck860v", | 196 | .llvm_name = "ck860v", |
| 197 | .description = "CSKY ck860v processors", | 197 | .description = "CSKY ck860v processors", |
| 198 | .dependencies = featureSet(&[_]Feature{}), | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | }; | 199 | }; |
| 200 | result[@enumToInt(Feature.constpool)] = .{ | 200 | result[@intFromEnum(Feature.constpool)] = .{ |
| 201 | .llvm_name = "constpool", | 201 | .llvm_name = "constpool", |
| 202 | .description = "Dump the constant pool by compiler", | 202 | .description = "Dump the constant pool by compiler", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@enumToInt(Feature.doloop)] = .{ | 205 | result[@intFromEnum(Feature.doloop)] = .{ |
| 206 | .llvm_name = "doloop", | 206 | .llvm_name = "doloop", |
| 207 | .description = "Enable doloop instructions", | 207 | .description = "Enable doloop instructions", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@enumToInt(Feature.dsp1e2)] = .{ | 210 | result[@intFromEnum(Feature.dsp1e2)] = .{ |
| 211 | .llvm_name = "dsp1e2", | 211 | .llvm_name = "dsp1e2", |
| 212 | .description = "Support CSKY dsp1e2 instructions", | 212 | .description = "Support CSKY dsp1e2 instructions", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@enumToInt(Feature.dsp_silan)] = .{ | 215 | result[@intFromEnum(Feature.dsp_silan)] = .{ |
| 216 | .llvm_name = "dsp_silan", | 216 | .llvm_name = "dsp_silan", |
| 217 | .description = "Enable DSP Silan instructions", | 217 | .description = "Enable DSP Silan instructions", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@enumToInt(Feature.dspe60)] = .{ | 220 | result[@intFromEnum(Feature.dspe60)] = .{ |
| 221 | .llvm_name = "dspe60", | 221 | .llvm_name = "dspe60", |
| 222 | .description = "Support CSKY dspe60 instructions", | 222 | .description = "Support CSKY dspe60 instructions", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@enumToInt(Feature.dspv2)] = .{ | 225 | result[@intFromEnum(Feature.dspv2)] = .{ |
| 226 | .llvm_name = "dspv2", | 226 | .llvm_name = "dspv2", |
| 227 | .description = "Enable DSP V2.0 instructions", | 227 | .description = "Enable DSP V2.0 instructions", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@enumToInt(Feature.e1)] = .{ | 230 | result[@intFromEnum(Feature.e1)] = .{ |
| 231 | .llvm_name = "e1", | 231 | .llvm_name = "e1", |
| 232 | .description = "Support CSKY e1 instructions", | 232 | .description = "Support CSKY e1 instructions", |
| 233 | .dependencies = featureSet(&[_]Feature{ | 233 | .dependencies = featureSet(&[_]Feature{ |
| 234 | .elrw, | 234 | .elrw, |
| 235 | }), | 235 | }), |
| 236 | }; | 236 | }; |
| 237 | result[@enumToInt(Feature.e2)] = .{ | 237 | result[@intFromEnum(Feature.e2)] = .{ |
| 238 | .llvm_name = "e2", | 238 | .llvm_name = "e2", |
| 239 | .description = "Support CSKY e2 instructions", | 239 | .description = "Support CSKY e2 instructions", |
| 240 | .dependencies = featureSet(&[_]Feature{ | 240 | .dependencies = featureSet(&[_]Feature{ |
| 241 | .e1, | 241 | .e1, |
| 242 | }), | 242 | }), |
| 243 | }; | 243 | }; |
| 244 | result[@enumToInt(Feature.edsp)] = .{ | 244 | result[@intFromEnum(Feature.edsp)] = .{ |
| 245 | .llvm_name = "edsp", | 245 | .llvm_name = "edsp", |
| 246 | .description = "Enable DSP instructions", | 246 | .description = "Enable DSP instructions", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@enumToInt(Feature.elrw)] = .{ | 249 | result[@intFromEnum(Feature.elrw)] = .{ |
| 250 | .llvm_name = "elrw", | 250 | .llvm_name = "elrw", |
| 251 | .description = "Use the extend LRW instruction", | 251 | .description = "Use the extend LRW instruction", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@enumToInt(Feature.fdivdu)] = .{ | 254 | result[@intFromEnum(Feature.fdivdu)] = .{ |
| 255 | .llvm_name = "fdivdu", | 255 | .llvm_name = "fdivdu", |
| 256 | .description = "Enable float divide instructions", | 256 | .description = "Enable float divide instructions", |
| 257 | .dependencies = featureSet(&[_]Feature{}), | 257 | .dependencies = featureSet(&[_]Feature{}), |
| 258 | }; | 258 | }; |
| 259 | result[@enumToInt(Feature.float1e2)] = .{ | 259 | result[@intFromEnum(Feature.float1e2)] = .{ |
| 260 | .llvm_name = "float1e2", | 260 | .llvm_name = "float1e2", |
| 261 | .description = "Support CSKY float1e2 instructions", | 261 | .description = "Support CSKY float1e2 instructions", |
| 262 | .dependencies = featureSet(&[_]Feature{}), | 262 | .dependencies = featureSet(&[_]Feature{}), |
| 263 | }; | 263 | }; |
| 264 | result[@enumToInt(Feature.float1e3)] = .{ | 264 | result[@intFromEnum(Feature.float1e3)] = .{ |
| 265 | .llvm_name = "float1e3", | 265 | .llvm_name = "float1e3", |
| 266 | .description = "Support CSKY float1e3 instructions", | 266 | .description = "Support CSKY float1e3 instructions", |
| 267 | .dependencies = featureSet(&[_]Feature{}), | 267 | .dependencies = featureSet(&[_]Feature{}), |
| 268 | }; | 268 | }; |
| 269 | result[@enumToInt(Feature.float3e4)] = .{ | 269 | result[@intFromEnum(Feature.float3e4)] = .{ |
| 270 | .llvm_name = "float3e4", | 270 | .llvm_name = "float3e4", |
| 271 | .description = "Support CSKY float3e4 instructions", | 271 | .description = "Support CSKY float3e4 instructions", |
| 272 | .dependencies = featureSet(&[_]Feature{}), | 272 | .dependencies = featureSet(&[_]Feature{}), |
| 273 | }; | 273 | }; |
| 274 | result[@enumToInt(Feature.float7e60)] = .{ | 274 | result[@intFromEnum(Feature.float7e60)] = .{ |
| 275 | .llvm_name = "float7e60", | 275 | .llvm_name = "float7e60", |
| 276 | .description = "Support CSKY float7e60 instructions", | 276 | .description = "Support CSKY float7e60 instructions", |
| 277 | .dependencies = featureSet(&[_]Feature{}), | 277 | .dependencies = featureSet(&[_]Feature{}), |
| 278 | }; | 278 | }; |
| 279 | result[@enumToInt(Feature.floate1)] = .{ | 279 | result[@intFromEnum(Feature.floate1)] = .{ |
| 280 | .llvm_name = "floate1", | 280 | .llvm_name = "floate1", |
| 281 | .description = "Support CSKY floate1 instructions", | 281 | .description = "Support CSKY floate1 instructions", |
| 282 | .dependencies = featureSet(&[_]Feature{}), | 282 | .dependencies = featureSet(&[_]Feature{}), |
| 283 | }; | 283 | }; |
| 284 | result[@enumToInt(Feature.fpuv2_df)] = .{ | 284 | result[@intFromEnum(Feature.fpuv2_df)] = .{ |
| 285 | .llvm_name = "fpuv2_df", | 285 | .llvm_name = "fpuv2_df", |
| 286 | .description = "Enable FPUv2 double float instructions", | 286 | .description = "Enable FPUv2 double float instructions", |
| 287 | .dependencies = featureSet(&[_]Feature{}), | 287 | .dependencies = featureSet(&[_]Feature{}), |
| 288 | }; | 288 | }; |
| 289 | result[@enumToInt(Feature.fpuv2_sf)] = .{ | 289 | result[@intFromEnum(Feature.fpuv2_sf)] = .{ |
| 290 | .llvm_name = "fpuv2_sf", | 290 | .llvm_name = "fpuv2_sf", |
| 291 | .description = "Enable FPUv2 single float instructions", | 291 | .description = "Enable FPUv2 single float instructions", |
| 292 | .dependencies = featureSet(&[_]Feature{}), | 292 | .dependencies = featureSet(&[_]Feature{}), |
| 293 | }; | 293 | }; |
| 294 | result[@enumToInt(Feature.fpuv3_df)] = .{ | 294 | result[@intFromEnum(Feature.fpuv3_df)] = .{ |
| 295 | .llvm_name = "fpuv3_df", | 295 | .llvm_name = "fpuv3_df", |
| 296 | .description = "Enable FPUv3 double float instructions", | 296 | .description = "Enable FPUv3 double float instructions", |
| 297 | .dependencies = featureSet(&[_]Feature{}), | 297 | .dependencies = featureSet(&[_]Feature{}), |
| 298 | }; | 298 | }; |
| 299 | result[@enumToInt(Feature.fpuv3_hf)] = .{ | 299 | result[@intFromEnum(Feature.fpuv3_hf)] = .{ |
| 300 | .llvm_name = "fpuv3_hf", | 300 | .llvm_name = "fpuv3_hf", |
| 301 | .description = "Enable FPUv3 harf precision operate instructions", | 301 | .description = "Enable FPUv3 harf precision operate instructions", |
| 302 | .dependencies = featureSet(&[_]Feature{}), | 302 | .dependencies = featureSet(&[_]Feature{}), |
| 303 | }; | 303 | }; |
| 304 | result[@enumToInt(Feature.fpuv3_hi)] = .{ | 304 | result[@intFromEnum(Feature.fpuv3_hi)] = .{ |
| 305 | .llvm_name = "fpuv3_hi", | 305 | .llvm_name = "fpuv3_hi", |
| 306 | .description = "Enable FPUv3 harf word converting instructions", | 306 | .description = "Enable FPUv3 harf word converting instructions", |
| 307 | .dependencies = featureSet(&[_]Feature{}), | 307 | .dependencies = featureSet(&[_]Feature{}), |
| 308 | }; | 308 | }; |
| 309 | result[@enumToInt(Feature.fpuv3_sf)] = .{ | 309 | result[@intFromEnum(Feature.fpuv3_sf)] = .{ |
| 310 | .llvm_name = "fpuv3_sf", | 310 | .llvm_name = "fpuv3_sf", |
| 311 | .description = "Enable FPUv3 single float instructions", | 311 | .description = "Enable FPUv3 single float instructions", |
| 312 | .dependencies = featureSet(&[_]Feature{}), | 312 | .dependencies = featureSet(&[_]Feature{}), |
| 313 | }; | 313 | }; |
| 314 | result[@enumToInt(Feature.hard_float)] = .{ | 314 | result[@intFromEnum(Feature.hard_float)] = .{ |
| 315 | .llvm_name = "hard-float", | 315 | .llvm_name = "hard-float", |
| 316 | .description = "Use hard floating point features", | 316 | .description = "Use hard floating point features", |
| 317 | .dependencies = featureSet(&[_]Feature{}), | 317 | .dependencies = featureSet(&[_]Feature{}), |
| 318 | }; | 318 | }; |
| 319 | result[@enumToInt(Feature.hard_float_abi)] = .{ | 319 | result[@intFromEnum(Feature.hard_float_abi)] = .{ |
| 320 | .llvm_name = "hard-float-abi", | 320 | .llvm_name = "hard-float-abi", |
| 321 | .description = "Use hard floating point ABI to pass args", | 321 | .description = "Use hard floating point ABI to pass args", |
| 322 | .dependencies = featureSet(&[_]Feature{}), | 322 | .dependencies = featureSet(&[_]Feature{}), |
| 323 | }; | 323 | }; |
| 324 | result[@enumToInt(Feature.hard_tp)] = .{ | 324 | result[@intFromEnum(Feature.hard_tp)] = .{ |
| 325 | .llvm_name = "hard-tp", | 325 | .llvm_name = "hard-tp", |
| 326 | .description = "Enable TLS Pointer register", | 326 | .description = "Enable TLS Pointer register", |
| 327 | .dependencies = featureSet(&[_]Feature{}), | 327 | .dependencies = featureSet(&[_]Feature{}), |
| 328 | }; | 328 | }; |
| 329 | result[@enumToInt(Feature.high_registers)] = .{ | 329 | result[@intFromEnum(Feature.high_registers)] = .{ |
| 330 | .llvm_name = "high-registers", | 330 | .llvm_name = "high-registers", |
| 331 | .description = "Enable r16-r31 registers", | 331 | .description = "Enable r16-r31 registers", |
| 332 | .dependencies = featureSet(&[_]Feature{}), | 332 | .dependencies = featureSet(&[_]Feature{}), |
| 333 | }; | 333 | }; |
| 334 | result[@enumToInt(Feature.hwdiv)] = .{ | 334 | result[@intFromEnum(Feature.hwdiv)] = .{ |
| 335 | .llvm_name = "hwdiv", | 335 | .llvm_name = "hwdiv", |
| 336 | .description = "Enable divide instructions", | 336 | .description = "Enable divide instructions", |
| 337 | .dependencies = featureSet(&[_]Feature{}), | 337 | .dependencies = featureSet(&[_]Feature{}), |
| 338 | }; | 338 | }; |
| 339 | result[@enumToInt(Feature.istack)] = .{ | 339 | result[@intFromEnum(Feature.istack)] = .{ |
| 340 | .llvm_name = "istack", | 340 | .llvm_name = "istack", |
| 341 | .description = "Enable interrupt attribute", | 341 | .description = "Enable interrupt attribute", |
| 342 | .dependencies = featureSet(&[_]Feature{}), | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | }; | 343 | }; |
| 344 | result[@enumToInt(Feature.java)] = .{ | 344 | result[@intFromEnum(Feature.java)] = .{ |
| 345 | .llvm_name = "java", | 345 | .llvm_name = "java", |
| 346 | .description = "Enable java instructions", | 346 | .description = "Enable java instructions", |
| 347 | .dependencies = featureSet(&[_]Feature{}), | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | }; | 348 | }; |
| 349 | result[@enumToInt(Feature.mp)] = .{ | 349 | result[@intFromEnum(Feature.mp)] = .{ |
| 350 | .llvm_name = "mp", | 350 | .llvm_name = "mp", |
| 351 | .description = "Support CSKY mp instructions", | 351 | .description = "Support CSKY mp instructions", |
| 352 | .dependencies = featureSet(&[_]Feature{ | 352 | .dependencies = featureSet(&[_]Feature{ |
| 353 | .@"2e3", | 353 | .@"2e3", |
| 354 | }), | 354 | }), |
| 355 | }; | 355 | }; |
| 356 | result[@enumToInt(Feature.mp1e2)] = .{ | 356 | result[@intFromEnum(Feature.mp1e2)] = .{ |
| 357 | .llvm_name = "mp1e2", | 357 | .llvm_name = "mp1e2", |
| 358 | .description = "Support CSKY mp1e2 instructions", | 358 | .description = "Support CSKY mp1e2 instructions", |
| 359 | .dependencies = featureSet(&[_]Feature{ | 359 | .dependencies = featureSet(&[_]Feature{ |
| 360 | .@"3e7", | 360 | .@"3e7", |
| 361 | }), | 361 | }), |
| 362 | }; | 362 | }; |
| 363 | result[@enumToInt(Feature.multiple_stld)] = .{ | 363 | result[@intFromEnum(Feature.multiple_stld)] = .{ |
| 364 | .llvm_name = "multiple_stld", | 364 | .llvm_name = "multiple_stld", |
| 365 | .description = "Enable multiple load/store instructions", | 365 | .description = "Enable multiple load/store instructions", |
| 366 | .dependencies = featureSet(&[_]Feature{}), | 366 | .dependencies = featureSet(&[_]Feature{}), |
| 367 | }; | 367 | }; |
| 368 | result[@enumToInt(Feature.nvic)] = .{ | 368 | result[@intFromEnum(Feature.nvic)] = .{ |
| 369 | .llvm_name = "nvic", | 369 | .llvm_name = "nvic", |
| 370 | .description = "Enable NVIC", | 370 | .description = "Enable NVIC", |
| 371 | .dependencies = featureSet(&[_]Feature{}), | 371 | .dependencies = featureSet(&[_]Feature{}), |
| 372 | }; | 372 | }; |
| 373 | result[@enumToInt(Feature.pushpop)] = .{ | 373 | result[@intFromEnum(Feature.pushpop)] = .{ |
| 374 | .llvm_name = "pushpop", | 374 | .llvm_name = "pushpop", |
| 375 | .description = "Enable push/pop instructions", | 375 | .description = "Enable push/pop instructions", |
| 376 | .dependencies = featureSet(&[_]Feature{}), | 376 | .dependencies = featureSet(&[_]Feature{}), |
| 377 | }; | 377 | }; |
| 378 | result[@enumToInt(Feature.smart)] = .{ | 378 | result[@intFromEnum(Feature.smart)] = .{ |
| 379 | .llvm_name = "smart", | 379 | .llvm_name = "smart", |
| 380 | .description = "Let CPU work in Smart Mode", | 380 | .description = "Let CPU work in Smart Mode", |
| 381 | .dependencies = featureSet(&[_]Feature{}), | 381 | .dependencies = featureSet(&[_]Feature{}), |
| 382 | }; | 382 | }; |
| 383 | result[@enumToInt(Feature.soft_tp)] = .{ | 383 | result[@intFromEnum(Feature.soft_tp)] = .{ |
| 384 | .llvm_name = "soft-tp", | 384 | .llvm_name = "soft-tp", |
| 385 | .description = "Disable TLS Pointer register", | 385 | .description = "Disable TLS Pointer register", |
| 386 | .dependencies = featureSet(&[_]Feature{}), | 386 | .dependencies = featureSet(&[_]Feature{}), |
| 387 | }; | 387 | }; |
| 388 | result[@enumToInt(Feature.stack_size)] = .{ | 388 | result[@intFromEnum(Feature.stack_size)] = .{ |
| 389 | .llvm_name = "stack-size", | 389 | .llvm_name = "stack-size", |
| 390 | .description = "Output stack size information", | 390 | .description = "Output stack size information", |
| 391 | .dependencies = featureSet(&[_]Feature{}), | 391 | .dependencies = featureSet(&[_]Feature{}), |
| 392 | }; | 392 | }; |
| 393 | result[@enumToInt(Feature.trust)] = .{ | 393 | result[@intFromEnum(Feature.trust)] = .{ |
| 394 | .llvm_name = "trust", | 394 | .llvm_name = "trust", |
| 395 | .description = "Enable trust instructions", | 395 | .description = "Enable trust instructions", |
| 396 | .dependencies = featureSet(&[_]Feature{}), | 396 | .dependencies = featureSet(&[_]Feature{}), |
| 397 | }; | 397 | }; |
| 398 | result[@enumToInt(Feature.vdsp2e3)] = .{ | 398 | result[@intFromEnum(Feature.vdsp2e3)] = .{ |
| 399 | .llvm_name = "vdsp2e3", | 399 | .llvm_name = "vdsp2e3", |
| 400 | .description = "Support CSKY vdsp2e3 instructions", | 400 | .description = "Support CSKY vdsp2e3 instructions", |
| 401 | .dependencies = featureSet(&[_]Feature{}), | 401 | .dependencies = featureSet(&[_]Feature{}), |
| 402 | }; | 402 | }; |
| 403 | result[@enumToInt(Feature.vdsp2e60f)] = .{ | 403 | result[@intFromEnum(Feature.vdsp2e60f)] = .{ |
| 404 | .llvm_name = "vdsp2e60f", | 404 | .llvm_name = "vdsp2e60f", |
| 405 | .description = "Support CSKY vdsp2e60f instructions", | 405 | .description = "Support CSKY vdsp2e60f instructions", |
| 406 | .dependencies = featureSet(&[_]Feature{}), | 406 | .dependencies = featureSet(&[_]Feature{}), |
| 407 | }; | 407 | }; |
| 408 | result[@enumToInt(Feature.vdspv1)] = .{ | 408 | result[@intFromEnum(Feature.vdspv1)] = .{ |
| 409 | .llvm_name = "vdspv1", | 409 | .llvm_name = "vdspv1", |
| 410 | .description = "Enable 128bit vdsp-v1 instructions", | 410 | .description = "Enable 128bit vdsp-v1 instructions", |
| 411 | .dependencies = featureSet(&[_]Feature{}), | 411 | .dependencies = featureSet(&[_]Feature{}), |
| 412 | }; | 412 | }; |
| 413 | result[@enumToInt(Feature.vdspv2)] = .{ | 413 | result[@intFromEnum(Feature.vdspv2)] = .{ |
| 414 | .llvm_name = "vdspv2", | 414 | .llvm_name = "vdspv2", |
| 415 | .description = "Enable vdsp-v2 instructions", | 415 | .description = "Enable vdsp-v2 instructions", |
| 416 | .dependencies = featureSet(&[_]Feature{}), | 416 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/hexagon.zig+42-42| ... | @@ -58,77 +58,77 @@ pub const all_features = blk: { | ... | @@ -58,77 +58,77 @@ pub const all_features = blk: { |
| 58 | const len = @typeInfo(Feature).Enum.fields.len; | 58 | const len = @typeInfo(Feature).Enum.fields.len; |
| 59 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 59 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 60 | var result: [len]CpuFeature = undefined; | 60 | var result: [len]CpuFeature = undefined; |
| 61 | result[@enumToInt(Feature.audio)] = .{ | 61 | result[@intFromEnum(Feature.audio)] = .{ |
| 62 | .llvm_name = "audio", | 62 | .llvm_name = "audio", |
| 63 | .description = "Hexagon Audio extension instructions", | 63 | .description = "Hexagon Audio extension instructions", |
| 64 | .dependencies = featureSet(&[_]Feature{}), | 64 | .dependencies = featureSet(&[_]Feature{}), |
| 65 | }; | 65 | }; |
| 66 | result[@enumToInt(Feature.cabac)] = .{ | 66 | result[@intFromEnum(Feature.cabac)] = .{ |
| 67 | .llvm_name = "cabac", | 67 | .llvm_name = "cabac", |
| 68 | .description = "Emit the CABAC instruction", | 68 | .description = "Emit the CABAC instruction", |
| 69 | .dependencies = featureSet(&[_]Feature{}), | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | }; | 70 | }; |
| 71 | result[@enumToInt(Feature.compound)] = .{ | 71 | result[@intFromEnum(Feature.compound)] = .{ |
| 72 | .llvm_name = "compound", | 72 | .llvm_name = "compound", |
| 73 | .description = "Use compound instructions", | 73 | .description = "Use compound instructions", |
| 74 | .dependencies = featureSet(&[_]Feature{}), | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | }; | 75 | }; |
| 76 | result[@enumToInt(Feature.duplex)] = .{ | 76 | result[@intFromEnum(Feature.duplex)] = .{ |
| 77 | .llvm_name = "duplex", | 77 | .llvm_name = "duplex", |
| 78 | .description = "Enable generation of duplex instruction", | 78 | .description = "Enable generation of duplex instruction", |
| 79 | .dependencies = featureSet(&[_]Feature{}), | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | }; | 80 | }; |
| 81 | result[@enumToInt(Feature.hvx)] = .{ | 81 | result[@intFromEnum(Feature.hvx)] = .{ |
| 82 | .llvm_name = "hvx", | 82 | .llvm_name = "hvx", |
| 83 | .description = "Hexagon HVX instructions", | 83 | .description = "Hexagon HVX instructions", |
| 84 | .dependencies = featureSet(&[_]Feature{}), | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | }; | 85 | }; |
| 86 | result[@enumToInt(Feature.hvx_ieee_fp)] = .{ | 86 | result[@intFromEnum(Feature.hvx_ieee_fp)] = .{ |
| 87 | .llvm_name = "hvx-ieee-fp", | 87 | .llvm_name = "hvx-ieee-fp", |
| 88 | .description = "Hexagon HVX IEEE floating point instructions", | 88 | .description = "Hexagon HVX IEEE floating point instructions", |
| 89 | .dependencies = featureSet(&[_]Feature{}), | 89 | .dependencies = featureSet(&[_]Feature{}), |
| 90 | }; | 90 | }; |
| 91 | result[@enumToInt(Feature.hvx_length128b)] = .{ | 91 | result[@intFromEnum(Feature.hvx_length128b)] = .{ |
| 92 | .llvm_name = "hvx-length128b", | 92 | .llvm_name = "hvx-length128b", |
| 93 | .description = "Hexagon HVX 128B instructions", | 93 | .description = "Hexagon HVX 128B instructions", |
| 94 | .dependencies = featureSet(&[_]Feature{ | 94 | .dependencies = featureSet(&[_]Feature{ |
| 95 | .hvx, | 95 | .hvx, |
| 96 | }), | 96 | }), |
| 97 | }; | 97 | }; |
| 98 | result[@enumToInt(Feature.hvx_length64b)] = .{ | 98 | result[@intFromEnum(Feature.hvx_length64b)] = .{ |
| 99 | .llvm_name = "hvx-length64b", | 99 | .llvm_name = "hvx-length64b", |
| 100 | .description = "Hexagon HVX 64B instructions", | 100 | .description = "Hexagon HVX 64B instructions", |
| 101 | .dependencies = featureSet(&[_]Feature{ | 101 | .dependencies = featureSet(&[_]Feature{ |
| 102 | .hvx, | 102 | .hvx, |
| 103 | }), | 103 | }), |
| 104 | }; | 104 | }; |
| 105 | result[@enumToInt(Feature.hvx_qfloat)] = .{ | 105 | result[@intFromEnum(Feature.hvx_qfloat)] = .{ |
| 106 | .llvm_name = "hvx-qfloat", | 106 | .llvm_name = "hvx-qfloat", |
| 107 | .description = "Hexagon HVX QFloating point instructions", | 107 | .description = "Hexagon HVX QFloating point instructions", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@enumToInt(Feature.hvxv60)] = .{ | 110 | result[@intFromEnum(Feature.hvxv60)] = .{ |
| 111 | .llvm_name = "hvxv60", | 111 | .llvm_name = "hvxv60", |
| 112 | .description = "Hexagon HVX instructions", | 112 | .description = "Hexagon HVX instructions", |
| 113 | .dependencies = featureSet(&[_]Feature{ | 113 | .dependencies = featureSet(&[_]Feature{ |
| 114 | .hvx, | 114 | .hvx, |
| 115 | }), | 115 | }), |
| 116 | }; | 116 | }; |
| 117 | result[@enumToInt(Feature.hvxv62)] = .{ | 117 | result[@intFromEnum(Feature.hvxv62)] = .{ |
| 118 | .llvm_name = "hvxv62", | 118 | .llvm_name = "hvxv62", |
| 119 | .description = "Hexagon HVX instructions", | 119 | .description = "Hexagon HVX instructions", |
| 120 | .dependencies = featureSet(&[_]Feature{ | 120 | .dependencies = featureSet(&[_]Feature{ |
| 121 | .hvxv60, | 121 | .hvxv60, |
| 122 | }), | 122 | }), |
| 123 | }; | 123 | }; |
| 124 | result[@enumToInt(Feature.hvxv65)] = .{ | 124 | result[@intFromEnum(Feature.hvxv65)] = .{ |
| 125 | .llvm_name = "hvxv65", | 125 | .llvm_name = "hvxv65", |
| 126 | .description = "Hexagon HVX instructions", | 126 | .description = "Hexagon HVX instructions", |
| 127 | .dependencies = featureSet(&[_]Feature{ | 127 | .dependencies = featureSet(&[_]Feature{ |
| 128 | .hvxv62, | 128 | .hvxv62, |
| 129 | }), | 129 | }), |
| 130 | }; | 130 | }; |
| 131 | result[@enumToInt(Feature.hvxv66)] = .{ | 131 | result[@intFromEnum(Feature.hvxv66)] = .{ |
| 132 | .llvm_name = "hvxv66", | 132 | .llvm_name = "hvxv66", |
| 133 | .description = "Hexagon HVX instructions", | 133 | .description = "Hexagon HVX instructions", |
| 134 | .dependencies = featureSet(&[_]Feature{ | 134 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -136,161 +136,161 @@ pub const all_features = blk: { | ... | @@ -136,161 +136,161 @@ pub const all_features = blk: { |
| 136 | .zreg, | 136 | .zreg, |
| 137 | }), | 137 | }), |
| 138 | }; | 138 | }; |
| 139 | result[@enumToInt(Feature.hvxv67)] = .{ | 139 | result[@intFromEnum(Feature.hvxv67)] = .{ |
| 140 | .llvm_name = "hvxv67", | 140 | .llvm_name = "hvxv67", |
| 141 | .description = "Hexagon HVX instructions", | 141 | .description = "Hexagon HVX instructions", |
| 142 | .dependencies = featureSet(&[_]Feature{ | 142 | .dependencies = featureSet(&[_]Feature{ |
| 143 | .hvxv66, | 143 | .hvxv66, |
| 144 | }), | 144 | }), |
| 145 | }; | 145 | }; |
| 146 | result[@enumToInt(Feature.hvxv68)] = .{ | 146 | result[@intFromEnum(Feature.hvxv68)] = .{ |
| 147 | .llvm_name = "hvxv68", | 147 | .llvm_name = "hvxv68", |
| 148 | .description = "Hexagon HVX instructions", | 148 | .description = "Hexagon HVX instructions", |
| 149 | .dependencies = featureSet(&[_]Feature{ | 149 | .dependencies = featureSet(&[_]Feature{ |
| 150 | .hvxv67, | 150 | .hvxv67, |
| 151 | }), | 151 | }), |
| 152 | }; | 152 | }; |
| 153 | result[@enumToInt(Feature.hvxv69)] = .{ | 153 | result[@intFromEnum(Feature.hvxv69)] = .{ |
| 154 | .llvm_name = "hvxv69", | 154 | .llvm_name = "hvxv69", |
| 155 | .description = "Hexagon HVX instructions", | 155 | .description = "Hexagon HVX instructions", |
| 156 | .dependencies = featureSet(&[_]Feature{ | 156 | .dependencies = featureSet(&[_]Feature{ |
| 157 | .hvxv68, | 157 | .hvxv68, |
| 158 | }), | 158 | }), |
| 159 | }; | 159 | }; |
| 160 | result[@enumToInt(Feature.hvxv71)] = .{ | 160 | result[@intFromEnum(Feature.hvxv71)] = .{ |
| 161 | .llvm_name = "hvxv71", | 161 | .llvm_name = "hvxv71", |
| 162 | .description = "Hexagon HVX instructions", | 162 | .description = "Hexagon HVX instructions", |
| 163 | .dependencies = featureSet(&[_]Feature{ | 163 | .dependencies = featureSet(&[_]Feature{ |
| 164 | .hvxv69, | 164 | .hvxv69, |
| 165 | }), | 165 | }), |
| 166 | }; | 166 | }; |
| 167 | result[@enumToInt(Feature.hvxv73)] = .{ | 167 | result[@intFromEnum(Feature.hvxv73)] = .{ |
| 168 | .llvm_name = "hvxv73", | 168 | .llvm_name = "hvxv73", |
| 169 | .description = "Hexagon HVX instructions", | 169 | .description = "Hexagon HVX instructions", |
| 170 | .dependencies = featureSet(&[_]Feature{ | 170 | .dependencies = featureSet(&[_]Feature{ |
| 171 | .hvxv71, | 171 | .hvxv71, |
| 172 | }), | 172 | }), |
| 173 | }; | 173 | }; |
| 174 | result[@enumToInt(Feature.long_calls)] = .{ | 174 | result[@intFromEnum(Feature.long_calls)] = .{ |
| 175 | .llvm_name = "long-calls", | 175 | .llvm_name = "long-calls", |
| 176 | .description = "Use constant-extended calls", | 176 | .description = "Use constant-extended calls", |
| 177 | .dependencies = featureSet(&[_]Feature{}), | 177 | .dependencies = featureSet(&[_]Feature{}), |
| 178 | }; | 178 | }; |
| 179 | result[@enumToInt(Feature.mem_noshuf)] = .{ | 179 | result[@intFromEnum(Feature.mem_noshuf)] = .{ |
| 180 | .llvm_name = "mem_noshuf", | 180 | .llvm_name = "mem_noshuf", |
| 181 | .description = "Supports mem_noshuf feature", | 181 | .description = "Supports mem_noshuf feature", |
| 182 | .dependencies = featureSet(&[_]Feature{}), | 182 | .dependencies = featureSet(&[_]Feature{}), |
| 183 | }; | 183 | }; |
| 184 | result[@enumToInt(Feature.memops)] = .{ | 184 | result[@intFromEnum(Feature.memops)] = .{ |
| 185 | .llvm_name = "memops", | 185 | .llvm_name = "memops", |
| 186 | .description = "Use memop instructions", | 186 | .description = "Use memop instructions", |
| 187 | .dependencies = featureSet(&[_]Feature{}), | 187 | .dependencies = featureSet(&[_]Feature{}), |
| 188 | }; | 188 | }; |
| 189 | result[@enumToInt(Feature.noreturn_stack_elim)] = .{ | 189 | result[@intFromEnum(Feature.noreturn_stack_elim)] = .{ |
| 190 | .llvm_name = "noreturn-stack-elim", | 190 | .llvm_name = "noreturn-stack-elim", |
| 191 | .description = "Eliminate stack allocation in a noreturn function when possible", | 191 | .description = "Eliminate stack allocation in a noreturn function when possible", |
| 192 | .dependencies = featureSet(&[_]Feature{}), | 192 | .dependencies = featureSet(&[_]Feature{}), |
| 193 | }; | 193 | }; |
| 194 | result[@enumToInt(Feature.nvj)] = .{ | 194 | result[@intFromEnum(Feature.nvj)] = .{ |
| 195 | .llvm_name = "nvj", | 195 | .llvm_name = "nvj", |
| 196 | .description = "Support for new-value jumps", | 196 | .description = "Support for new-value jumps", |
| 197 | .dependencies = featureSet(&[_]Feature{ | 197 | .dependencies = featureSet(&[_]Feature{ |
| 198 | .packets, | 198 | .packets, |
| 199 | }), | 199 | }), |
| 200 | }; | 200 | }; |
| 201 | result[@enumToInt(Feature.nvs)] = .{ | 201 | result[@intFromEnum(Feature.nvs)] = .{ |
| 202 | .llvm_name = "nvs", | 202 | .llvm_name = "nvs", |
| 203 | .description = "Support for new-value stores", | 203 | .description = "Support for new-value stores", |
| 204 | .dependencies = featureSet(&[_]Feature{ | 204 | .dependencies = featureSet(&[_]Feature{ |
| 205 | .packets, | 205 | .packets, |
| 206 | }), | 206 | }), |
| 207 | }; | 207 | }; |
| 208 | result[@enumToInt(Feature.packets)] = .{ | 208 | result[@intFromEnum(Feature.packets)] = .{ |
| 209 | .llvm_name = "packets", | 209 | .llvm_name = "packets", |
| 210 | .description = "Support for instruction packets", | 210 | .description = "Support for instruction packets", |
| 211 | .dependencies = featureSet(&[_]Feature{}), | 211 | .dependencies = featureSet(&[_]Feature{}), |
| 212 | }; | 212 | }; |
| 213 | result[@enumToInt(Feature.prev65)] = .{ | 213 | result[@intFromEnum(Feature.prev65)] = .{ |
| 214 | .llvm_name = "prev65", | 214 | .llvm_name = "prev65", |
| 215 | .description = "Support features deprecated in v65", | 215 | .description = "Support features deprecated in v65", |
| 216 | .dependencies = featureSet(&[_]Feature{}), | 216 | .dependencies = featureSet(&[_]Feature{}), |
| 217 | }; | 217 | }; |
| 218 | result[@enumToInt(Feature.reserved_r19)] = .{ | 218 | result[@intFromEnum(Feature.reserved_r19)] = .{ |
| 219 | .llvm_name = "reserved-r19", | 219 | .llvm_name = "reserved-r19", |
| 220 | .description = "Reserve register R19", | 220 | .description = "Reserve register R19", |
| 221 | .dependencies = featureSet(&[_]Feature{}), | 221 | .dependencies = featureSet(&[_]Feature{}), |
| 222 | }; | 222 | }; |
| 223 | result[@enumToInt(Feature.small_data)] = .{ | 223 | result[@intFromEnum(Feature.small_data)] = .{ |
| 224 | .llvm_name = "small-data", | 224 | .llvm_name = "small-data", |
| 225 | .description = "Allow GP-relative addressing of global variables", | 225 | .description = "Allow GP-relative addressing of global variables", |
| 226 | .dependencies = featureSet(&[_]Feature{}), | 226 | .dependencies = featureSet(&[_]Feature{}), |
| 227 | }; | 227 | }; |
| 228 | result[@enumToInt(Feature.tinycore)] = .{ | 228 | result[@intFromEnum(Feature.tinycore)] = .{ |
| 229 | .llvm_name = "tinycore", | 229 | .llvm_name = "tinycore", |
| 230 | .description = "Hexagon Tiny Core", | 230 | .description = "Hexagon Tiny Core", |
| 231 | .dependencies = featureSet(&[_]Feature{}), | 231 | .dependencies = featureSet(&[_]Feature{}), |
| 232 | }; | 232 | }; |
| 233 | result[@enumToInt(Feature.unsafe_fp)] = .{ | 233 | result[@intFromEnum(Feature.unsafe_fp)] = .{ |
| 234 | .llvm_name = "unsafe-fp", | 234 | .llvm_name = "unsafe-fp", |
| 235 | .description = "Use unsafe FP math", | 235 | .description = "Use unsafe FP math", |
| 236 | .dependencies = featureSet(&[_]Feature{}), | 236 | .dependencies = featureSet(&[_]Feature{}), |
| 237 | }; | 237 | }; |
| 238 | result[@enumToInt(Feature.v5)] = .{ | 238 | result[@intFromEnum(Feature.v5)] = .{ |
| 239 | .llvm_name = "v5", | 239 | .llvm_name = "v5", |
| 240 | .description = "Enable Hexagon V5 architecture", | 240 | .description = "Enable Hexagon V5 architecture", |
| 241 | .dependencies = featureSet(&[_]Feature{}), | 241 | .dependencies = featureSet(&[_]Feature{}), |
| 242 | }; | 242 | }; |
| 243 | result[@enumToInt(Feature.v55)] = .{ | 243 | result[@intFromEnum(Feature.v55)] = .{ |
| 244 | .llvm_name = "v55", | 244 | .llvm_name = "v55", |
| 245 | .description = "Enable Hexagon V55 architecture", | 245 | .description = "Enable Hexagon V55 architecture", |
| 246 | .dependencies = featureSet(&[_]Feature{}), | 246 | .dependencies = featureSet(&[_]Feature{}), |
| 247 | }; | 247 | }; |
| 248 | result[@enumToInt(Feature.v60)] = .{ | 248 | result[@intFromEnum(Feature.v60)] = .{ |
| 249 | .llvm_name = "v60", | 249 | .llvm_name = "v60", |
| 250 | .description = "Enable Hexagon V60 architecture", | 250 | .description = "Enable Hexagon V60 architecture", |
| 251 | .dependencies = featureSet(&[_]Feature{}), | 251 | .dependencies = featureSet(&[_]Feature{}), |
| 252 | }; | 252 | }; |
| 253 | result[@enumToInt(Feature.v62)] = .{ | 253 | result[@intFromEnum(Feature.v62)] = .{ |
| 254 | .llvm_name = "v62", | 254 | .llvm_name = "v62", |
| 255 | .description = "Enable Hexagon V62 architecture", | 255 | .description = "Enable Hexagon V62 architecture", |
| 256 | .dependencies = featureSet(&[_]Feature{}), | 256 | .dependencies = featureSet(&[_]Feature{}), |
| 257 | }; | 257 | }; |
| 258 | result[@enumToInt(Feature.v65)] = .{ | 258 | result[@intFromEnum(Feature.v65)] = .{ |
| 259 | .llvm_name = "v65", | 259 | .llvm_name = "v65", |
| 260 | .description = "Enable Hexagon V65 architecture", | 260 | .description = "Enable Hexagon V65 architecture", |
| 261 | .dependencies = featureSet(&[_]Feature{}), | 261 | .dependencies = featureSet(&[_]Feature{}), |
| 262 | }; | 262 | }; |
| 263 | result[@enumToInt(Feature.v66)] = .{ | 263 | result[@intFromEnum(Feature.v66)] = .{ |
| 264 | .llvm_name = "v66", | 264 | .llvm_name = "v66", |
| 265 | .description = "Enable Hexagon V66 architecture", | 265 | .description = "Enable Hexagon V66 architecture", |
| 266 | .dependencies = featureSet(&[_]Feature{}), | 266 | .dependencies = featureSet(&[_]Feature{}), |
| 267 | }; | 267 | }; |
| 268 | result[@enumToInt(Feature.v67)] = .{ | 268 | result[@intFromEnum(Feature.v67)] = .{ |
| 269 | .llvm_name = "v67", | 269 | .llvm_name = "v67", |
| 270 | .description = "Enable Hexagon V67 architecture", | 270 | .description = "Enable Hexagon V67 architecture", |
| 271 | .dependencies = featureSet(&[_]Feature{}), | 271 | .dependencies = featureSet(&[_]Feature{}), |
| 272 | }; | 272 | }; |
| 273 | result[@enumToInt(Feature.v68)] = .{ | 273 | result[@intFromEnum(Feature.v68)] = .{ |
| 274 | .llvm_name = "v68", | 274 | .llvm_name = "v68", |
| 275 | .description = "Enable Hexagon V68 architecture", | 275 | .description = "Enable Hexagon V68 architecture", |
| 276 | .dependencies = featureSet(&[_]Feature{}), | 276 | .dependencies = featureSet(&[_]Feature{}), |
| 277 | }; | 277 | }; |
| 278 | result[@enumToInt(Feature.v69)] = .{ | 278 | result[@intFromEnum(Feature.v69)] = .{ |
| 279 | .llvm_name = "v69", | 279 | .llvm_name = "v69", |
| 280 | .description = "Enable Hexagon V69 architecture", | 280 | .description = "Enable Hexagon V69 architecture", |
| 281 | .dependencies = featureSet(&[_]Feature{}), | 281 | .dependencies = featureSet(&[_]Feature{}), |
| 282 | }; | 282 | }; |
| 283 | result[@enumToInt(Feature.v71)] = .{ | 283 | result[@intFromEnum(Feature.v71)] = .{ |
| 284 | .llvm_name = "v71", | 284 | .llvm_name = "v71", |
| 285 | .description = "Enable Hexagon V71 architecture", | 285 | .description = "Enable Hexagon V71 architecture", |
| 286 | .dependencies = featureSet(&[_]Feature{}), | 286 | .dependencies = featureSet(&[_]Feature{}), |
| 287 | }; | 287 | }; |
| 288 | result[@enumToInt(Feature.v73)] = .{ | 288 | result[@intFromEnum(Feature.v73)] = .{ |
| 289 | .llvm_name = "v73", | 289 | .llvm_name = "v73", |
| 290 | .description = "Enable Hexagon V73 architecture", | 290 | .description = "Enable Hexagon V73 architecture", |
| 291 | .dependencies = featureSet(&[_]Feature{}), | 291 | .dependencies = featureSet(&[_]Feature{}), |
| 292 | }; | 292 | }; |
| 293 | result[@enumToInt(Feature.zreg)] = .{ | 293 | result[@intFromEnum(Feature.zreg)] = .{ |
| 294 | .llvm_name = "zreg", | 294 | .llvm_name = "zreg", |
| 295 | .description = "Hexagon ZReg extension instructions", | 295 | .description = "Hexagon ZReg extension instructions", |
| 296 | .dependencies = featureSet(&[_]Feature{}), | 296 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/loongarch.zig+11-11| ... | @@ -27,63 +27,63 @@ pub const all_features = blk: { | ... | @@ -27,63 +27,63 @@ pub const all_features = blk: { |
| 27 | const len = @typeInfo(Feature).Enum.fields.len; | 27 | const len = @typeInfo(Feature).Enum.fields.len; |
| 28 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 28 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 29 | var result: [len]CpuFeature = undefined; | 29 | var result: [len]CpuFeature = undefined; |
| 30 | result[@enumToInt(Feature.@"32bit")] = .{ | 30 | result[@intFromEnum(Feature.@"32bit")] = .{ |
| 31 | .llvm_name = "32bit", | 31 | .llvm_name = "32bit", |
| 32 | .description = "LA32 Basic Integer and Privilege Instruction Set", | 32 | .description = "LA32 Basic Integer and Privilege Instruction Set", |
| 33 | .dependencies = featureSet(&[_]Feature{}), | 33 | .dependencies = featureSet(&[_]Feature{}), |
| 34 | }; | 34 | }; |
| 35 | result[@enumToInt(Feature.@"64bit")] = .{ | 35 | result[@intFromEnum(Feature.@"64bit")] = .{ |
| 36 | .llvm_name = "64bit", | 36 | .llvm_name = "64bit", |
| 37 | .description = "LA64 Basic Integer and Privilege Instruction Set", | 37 | .description = "LA64 Basic Integer and Privilege Instruction Set", |
| 38 | .dependencies = featureSet(&[_]Feature{}), | 38 | .dependencies = featureSet(&[_]Feature{}), |
| 39 | }; | 39 | }; |
| 40 | result[@enumToInt(Feature.d)] = .{ | 40 | result[@intFromEnum(Feature.d)] = .{ |
| 41 | .llvm_name = "d", | 41 | .llvm_name = "d", |
| 42 | .description = "'D' (Double-Precision Floating-Point)", | 42 | .description = "'D' (Double-Precision Floating-Point)", |
| 43 | .dependencies = featureSet(&[_]Feature{ | 43 | .dependencies = featureSet(&[_]Feature{ |
| 44 | .f, | 44 | .f, |
| 45 | }), | 45 | }), |
| 46 | }; | 46 | }; |
| 47 | result[@enumToInt(Feature.f)] = .{ | 47 | result[@intFromEnum(Feature.f)] = .{ |
| 48 | .llvm_name = "f", | 48 | .llvm_name = "f", |
| 49 | .description = "'F' (Single-Precision Floating-Point)", | 49 | .description = "'F' (Single-Precision Floating-Point)", |
| 50 | .dependencies = featureSet(&[_]Feature{}), | 50 | .dependencies = featureSet(&[_]Feature{}), |
| 51 | }; | 51 | }; |
| 52 | result[@enumToInt(Feature.la_global_with_abs)] = .{ | 52 | result[@intFromEnum(Feature.la_global_with_abs)] = .{ |
| 53 | .llvm_name = "la-global-with-abs", | 53 | .llvm_name = "la-global-with-abs", |
| 54 | .description = "Expand la.global as la.abs", | 54 | .description = "Expand la.global as la.abs", |
| 55 | .dependencies = featureSet(&[_]Feature{}), | 55 | .dependencies = featureSet(&[_]Feature{}), |
| 56 | }; | 56 | }; |
| 57 | result[@enumToInt(Feature.la_global_with_pcrel)] = .{ | 57 | result[@intFromEnum(Feature.la_global_with_pcrel)] = .{ |
| 58 | .llvm_name = "la-global-with-pcrel", | 58 | .llvm_name = "la-global-with-pcrel", |
| 59 | .description = "Expand la.global as la.pcrel", | 59 | .description = "Expand la.global as la.pcrel", |
| 60 | .dependencies = featureSet(&[_]Feature{}), | 60 | .dependencies = featureSet(&[_]Feature{}), |
| 61 | }; | 61 | }; |
| 62 | result[@enumToInt(Feature.la_local_with_abs)] = .{ | 62 | result[@intFromEnum(Feature.la_local_with_abs)] = .{ |
| 63 | .llvm_name = "la-local-with-abs", | 63 | .llvm_name = "la-local-with-abs", |
| 64 | .description = "Expand la.local as la.abs", | 64 | .description = "Expand la.local as la.abs", |
| 65 | .dependencies = featureSet(&[_]Feature{}), | 65 | .dependencies = featureSet(&[_]Feature{}), |
| 66 | }; | 66 | }; |
| 67 | result[@enumToInt(Feature.lasx)] = .{ | 67 | result[@intFromEnum(Feature.lasx)] = .{ |
| 68 | .llvm_name = "lasx", | 68 | .llvm_name = "lasx", |
| 69 | .description = "'LASX' (Loongson Advanced SIMD Extension)", | 69 | .description = "'LASX' (Loongson Advanced SIMD Extension)", |
| 70 | .dependencies = featureSet(&[_]Feature{ | 70 | .dependencies = featureSet(&[_]Feature{ |
| 71 | .lsx, | 71 | .lsx, |
| 72 | }), | 72 | }), |
| 73 | }; | 73 | }; |
| 74 | result[@enumToInt(Feature.lbt)] = .{ | 74 | result[@intFromEnum(Feature.lbt)] = .{ |
| 75 | .llvm_name = "lbt", | 75 | .llvm_name = "lbt", |
| 76 | .description = "'LBT' (Loongson Binary Translation Extension)", | 76 | .description = "'LBT' (Loongson Binary Translation Extension)", |
| 77 | .dependencies = featureSet(&[_]Feature{}), | 77 | .dependencies = featureSet(&[_]Feature{}), |
| 78 | }; | 78 | }; |
| 79 | result[@enumToInt(Feature.lsx)] = .{ | 79 | result[@intFromEnum(Feature.lsx)] = .{ |
| 80 | .llvm_name = "lsx", | 80 | .llvm_name = "lsx", |
| 81 | .description = "'LSX' (Loongson SIMD Extension)", | 81 | .description = "'LSX' (Loongson SIMD Extension)", |
| 82 | .dependencies = featureSet(&[_]Feature{ | 82 | .dependencies = featureSet(&[_]Feature{ |
| 83 | .d, | 83 | .d, |
| 84 | }), | 84 | }), |
| 85 | }; | 85 | }; |
| 86 | result[@enumToInt(Feature.lvz)] = .{ | 86 | result[@intFromEnum(Feature.lvz)] = .{ |
| 87 | .llvm_name = "lvz", | 87 | .llvm_name = "lvz", |
| 88 | .description = "'LVZ' (Loongson Virtualization Extension)", | 88 | .description = "'LVZ' (Loongson Virtualization Extension)", |
| 89 | .dependencies = featureSet(&[_]Feature{}), | 89 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/m68k.zig+21-21| ... | @@ -37,117 +37,117 @@ pub const all_features = blk: { | ... | @@ -37,117 +37,117 @@ pub const all_features = blk: { |
| 37 | const len = @typeInfo(Feature).Enum.fields.len; | 37 | const len = @typeInfo(Feature).Enum.fields.len; |
| 38 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 38 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 39 | var result: [len]CpuFeature = undefined; | 39 | var result: [len]CpuFeature = undefined; |
| 40 | result[@enumToInt(Feature.isa_68000)] = .{ | 40 | result[@intFromEnum(Feature.isa_68000)] = .{ |
| 41 | .llvm_name = "isa-68000", | 41 | .llvm_name = "isa-68000", |
| 42 | .description = "Is M68000 ISA supported", | 42 | .description = "Is M68000 ISA supported", |
| 43 | .dependencies = featureSet(&[_]Feature{}), | 43 | .dependencies = featureSet(&[_]Feature{}), |
| 44 | }; | 44 | }; |
| 45 | result[@enumToInt(Feature.isa_68010)] = .{ | 45 | result[@intFromEnum(Feature.isa_68010)] = .{ |
| 46 | .llvm_name = "isa-68010", | 46 | .llvm_name = "isa-68010", |
| 47 | .description = "Is M68010 ISA supported", | 47 | .description = "Is M68010 ISA supported", |
| 48 | .dependencies = featureSet(&[_]Feature{ | 48 | .dependencies = featureSet(&[_]Feature{ |
| 49 | .isa_68000, | 49 | .isa_68000, |
| 50 | }), | 50 | }), |
| 51 | }; | 51 | }; |
| 52 | result[@enumToInt(Feature.isa_68020)] = .{ | 52 | result[@intFromEnum(Feature.isa_68020)] = .{ |
| 53 | .llvm_name = "isa-68020", | 53 | .llvm_name = "isa-68020", |
| 54 | .description = "Is M68020 ISA supported", | 54 | .description = "Is M68020 ISA supported", |
| 55 | .dependencies = featureSet(&[_]Feature{ | 55 | .dependencies = featureSet(&[_]Feature{ |
| 56 | .isa_68010, | 56 | .isa_68010, |
| 57 | }), | 57 | }), |
| 58 | }; | 58 | }; |
| 59 | result[@enumToInt(Feature.isa_68030)] = .{ | 59 | result[@intFromEnum(Feature.isa_68030)] = .{ |
| 60 | .llvm_name = "isa-68030", | 60 | .llvm_name = "isa-68030", |
| 61 | .description = "Is M68030 ISA supported", | 61 | .description = "Is M68030 ISA supported", |
| 62 | .dependencies = featureSet(&[_]Feature{ | 62 | .dependencies = featureSet(&[_]Feature{ |
| 63 | .isa_68020, | 63 | .isa_68020, |
| 64 | }), | 64 | }), |
| 65 | }; | 65 | }; |
| 66 | result[@enumToInt(Feature.isa_68040)] = .{ | 66 | result[@intFromEnum(Feature.isa_68040)] = .{ |
| 67 | .llvm_name = "isa-68040", | 67 | .llvm_name = "isa-68040", |
| 68 | .description = "Is M68040 ISA supported", | 68 | .description = "Is M68040 ISA supported", |
| 69 | .dependencies = featureSet(&[_]Feature{ | 69 | .dependencies = featureSet(&[_]Feature{ |
| 70 | .isa_68030, | 70 | .isa_68030, |
| 71 | }), | 71 | }), |
| 72 | }; | 72 | }; |
| 73 | result[@enumToInt(Feature.isa_68060)] = .{ | 73 | result[@intFromEnum(Feature.isa_68060)] = .{ |
| 74 | .llvm_name = "isa-68060", | 74 | .llvm_name = "isa-68060", |
| 75 | .description = "Is M68060 ISA supported", | 75 | .description = "Is M68060 ISA supported", |
| 76 | .dependencies = featureSet(&[_]Feature{ | 76 | .dependencies = featureSet(&[_]Feature{ |
| 77 | .isa_68040, | 77 | .isa_68040, |
| 78 | }), | 78 | }), |
| 79 | }; | 79 | }; |
| 80 | result[@enumToInt(Feature.reserve_a0)] = .{ | 80 | result[@intFromEnum(Feature.reserve_a0)] = .{ |
| 81 | .llvm_name = "reserve-a0", | 81 | .llvm_name = "reserve-a0", |
| 82 | .description = "Reserve A0 register", | 82 | .description = "Reserve A0 register", |
| 83 | .dependencies = featureSet(&[_]Feature{}), | 83 | .dependencies = featureSet(&[_]Feature{}), |
| 84 | }; | 84 | }; |
| 85 | result[@enumToInt(Feature.reserve_a1)] = .{ | 85 | result[@intFromEnum(Feature.reserve_a1)] = .{ |
| 86 | .llvm_name = "reserve-a1", | 86 | .llvm_name = "reserve-a1", |
| 87 | .description = "Reserve A1 register", | 87 | .description = "Reserve A1 register", |
| 88 | .dependencies = featureSet(&[_]Feature{}), | 88 | .dependencies = featureSet(&[_]Feature{}), |
| 89 | }; | 89 | }; |
| 90 | result[@enumToInt(Feature.reserve_a2)] = .{ | 90 | result[@intFromEnum(Feature.reserve_a2)] = .{ |
| 91 | .llvm_name = "reserve-a2", | 91 | .llvm_name = "reserve-a2", |
| 92 | .description = "Reserve A2 register", | 92 | .description = "Reserve A2 register", |
| 93 | .dependencies = featureSet(&[_]Feature{}), | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | }; | 94 | }; |
| 95 | result[@enumToInt(Feature.reserve_a3)] = .{ | 95 | result[@intFromEnum(Feature.reserve_a3)] = .{ |
| 96 | .llvm_name = "reserve-a3", | 96 | .llvm_name = "reserve-a3", |
| 97 | .description = "Reserve A3 register", | 97 | .description = "Reserve A3 register", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@enumToInt(Feature.reserve_a4)] = .{ | 100 | result[@intFromEnum(Feature.reserve_a4)] = .{ |
| 101 | .llvm_name = "reserve-a4", | 101 | .llvm_name = "reserve-a4", |
| 102 | .description = "Reserve A4 register", | 102 | .description = "Reserve A4 register", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@enumToInt(Feature.reserve_a5)] = .{ | 105 | result[@intFromEnum(Feature.reserve_a5)] = .{ |
| 106 | .llvm_name = "reserve-a5", | 106 | .llvm_name = "reserve-a5", |
| 107 | .description = "Reserve A5 register", | 107 | .description = "Reserve A5 register", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@enumToInt(Feature.reserve_a6)] = .{ | 110 | result[@intFromEnum(Feature.reserve_a6)] = .{ |
| 111 | .llvm_name = "reserve-a6", | 111 | .llvm_name = "reserve-a6", |
| 112 | .description = "Reserve A6 register", | 112 | .description = "Reserve A6 register", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@enumToInt(Feature.reserve_d0)] = .{ | 115 | result[@intFromEnum(Feature.reserve_d0)] = .{ |
| 116 | .llvm_name = "reserve-d0", | 116 | .llvm_name = "reserve-d0", |
| 117 | .description = "Reserve D0 register", | 117 | .description = "Reserve D0 register", |
| 118 | .dependencies = featureSet(&[_]Feature{}), | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | }; | 119 | }; |
| 120 | result[@enumToInt(Feature.reserve_d1)] = .{ | 120 | result[@intFromEnum(Feature.reserve_d1)] = .{ |
| 121 | .llvm_name = "reserve-d1", | 121 | .llvm_name = "reserve-d1", |
| 122 | .description = "Reserve D1 register", | 122 | .description = "Reserve D1 register", |
| 123 | .dependencies = featureSet(&[_]Feature{}), | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | }; | 124 | }; |
| 125 | result[@enumToInt(Feature.reserve_d2)] = .{ | 125 | result[@intFromEnum(Feature.reserve_d2)] = .{ |
| 126 | .llvm_name = "reserve-d2", | 126 | .llvm_name = "reserve-d2", |
| 127 | .description = "Reserve D2 register", | 127 | .description = "Reserve D2 register", |
| 128 | .dependencies = featureSet(&[_]Feature{}), | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | }; | 129 | }; |
| 130 | result[@enumToInt(Feature.reserve_d3)] = .{ | 130 | result[@intFromEnum(Feature.reserve_d3)] = .{ |
| 131 | .llvm_name = "reserve-d3", | 131 | .llvm_name = "reserve-d3", |
| 132 | .description = "Reserve D3 register", | 132 | .description = "Reserve D3 register", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@enumToInt(Feature.reserve_d4)] = .{ | 135 | result[@intFromEnum(Feature.reserve_d4)] = .{ |
| 136 | .llvm_name = "reserve-d4", | 136 | .llvm_name = "reserve-d4", |
| 137 | .description = "Reserve D4 register", | 137 | .description = "Reserve D4 register", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@enumToInt(Feature.reserve_d5)] = .{ | 140 | result[@intFromEnum(Feature.reserve_d5)] = .{ |
| 141 | .llvm_name = "reserve-d5", | 141 | .llvm_name = "reserve-d5", |
| 142 | .description = "Reserve D5 register", | 142 | .description = "Reserve D5 register", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@enumToInt(Feature.reserve_d6)] = .{ | 145 | result[@intFromEnum(Feature.reserve_d6)] = .{ |
| 146 | .llvm_name = "reserve-d6", | 146 | .llvm_name = "reserve-d6", |
| 147 | .description = "Reserve D6 register", | 147 | .description = "Reserve D6 register", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@enumToInt(Feature.reserve_d7)] = .{ | 150 | result[@intFromEnum(Feature.reserve_d7)] = .{ |
| 151 | .llvm_name = "reserve-d7", | 151 | .llvm_name = "reserve-d7", |
| 152 | .description = "Reserve D7 register", | 152 | .description = "Reserve D7 register", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/mips.zig+52-52| ... | @@ -68,102 +68,102 @@ pub const all_features = blk: { | ... | @@ -68,102 +68,102 @@ pub const all_features = blk: { |
| 68 | const len = @typeInfo(Feature).Enum.fields.len; | 68 | const len = @typeInfo(Feature).Enum.fields.len; |
| 69 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 69 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 70 | var result: [len]CpuFeature = undefined; | 70 | var result: [len]CpuFeature = undefined; |
| 71 | result[@enumToInt(Feature.abs2008)] = .{ | 71 | result[@intFromEnum(Feature.abs2008)] = .{ |
| 72 | .llvm_name = "abs2008", | 72 | .llvm_name = "abs2008", |
| 73 | .description = "Disable IEEE 754-2008 abs.fmt mode", | 73 | .description = "Disable IEEE 754-2008 abs.fmt mode", |
| 74 | .dependencies = featureSet(&[_]Feature{}), | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | }; | 75 | }; |
| 76 | result[@enumToInt(Feature.cnmips)] = .{ | 76 | result[@intFromEnum(Feature.cnmips)] = .{ |
| 77 | .llvm_name = "cnmips", | 77 | .llvm_name = "cnmips", |
| 78 | .description = "Octeon cnMIPS Support", | 78 | .description = "Octeon cnMIPS Support", |
| 79 | .dependencies = featureSet(&[_]Feature{ | 79 | .dependencies = featureSet(&[_]Feature{ |
| 80 | .mips64r2, | 80 | .mips64r2, |
| 81 | }), | 81 | }), |
| 82 | }; | 82 | }; |
| 83 | result[@enumToInt(Feature.cnmipsp)] = .{ | 83 | result[@intFromEnum(Feature.cnmipsp)] = .{ |
| 84 | .llvm_name = "cnmipsp", | 84 | .llvm_name = "cnmipsp", |
| 85 | .description = "Octeon+ cnMIPS Support", | 85 | .description = "Octeon+ cnMIPS Support", |
| 86 | .dependencies = featureSet(&[_]Feature{ | 86 | .dependencies = featureSet(&[_]Feature{ |
| 87 | .cnmips, | 87 | .cnmips, |
| 88 | }), | 88 | }), |
| 89 | }; | 89 | }; |
| 90 | result[@enumToInt(Feature.crc)] = .{ | 90 | result[@intFromEnum(Feature.crc)] = .{ |
| 91 | .llvm_name = "crc", | 91 | .llvm_name = "crc", |
| 92 | .description = "Mips R6 CRC ASE", | 92 | .description = "Mips R6 CRC ASE", |
| 93 | .dependencies = featureSet(&[_]Feature{}), | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | }; | 94 | }; |
| 95 | result[@enumToInt(Feature.dsp)] = .{ | 95 | result[@intFromEnum(Feature.dsp)] = .{ |
| 96 | .llvm_name = "dsp", | 96 | .llvm_name = "dsp", |
| 97 | .description = "Mips DSP ASE", | 97 | .description = "Mips DSP ASE", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@enumToInt(Feature.dspr2)] = .{ | 100 | result[@intFromEnum(Feature.dspr2)] = .{ |
| 101 | .llvm_name = "dspr2", | 101 | .llvm_name = "dspr2", |
| 102 | .description = "Mips DSP-R2 ASE", | 102 | .description = "Mips DSP-R2 ASE", |
| 103 | .dependencies = featureSet(&[_]Feature{ | 103 | .dependencies = featureSet(&[_]Feature{ |
| 104 | .dsp, | 104 | .dsp, |
| 105 | }), | 105 | }), |
| 106 | }; | 106 | }; |
| 107 | result[@enumToInt(Feature.dspr3)] = .{ | 107 | result[@intFromEnum(Feature.dspr3)] = .{ |
| 108 | .llvm_name = "dspr3", | 108 | .llvm_name = "dspr3", |
| 109 | .description = "Mips DSP-R3 ASE", | 109 | .description = "Mips DSP-R3 ASE", |
| 110 | .dependencies = featureSet(&[_]Feature{ | 110 | .dependencies = featureSet(&[_]Feature{ |
| 111 | .dspr2, | 111 | .dspr2, |
| 112 | }), | 112 | }), |
| 113 | }; | 113 | }; |
| 114 | result[@enumToInt(Feature.eva)] = .{ | 114 | result[@intFromEnum(Feature.eva)] = .{ |
| 115 | .llvm_name = "eva", | 115 | .llvm_name = "eva", |
| 116 | .description = "Mips EVA ASE", | 116 | .description = "Mips EVA ASE", |
| 117 | .dependencies = featureSet(&[_]Feature{}), | 117 | .dependencies = featureSet(&[_]Feature{}), |
| 118 | }; | 118 | }; |
| 119 | result[@enumToInt(Feature.fp64)] = .{ | 119 | result[@intFromEnum(Feature.fp64)] = .{ |
| 120 | .llvm_name = "fp64", | 120 | .llvm_name = "fp64", |
| 121 | .description = "Support 64-bit FP registers", | 121 | .description = "Support 64-bit FP registers", |
| 122 | .dependencies = featureSet(&[_]Feature{}), | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | }; | 123 | }; |
| 124 | result[@enumToInt(Feature.fpxx)] = .{ | 124 | result[@intFromEnum(Feature.fpxx)] = .{ |
| 125 | .llvm_name = "fpxx", | 125 | .llvm_name = "fpxx", |
| 126 | .description = "Support for FPXX", | 126 | .description = "Support for FPXX", |
| 127 | .dependencies = featureSet(&[_]Feature{}), | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | }; | 128 | }; |
| 129 | result[@enumToInt(Feature.ginv)] = .{ | 129 | result[@intFromEnum(Feature.ginv)] = .{ |
| 130 | .llvm_name = "ginv", | 130 | .llvm_name = "ginv", |
| 131 | .description = "Mips Global Invalidate ASE", | 131 | .description = "Mips Global Invalidate ASE", |
| 132 | .dependencies = featureSet(&[_]Feature{}), | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | }; | 133 | }; |
| 134 | result[@enumToInt(Feature.gp64)] = .{ | 134 | result[@intFromEnum(Feature.gp64)] = .{ |
| 135 | .llvm_name = "gp64", | 135 | .llvm_name = "gp64", |
| 136 | .description = "General Purpose Registers are 64-bit wide", | 136 | .description = "General Purpose Registers are 64-bit wide", |
| 137 | .dependencies = featureSet(&[_]Feature{}), | 137 | .dependencies = featureSet(&[_]Feature{}), |
| 138 | }; | 138 | }; |
| 139 | result[@enumToInt(Feature.long_calls)] = .{ | 139 | result[@intFromEnum(Feature.long_calls)] = .{ |
| 140 | .llvm_name = "long-calls", | 140 | .llvm_name = "long-calls", |
| 141 | .description = "Disable use of the jal instruction", | 141 | .description = "Disable use of the jal instruction", |
| 142 | .dependencies = featureSet(&[_]Feature{}), | 142 | .dependencies = featureSet(&[_]Feature{}), |
| 143 | }; | 143 | }; |
| 144 | result[@enumToInt(Feature.micromips)] = .{ | 144 | result[@intFromEnum(Feature.micromips)] = .{ |
| 145 | .llvm_name = "micromips", | 145 | .llvm_name = "micromips", |
| 146 | .description = "microMips mode", | 146 | .description = "microMips mode", |
| 147 | .dependencies = featureSet(&[_]Feature{}), | 147 | .dependencies = featureSet(&[_]Feature{}), |
| 148 | }; | 148 | }; |
| 149 | result[@enumToInt(Feature.mips1)] = .{ | 149 | result[@intFromEnum(Feature.mips1)] = .{ |
| 150 | .llvm_name = "mips1", | 150 | .llvm_name = "mips1", |
| 151 | .description = "Mips I ISA Support [highly experimental]", | 151 | .description = "Mips I ISA Support [highly experimental]", |
| 152 | .dependencies = featureSet(&[_]Feature{}), | 152 | .dependencies = featureSet(&[_]Feature{}), |
| 153 | }; | 153 | }; |
| 154 | result[@enumToInt(Feature.mips16)] = .{ | 154 | result[@intFromEnum(Feature.mips16)] = .{ |
| 155 | .llvm_name = "mips16", | 155 | .llvm_name = "mips16", |
| 156 | .description = "Mips16 mode", | 156 | .description = "Mips16 mode", |
| 157 | .dependencies = featureSet(&[_]Feature{}), | 157 | .dependencies = featureSet(&[_]Feature{}), |
| 158 | }; | 158 | }; |
| 159 | result[@enumToInt(Feature.mips2)] = .{ | 159 | result[@intFromEnum(Feature.mips2)] = .{ |
| 160 | .llvm_name = "mips2", | 160 | .llvm_name = "mips2", |
| 161 | .description = "Mips II ISA Support [highly experimental]", | 161 | .description = "Mips II ISA Support [highly experimental]", |
| 162 | .dependencies = featureSet(&[_]Feature{ | 162 | .dependencies = featureSet(&[_]Feature{ |
| 163 | .mips1, | 163 | .mips1, |
| 164 | }), | 164 | }), |
| 165 | }; | 165 | }; |
| 166 | result[@enumToInt(Feature.mips3)] = .{ | 166 | result[@intFromEnum(Feature.mips3)] = .{ |
| 167 | .llvm_name = "mips3", | 167 | .llvm_name = "mips3", |
| 168 | .description = "MIPS III ISA Support [highly experimental]", | 168 | .description = "MIPS III ISA Support [highly experimental]", |
| 169 | .dependencies = featureSet(&[_]Feature{ | 169 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -174,7 +174,7 @@ pub const all_features = blk: { | ... | @@ -174,7 +174,7 @@ pub const all_features = blk: { |
| 174 | .mips3_32r2, | 174 | .mips3_32r2, |
| 175 | }), | 175 | }), |
| 176 | }; | 176 | }; |
| 177 | result[@enumToInt(Feature.mips32)] = .{ | 177 | result[@intFromEnum(Feature.mips32)] = .{ |
| 178 | .llvm_name = "mips32", | 178 | .llvm_name = "mips32", |
| 179 | .description = "Mips32 ISA Support", | 179 | .description = "Mips32 ISA Support", |
| 180 | .dependencies = featureSet(&[_]Feature{ | 180 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -183,7 +183,7 @@ pub const all_features = blk: { | ... | @@ -183,7 +183,7 @@ pub const all_features = blk: { |
| 183 | .mips4_32, | 183 | .mips4_32, |
| 184 | }), | 184 | }), |
| 185 | }; | 185 | }; |
| 186 | result[@enumToInt(Feature.mips32r2)] = .{ | 186 | result[@intFromEnum(Feature.mips32r2)] = .{ |
| 187 | .llvm_name = "mips32r2", | 187 | .llvm_name = "mips32r2", |
| 188 | .description = "Mips32r2 ISA Support", | 188 | .description = "Mips32r2 ISA Support", |
| 189 | .dependencies = featureSet(&[_]Feature{ | 189 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -193,21 +193,21 @@ pub const all_features = blk: { | ... | @@ -193,21 +193,21 @@ pub const all_features = blk: { |
| 193 | .mips5_32r2, | 193 | .mips5_32r2, |
| 194 | }), | 194 | }), |
| 195 | }; | 195 | }; |
| 196 | result[@enumToInt(Feature.mips32r3)] = .{ | 196 | result[@intFromEnum(Feature.mips32r3)] = .{ |
| 197 | .llvm_name = "mips32r3", | 197 | .llvm_name = "mips32r3", |
| 198 | .description = "Mips32r3 ISA Support", | 198 | .description = "Mips32r3 ISA Support", |
| 199 | .dependencies = featureSet(&[_]Feature{ | 199 | .dependencies = featureSet(&[_]Feature{ |
| 200 | .mips32r2, | 200 | .mips32r2, |
| 201 | }), | 201 | }), |
| 202 | }; | 202 | }; |
| 203 | result[@enumToInt(Feature.mips32r5)] = .{ | 203 | result[@intFromEnum(Feature.mips32r5)] = .{ |
| 204 | .llvm_name = "mips32r5", | 204 | .llvm_name = "mips32r5", |
| 205 | .description = "Mips32r5 ISA Support", | 205 | .description = "Mips32r5 ISA Support", |
| 206 | .dependencies = featureSet(&[_]Feature{ | 206 | .dependencies = featureSet(&[_]Feature{ |
| 207 | .mips32r3, | 207 | .mips32r3, |
| 208 | }), | 208 | }), |
| 209 | }; | 209 | }; |
| 210 | result[@enumToInt(Feature.mips32r6)] = .{ | 210 | result[@intFromEnum(Feature.mips32r6)] = .{ |
| 211 | .llvm_name = "mips32r6", | 211 | .llvm_name = "mips32r6", |
| 212 | .description = "Mips32r6 ISA Support [experimental]", | 212 | .description = "Mips32r6 ISA Support [experimental]", |
| 213 | .dependencies = featureSet(&[_]Feature{ | 213 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -217,22 +217,22 @@ pub const all_features = blk: { | ... | @@ -217,22 +217,22 @@ pub const all_features = blk: { |
| 217 | .nan2008, | 217 | .nan2008, |
| 218 | }), | 218 | }), |
| 219 | }; | 219 | }; |
| 220 | result[@enumToInt(Feature.mips3_32)] = .{ | 220 | result[@intFromEnum(Feature.mips3_32)] = .{ |
| 221 | .llvm_name = "mips3_32", | 221 | .llvm_name = "mips3_32", |
| 222 | .description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]", | 222 | .description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@enumToInt(Feature.mips3_32r2)] = .{ | 225 | result[@intFromEnum(Feature.mips3_32r2)] = .{ |
| 226 | .llvm_name = "mips3_32r2", | 226 | .llvm_name = "mips3_32r2", |
| 227 | .description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]", | 227 | .description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@enumToInt(Feature.mips3d)] = .{ | 230 | result[@intFromEnum(Feature.mips3d)] = .{ |
| 231 | .llvm_name = "mips3d", | 231 | .llvm_name = "mips3d", |
| 232 | .description = "Mips 3D ASE", | 232 | .description = "Mips 3D ASE", |
| 233 | .dependencies = featureSet(&[_]Feature{}), | 233 | .dependencies = featureSet(&[_]Feature{}), |
| 234 | }; | 234 | }; |
| 235 | result[@enumToInt(Feature.mips4)] = .{ | 235 | result[@intFromEnum(Feature.mips4)] = .{ |
| 236 | .llvm_name = "mips4", | 236 | .llvm_name = "mips4", |
| 237 | .description = "MIPS IV ISA Support", | 237 | .description = "MIPS IV ISA Support", |
| 238 | .dependencies = featureSet(&[_]Feature{ | 238 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -241,17 +241,17 @@ pub const all_features = blk: { | ... | @@ -241,17 +241,17 @@ pub const all_features = blk: { |
| 241 | .mips4_32r2, | 241 | .mips4_32r2, |
| 242 | }), | 242 | }), |
| 243 | }; | 243 | }; |
| 244 | result[@enumToInt(Feature.mips4_32)] = .{ | 244 | result[@intFromEnum(Feature.mips4_32)] = .{ |
| 245 | .llvm_name = "mips4_32", | 245 | .llvm_name = "mips4_32", |
| 246 | .description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]", | 246 | .description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@enumToInt(Feature.mips4_32r2)] = .{ | 249 | result[@intFromEnum(Feature.mips4_32r2)] = .{ |
| 250 | .llvm_name = "mips4_32r2", | 250 | .llvm_name = "mips4_32r2", |
| 251 | .description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]", | 251 | .description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@enumToInt(Feature.mips5)] = .{ | 254 | result[@intFromEnum(Feature.mips5)] = .{ |
| 255 | .llvm_name = "mips5", | 255 | .llvm_name = "mips5", |
| 256 | .description = "MIPS V ISA Support [highly experimental]", | 256 | .description = "MIPS V ISA Support [highly experimental]", |
| 257 | .dependencies = featureSet(&[_]Feature{ | 257 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -259,12 +259,12 @@ pub const all_features = blk: { | ... | @@ -259,12 +259,12 @@ pub const all_features = blk: { |
| 259 | .mips5_32r2, | 259 | .mips5_32r2, |
| 260 | }), | 260 | }), |
| 261 | }; | 261 | }; |
| 262 | result[@enumToInt(Feature.mips5_32r2)] = .{ | 262 | result[@intFromEnum(Feature.mips5_32r2)] = .{ |
| 263 | .llvm_name = "mips5_32r2", | 263 | .llvm_name = "mips5_32r2", |
| 264 | .description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]", | 264 | .description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]", |
| 265 | .dependencies = featureSet(&[_]Feature{}), | 265 | .dependencies = featureSet(&[_]Feature{}), |
| 266 | }; | 266 | }; |
| 267 | result[@enumToInt(Feature.mips64)] = .{ | 267 | result[@intFromEnum(Feature.mips64)] = .{ |
| 268 | .llvm_name = "mips64", | 268 | .llvm_name = "mips64", |
| 269 | .description = "Mips64 ISA Support", | 269 | .description = "Mips64 ISA Support", |
| 270 | .dependencies = featureSet(&[_]Feature{ | 270 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -272,7 +272,7 @@ pub const all_features = blk: { | ... | @@ -272,7 +272,7 @@ pub const all_features = blk: { |
| 272 | .mips5, | 272 | .mips5, |
| 273 | }), | 273 | }), |
| 274 | }; | 274 | }; |
| 275 | result[@enumToInt(Feature.mips64r2)] = .{ | 275 | result[@intFromEnum(Feature.mips64r2)] = .{ |
| 276 | .llvm_name = "mips64r2", | 276 | .llvm_name = "mips64r2", |
| 277 | .description = "Mips64r2 ISA Support", | 277 | .description = "Mips64r2 ISA Support", |
| 278 | .dependencies = featureSet(&[_]Feature{ | 278 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -280,7 +280,7 @@ pub const all_features = blk: { | ... | @@ -280,7 +280,7 @@ pub const all_features = blk: { |
| 280 | .mips64, | 280 | .mips64, |
| 281 | }), | 281 | }), |
| 282 | }; | 282 | }; |
| 283 | result[@enumToInt(Feature.mips64r3)] = .{ | 283 | result[@intFromEnum(Feature.mips64r3)] = .{ |
| 284 | .llvm_name = "mips64r3", | 284 | .llvm_name = "mips64r3", |
| 285 | .description = "Mips64r3 ISA Support", | 285 | .description = "Mips64r3 ISA Support", |
| 286 | .dependencies = featureSet(&[_]Feature{ | 286 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -288,7 +288,7 @@ pub const all_features = blk: { | ... | @@ -288,7 +288,7 @@ pub const all_features = blk: { |
| 288 | .mips64r2, | 288 | .mips64r2, |
| 289 | }), | 289 | }), |
| 290 | }; | 290 | }; |
| 291 | result[@enumToInt(Feature.mips64r5)] = .{ | 291 | result[@intFromEnum(Feature.mips64r5)] = .{ |
| 292 | .llvm_name = "mips64r5", | 292 | .llvm_name = "mips64r5", |
| 293 | .description = "Mips64r5 ISA Support", | 293 | .description = "Mips64r5 ISA Support", |
| 294 | .dependencies = featureSet(&[_]Feature{ | 294 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -296,7 +296,7 @@ pub const all_features = blk: { | ... | @@ -296,7 +296,7 @@ pub const all_features = blk: { |
| 296 | .mips64r3, | 296 | .mips64r3, |
| 297 | }), | 297 | }), |
| 298 | }; | 298 | }; |
| 299 | result[@enumToInt(Feature.mips64r6)] = .{ | 299 | result[@intFromEnum(Feature.mips64r6)] = .{ |
| 300 | .llvm_name = "mips64r6", | 300 | .llvm_name = "mips64r6", |
| 301 | .description = "Mips64r6 ISA Support [experimental]", | 301 | .description = "Mips64r6 ISA Support [experimental]", |
| 302 | .dependencies = featureSet(&[_]Feature{ | 302 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -304,84 +304,84 @@ pub const all_features = blk: { | ... | @@ -304,84 +304,84 @@ pub const all_features = blk: { |
| 304 | .mips64r5, | 304 | .mips64r5, |
| 305 | }), | 305 | }), |
| 306 | }; | 306 | }; |
| 307 | result[@enumToInt(Feature.msa)] = .{ | 307 | result[@intFromEnum(Feature.msa)] = .{ |
| 308 | .llvm_name = "msa", | 308 | .llvm_name = "msa", |
| 309 | .description = "Mips MSA ASE", | 309 | .description = "Mips MSA ASE", |
| 310 | .dependencies = featureSet(&[_]Feature{}), | 310 | .dependencies = featureSet(&[_]Feature{}), |
| 311 | }; | 311 | }; |
| 312 | result[@enumToInt(Feature.mt)] = .{ | 312 | result[@intFromEnum(Feature.mt)] = .{ |
| 313 | .llvm_name = "mt", | 313 | .llvm_name = "mt", |
| 314 | .description = "Mips MT ASE", | 314 | .description = "Mips MT ASE", |
| 315 | .dependencies = featureSet(&[_]Feature{}), | 315 | .dependencies = featureSet(&[_]Feature{}), |
| 316 | }; | 316 | }; |
| 317 | result[@enumToInt(Feature.nan2008)] = .{ | 317 | result[@intFromEnum(Feature.nan2008)] = .{ |
| 318 | .llvm_name = "nan2008", | 318 | .llvm_name = "nan2008", |
| 319 | .description = "IEEE 754-2008 NaN encoding", | 319 | .description = "IEEE 754-2008 NaN encoding", |
| 320 | .dependencies = featureSet(&[_]Feature{}), | 320 | .dependencies = featureSet(&[_]Feature{}), |
| 321 | }; | 321 | }; |
| 322 | result[@enumToInt(Feature.noabicalls)] = .{ | 322 | result[@intFromEnum(Feature.noabicalls)] = .{ |
| 323 | .llvm_name = "noabicalls", | 323 | .llvm_name = "noabicalls", |
| 324 | .description = "Disable SVR4-style position-independent code", | 324 | .description = "Disable SVR4-style position-independent code", |
| 325 | .dependencies = featureSet(&[_]Feature{}), | 325 | .dependencies = featureSet(&[_]Feature{}), |
| 326 | }; | 326 | }; |
| 327 | result[@enumToInt(Feature.nomadd4)] = .{ | 327 | result[@intFromEnum(Feature.nomadd4)] = .{ |
| 328 | .llvm_name = "nomadd4", | 328 | .llvm_name = "nomadd4", |
| 329 | .description = "Disable 4-operand madd.fmt and related instructions", | 329 | .description = "Disable 4-operand madd.fmt and related instructions", |
| 330 | .dependencies = featureSet(&[_]Feature{}), | 330 | .dependencies = featureSet(&[_]Feature{}), |
| 331 | }; | 331 | }; |
| 332 | result[@enumToInt(Feature.nooddspreg)] = .{ | 332 | result[@intFromEnum(Feature.nooddspreg)] = .{ |
| 333 | .llvm_name = "nooddspreg", | 333 | .llvm_name = "nooddspreg", |
| 334 | .description = "Disable odd numbered single-precision registers", | 334 | .description = "Disable odd numbered single-precision registers", |
| 335 | .dependencies = featureSet(&[_]Feature{}), | 335 | .dependencies = featureSet(&[_]Feature{}), |
| 336 | }; | 336 | }; |
| 337 | result[@enumToInt(Feature.p5600)] = .{ | 337 | result[@intFromEnum(Feature.p5600)] = .{ |
| 338 | .llvm_name = "p5600", | 338 | .llvm_name = "p5600", |
| 339 | .description = "The P5600 Processor", | 339 | .description = "The P5600 Processor", |
| 340 | .dependencies = featureSet(&[_]Feature{ | 340 | .dependencies = featureSet(&[_]Feature{ |
| 341 | .mips32r5, | 341 | .mips32r5, |
| 342 | }), | 342 | }), |
| 343 | }; | 343 | }; |
| 344 | result[@enumToInt(Feature.ptr64)] = .{ | 344 | result[@intFromEnum(Feature.ptr64)] = .{ |
| 345 | .llvm_name = "ptr64", | 345 | .llvm_name = "ptr64", |
| 346 | .description = "Pointers are 64-bit wide", | 346 | .description = "Pointers are 64-bit wide", |
| 347 | .dependencies = featureSet(&[_]Feature{}), | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | }; | 348 | }; |
| 349 | result[@enumToInt(Feature.single_float)] = .{ | 349 | result[@intFromEnum(Feature.single_float)] = .{ |
| 350 | .llvm_name = "single-float", | 350 | .llvm_name = "single-float", |
| 351 | .description = "Only supports single precision float", | 351 | .description = "Only supports single precision float", |
| 352 | .dependencies = featureSet(&[_]Feature{}), | 352 | .dependencies = featureSet(&[_]Feature{}), |
| 353 | }; | 353 | }; |
| 354 | result[@enumToInt(Feature.soft_float)] = .{ | 354 | result[@intFromEnum(Feature.soft_float)] = .{ |
| 355 | .llvm_name = "soft-float", | 355 | .llvm_name = "soft-float", |
| 356 | .description = "Does not support floating point instructions", | 356 | .description = "Does not support floating point instructions", |
| 357 | .dependencies = featureSet(&[_]Feature{}), | 357 | .dependencies = featureSet(&[_]Feature{}), |
| 358 | }; | 358 | }; |
| 359 | result[@enumToInt(Feature.sym32)] = .{ | 359 | result[@intFromEnum(Feature.sym32)] = .{ |
| 360 | .llvm_name = "sym32", | 360 | .llvm_name = "sym32", |
| 361 | .description = "Symbols are 32 bit on Mips64", | 361 | .description = "Symbols are 32 bit on Mips64", |
| 362 | .dependencies = featureSet(&[_]Feature{}), | 362 | .dependencies = featureSet(&[_]Feature{}), |
| 363 | }; | 363 | }; |
| 364 | result[@enumToInt(Feature.use_indirect_jump_hazard)] = .{ | 364 | result[@intFromEnum(Feature.use_indirect_jump_hazard)] = .{ |
| 365 | .llvm_name = "use-indirect-jump-hazard", | 365 | .llvm_name = "use-indirect-jump-hazard", |
| 366 | .description = "Use indirect jump guards to prevent certain speculation based attacks", | 366 | .description = "Use indirect jump guards to prevent certain speculation based attacks", |
| 367 | .dependencies = featureSet(&[_]Feature{}), | 367 | .dependencies = featureSet(&[_]Feature{}), |
| 368 | }; | 368 | }; |
| 369 | result[@enumToInt(Feature.use_tcc_in_div)] = .{ | 369 | result[@intFromEnum(Feature.use_tcc_in_div)] = .{ |
| 370 | .llvm_name = "use-tcc-in-div", | 370 | .llvm_name = "use-tcc-in-div", |
| 371 | .description = "Force the assembler to use trapping", | 371 | .description = "Force the assembler to use trapping", |
| 372 | .dependencies = featureSet(&[_]Feature{}), | 372 | .dependencies = featureSet(&[_]Feature{}), |
| 373 | }; | 373 | }; |
| 374 | result[@enumToInt(Feature.vfpu)] = .{ | 374 | result[@intFromEnum(Feature.vfpu)] = .{ |
| 375 | .llvm_name = "vfpu", | 375 | .llvm_name = "vfpu", |
| 376 | .description = "Enable vector FPU instructions", | 376 | .description = "Enable vector FPU instructions", |
| 377 | .dependencies = featureSet(&[_]Feature{}), | 377 | .dependencies = featureSet(&[_]Feature{}), |
| 378 | }; | 378 | }; |
| 379 | result[@enumToInt(Feature.virt)] = .{ | 379 | result[@intFromEnum(Feature.virt)] = .{ |
| 380 | .llvm_name = "virt", | 380 | .llvm_name = "virt", |
| 381 | .description = "Mips Virtualization ASE", | 381 | .description = "Mips Virtualization ASE", |
| 382 | .dependencies = featureSet(&[_]Feature{}), | 382 | .dependencies = featureSet(&[_]Feature{}), |
| 383 | }; | 383 | }; |
| 384 | result[@enumToInt(Feature.xgot)] = .{ | 384 | result[@intFromEnum(Feature.xgot)] = .{ |
| 385 | .llvm_name = "xgot", | 385 | .llvm_name = "xgot", |
| 386 | .description = "Assume 32-bit GOT", | 386 | .description = "Assume 32-bit GOT", |
| 387 | .dependencies = featureSet(&[_]Feature{}), | 387 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/msp430.zig+4-4| ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { | ... | @@ -20,22 +20,22 @@ pub const all_features = blk: { |
| 20 | const len = @typeInfo(Feature).Enum.fields.len; | 20 | const len = @typeInfo(Feature).Enum.fields.len; |
| 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 21 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 22 | var result: [len]CpuFeature = undefined; | 22 | var result: [len]CpuFeature = undefined; |
| 23 | result[@enumToInt(Feature.ext)] = .{ | 23 | result[@intFromEnum(Feature.ext)] = .{ |
| 24 | .llvm_name = "ext", | 24 | .llvm_name = "ext", |
| 25 | .description = "Enable MSP430-X extensions", | 25 | .description = "Enable MSP430-X extensions", |
| 26 | .dependencies = featureSet(&[_]Feature{}), | 26 | .dependencies = featureSet(&[_]Feature{}), |
| 27 | }; | 27 | }; |
| 28 | result[@enumToInt(Feature.hwmult16)] = .{ | 28 | result[@intFromEnum(Feature.hwmult16)] = .{ |
| 29 | .llvm_name = "hwmult16", | 29 | .llvm_name = "hwmult16", |
| 30 | .description = "Enable 16-bit hardware multiplier", | 30 | .description = "Enable 16-bit hardware multiplier", |
| 31 | .dependencies = featureSet(&[_]Feature{}), | 31 | .dependencies = featureSet(&[_]Feature{}), |
| 32 | }; | 32 | }; |
| 33 | result[@enumToInt(Feature.hwmult32)] = .{ | 33 | result[@intFromEnum(Feature.hwmult32)] = .{ |
| 34 | .llvm_name = "hwmult32", | 34 | .llvm_name = "hwmult32", |
| 35 | .description = "Enable 32-bit hardware multiplier", | 35 | .description = "Enable 32-bit hardware multiplier", |
| 36 | .dependencies = featureSet(&[_]Feature{}), | 36 | .dependencies = featureSet(&[_]Feature{}), |
| 37 | }; | 37 | }; |
| 38 | result[@enumToInt(Feature.hwmultf5)] = .{ | 38 | result[@intFromEnum(Feature.hwmultf5)] = .{ |
| 39 | .llvm_name = "hwmultf5", | 39 | .llvm_name = "hwmultf5", |
| 40 | .description = "Enable F5 series hardware multiplier", | 40 | .description = "Enable F5 series hardware multiplier", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/nvptx.zig+40-40| ... | @@ -56,202 +56,202 @@ pub const all_features = blk: { | ... | @@ -56,202 +56,202 @@ pub const all_features = blk: { |
| 56 | const len = @typeInfo(Feature).Enum.fields.len; | 56 | const len = @typeInfo(Feature).Enum.fields.len; |
| 57 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 57 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 58 | var result: [len]CpuFeature = undefined; | 58 | var result: [len]CpuFeature = undefined; |
| 59 | result[@enumToInt(Feature.ptx32)] = .{ | 59 | result[@intFromEnum(Feature.ptx32)] = .{ |
| 60 | .llvm_name = "ptx32", | 60 | .llvm_name = "ptx32", |
| 61 | .description = "Use PTX version 3.2", | 61 | .description = "Use PTX version 3.2", |
| 62 | .dependencies = featureSet(&[_]Feature{}), | 62 | .dependencies = featureSet(&[_]Feature{}), |
| 63 | }; | 63 | }; |
| 64 | result[@enumToInt(Feature.ptx40)] = .{ | 64 | result[@intFromEnum(Feature.ptx40)] = .{ |
| 65 | .llvm_name = "ptx40", | 65 | .llvm_name = "ptx40", |
| 66 | .description = "Use PTX version 4.0", | 66 | .description = "Use PTX version 4.0", |
| 67 | .dependencies = featureSet(&[_]Feature{}), | 67 | .dependencies = featureSet(&[_]Feature{}), |
| 68 | }; | 68 | }; |
| 69 | result[@enumToInt(Feature.ptx41)] = .{ | 69 | result[@intFromEnum(Feature.ptx41)] = .{ |
| 70 | .llvm_name = "ptx41", | 70 | .llvm_name = "ptx41", |
| 71 | .description = "Use PTX version 4.1", | 71 | .description = "Use PTX version 4.1", |
| 72 | .dependencies = featureSet(&[_]Feature{}), | 72 | .dependencies = featureSet(&[_]Feature{}), |
| 73 | }; | 73 | }; |
| 74 | result[@enumToInt(Feature.ptx42)] = .{ | 74 | result[@intFromEnum(Feature.ptx42)] = .{ |
| 75 | .llvm_name = "ptx42", | 75 | .llvm_name = "ptx42", |
| 76 | .description = "Use PTX version 4.2", | 76 | .description = "Use PTX version 4.2", |
| 77 | .dependencies = featureSet(&[_]Feature{}), | 77 | .dependencies = featureSet(&[_]Feature{}), |
| 78 | }; | 78 | }; |
| 79 | result[@enumToInt(Feature.ptx43)] = .{ | 79 | result[@intFromEnum(Feature.ptx43)] = .{ |
| 80 | .llvm_name = "ptx43", | 80 | .llvm_name = "ptx43", |
| 81 | .description = "Use PTX version 4.3", | 81 | .description = "Use PTX version 4.3", |
| 82 | .dependencies = featureSet(&[_]Feature{}), | 82 | .dependencies = featureSet(&[_]Feature{}), |
| 83 | }; | 83 | }; |
| 84 | result[@enumToInt(Feature.ptx50)] = .{ | 84 | result[@intFromEnum(Feature.ptx50)] = .{ |
| 85 | .llvm_name = "ptx50", | 85 | .llvm_name = "ptx50", |
| 86 | .description = "Use PTX version 5.0", | 86 | .description = "Use PTX version 5.0", |
| 87 | .dependencies = featureSet(&[_]Feature{}), | 87 | .dependencies = featureSet(&[_]Feature{}), |
| 88 | }; | 88 | }; |
| 89 | result[@enumToInt(Feature.ptx60)] = .{ | 89 | result[@intFromEnum(Feature.ptx60)] = .{ |
| 90 | .llvm_name = "ptx60", | 90 | .llvm_name = "ptx60", |
| 91 | .description = "Use PTX version 6.0", | 91 | .description = "Use PTX version 6.0", |
| 92 | .dependencies = featureSet(&[_]Feature{}), | 92 | .dependencies = featureSet(&[_]Feature{}), |
| 93 | }; | 93 | }; |
| 94 | result[@enumToInt(Feature.ptx61)] = .{ | 94 | result[@intFromEnum(Feature.ptx61)] = .{ |
| 95 | .llvm_name = "ptx61", | 95 | .llvm_name = "ptx61", |
| 96 | .description = "Use PTX version 6.1", | 96 | .description = "Use PTX version 6.1", |
| 97 | .dependencies = featureSet(&[_]Feature{}), | 97 | .dependencies = featureSet(&[_]Feature{}), |
| 98 | }; | 98 | }; |
| 99 | result[@enumToInt(Feature.ptx63)] = .{ | 99 | result[@intFromEnum(Feature.ptx63)] = .{ |
| 100 | .llvm_name = "ptx63", | 100 | .llvm_name = "ptx63", |
| 101 | .description = "Use PTX version 6.3", | 101 | .description = "Use PTX version 6.3", |
| 102 | .dependencies = featureSet(&[_]Feature{}), | 102 | .dependencies = featureSet(&[_]Feature{}), |
| 103 | }; | 103 | }; |
| 104 | result[@enumToInt(Feature.ptx64)] = .{ | 104 | result[@intFromEnum(Feature.ptx64)] = .{ |
| 105 | .llvm_name = "ptx64", | 105 | .llvm_name = "ptx64", |
| 106 | .description = "Use PTX version 6.4", | 106 | .description = "Use PTX version 6.4", |
| 107 | .dependencies = featureSet(&[_]Feature{}), | 107 | .dependencies = featureSet(&[_]Feature{}), |
| 108 | }; | 108 | }; |
| 109 | result[@enumToInt(Feature.ptx65)] = .{ | 109 | result[@intFromEnum(Feature.ptx65)] = .{ |
| 110 | .llvm_name = "ptx65", | 110 | .llvm_name = "ptx65", |
| 111 | .description = "Use PTX version 6.5", | 111 | .description = "Use PTX version 6.5", |
| 112 | .dependencies = featureSet(&[_]Feature{}), | 112 | .dependencies = featureSet(&[_]Feature{}), |
| 113 | }; | 113 | }; |
| 114 | result[@enumToInt(Feature.ptx70)] = .{ | 114 | result[@intFromEnum(Feature.ptx70)] = .{ |
| 115 | .llvm_name = "ptx70", | 115 | .llvm_name = "ptx70", |
| 116 | .description = "Use PTX version 7.0", | 116 | .description = "Use PTX version 7.0", |
| 117 | .dependencies = featureSet(&[_]Feature{}), | 117 | .dependencies = featureSet(&[_]Feature{}), |
| 118 | }; | 118 | }; |
| 119 | result[@enumToInt(Feature.ptx71)] = .{ | 119 | result[@intFromEnum(Feature.ptx71)] = .{ |
| 120 | .llvm_name = "ptx71", | 120 | .llvm_name = "ptx71", |
| 121 | .description = "Use PTX version 7.1", | 121 | .description = "Use PTX version 7.1", |
| 122 | .dependencies = featureSet(&[_]Feature{}), | 122 | .dependencies = featureSet(&[_]Feature{}), |
| 123 | }; | 123 | }; |
| 124 | result[@enumToInt(Feature.ptx72)] = .{ | 124 | result[@intFromEnum(Feature.ptx72)] = .{ |
| 125 | .llvm_name = "ptx72", | 125 | .llvm_name = "ptx72", |
| 126 | .description = "Use PTX version 7.2", | 126 | .description = "Use PTX version 7.2", |
| 127 | .dependencies = featureSet(&[_]Feature{}), | 127 | .dependencies = featureSet(&[_]Feature{}), |
| 128 | }; | 128 | }; |
| 129 | result[@enumToInt(Feature.ptx73)] = .{ | 129 | result[@intFromEnum(Feature.ptx73)] = .{ |
| 130 | .llvm_name = "ptx73", | 130 | .llvm_name = "ptx73", |
| 131 | .description = "Use PTX version 7.3", | 131 | .description = "Use PTX version 7.3", |
| 132 | .dependencies = featureSet(&[_]Feature{}), | 132 | .dependencies = featureSet(&[_]Feature{}), |
| 133 | }; | 133 | }; |
| 134 | result[@enumToInt(Feature.ptx74)] = .{ | 134 | result[@intFromEnum(Feature.ptx74)] = .{ |
| 135 | .llvm_name = "ptx74", | 135 | .llvm_name = "ptx74", |
| 136 | .description = "Use PTX version 7.4", | 136 | .description = "Use PTX version 7.4", |
| 137 | .dependencies = featureSet(&[_]Feature{}), | 137 | .dependencies = featureSet(&[_]Feature{}), |
| 138 | }; | 138 | }; |
| 139 | result[@enumToInt(Feature.ptx75)] = .{ | 139 | result[@intFromEnum(Feature.ptx75)] = .{ |
| 140 | .llvm_name = "ptx75", | 140 | .llvm_name = "ptx75", |
| 141 | .description = "Use PTX version 7.5", | 141 | .description = "Use PTX version 7.5", |
| 142 | .dependencies = featureSet(&[_]Feature{}), | 142 | .dependencies = featureSet(&[_]Feature{}), |
| 143 | }; | 143 | }; |
| 144 | result[@enumToInt(Feature.ptx76)] = .{ | 144 | result[@intFromEnum(Feature.ptx76)] = .{ |
| 145 | .llvm_name = "ptx76", | 145 | .llvm_name = "ptx76", |
| 146 | .description = "Use PTX version 7.6", | 146 | .description = "Use PTX version 7.6", |
| 147 | .dependencies = featureSet(&[_]Feature{}), | 147 | .dependencies = featureSet(&[_]Feature{}), |
| 148 | }; | 148 | }; |
| 149 | result[@enumToInt(Feature.ptx77)] = .{ | 149 | result[@intFromEnum(Feature.ptx77)] = .{ |
| 150 | .llvm_name = "ptx77", | 150 | .llvm_name = "ptx77", |
| 151 | .description = "Use PTX version 7.7", | 151 | .description = "Use PTX version 7.7", |
| 152 | .dependencies = featureSet(&[_]Feature{}), | 152 | .dependencies = featureSet(&[_]Feature{}), |
| 153 | }; | 153 | }; |
| 154 | result[@enumToInt(Feature.ptx78)] = .{ | 154 | result[@intFromEnum(Feature.ptx78)] = .{ |
| 155 | .llvm_name = "ptx78", | 155 | .llvm_name = "ptx78", |
| 156 | .description = "Use PTX version 7.8", | 156 | .description = "Use PTX version 7.8", |
| 157 | .dependencies = featureSet(&[_]Feature{}), | 157 | .dependencies = featureSet(&[_]Feature{}), |
| 158 | }; | 158 | }; |
| 159 | result[@enumToInt(Feature.sm_20)] = .{ | 159 | result[@intFromEnum(Feature.sm_20)] = .{ |
| 160 | .llvm_name = "sm_20", | 160 | .llvm_name = "sm_20", |
| 161 | .description = "Target SM 2.0", | 161 | .description = "Target SM 2.0", |
| 162 | .dependencies = featureSet(&[_]Feature{}), | 162 | .dependencies = featureSet(&[_]Feature{}), |
| 163 | }; | 163 | }; |
| 164 | result[@enumToInt(Feature.sm_21)] = .{ | 164 | result[@intFromEnum(Feature.sm_21)] = .{ |
| 165 | .llvm_name = "sm_21", | 165 | .llvm_name = "sm_21", |
| 166 | .description = "Target SM 2.1", | 166 | .description = "Target SM 2.1", |
| 167 | .dependencies = featureSet(&[_]Feature{}), | 167 | .dependencies = featureSet(&[_]Feature{}), |
| 168 | }; | 168 | }; |
| 169 | result[@enumToInt(Feature.sm_30)] = .{ | 169 | result[@intFromEnum(Feature.sm_30)] = .{ |
| 170 | .llvm_name = "sm_30", | 170 | .llvm_name = "sm_30", |
| 171 | .description = "Target SM 3.0", | 171 | .description = "Target SM 3.0", |
| 172 | .dependencies = featureSet(&[_]Feature{}), | 172 | .dependencies = featureSet(&[_]Feature{}), |
| 173 | }; | 173 | }; |
| 174 | result[@enumToInt(Feature.sm_32)] = .{ | 174 | result[@intFromEnum(Feature.sm_32)] = .{ |
| 175 | .llvm_name = "sm_32", | 175 | .llvm_name = "sm_32", |
| 176 | .description = "Target SM 3.2", | 176 | .description = "Target SM 3.2", |
| 177 | .dependencies = featureSet(&[_]Feature{}), | 177 | .dependencies = featureSet(&[_]Feature{}), |
| 178 | }; | 178 | }; |
| 179 | result[@enumToInt(Feature.sm_35)] = .{ | 179 | result[@intFromEnum(Feature.sm_35)] = .{ |
| 180 | .llvm_name = "sm_35", | 180 | .llvm_name = "sm_35", |
| 181 | .description = "Target SM 3.5", | 181 | .description = "Target SM 3.5", |
| 182 | .dependencies = featureSet(&[_]Feature{}), | 182 | .dependencies = featureSet(&[_]Feature{}), |
| 183 | }; | 183 | }; |
| 184 | result[@enumToInt(Feature.sm_37)] = .{ | 184 | result[@intFromEnum(Feature.sm_37)] = .{ |
| 185 | .llvm_name = "sm_37", | 185 | .llvm_name = "sm_37", |
| 186 | .description = "Target SM 3.7", | 186 | .description = "Target SM 3.7", |
| 187 | .dependencies = featureSet(&[_]Feature{}), | 187 | .dependencies = featureSet(&[_]Feature{}), |
| 188 | }; | 188 | }; |
| 189 | result[@enumToInt(Feature.sm_50)] = .{ | 189 | result[@intFromEnum(Feature.sm_50)] = .{ |
| 190 | .llvm_name = "sm_50", | 190 | .llvm_name = "sm_50", |
| 191 | .description = "Target SM 5.0", | 191 | .description = "Target SM 5.0", |
| 192 | .dependencies = featureSet(&[_]Feature{}), | 192 | .dependencies = featureSet(&[_]Feature{}), |
| 193 | }; | 193 | }; |
| 194 | result[@enumToInt(Feature.sm_52)] = .{ | 194 | result[@intFromEnum(Feature.sm_52)] = .{ |
| 195 | .llvm_name = "sm_52", | 195 | .llvm_name = "sm_52", |
| 196 | .description = "Target SM 5.2", | 196 | .description = "Target SM 5.2", |
| 197 | .dependencies = featureSet(&[_]Feature{}), | 197 | .dependencies = featureSet(&[_]Feature{}), |
| 198 | }; | 198 | }; |
| 199 | result[@enumToInt(Feature.sm_53)] = .{ | 199 | result[@intFromEnum(Feature.sm_53)] = .{ |
| 200 | .llvm_name = "sm_53", | 200 | .llvm_name = "sm_53", |
| 201 | .description = "Target SM 5.3", | 201 | .description = "Target SM 5.3", |
| 202 | .dependencies = featureSet(&[_]Feature{}), | 202 | .dependencies = featureSet(&[_]Feature{}), |
| 203 | }; | 203 | }; |
| 204 | result[@enumToInt(Feature.sm_60)] = .{ | 204 | result[@intFromEnum(Feature.sm_60)] = .{ |
| 205 | .llvm_name = "sm_60", | 205 | .llvm_name = "sm_60", |
| 206 | .description = "Target SM 6.0", | 206 | .description = "Target SM 6.0", |
| 207 | .dependencies = featureSet(&[_]Feature{}), | 207 | .dependencies = featureSet(&[_]Feature{}), |
| 208 | }; | 208 | }; |
| 209 | result[@enumToInt(Feature.sm_61)] = .{ | 209 | result[@intFromEnum(Feature.sm_61)] = .{ |
| 210 | .llvm_name = "sm_61", | 210 | .llvm_name = "sm_61", |
| 211 | .description = "Target SM 6.1", | 211 | .description = "Target SM 6.1", |
| 212 | .dependencies = featureSet(&[_]Feature{}), | 212 | .dependencies = featureSet(&[_]Feature{}), |
| 213 | }; | 213 | }; |
| 214 | result[@enumToInt(Feature.sm_62)] = .{ | 214 | result[@intFromEnum(Feature.sm_62)] = .{ |
| 215 | .llvm_name = "sm_62", | 215 | .llvm_name = "sm_62", |
| 216 | .description = "Target SM 6.2", | 216 | .description = "Target SM 6.2", |
| 217 | .dependencies = featureSet(&[_]Feature{}), | 217 | .dependencies = featureSet(&[_]Feature{}), |
| 218 | }; | 218 | }; |
| 219 | result[@enumToInt(Feature.sm_70)] = .{ | 219 | result[@intFromEnum(Feature.sm_70)] = .{ |
| 220 | .llvm_name = "sm_70", | 220 | .llvm_name = "sm_70", |
| 221 | .description = "Target SM 7.0", | 221 | .description = "Target SM 7.0", |
| 222 | .dependencies = featureSet(&[_]Feature{}), | 222 | .dependencies = featureSet(&[_]Feature{}), |
| 223 | }; | 223 | }; |
| 224 | result[@enumToInt(Feature.sm_72)] = .{ | 224 | result[@intFromEnum(Feature.sm_72)] = .{ |
| 225 | .llvm_name = "sm_72", | 225 | .llvm_name = "sm_72", |
| 226 | .description = "Target SM 7.2", | 226 | .description = "Target SM 7.2", |
| 227 | .dependencies = featureSet(&[_]Feature{}), | 227 | .dependencies = featureSet(&[_]Feature{}), |
| 228 | }; | 228 | }; |
| 229 | result[@enumToInt(Feature.sm_75)] = .{ | 229 | result[@intFromEnum(Feature.sm_75)] = .{ |
| 230 | .llvm_name = "sm_75", | 230 | .llvm_name = "sm_75", |
| 231 | .description = "Target SM 7.5", | 231 | .description = "Target SM 7.5", |
| 232 | .dependencies = featureSet(&[_]Feature{}), | 232 | .dependencies = featureSet(&[_]Feature{}), |
| 233 | }; | 233 | }; |
| 234 | result[@enumToInt(Feature.sm_80)] = .{ | 234 | result[@intFromEnum(Feature.sm_80)] = .{ |
| 235 | .llvm_name = "sm_80", | 235 | .llvm_name = "sm_80", |
| 236 | .description = "Target SM 8.0", | 236 | .description = "Target SM 8.0", |
| 237 | .dependencies = featureSet(&[_]Feature{}), | 237 | .dependencies = featureSet(&[_]Feature{}), |
| 238 | }; | 238 | }; |
| 239 | result[@enumToInt(Feature.sm_86)] = .{ | 239 | result[@intFromEnum(Feature.sm_86)] = .{ |
| 240 | .llvm_name = "sm_86", | 240 | .llvm_name = "sm_86", |
| 241 | .description = "Target SM 8.6", | 241 | .description = "Target SM 8.6", |
| 242 | .dependencies = featureSet(&[_]Feature{}), | 242 | .dependencies = featureSet(&[_]Feature{}), |
| 243 | }; | 243 | }; |
| 244 | result[@enumToInt(Feature.sm_87)] = .{ | 244 | result[@intFromEnum(Feature.sm_87)] = .{ |
| 245 | .llvm_name = "sm_87", | 245 | .llvm_name = "sm_87", |
| 246 | .description = "Target SM 8.7", | 246 | .description = "Target SM 8.7", |
| 247 | .dependencies = featureSet(&[_]Feature{}), | 247 | .dependencies = featureSet(&[_]Feature{}), |
| 248 | }; | 248 | }; |
| 249 | result[@enumToInt(Feature.sm_89)] = .{ | 249 | result[@intFromEnum(Feature.sm_89)] = .{ |
| 250 | .llvm_name = "sm_89", | 250 | .llvm_name = "sm_89", |
| 251 | .description = "Target SM 8.9", | 251 | .description = "Target SM 8.9", |
| 252 | .dependencies = featureSet(&[_]Feature{}), | 252 | .dependencies = featureSet(&[_]Feature{}), |
| 253 | }; | 253 | }; |
| 254 | result[@enumToInt(Feature.sm_90)] = .{ | 254 | result[@intFromEnum(Feature.sm_90)] = .{ |
| 255 | .llvm_name = "sm_90", | 255 | .llvm_name = "sm_90", |
| 256 | .description = "Target SM 9.0", | 256 | .description = "Target SM 9.0", |
| 257 | .dependencies = featureSet(&[_]Feature{}), | 257 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/powerpc.zig+81-81| ... | @@ -97,329 +97,329 @@ pub const all_features = blk: { | ... | @@ -97,329 +97,329 @@ pub const all_features = blk: { |
| 97 | const len = @typeInfo(Feature).Enum.fields.len; | 97 | const len = @typeInfo(Feature).Enum.fields.len; |
| 98 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 98 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 99 | var result: [len]CpuFeature = undefined; | 99 | var result: [len]CpuFeature = undefined; |
| 100 | result[@enumToInt(Feature.@"64bit")] = .{ | 100 | result[@intFromEnum(Feature.@"64bit")] = .{ |
| 101 | .llvm_name = "64bit", | 101 | .llvm_name = "64bit", |
| 102 | .description = "Enable 64-bit instructions", | 102 | .description = "Enable 64-bit instructions", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@enumToInt(Feature.@"64bitregs")] = .{ | 105 | result[@intFromEnum(Feature.@"64bitregs")] = .{ |
| 106 | .llvm_name = "64bitregs", | 106 | .llvm_name = "64bitregs", |
| 107 | .description = "Enable 64-bit registers usage for ppc32 [beta]", | 107 | .description = "Enable 64-bit registers usage for ppc32 [beta]", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@enumToInt(Feature.aix)] = .{ | 110 | result[@intFromEnum(Feature.aix)] = .{ |
| 111 | .llvm_name = "aix", | 111 | .llvm_name = "aix", |
| 112 | .description = "AIX OS", | 112 | .description = "AIX OS", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@enumToInt(Feature.allow_unaligned_fp_access)] = .{ | 115 | result[@intFromEnum(Feature.allow_unaligned_fp_access)] = .{ |
| 116 | .llvm_name = "allow-unaligned-fp-access", | 116 | .llvm_name = "allow-unaligned-fp-access", |
| 117 | .description = "CPU does not trap on unaligned FP access", | 117 | .description = "CPU does not trap on unaligned FP access", |
| 118 | .dependencies = featureSet(&[_]Feature{}), | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | }; | 119 | }; |
| 120 | result[@enumToInt(Feature.altivec)] = .{ | 120 | result[@intFromEnum(Feature.altivec)] = .{ |
| 121 | .llvm_name = "altivec", | 121 | .llvm_name = "altivec", |
| 122 | .description = "Enable Altivec instructions", | 122 | .description = "Enable Altivec instructions", |
| 123 | .dependencies = featureSet(&[_]Feature{ | 123 | .dependencies = featureSet(&[_]Feature{ |
| 124 | .fpu, | 124 | .fpu, |
| 125 | }), | 125 | }), |
| 126 | }; | 126 | }; |
| 127 | result[@enumToInt(Feature.booke)] = .{ | 127 | result[@intFromEnum(Feature.booke)] = .{ |
| 128 | .llvm_name = "booke", | 128 | .llvm_name = "booke", |
| 129 | .description = "Enable Book E instructions", | 129 | .description = "Enable Book E instructions", |
| 130 | .dependencies = featureSet(&[_]Feature{ | 130 | .dependencies = featureSet(&[_]Feature{ |
| 131 | .icbt, | 131 | .icbt, |
| 132 | }), | 132 | }), |
| 133 | }; | 133 | }; |
| 134 | result[@enumToInt(Feature.bpermd)] = .{ | 134 | result[@intFromEnum(Feature.bpermd)] = .{ |
| 135 | .llvm_name = "bpermd", | 135 | .llvm_name = "bpermd", |
| 136 | .description = "Enable the bpermd instruction", | 136 | .description = "Enable the bpermd instruction", |
| 137 | .dependencies = featureSet(&[_]Feature{}), | 137 | .dependencies = featureSet(&[_]Feature{}), |
| 138 | }; | 138 | }; |
| 139 | result[@enumToInt(Feature.cmpb)] = .{ | 139 | result[@intFromEnum(Feature.cmpb)] = .{ |
| 140 | .llvm_name = "cmpb", | 140 | .llvm_name = "cmpb", |
| 141 | .description = "Enable the cmpb instruction", | 141 | .description = "Enable the cmpb instruction", |
| 142 | .dependencies = featureSet(&[_]Feature{}), | 142 | .dependencies = featureSet(&[_]Feature{}), |
| 143 | }; | 143 | }; |
| 144 | result[@enumToInt(Feature.crbits)] = .{ | 144 | result[@intFromEnum(Feature.crbits)] = .{ |
| 145 | .llvm_name = "crbits", | 145 | .llvm_name = "crbits", |
| 146 | .description = "Use condition-register bits individually", | 146 | .description = "Use condition-register bits individually", |
| 147 | .dependencies = featureSet(&[_]Feature{}), | 147 | .dependencies = featureSet(&[_]Feature{}), |
| 148 | }; | 148 | }; |
| 149 | result[@enumToInt(Feature.crypto)] = .{ | 149 | result[@intFromEnum(Feature.crypto)] = .{ |
| 150 | .llvm_name = "crypto", | 150 | .llvm_name = "crypto", |
| 151 | .description = "Enable POWER8 Crypto instructions", | 151 | .description = "Enable POWER8 Crypto instructions", |
| 152 | .dependencies = featureSet(&[_]Feature{ | 152 | .dependencies = featureSet(&[_]Feature{ |
| 153 | .power8_altivec, | 153 | .power8_altivec, |
| 154 | }), | 154 | }), |
| 155 | }; | 155 | }; |
| 156 | result[@enumToInt(Feature.direct_move)] = .{ | 156 | result[@intFromEnum(Feature.direct_move)] = .{ |
| 157 | .llvm_name = "direct-move", | 157 | .llvm_name = "direct-move", |
| 158 | .description = "Enable Power8 direct move instructions", | 158 | .description = "Enable Power8 direct move instructions", |
| 159 | .dependencies = featureSet(&[_]Feature{ | 159 | .dependencies = featureSet(&[_]Feature{ |
| 160 | .vsx, | 160 | .vsx, |
| 161 | }), | 161 | }), |
| 162 | }; | 162 | }; |
| 163 | result[@enumToInt(Feature.e500)] = .{ | 163 | result[@intFromEnum(Feature.e500)] = .{ |
| 164 | .llvm_name = "e500", | 164 | .llvm_name = "e500", |
| 165 | .description = "Enable E500/E500mc instructions", | 165 | .description = "Enable E500/E500mc instructions", |
| 166 | .dependencies = featureSet(&[_]Feature{}), | 166 | .dependencies = featureSet(&[_]Feature{}), |
| 167 | }; | 167 | }; |
| 168 | result[@enumToInt(Feature.efpu2)] = .{ | 168 | result[@intFromEnum(Feature.efpu2)] = .{ |
| 169 | .llvm_name = "efpu2", | 169 | .llvm_name = "efpu2", |
| 170 | .description = "Enable Embedded Floating-Point APU 2 instructions", | 170 | .description = "Enable Embedded Floating-Point APU 2 instructions", |
| 171 | .dependencies = featureSet(&[_]Feature{ | 171 | .dependencies = featureSet(&[_]Feature{ |
| 172 | .spe, | 172 | .spe, |
| 173 | }), | 173 | }), |
| 174 | }; | 174 | }; |
| 175 | result[@enumToInt(Feature.extdiv)] = .{ | 175 | result[@intFromEnum(Feature.extdiv)] = .{ |
| 176 | .llvm_name = "extdiv", | 176 | .llvm_name = "extdiv", |
| 177 | .description = "Enable extended divide instructions", | 177 | .description = "Enable extended divide instructions", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@enumToInt(Feature.fast_MFLR)] = .{ | 180 | result[@intFromEnum(Feature.fast_MFLR)] = .{ |
| 181 | .llvm_name = "fast-MFLR", | 181 | .llvm_name = "fast-MFLR", |
| 182 | .description = "MFLR is a fast instruction", | 182 | .description = "MFLR is a fast instruction", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@enumToInt(Feature.fcpsgn)] = .{ | 185 | result[@intFromEnum(Feature.fcpsgn)] = .{ |
| 186 | .llvm_name = "fcpsgn", | 186 | .llvm_name = "fcpsgn", |
| 187 | .description = "Enable the fcpsgn instruction", | 187 | .description = "Enable the fcpsgn instruction", |
| 188 | .dependencies = featureSet(&[_]Feature{ | 188 | .dependencies = featureSet(&[_]Feature{ |
| 189 | .fpu, | 189 | .fpu, |
| 190 | }), | 190 | }), |
| 191 | }; | 191 | }; |
| 192 | result[@enumToInt(Feature.float128)] = .{ | 192 | result[@intFromEnum(Feature.float128)] = .{ |
| 193 | .llvm_name = "float128", | 193 | .llvm_name = "float128", |
| 194 | .description = "Enable the __float128 data type for IEEE-754R Binary128.", | 194 | .description = "Enable the __float128 data type for IEEE-754R Binary128.", |
| 195 | .dependencies = featureSet(&[_]Feature{ | 195 | .dependencies = featureSet(&[_]Feature{ |
| 196 | .vsx, | 196 | .vsx, |
| 197 | }), | 197 | }), |
| 198 | }; | 198 | }; |
| 199 | result[@enumToInt(Feature.fpcvt)] = .{ | 199 | result[@intFromEnum(Feature.fpcvt)] = .{ |
| 200 | .llvm_name = "fpcvt", | 200 | .llvm_name = "fpcvt", |
| 201 | .description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", | 201 | .description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions", |
| 202 | .dependencies = featureSet(&[_]Feature{ | 202 | .dependencies = featureSet(&[_]Feature{ |
| 203 | .fpu, | 203 | .fpu, |
| 204 | }), | 204 | }), |
| 205 | }; | 205 | }; |
| 206 | result[@enumToInt(Feature.fprnd)] = .{ | 206 | result[@intFromEnum(Feature.fprnd)] = .{ |
| 207 | .llvm_name = "fprnd", | 207 | .llvm_name = "fprnd", |
| 208 | .description = "Enable the fri[mnpz] instructions", | 208 | .description = "Enable the fri[mnpz] instructions", |
| 209 | .dependencies = featureSet(&[_]Feature{ | 209 | .dependencies = featureSet(&[_]Feature{ |
| 210 | .fpu, | 210 | .fpu, |
| 211 | }), | 211 | }), |
| 212 | }; | 212 | }; |
| 213 | result[@enumToInt(Feature.fpu)] = .{ | 213 | result[@intFromEnum(Feature.fpu)] = .{ |
| 214 | .llvm_name = "fpu", | 214 | .llvm_name = "fpu", |
| 215 | .description = "Enable classic FPU instructions", | 215 | .description = "Enable classic FPU instructions", |
| 216 | .dependencies = featureSet(&[_]Feature{ | 216 | .dependencies = featureSet(&[_]Feature{ |
| 217 | .hard_float, | 217 | .hard_float, |
| 218 | }), | 218 | }), |
| 219 | }; | 219 | }; |
| 220 | result[@enumToInt(Feature.fre)] = .{ | 220 | result[@intFromEnum(Feature.fre)] = .{ |
| 221 | .llvm_name = "fre", | 221 | .llvm_name = "fre", |
| 222 | .description = "Enable the fre instruction", | 222 | .description = "Enable the fre instruction", |
| 223 | .dependencies = featureSet(&[_]Feature{ | 223 | .dependencies = featureSet(&[_]Feature{ |
| 224 | .fpu, | 224 | .fpu, |
| 225 | }), | 225 | }), |
| 226 | }; | 226 | }; |
| 227 | result[@enumToInt(Feature.fres)] = .{ | 227 | result[@intFromEnum(Feature.fres)] = .{ |
| 228 | .llvm_name = "fres", | 228 | .llvm_name = "fres", |
| 229 | .description = "Enable the fres instruction", | 229 | .description = "Enable the fres instruction", |
| 230 | .dependencies = featureSet(&[_]Feature{ | 230 | .dependencies = featureSet(&[_]Feature{ |
| 231 | .fpu, | 231 | .fpu, |
| 232 | }), | 232 | }), |
| 233 | }; | 233 | }; |
| 234 | result[@enumToInt(Feature.frsqrte)] = .{ | 234 | result[@intFromEnum(Feature.frsqrte)] = .{ |
| 235 | .llvm_name = "frsqrte", | 235 | .llvm_name = "frsqrte", |
| 236 | .description = "Enable the frsqrte instruction", | 236 | .description = "Enable the frsqrte instruction", |
| 237 | .dependencies = featureSet(&[_]Feature{ | 237 | .dependencies = featureSet(&[_]Feature{ |
| 238 | .fpu, | 238 | .fpu, |
| 239 | }), | 239 | }), |
| 240 | }; | 240 | }; |
| 241 | result[@enumToInt(Feature.frsqrtes)] = .{ | 241 | result[@intFromEnum(Feature.frsqrtes)] = .{ |
| 242 | .llvm_name = "frsqrtes", | 242 | .llvm_name = "frsqrtes", |
| 243 | .description = "Enable the frsqrtes instruction", | 243 | .description = "Enable the frsqrtes instruction", |
| 244 | .dependencies = featureSet(&[_]Feature{ | 244 | .dependencies = featureSet(&[_]Feature{ |
| 245 | .fpu, | 245 | .fpu, |
| 246 | }), | 246 | }), |
| 247 | }; | 247 | }; |
| 248 | result[@enumToInt(Feature.fsqrt)] = .{ | 248 | result[@intFromEnum(Feature.fsqrt)] = .{ |
| 249 | .llvm_name = "fsqrt", | 249 | .llvm_name = "fsqrt", |
| 250 | .description = "Enable the fsqrt instruction", | 250 | .description = "Enable the fsqrt instruction", |
| 251 | .dependencies = featureSet(&[_]Feature{ | 251 | .dependencies = featureSet(&[_]Feature{ |
| 252 | .fpu, | 252 | .fpu, |
| 253 | }), | 253 | }), |
| 254 | }; | 254 | }; |
| 255 | result[@enumToInt(Feature.fuse_add_logical)] = .{ | 255 | result[@intFromEnum(Feature.fuse_add_logical)] = .{ |
| 256 | .llvm_name = "fuse-add-logical", | 256 | .llvm_name = "fuse-add-logical", |
| 257 | .description = "Target supports Add with Logical Operations fusion", | 257 | .description = "Target supports Add with Logical Operations fusion", |
| 258 | .dependencies = featureSet(&[_]Feature{ | 258 | .dependencies = featureSet(&[_]Feature{ |
| 259 | .fusion, | 259 | .fusion, |
| 260 | }), | 260 | }), |
| 261 | }; | 261 | }; |
| 262 | result[@enumToInt(Feature.fuse_addi_load)] = .{ | 262 | result[@intFromEnum(Feature.fuse_addi_load)] = .{ |
| 263 | .llvm_name = "fuse-addi-load", | 263 | .llvm_name = "fuse-addi-load", |
| 264 | .description = "Power8 Addi-Load fusion", | 264 | .description = "Power8 Addi-Load fusion", |
| 265 | .dependencies = featureSet(&[_]Feature{ | 265 | .dependencies = featureSet(&[_]Feature{ |
| 266 | .fusion, | 266 | .fusion, |
| 267 | }), | 267 | }), |
| 268 | }; | 268 | }; |
| 269 | result[@enumToInt(Feature.fuse_addis_load)] = .{ | 269 | result[@intFromEnum(Feature.fuse_addis_load)] = .{ |
| 270 | .llvm_name = "fuse-addis-load", | 270 | .llvm_name = "fuse-addis-load", |
| 271 | .description = "Power8 Addis-Load fusion", | 271 | .description = "Power8 Addis-Load fusion", |
| 272 | .dependencies = featureSet(&[_]Feature{ | 272 | .dependencies = featureSet(&[_]Feature{ |
| 273 | .fusion, | 273 | .fusion, |
| 274 | }), | 274 | }), |
| 275 | }; | 275 | }; |
| 276 | result[@enumToInt(Feature.fuse_arith_add)] = .{ | 276 | result[@intFromEnum(Feature.fuse_arith_add)] = .{ |
| 277 | .llvm_name = "fuse-arith-add", | 277 | .llvm_name = "fuse-arith-add", |
| 278 | .description = "Target supports Arithmetic Operations with Add fusion", | 278 | .description = "Target supports Arithmetic Operations with Add fusion", |
| 279 | .dependencies = featureSet(&[_]Feature{ | 279 | .dependencies = featureSet(&[_]Feature{ |
| 280 | .fusion, | 280 | .fusion, |
| 281 | }), | 281 | }), |
| 282 | }; | 282 | }; |
| 283 | result[@enumToInt(Feature.fuse_back2back)] = .{ | 283 | result[@intFromEnum(Feature.fuse_back2back)] = .{ |
| 284 | .llvm_name = "fuse-back2back", | 284 | .llvm_name = "fuse-back2back", |
| 285 | .description = "Target supports general back to back fusion", | 285 | .description = "Target supports general back to back fusion", |
| 286 | .dependencies = featureSet(&[_]Feature{ | 286 | .dependencies = featureSet(&[_]Feature{ |
| 287 | .fusion, | 287 | .fusion, |
| 288 | }), | 288 | }), |
| 289 | }; | 289 | }; |
| 290 | result[@enumToInt(Feature.fuse_cmp)] = .{ | 290 | result[@intFromEnum(Feature.fuse_cmp)] = .{ |
| 291 | .llvm_name = "fuse-cmp", | 291 | .llvm_name = "fuse-cmp", |
| 292 | .description = "Target supports Comparison Operations fusion", | 292 | .description = "Target supports Comparison Operations fusion", |
| 293 | .dependencies = featureSet(&[_]Feature{ | 293 | .dependencies = featureSet(&[_]Feature{ |
| 294 | .fusion, | 294 | .fusion, |
| 295 | }), | 295 | }), |
| 296 | }; | 296 | }; |
| 297 | result[@enumToInt(Feature.fuse_logical)] = .{ | 297 | result[@intFromEnum(Feature.fuse_logical)] = .{ |
| 298 | .llvm_name = "fuse-logical", | 298 | .llvm_name = "fuse-logical", |
| 299 | .description = "Target supports Logical Operations fusion", | 299 | .description = "Target supports Logical Operations fusion", |
| 300 | .dependencies = featureSet(&[_]Feature{ | 300 | .dependencies = featureSet(&[_]Feature{ |
| 301 | .fusion, | 301 | .fusion, |
| 302 | }), | 302 | }), |
| 303 | }; | 303 | }; |
| 304 | result[@enumToInt(Feature.fuse_logical_add)] = .{ | 304 | result[@intFromEnum(Feature.fuse_logical_add)] = .{ |
| 305 | .llvm_name = "fuse-logical-add", | 305 | .llvm_name = "fuse-logical-add", |
| 306 | .description = "Target supports Logical with Add Operations fusion", | 306 | .description = "Target supports Logical with Add Operations fusion", |
| 307 | .dependencies = featureSet(&[_]Feature{ | 307 | .dependencies = featureSet(&[_]Feature{ |
| 308 | .fusion, | 308 | .fusion, |
| 309 | }), | 309 | }), |
| 310 | }; | 310 | }; |
| 311 | result[@enumToInt(Feature.fuse_sha3)] = .{ | 311 | result[@intFromEnum(Feature.fuse_sha3)] = .{ |
| 312 | .llvm_name = "fuse-sha3", | 312 | .llvm_name = "fuse-sha3", |
| 313 | .description = "Target supports SHA3 assist fusion", | 313 | .description = "Target supports SHA3 assist fusion", |
| 314 | .dependencies = featureSet(&[_]Feature{ | 314 | .dependencies = featureSet(&[_]Feature{ |
| 315 | .fusion, | 315 | .fusion, |
| 316 | }), | 316 | }), |
| 317 | }; | 317 | }; |
| 318 | result[@enumToInt(Feature.fuse_store)] = .{ | 318 | result[@intFromEnum(Feature.fuse_store)] = .{ |
| 319 | .llvm_name = "fuse-store", | 319 | .llvm_name = "fuse-store", |
| 320 | .description = "Target supports store clustering", | 320 | .description = "Target supports store clustering", |
| 321 | .dependencies = featureSet(&[_]Feature{ | 321 | .dependencies = featureSet(&[_]Feature{ |
| 322 | .fusion, | 322 | .fusion, |
| 323 | }), | 323 | }), |
| 324 | }; | 324 | }; |
| 325 | result[@enumToInt(Feature.fuse_wideimm)] = .{ | 325 | result[@intFromEnum(Feature.fuse_wideimm)] = .{ |
| 326 | .llvm_name = "fuse-wideimm", | 326 | .llvm_name = "fuse-wideimm", |
| 327 | .description = "Target supports Wide-Immediate fusion", | 327 | .description = "Target supports Wide-Immediate fusion", |
| 328 | .dependencies = featureSet(&[_]Feature{ | 328 | .dependencies = featureSet(&[_]Feature{ |
| 329 | .fusion, | 329 | .fusion, |
| 330 | }), | 330 | }), |
| 331 | }; | 331 | }; |
| 332 | result[@enumToInt(Feature.fuse_zeromove)] = .{ | 332 | result[@intFromEnum(Feature.fuse_zeromove)] = .{ |
| 333 | .llvm_name = "fuse-zeromove", | 333 | .llvm_name = "fuse-zeromove", |
| 334 | .description = "Target supports move to SPR with branch fusion", | 334 | .description = "Target supports move to SPR with branch fusion", |
| 335 | .dependencies = featureSet(&[_]Feature{ | 335 | .dependencies = featureSet(&[_]Feature{ |
| 336 | .fusion, | 336 | .fusion, |
| 337 | }), | 337 | }), |
| 338 | }; | 338 | }; |
| 339 | result[@enumToInt(Feature.fusion)] = .{ | 339 | result[@intFromEnum(Feature.fusion)] = .{ |
| 340 | .llvm_name = "fusion", | 340 | .llvm_name = "fusion", |
| 341 | .description = "Target supports instruction fusion", | 341 | .description = "Target supports instruction fusion", |
| 342 | .dependencies = featureSet(&[_]Feature{}), | 342 | .dependencies = featureSet(&[_]Feature{}), |
| 343 | }; | 343 | }; |
| 344 | result[@enumToInt(Feature.hard_float)] = .{ | 344 | result[@intFromEnum(Feature.hard_float)] = .{ |
| 345 | .llvm_name = "hard-float", | 345 | .llvm_name = "hard-float", |
| 346 | .description = "Enable floating-point instructions", | 346 | .description = "Enable floating-point instructions", |
| 347 | .dependencies = featureSet(&[_]Feature{}), | 347 | .dependencies = featureSet(&[_]Feature{}), |
| 348 | }; | 348 | }; |
| 349 | result[@enumToInt(Feature.htm)] = .{ | 349 | result[@intFromEnum(Feature.htm)] = .{ |
| 350 | .llvm_name = "htm", | 350 | .llvm_name = "htm", |
| 351 | .description = "Enable Hardware Transactional Memory instructions", | 351 | .description = "Enable Hardware Transactional Memory instructions", |
| 352 | .dependencies = featureSet(&[_]Feature{}), | 352 | .dependencies = featureSet(&[_]Feature{}), |
| 353 | }; | 353 | }; |
| 354 | result[@enumToInt(Feature.icbt)] = .{ | 354 | result[@intFromEnum(Feature.icbt)] = .{ |
| 355 | .llvm_name = "icbt", | 355 | .llvm_name = "icbt", |
| 356 | .description = "Enable icbt instruction", | 356 | .description = "Enable icbt instruction", |
| 357 | .dependencies = featureSet(&[_]Feature{}), | 357 | .dependencies = featureSet(&[_]Feature{}), |
| 358 | }; | 358 | }; |
| 359 | result[@enumToInt(Feature.invariant_function_descriptors)] = .{ | 359 | result[@intFromEnum(Feature.invariant_function_descriptors)] = .{ |
| 360 | .llvm_name = "invariant-function-descriptors", | 360 | .llvm_name = "invariant-function-descriptors", |
| 361 | .description = "Assume function descriptors are invariant", | 361 | .description = "Assume function descriptors are invariant", |
| 362 | .dependencies = featureSet(&[_]Feature{}), | 362 | .dependencies = featureSet(&[_]Feature{}), |
| 363 | }; | 363 | }; |
| 364 | result[@enumToInt(Feature.isa_future_instructions)] = .{ | 364 | result[@intFromEnum(Feature.isa_future_instructions)] = .{ |
| 365 | .llvm_name = "isa-future-instructions", | 365 | .llvm_name = "isa-future-instructions", |
| 366 | .description = "Enable instructions for Future ISA.", | 366 | .description = "Enable instructions for Future ISA.", |
| 367 | .dependencies = featureSet(&[_]Feature{ | 367 | .dependencies = featureSet(&[_]Feature{ |
| 368 | .isa_v31_instructions, | 368 | .isa_v31_instructions, |
| 369 | }), | 369 | }), |
| 370 | }; | 370 | }; |
| 371 | result[@enumToInt(Feature.isa_v206_instructions)] = .{ | 371 | result[@intFromEnum(Feature.isa_v206_instructions)] = .{ |
| 372 | .llvm_name = "isa-v206-instructions", | 372 | .llvm_name = "isa-v206-instructions", |
| 373 | .description = "Enable instructions in ISA 2.06.", | 373 | .description = "Enable instructions in ISA 2.06.", |
| 374 | .dependencies = featureSet(&[_]Feature{}), | 374 | .dependencies = featureSet(&[_]Feature{}), |
| 375 | }; | 375 | }; |
| 376 | result[@enumToInt(Feature.isa_v207_instructions)] = .{ | 376 | result[@intFromEnum(Feature.isa_v207_instructions)] = .{ |
| 377 | .llvm_name = "isa-v207-instructions", | 377 | .llvm_name = "isa-v207-instructions", |
| 378 | .description = "Enable instructions in ISA 2.07.", | 378 | .description = "Enable instructions in ISA 2.07.", |
| 379 | .dependencies = featureSet(&[_]Feature{}), | 379 | .dependencies = featureSet(&[_]Feature{}), |
| 380 | }; | 380 | }; |
| 381 | result[@enumToInt(Feature.isa_v30_instructions)] = .{ | 381 | result[@intFromEnum(Feature.isa_v30_instructions)] = .{ |
| 382 | .llvm_name = "isa-v30-instructions", | 382 | .llvm_name = "isa-v30-instructions", |
| 383 | .description = "Enable instructions in ISA 3.0.", | 383 | .description = "Enable instructions in ISA 3.0.", |
| 384 | .dependencies = featureSet(&[_]Feature{ | 384 | .dependencies = featureSet(&[_]Feature{ |
| 385 | .isa_v207_instructions, | 385 | .isa_v207_instructions, |
| 386 | }), | 386 | }), |
| 387 | }; | 387 | }; |
| 388 | result[@enumToInt(Feature.isa_v31_instructions)] = .{ | 388 | result[@intFromEnum(Feature.isa_v31_instructions)] = .{ |
| 389 | .llvm_name = "isa-v31-instructions", | 389 | .llvm_name = "isa-v31-instructions", |
| 390 | .description = "Enable instructions in ISA 3.1.", | 390 | .description = "Enable instructions in ISA 3.1.", |
| 391 | .dependencies = featureSet(&[_]Feature{ | 391 | .dependencies = featureSet(&[_]Feature{ |
| 392 | .isa_v30_instructions, | 392 | .isa_v30_instructions, |
| 393 | }), | 393 | }), |
| 394 | }; | 394 | }; |
| 395 | result[@enumToInt(Feature.isel)] = .{ | 395 | result[@intFromEnum(Feature.isel)] = .{ |
| 396 | .llvm_name = "isel", | 396 | .llvm_name = "isel", |
| 397 | .description = "Enable the isel instruction", | 397 | .description = "Enable the isel instruction", |
| 398 | .dependencies = featureSet(&[_]Feature{}), | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | }; | 399 | }; |
| 400 | result[@enumToInt(Feature.ldbrx)] = .{ | 400 | result[@intFromEnum(Feature.ldbrx)] = .{ |
| 401 | .llvm_name = "ldbrx", | 401 | .llvm_name = "ldbrx", |
| 402 | .description = "Enable the ldbrx instruction", | 402 | .description = "Enable the ldbrx instruction", |
| 403 | .dependencies = featureSet(&[_]Feature{}), | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | }; | 404 | }; |
| 405 | result[@enumToInt(Feature.lfiwax)] = .{ | 405 | result[@intFromEnum(Feature.lfiwax)] = .{ |
| 406 | .llvm_name = "lfiwax", | 406 | .llvm_name = "lfiwax", |
| 407 | .description = "Enable the lfiwax instruction", | 407 | .description = "Enable the lfiwax instruction", |
| 408 | .dependencies = featureSet(&[_]Feature{ | 408 | .dependencies = featureSet(&[_]Feature{ |
| 409 | .fpu, | 409 | .fpu, |
| 410 | }), | 410 | }), |
| 411 | }; | 411 | }; |
| 412 | result[@enumToInt(Feature.longcall)] = .{ | 412 | result[@intFromEnum(Feature.longcall)] = .{ |
| 413 | .llvm_name = "longcall", | 413 | .llvm_name = "longcall", |
| 414 | .description = "Always use indirect calls", | 414 | .description = "Always use indirect calls", |
| 415 | .dependencies = featureSet(&[_]Feature{}), | 415 | .dependencies = featureSet(&[_]Feature{}), |
| 416 | }; | 416 | }; |
| 417 | result[@enumToInt(Feature.mfocrf)] = .{ | 417 | result[@intFromEnum(Feature.mfocrf)] = .{ |
| 418 | .llvm_name = "mfocrf", | 418 | .llvm_name = "mfocrf", |
| 419 | .description = "Enable the MFOCRF instruction", | 419 | .description = "Enable the MFOCRF instruction", |
| 420 | .dependencies = featureSet(&[_]Feature{}), | 420 | .dependencies = featureSet(&[_]Feature{}), |
| 421 | }; | 421 | }; |
| 422 | result[@enumToInt(Feature.mma)] = .{ | 422 | result[@intFromEnum(Feature.mma)] = .{ |
| 423 | .llvm_name = "mma", | 423 | .llvm_name = "mma", |
| 424 | .description = "Enable MMA instructions", | 424 | .description = "Enable MMA instructions", |
| 425 | .dependencies = featureSet(&[_]Feature{ | 425 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -428,43 +428,43 @@ pub const all_features = blk: { | ... | @@ -428,43 +428,43 @@ pub const all_features = blk: { |
| 428 | .power9_altivec, | 428 | .power9_altivec, |
| 429 | }), | 429 | }), |
| 430 | }; | 430 | }; |
| 431 | result[@enumToInt(Feature.modern_aix_as)] = .{ | 431 | result[@intFromEnum(Feature.modern_aix_as)] = .{ |
| 432 | .llvm_name = "modern-aix-as", | 432 | .llvm_name = "modern-aix-as", |
| 433 | .description = "AIX system assembler is modern enough to support new mnes", | 433 | .description = "AIX system assembler is modern enough to support new mnes", |
| 434 | .dependencies = featureSet(&[_]Feature{}), | 434 | .dependencies = featureSet(&[_]Feature{}), |
| 435 | }; | 435 | }; |
| 436 | result[@enumToInt(Feature.msync)] = .{ | 436 | result[@intFromEnum(Feature.msync)] = .{ |
| 437 | .llvm_name = "msync", | 437 | .llvm_name = "msync", |
| 438 | .description = "Has only the msync instruction instead of sync", | 438 | .description = "Has only the msync instruction instead of sync", |
| 439 | .dependencies = featureSet(&[_]Feature{ | 439 | .dependencies = featureSet(&[_]Feature{ |
| 440 | .booke, | 440 | .booke, |
| 441 | }), | 441 | }), |
| 442 | }; | 442 | }; |
| 443 | result[@enumToInt(Feature.paired_vector_memops)] = .{ | 443 | result[@intFromEnum(Feature.paired_vector_memops)] = .{ |
| 444 | .llvm_name = "paired-vector-memops", | 444 | .llvm_name = "paired-vector-memops", |
| 445 | .description = "32Byte load and store instructions", | 445 | .description = "32Byte load and store instructions", |
| 446 | .dependencies = featureSet(&[_]Feature{ | 446 | .dependencies = featureSet(&[_]Feature{ |
| 447 | .isa_v30_instructions, | 447 | .isa_v30_instructions, |
| 448 | }), | 448 | }), |
| 449 | }; | 449 | }; |
| 450 | result[@enumToInt(Feature.partword_atomics)] = .{ | 450 | result[@intFromEnum(Feature.partword_atomics)] = .{ |
| 451 | .llvm_name = "partword-atomics", | 451 | .llvm_name = "partword-atomics", |
| 452 | .description = "Enable l[bh]arx and st[bh]cx.", | 452 | .description = "Enable l[bh]arx and st[bh]cx.", |
| 453 | .dependencies = featureSet(&[_]Feature{}), | 453 | .dependencies = featureSet(&[_]Feature{}), |
| 454 | }; | 454 | }; |
| 455 | result[@enumToInt(Feature.pcrelative_memops)] = .{ | 455 | result[@intFromEnum(Feature.pcrelative_memops)] = .{ |
| 456 | .llvm_name = "pcrelative-memops", | 456 | .llvm_name = "pcrelative-memops", |
| 457 | .description = "Enable PC relative Memory Ops", | 457 | .description = "Enable PC relative Memory Ops", |
| 458 | .dependencies = featureSet(&[_]Feature{ | 458 | .dependencies = featureSet(&[_]Feature{ |
| 459 | .prefix_instrs, | 459 | .prefix_instrs, |
| 460 | }), | 460 | }), |
| 461 | }; | 461 | }; |
| 462 | result[@enumToInt(Feature.popcntd)] = .{ | 462 | result[@intFromEnum(Feature.popcntd)] = .{ |
| 463 | .llvm_name = "popcntd", | 463 | .llvm_name = "popcntd", |
| 464 | .description = "Enable the popcnt[dw] instructions", | 464 | .description = "Enable the popcnt[dw] instructions", |
| 465 | .dependencies = featureSet(&[_]Feature{}), | 465 | .dependencies = featureSet(&[_]Feature{}), |
| 466 | }; | 466 | }; |
| 467 | result[@enumToInt(Feature.power10_vector)] = .{ | 467 | result[@intFromEnum(Feature.power10_vector)] = .{ |
| 468 | .llvm_name = "power10-vector", | 468 | .llvm_name = "power10-vector", |
| 469 | .description = "Enable POWER10 vector instructions", | 469 | .description = "Enable POWER10 vector instructions", |
| 470 | .dependencies = featureSet(&[_]Feature{ | 470 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -472,14 +472,14 @@ pub const all_features = blk: { | ... | @@ -472,14 +472,14 @@ pub const all_features = blk: { |
| 472 | .power9_vector, | 472 | .power9_vector, |
| 473 | }), | 473 | }), |
| 474 | }; | 474 | }; |
| 475 | result[@enumToInt(Feature.power8_altivec)] = .{ | 475 | result[@intFromEnum(Feature.power8_altivec)] = .{ |
| 476 | .llvm_name = "power8-altivec", | 476 | .llvm_name = "power8-altivec", |
| 477 | .description = "Enable POWER8 Altivec instructions", | 477 | .description = "Enable POWER8 Altivec instructions", |
| 478 | .dependencies = featureSet(&[_]Feature{ | 478 | .dependencies = featureSet(&[_]Feature{ |
| 479 | .altivec, | 479 | .altivec, |
| 480 | }), | 480 | }), |
| 481 | }; | 481 | }; |
| 482 | result[@enumToInt(Feature.power8_vector)] = .{ | 482 | result[@intFromEnum(Feature.power8_vector)] = .{ |
| 483 | .llvm_name = "power8-vector", | 483 | .llvm_name = "power8-vector", |
| 484 | .description = "Enable POWER8 vector instructions", | 484 | .description = "Enable POWER8 vector instructions", |
| 485 | .dependencies = featureSet(&[_]Feature{ | 485 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -487,7 +487,7 @@ pub const all_features = blk: { | ... | @@ -487,7 +487,7 @@ pub const all_features = blk: { |
| 487 | .vsx, | 487 | .vsx, |
| 488 | }), | 488 | }), |
| 489 | }; | 489 | }; |
| 490 | result[@enumToInt(Feature.power9_altivec)] = .{ | 490 | result[@intFromEnum(Feature.power9_altivec)] = .{ |
| 491 | .llvm_name = "power9-altivec", | 491 | .llvm_name = "power9-altivec", |
| 492 | .description = "Enable POWER9 Altivec instructions", | 492 | .description = "Enable POWER9 Altivec instructions", |
| 493 | .dependencies = featureSet(&[_]Feature{ | 493 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -495,7 +495,7 @@ pub const all_features = blk: { | ... | @@ -495,7 +495,7 @@ pub const all_features = blk: { |
| 495 | .power8_altivec, | 495 | .power8_altivec, |
| 496 | }), | 496 | }), |
| 497 | }; | 497 | }; |
| 498 | result[@enumToInt(Feature.power9_vector)] = .{ | 498 | result[@intFromEnum(Feature.power9_vector)] = .{ |
| 499 | .llvm_name = "power9-vector", | 499 | .llvm_name = "power9-vector", |
| 500 | .description = "Enable POWER9 vector instructions", | 500 | .description = "Enable POWER9 vector instructions", |
| 501 | .dependencies = featureSet(&[_]Feature{ | 501 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -503,32 +503,32 @@ pub const all_features = blk: { | ... | @@ -503,32 +503,32 @@ pub const all_features = blk: { |
| 503 | .power9_altivec, | 503 | .power9_altivec, |
| 504 | }), | 504 | }), |
| 505 | }; | 505 | }; |
| 506 | result[@enumToInt(Feature.ppc4xx)] = .{ | 506 | result[@intFromEnum(Feature.ppc4xx)] = .{ |
| 507 | .llvm_name = "ppc4xx", | 507 | .llvm_name = "ppc4xx", |
| 508 | .description = "Enable PPC 4xx instructions", | 508 | .description = "Enable PPC 4xx instructions", |
| 509 | .dependencies = featureSet(&[_]Feature{}), | 509 | .dependencies = featureSet(&[_]Feature{}), |
| 510 | }; | 510 | }; |
| 511 | result[@enumToInt(Feature.ppc6xx)] = .{ | 511 | result[@intFromEnum(Feature.ppc6xx)] = .{ |
| 512 | .llvm_name = "ppc6xx", | 512 | .llvm_name = "ppc6xx", |
| 513 | .description = "Enable PPC 6xx instructions", | 513 | .description = "Enable PPC 6xx instructions", |
| 514 | .dependencies = featureSet(&[_]Feature{}), | 514 | .dependencies = featureSet(&[_]Feature{}), |
| 515 | }; | 515 | }; |
| 516 | result[@enumToInt(Feature.ppc_postra_sched)] = .{ | 516 | result[@intFromEnum(Feature.ppc_postra_sched)] = .{ |
| 517 | .llvm_name = "ppc-postra-sched", | 517 | .llvm_name = "ppc-postra-sched", |
| 518 | .description = "Use PowerPC post-RA scheduling strategy", | 518 | .description = "Use PowerPC post-RA scheduling strategy", |
| 519 | .dependencies = featureSet(&[_]Feature{}), | 519 | .dependencies = featureSet(&[_]Feature{}), |
| 520 | }; | 520 | }; |
| 521 | result[@enumToInt(Feature.ppc_prera_sched)] = .{ | 521 | result[@intFromEnum(Feature.ppc_prera_sched)] = .{ |
| 522 | .llvm_name = "ppc-prera-sched", | 522 | .llvm_name = "ppc-prera-sched", |
| 523 | .description = "Use PowerPC pre-RA scheduling strategy", | 523 | .description = "Use PowerPC pre-RA scheduling strategy", |
| 524 | .dependencies = featureSet(&[_]Feature{}), | 524 | .dependencies = featureSet(&[_]Feature{}), |
| 525 | }; | 525 | }; |
| 526 | result[@enumToInt(Feature.predictable_select_expensive)] = .{ | 526 | result[@intFromEnum(Feature.predictable_select_expensive)] = .{ |
| 527 | .llvm_name = "predictable-select-expensive", | 527 | .llvm_name = "predictable-select-expensive", |
| 528 | .description = "Prefer likely predicted branches over selects", | 528 | .description = "Prefer likely predicted branches over selects", |
| 529 | .dependencies = featureSet(&[_]Feature{}), | 529 | .dependencies = featureSet(&[_]Feature{}), |
| 530 | }; | 530 | }; |
| 531 | result[@enumToInt(Feature.prefix_instrs)] = .{ | 531 | result[@intFromEnum(Feature.prefix_instrs)] = .{ |
| 532 | .llvm_name = "prefix-instrs", | 532 | .llvm_name = "prefix-instrs", |
| 533 | .description = "Enable prefixed instructions", | 533 | .description = "Enable prefixed instructions", |
| 534 | .dependencies = featureSet(&[_]Feature{ | 534 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -536,61 +536,61 @@ pub const all_features = blk: { | ... | @@ -536,61 +536,61 @@ pub const all_features = blk: { |
| 536 | .power9_altivec, | 536 | .power9_altivec, |
| 537 | }), | 537 | }), |
| 538 | }; | 538 | }; |
| 539 | result[@enumToInt(Feature.privileged)] = .{ | 539 | result[@intFromEnum(Feature.privileged)] = .{ |
| 540 | .llvm_name = "privileged", | 540 | .llvm_name = "privileged", |
| 541 | .description = "Add privileged instructions", | 541 | .description = "Add privileged instructions", |
| 542 | .dependencies = featureSet(&[_]Feature{}), | 542 | .dependencies = featureSet(&[_]Feature{}), |
| 543 | }; | 543 | }; |
| 544 | result[@enumToInt(Feature.quadword_atomics)] = .{ | 544 | result[@intFromEnum(Feature.quadword_atomics)] = .{ |
| 545 | .llvm_name = "quadword-atomics", | 545 | .llvm_name = "quadword-atomics", |
| 546 | .description = "Enable lqarx and stqcx.", | 546 | .description = "Enable lqarx and stqcx.", |
| 547 | .dependencies = featureSet(&[_]Feature{}), | 547 | .dependencies = featureSet(&[_]Feature{}), |
| 548 | }; | 548 | }; |
| 549 | result[@enumToInt(Feature.recipprec)] = .{ | 549 | result[@intFromEnum(Feature.recipprec)] = .{ |
| 550 | .llvm_name = "recipprec", | 550 | .llvm_name = "recipprec", |
| 551 | .description = "Assume higher precision reciprocal estimates", | 551 | .description = "Assume higher precision reciprocal estimates", |
| 552 | .dependencies = featureSet(&[_]Feature{}), | 552 | .dependencies = featureSet(&[_]Feature{}), |
| 553 | }; | 553 | }; |
| 554 | result[@enumToInt(Feature.rop_protect)] = .{ | 554 | result[@intFromEnum(Feature.rop_protect)] = .{ |
| 555 | .llvm_name = "rop-protect", | 555 | .llvm_name = "rop-protect", |
| 556 | .description = "Add ROP protect", | 556 | .description = "Add ROP protect", |
| 557 | .dependencies = featureSet(&[_]Feature{}), | 557 | .dependencies = featureSet(&[_]Feature{}), |
| 558 | }; | 558 | }; |
| 559 | result[@enumToInt(Feature.secure_plt)] = .{ | 559 | result[@intFromEnum(Feature.secure_plt)] = .{ |
| 560 | .llvm_name = "secure-plt", | 560 | .llvm_name = "secure-plt", |
| 561 | .description = "Enable secure plt mode", | 561 | .description = "Enable secure plt mode", |
| 562 | .dependencies = featureSet(&[_]Feature{}), | 562 | .dependencies = featureSet(&[_]Feature{}), |
| 563 | }; | 563 | }; |
| 564 | result[@enumToInt(Feature.slow_popcntd)] = .{ | 564 | result[@intFromEnum(Feature.slow_popcntd)] = .{ |
| 565 | .llvm_name = "slow-popcntd", | 565 | .llvm_name = "slow-popcntd", |
| 566 | .description = "Has slow popcnt[dw] instructions", | 566 | .description = "Has slow popcnt[dw] instructions", |
| 567 | .dependencies = featureSet(&[_]Feature{}), | 567 | .dependencies = featureSet(&[_]Feature{}), |
| 568 | }; | 568 | }; |
| 569 | result[@enumToInt(Feature.spe)] = .{ | 569 | result[@intFromEnum(Feature.spe)] = .{ |
| 570 | .llvm_name = "spe", | 570 | .llvm_name = "spe", |
| 571 | .description = "Enable SPE instructions", | 571 | .description = "Enable SPE instructions", |
| 572 | .dependencies = featureSet(&[_]Feature{ | 572 | .dependencies = featureSet(&[_]Feature{ |
| 573 | .hard_float, | 573 | .hard_float, |
| 574 | }), | 574 | }), |
| 575 | }; | 575 | }; |
| 576 | result[@enumToInt(Feature.stfiwx)] = .{ | 576 | result[@intFromEnum(Feature.stfiwx)] = .{ |
| 577 | .llvm_name = "stfiwx", | 577 | .llvm_name = "stfiwx", |
| 578 | .description = "Enable the stfiwx instruction", | 578 | .description = "Enable the stfiwx instruction", |
| 579 | .dependencies = featureSet(&[_]Feature{ | 579 | .dependencies = featureSet(&[_]Feature{ |
| 580 | .fpu, | 580 | .fpu, |
| 581 | }), | 581 | }), |
| 582 | }; | 582 | }; |
| 583 | result[@enumToInt(Feature.two_const_nr)] = .{ | 583 | result[@intFromEnum(Feature.two_const_nr)] = .{ |
| 584 | .llvm_name = "two-const-nr", | 584 | .llvm_name = "two-const-nr", |
| 585 | .description = "Requires two constant Newton-Raphson computation", | 585 | .description = "Requires two constant Newton-Raphson computation", |
| 586 | .dependencies = featureSet(&[_]Feature{}), | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | }; | 587 | }; |
| 588 | result[@enumToInt(Feature.vectors_use_two_units)] = .{ | 588 | result[@intFromEnum(Feature.vectors_use_two_units)] = .{ |
| 589 | .llvm_name = "vectors-use-two-units", | 589 | .llvm_name = "vectors-use-two-units", |
| 590 | .description = "Vectors use two units", | 590 | .description = "Vectors use two units", |
| 591 | .dependencies = featureSet(&[_]Feature{}), | 591 | .dependencies = featureSet(&[_]Feature{}), |
| 592 | }; | 592 | }; |
| 593 | result[@enumToInt(Feature.vsx)] = .{ | 593 | result[@intFromEnum(Feature.vsx)] = .{ |
| 594 | .llvm_name = "vsx", | 594 | .llvm_name = "vsx", |
| 595 | .description = "Enable VSX instructions", | 595 | .description = "Enable VSX instructions", |
| 596 | .dependencies = featureSet(&[_]Feature{ | 596 | .dependencies = featureSet(&[_]Feature{ |
lib/std/target/riscv.zig+108-108| ... | @@ -124,311 +124,311 @@ pub const all_features = blk: { | ... | @@ -124,311 +124,311 @@ pub const all_features = blk: { |
| 124 | const len = @typeInfo(Feature).Enum.fields.len; | 124 | const len = @typeInfo(Feature).Enum.fields.len; |
| 125 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 125 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 126 | var result: [len]CpuFeature = undefined; | 126 | var result: [len]CpuFeature = undefined; |
| 127 | result[@enumToInt(Feature.@"32bit")] = .{ | 127 | result[@intFromEnum(Feature.@"32bit")] = .{ |
| 128 | .llvm_name = "32bit", | 128 | .llvm_name = "32bit", |
| 129 | .description = "Implements RV32", | 129 | .description = "Implements RV32", |
| 130 | .dependencies = featureSet(&[_]Feature{}), | 130 | .dependencies = featureSet(&[_]Feature{}), |
| 131 | }; | 131 | }; |
| 132 | result[@enumToInt(Feature.@"64bit")] = .{ | 132 | result[@intFromEnum(Feature.@"64bit")] = .{ |
| 133 | .llvm_name = "64bit", | 133 | .llvm_name = "64bit", |
| 134 | .description = "Implements RV64", | 134 | .description = "Implements RV64", |
| 135 | .dependencies = featureSet(&[_]Feature{}), | 135 | .dependencies = featureSet(&[_]Feature{}), |
| 136 | }; | 136 | }; |
| 137 | result[@enumToInt(Feature.a)] = .{ | 137 | result[@intFromEnum(Feature.a)] = .{ |
| 138 | .llvm_name = "a", | 138 | .llvm_name = "a", |
| 139 | .description = "'A' (Atomic Instructions)", | 139 | .description = "'A' (Atomic Instructions)", |
| 140 | .dependencies = featureSet(&[_]Feature{}), | 140 | .dependencies = featureSet(&[_]Feature{}), |
| 141 | }; | 141 | }; |
| 142 | result[@enumToInt(Feature.c)] = .{ | 142 | result[@intFromEnum(Feature.c)] = .{ |
| 143 | .llvm_name = "c", | 143 | .llvm_name = "c", |
| 144 | .description = "'C' (Compressed Instructions)", | 144 | .description = "'C' (Compressed Instructions)", |
| 145 | .dependencies = featureSet(&[_]Feature{}), | 145 | .dependencies = featureSet(&[_]Feature{}), |
| 146 | }; | 146 | }; |
| 147 | result[@enumToInt(Feature.d)] = .{ | 147 | result[@intFromEnum(Feature.d)] = .{ |
| 148 | .llvm_name = "d", | 148 | .llvm_name = "d", |
| 149 | .description = "'D' (Double-Precision Floating-Point)", | 149 | .description = "'D' (Double-Precision Floating-Point)", |
| 150 | .dependencies = featureSet(&[_]Feature{ | 150 | .dependencies = featureSet(&[_]Feature{ |
| 151 | .f, | 151 | .f, |
| 152 | }), | 152 | }), |
| 153 | }; | 153 | }; |
| 154 | result[@enumToInt(Feature.e)] = .{ | 154 | result[@intFromEnum(Feature.e)] = .{ |
| 155 | .llvm_name = "e", | 155 | .llvm_name = "e", |
| 156 | .description = "Implements RV32E (provides 16 rather than 32 GPRs)", | 156 | .description = "Implements RV32E (provides 16 rather than 32 GPRs)", |
| 157 | .dependencies = featureSet(&[_]Feature{}), | 157 | .dependencies = featureSet(&[_]Feature{}), |
| 158 | }; | 158 | }; |
| 159 | result[@enumToInt(Feature.experimental_zawrs)] = .{ | 159 | result[@intFromEnum(Feature.experimental_zawrs)] = .{ |
| 160 | .llvm_name = "experimental-zawrs", | 160 | .llvm_name = "experimental-zawrs", |
| 161 | .description = "'Zawrs' (Wait on Reservation Set)", | 161 | .description = "'Zawrs' (Wait on Reservation Set)", |
| 162 | .dependencies = featureSet(&[_]Feature{}), | 162 | .dependencies = featureSet(&[_]Feature{}), |
| 163 | }; | 163 | }; |
| 164 | result[@enumToInt(Feature.experimental_zca)] = .{ | 164 | result[@intFromEnum(Feature.experimental_zca)] = .{ |
| 165 | .llvm_name = "experimental-zca", | 165 | .llvm_name = "experimental-zca", |
| 166 | .description = "'Zca' (part of the C extension, excluding compressed floating point loads/stores)", | 166 | .description = "'Zca' (part of the C extension, excluding compressed floating point loads/stores)", |
| 167 | .dependencies = featureSet(&[_]Feature{}), | 167 | .dependencies = featureSet(&[_]Feature{}), |
| 168 | }; | 168 | }; |
| 169 | result[@enumToInt(Feature.experimental_zcd)] = .{ | 169 | result[@intFromEnum(Feature.experimental_zcd)] = .{ |
| 170 | .llvm_name = "experimental-zcd", | 170 | .llvm_name = "experimental-zcd", |
| 171 | .description = "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", | 171 | .description = "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", |
| 172 | .dependencies = featureSet(&[_]Feature{}), | 172 | .dependencies = featureSet(&[_]Feature{}), |
| 173 | }; | 173 | }; |
| 174 | result[@enumToInt(Feature.experimental_zcf)] = .{ | 174 | result[@intFromEnum(Feature.experimental_zcf)] = .{ |
| 175 | .llvm_name = "experimental-zcf", | 175 | .llvm_name = "experimental-zcf", |
| 176 | .description = "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", | 176 | .description = "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", |
| 177 | .dependencies = featureSet(&[_]Feature{}), | 177 | .dependencies = featureSet(&[_]Feature{}), |
| 178 | }; | 178 | }; |
| 179 | result[@enumToInt(Feature.experimental_zihintntl)] = .{ | 179 | result[@intFromEnum(Feature.experimental_zihintntl)] = .{ |
| 180 | .llvm_name = "experimental-zihintntl", | 180 | .llvm_name = "experimental-zihintntl", |
| 181 | .description = "'zihintntl' (Non-Temporal Locality Hints)", | 181 | .description = "'zihintntl' (Non-Temporal Locality Hints)", |
| 182 | .dependencies = featureSet(&[_]Feature{}), | 182 | .dependencies = featureSet(&[_]Feature{}), |
| 183 | }; | 183 | }; |
| 184 | result[@enumToInt(Feature.experimental_ztso)] = .{ | 184 | result[@intFromEnum(Feature.experimental_ztso)] = .{ |
| 185 | .llvm_name = "experimental-ztso", | 185 | .llvm_name = "experimental-ztso", |
| 186 | .description = "'Ztso' (Memory Model - Total Store Order)", | 186 | .description = "'Ztso' (Memory Model - Total Store Order)", |
| 187 | .dependencies = featureSet(&[_]Feature{}), | 187 | .dependencies = featureSet(&[_]Feature{}), |
| 188 | }; | 188 | }; |
| 189 | result[@enumToInt(Feature.experimental_zvfh)] = .{ | 189 | result[@intFromEnum(Feature.experimental_zvfh)] = .{ |
| 190 | .llvm_name = "experimental-zvfh", | 190 | .llvm_name = "experimental-zvfh", |
| 191 | .description = "'Zvfh' (Vector Half-Precision Floating-Point)", | 191 | .description = "'Zvfh' (Vector Half-Precision Floating-Point)", |
| 192 | .dependencies = featureSet(&[_]Feature{ | 192 | .dependencies = featureSet(&[_]Feature{ |
| 193 | .zve32f, | 193 | .zve32f, |
| 194 | }), | 194 | }), |
| 195 | }; | 195 | }; |
| 196 | result[@enumToInt(Feature.f)] = .{ | 196 | result[@intFromEnum(Feature.f)] = .{ |
| 197 | .llvm_name = "f", | 197 | .llvm_name = "f", |
| 198 | .description = "'F' (Single-Precision Floating-Point)", | 198 | .description = "'F' (Single-Precision Floating-Point)", |
| 199 | .dependencies = featureSet(&[_]Feature{}), | 199 | .dependencies = featureSet(&[_]Feature{}), |
| 200 | }; | 200 | }; |
| 201 | result[@enumToInt(Feature.forced_atomics)] = .{ | 201 | result[@intFromEnum(Feature.forced_atomics)] = .{ |
| 202 | .llvm_name = "forced-atomics", | 202 | .llvm_name = "forced-atomics", |
| 203 | .description = "Assume that lock-free native-width atomics are available", | 203 | .description = "Assume that lock-free native-width atomics are available", |
| 204 | .dependencies = featureSet(&[_]Feature{}), | 204 | .dependencies = featureSet(&[_]Feature{}), |
| 205 | }; | 205 | }; |
| 206 | result[@enumToInt(Feature.h)] = .{ | 206 | result[@intFromEnum(Feature.h)] = .{ |
| 207 | .llvm_name = "h", | 207 | .llvm_name = "h", |
| 208 | .description = "'H' (Hypervisor)", | 208 | .description = "'H' (Hypervisor)", |
| 209 | .dependencies = featureSet(&[_]Feature{}), | 209 | .dependencies = featureSet(&[_]Feature{}), |
| 210 | }; | 210 | }; |
| 211 | result[@enumToInt(Feature.lui_addi_fusion)] = .{ | 211 | result[@intFromEnum(Feature.lui_addi_fusion)] = .{ |
| 212 | .llvm_name = "lui-addi-fusion", | 212 | .llvm_name = "lui-addi-fusion", |
| 213 | .description = "Enable LUI+ADDI macrofusion", | 213 | .description = "Enable LUI+ADDI macrofusion", |
| 214 | .dependencies = featureSet(&[_]Feature{}), | 214 | .dependencies = featureSet(&[_]Feature{}), |
| 215 | }; | 215 | }; |
| 216 | result[@enumToInt(Feature.m)] = .{ | 216 | result[@intFromEnum(Feature.m)] = .{ |
| 217 | .llvm_name = "m", | 217 | .llvm_name = "m", |
| 218 | .description = "'M' (Integer Multiplication and Division)", | 218 | .description = "'M' (Integer Multiplication and Division)", |
| 219 | .dependencies = featureSet(&[_]Feature{}), | 219 | .dependencies = featureSet(&[_]Feature{}), |
| 220 | }; | 220 | }; |
| 221 | result[@enumToInt(Feature.no_default_unroll)] = .{ | 221 | result[@intFromEnum(Feature.no_default_unroll)] = .{ |
| 222 | .llvm_name = "no-default-unroll", | 222 | .llvm_name = "no-default-unroll", |
| 223 | .description = "Disable default unroll preference.", | 223 | .description = "Disable default unroll preference.", |
| 224 | .dependencies = featureSet(&[_]Feature{}), | 224 | .dependencies = featureSet(&[_]Feature{}), |
| 225 | }; | 225 | }; |
| 226 | result[@enumToInt(Feature.no_optimized_zero_stride_load)] = .{ | 226 | result[@intFromEnum(Feature.no_optimized_zero_stride_load)] = .{ |
| 227 | .llvm_name = "no-optimized-zero-stride-load", | 227 | .llvm_name = "no-optimized-zero-stride-load", |
| 228 | .description = "Hasn't optimized (perform fewer memory operations)zero-stride vector load", | 228 | .description = "Hasn't optimized (perform fewer memory operations)zero-stride vector load", |
| 229 | .dependencies = featureSet(&[_]Feature{}), | 229 | .dependencies = featureSet(&[_]Feature{}), |
| 230 | }; | 230 | }; |
| 231 | result[@enumToInt(Feature.no_rvc_hints)] = .{ | 231 | result[@intFromEnum(Feature.no_rvc_hints)] = .{ |
| 232 | .llvm_name = "no-rvc-hints", | 232 | .llvm_name = "no-rvc-hints", |
| 233 | .description = "Disable RVC Hint Instructions.", | 233 | .description = "Disable RVC Hint Instructions.", |
| 234 | .dependencies = featureSet(&[_]Feature{}), | 234 | .dependencies = featureSet(&[_]Feature{}), |
| 235 | }; | 235 | }; |
| 236 | result[@enumToInt(Feature.relax)] = .{ | 236 | result[@intFromEnum(Feature.relax)] = .{ |
| 237 | .llvm_name = "relax", | 237 | .llvm_name = "relax", |
| 238 | .description = "Enable Linker relaxation.", | 238 | .description = "Enable Linker relaxation.", |
| 239 | .dependencies = featureSet(&[_]Feature{}), | 239 | .dependencies = featureSet(&[_]Feature{}), |
| 240 | }; | 240 | }; |
| 241 | result[@enumToInt(Feature.reserve_x1)] = .{ | 241 | result[@intFromEnum(Feature.reserve_x1)] = .{ |
| 242 | .llvm_name = "reserve-x1", | 242 | .llvm_name = "reserve-x1", |
| 243 | .description = "Reserve X1", | 243 | .description = "Reserve X1", |
| 244 | .dependencies = featureSet(&[_]Feature{}), | 244 | .dependencies = featureSet(&[_]Feature{}), |
| 245 | }; | 245 | }; |
| 246 | result[@enumToInt(Feature.reserve_x10)] = .{ | 246 | result[@intFromEnum(Feature.reserve_x10)] = .{ |
| 247 | .llvm_name = "reserve-x10", | 247 | .llvm_name = "reserve-x10", |
| 248 | .description = "Reserve X10", | 248 | .description = "Reserve X10", |
| 249 | .dependencies = featureSet(&[_]Feature{}), | 249 | .dependencies = featureSet(&[_]Feature{}), |
| 250 | }; | 250 | }; |
| 251 | result[@enumToInt(Feature.reserve_x11)] = .{ | 251 | result[@intFromEnum(Feature.reserve_x11)] = .{ |
| 252 | .llvm_name = "reserve-x11", | 252 | .llvm_name = "reserve-x11", |
| 253 | .description = "Reserve X11", | 253 | .description = "Reserve X11", |
| 254 | .dependencies = featureSet(&[_]Feature{}), | 254 | .dependencies = featureSet(&[_]Feature{}), |
| 255 | }; | 255 | }; |
| 256 | result[@enumToInt(Feature.reserve_x12)] = .{ | 256 | result[@intFromEnum(Feature.reserve_x12)] = .{ |
| 257 | .llvm_name = "reserve-x12", | 257 | .llvm_name = "reserve-x12", |
| 258 | .description = "Reserve X12", | 258 | .description = "Reserve X12", |
| 259 | .dependencies = featureSet(&[_]Feature{}), | 259 | .dependencies = featureSet(&[_]Feature{}), |
| 260 | }; | 260 | }; |
| 261 | result[@enumToInt(Feature.reserve_x13)] = .{ | 261 | result[@intFromEnum(Feature.reserve_x13)] = .{ |
| 262 | .llvm_name = "reserve-x13", | 262 | .llvm_name = "reserve-x13", |
| 263 | .description = "Reserve X13", | 263 | .description = "Reserve X13", |
| 264 | .dependencies = featureSet(&[_]Feature{}), | 264 | .dependencies = featureSet(&[_]Feature{}), |
| 265 | }; | 265 | }; |
| 266 | result[@enumToInt(Feature.reserve_x14)] = .{ | 266 | result[@intFromEnum(Feature.reserve_x14)] = .{ |
| 267 | .llvm_name = "reserve-x14", | 267 | .llvm_name = "reserve-x14", |
| 268 | .description = "Reserve X14", | 268 | .description = "Reserve X14", |
| 269 | .dependencies = featureSet(&[_]Feature{}), | 269 | .dependencies = featureSet(&[_]Feature{}), |
| 270 | }; | 270 | }; |
| 271 | result[@enumToInt(Feature.reserve_x15)] = .{ | 271 | result[@intFromEnum(Feature.reserve_x15)] = .{ |
| 272 | .llvm_name = "reserve-x15", | 272 | .llvm_name = "reserve-x15", |
| 273 | .description = "Reserve X15", | 273 | .description = "Reserve X15", |
| 274 | .dependencies = featureSet(&[_]Feature{}), | 274 | .dependencies = featureSet(&[_]Feature{}), |
| 275 | }; | 275 | }; |
| 276 | result[@enumToInt(Feature.reserve_x16)] = .{ | 276 | result[@intFromEnum(Feature.reserve_x16)] = .{ |
| 277 | .llvm_name = "reserve-x16", | 277 | .llvm_name = "reserve-x16", |
| 278 | .description = "Reserve X16", | 278 | .description = "Reserve X16", |
| 279 | .dependencies = featureSet(&[_]Feature{}), | 279 | .dependencies = featureSet(&[_]Feature{}), |
| 280 | }; | 280 | }; |
| 281 | result[@enumToInt(Feature.reserve_x17)] = .{ | 281 | result[@intFromEnum(Feature.reserve_x17)] = .{ |
| 282 | .llvm_name = "reserve-x17", | 282 | .llvm_name = "reserve-x17", |
| 283 | .description = "Reserve X17", | 283 | .description = "Reserve X17", |
| 284 | .dependencies = featureSet(&[_]Feature{}), | 284 | .dependencies = featureSet(&[_]Feature{}), |
| 285 | }; | 285 | }; |
| 286 | result[@enumToInt(Feature.reserve_x18)] = .{ | 286 | result[@intFromEnum(Feature.reserve_x18)] = .{ |
| 287 | .llvm_name = "reserve-x18", | 287 | .llvm_name = "reserve-x18", |
| 288 | .description = "Reserve X18", | 288 | .description = "Reserve X18", |
| 289 | .dependencies = featureSet(&[_]Feature{}), | 289 | .dependencies = featureSet(&[_]Feature{}), |
| 290 | }; | 290 | }; |
| 291 | result[@enumToInt(Feature.reserve_x19)] = .{ | 291 | result[@intFromEnum(Feature.reserve_x19)] = .{ |
| 292 | .llvm_name = "reserve-x19", | 292 | .llvm_name = "reserve-x19", |
| 293 | .description = "Reserve X19", | 293 | .description = "Reserve X19", |
| 294 | .dependencies = featureSet(&[_]Feature{}), | 294 | .dependencies = featureSet(&[_]Feature{}), |
| 295 | }; | 295 | }; |
| 296 | result[@enumToInt(Feature.reserve_x2)] = .{ | 296 | result[@intFromEnum(Feature.reserve_x2)] = .{ |
| 297 | .llvm_name = "reserve-x2", | 297 | .llvm_name = "reserve-x2", |
| 298 | .description = "Reserve X2", | 298 | .description = "Reserve X2", |
| 299 | .dependencies = featureSet(&[_]Feature{}), | 299 | .dependencies = featureSet(&[_]Feature{}), |
| 300 | }; | 300 | }; |
| 301 | result[@enumToInt(Feature.reserve_x20)] = .{ | 301 | result[@intFromEnum(Feature.reserve_x20)] = .{ |
| 302 | .llvm_name = "reserve-x20", | 302 | .llvm_name = "reserve-x20", |
| 303 | .description = "Reserve X20", | 303 | .description = "Reserve X20", |
| 304 | .dependencies = featureSet(&[_]Feature{}), | 304 | .dependencies = featureSet(&[_]Feature{}), |
| 305 | }; | 305 | }; |
| 306 | result[@enumToInt(Feature.reserve_x21)] = .{ | 306 | result[@intFromEnum(Feature.reserve_x21)] = .{ |
| 307 | .llvm_name = "reserve-x21", | 307 | .llvm_name = "reserve-x21", |
| 308 | .description = "Reserve X21", | 308 | .description = "Reserve X21", |
| 309 | .dependencies = featureSet(&[_]Feature{}), | 309 | .dependencies = featureSet(&[_]Feature{}), |
| 310 | }; | 310 | }; |
| 311 | result[@enumToInt(Feature.reserve_x22)] = .{ | 311 | result[@intFromEnum(Feature.reserve_x22)] = .{ |
| 312 | .llvm_name = "reserve-x22", | 312 | .llvm_name = "reserve-x22", |
| 313 | .description = "Reserve X22", | 313 | .description = "Reserve X22", |
| 314 | .dependencies = featureSet(&[_]Feature{}), | 314 | .dependencies = featureSet(&[_]Feature{}), |
| 315 | }; | 315 | }; |
| 316 | result[@enumToInt(Feature.reserve_x23)] = .{ | 316 | result[@intFromEnum(Feature.reserve_x23)] = .{ |
| 317 | .llvm_name = "reserve-x23", | 317 | .llvm_name = "reserve-x23", |
| 318 | .description = "Reserve X23", | 318 | .description = "Reserve X23", |
| 319 | .dependencies = featureSet(&[_]Feature{}), | 319 | .dependencies = featureSet(&[_]Feature{}), |
| 320 | }; | 320 | }; |
| 321 | result[@enumToInt(Feature.reserve_x24)] = .{ | 321 | result[@intFromEnum(Feature.reserve_x24)] = .{ |
| 322 | .llvm_name = "reserve-x24", | 322 | .llvm_name = "reserve-x24", |
| 323 | .description = "Reserve X24", | 323 | .description = "Reserve X24", |
| 324 | .dependencies = featureSet(&[_]Feature{}), | 324 | .dependencies = featureSet(&[_]Feature{}), |
| 325 | }; | 325 | }; |
| 326 | result[@enumToInt(Feature.reserve_x25)] = .{ | 326 | result[@intFromEnum(Feature.reserve_x25)] = .{ |
| 327 | .llvm_name = "reserve-x25", | 327 | .llvm_name = "reserve-x25", |
| 328 | .description = "Reserve X25", | 328 | .description = "Reserve X25", |
| 329 | .dependencies = featureSet(&[_]Feature{}), | 329 | .dependencies = featureSet(&[_]Feature{}), |
| 330 | }; | 330 | }; |
| 331 | result[@enumToInt(Feature.reserve_x26)] = .{ | 331 | result[@intFromEnum(Feature.reserve_x26)] = .{ |
| 332 | .llvm_name = "reserve-x26", | 332 | .llvm_name = "reserve-x26", |
| 333 | .description = "Reserve X26", | 333 | .description = "Reserve X26", |
| 334 | .dependencies = featureSet(&[_]Feature{}), | 334 | .dependencies = featureSet(&[_]Feature{}), |
| 335 | }; | 335 | }; |
| 336 | result[@enumToInt(Feature.reserve_x27)] = .{ | 336 | result[@intFromEnum(Feature.reserve_x27)] = .{ |
| 337 | .llvm_name = "reserve-x27", | 337 | .llvm_name = "reserve-x27", |
| 338 | .description = "Reserve X27", | 338 | .description = "Reserve X27", |
| 339 | .dependencies = featureSet(&[_]Feature{}), | 339 | .dependencies = featureSet(&[_]Feature{}), |
| 340 | }; | 340 | }; |
| 341 | result[@enumToInt(Feature.reserve_x28)] = .{ | 341 | result[@intFromEnum(Feature.reserve_x28)] = .{ |
| 342 | .llvm_name = "reserve-x28", | 342 | .llvm_name = "reserve-x28", |
| 343 | .description = "Reserve X28", | 343 | .description = "Reserve X28", |
| 344 | .dependencies = featureSet(&[_]Feature{}), | 344 | .dependencies = featureSet(&[_]Feature{}), |
| 345 | }; | 345 | }; |
| 346 | result[@enumToInt(Feature.reserve_x29)] = .{ | 346 | result[@intFromEnum(Feature.reserve_x29)] = .{ |
| 347 | .llvm_name = "reserve-x29", | 347 | .llvm_name = "reserve-x29", |
| 348 | .description = "Reserve X29", | 348 | .description = "Reserve X29", |
| 349 | .dependencies = featureSet(&[_]Feature{}), | 349 | .dependencies = featureSet(&[_]Feature{}), |
| 350 | }; | 350 | }; |
| 351 | result[@enumToInt(Feature.reserve_x3)] = .{ | 351 | result[@intFromEnum(Feature.reserve_x3)] = .{ |
| 352 | .llvm_name = "reserve-x3", | 352 | .llvm_name = "reserve-x3", |
| 353 | .description = "Reserve X3", | 353 | .description = "Reserve X3", |
| 354 | .dependencies = featureSet(&[_]Feature{}), | 354 | .dependencies = featureSet(&[_]Feature{}), |
| 355 | }; | 355 | }; |
| 356 | result[@enumToInt(Feature.reserve_x30)] = .{ | 356 | result[@intFromEnum(Feature.reserve_x30)] = .{ |
| 357 | .llvm_name = "reserve-x30", | 357 | .llvm_name = "reserve-x30", |
| 358 | .description = "Reserve X30", | 358 | .description = "Reserve X30", |
| 359 | .dependencies = featureSet(&[_]Feature{}), | 359 | .dependencies = featureSet(&[_]Feature{}), |
| 360 | }; | 360 | }; |
| 361 | result[@enumToInt(Feature.reserve_x31)] = .{ | 361 | result[@intFromEnum(Feature.reserve_x31)] = .{ |
| 362 | .llvm_name = "reserve-x31", | 362 | .llvm_name = "reserve-x31", |
| 363 | .description = "Reserve X31", | 363 | .description = "Reserve X31", |
| 364 | .dependencies = featureSet(&[_]Feature{}), | 364 | .dependencies = featureSet(&[_]Feature{}), |
| 365 | }; | 365 | }; |
| 366 | result[@enumToInt(Feature.reserve_x4)] = .{ | 366 | result[@intFromEnum(Feature.reserve_x4)] = .{ |
| 367 | .llvm_name = "reserve-x4", | 367 | .llvm_name = "reserve-x4", |
| 368 | .description = "Reserve X4", | 368 | .description = "Reserve X4", |
| 369 | .dependencies = featureSet(&[_]Feature{}), | 369 | .dependencies = featureSet(&[_]Feature{}), |
| 370 | }; | 370 | }; |
| 371 | result[@enumToInt(Feature.reserve_x5)] = .{ | 371 | result[@intFromEnum(Feature.reserve_x5)] = .{ |
| 372 | .llvm_name = "reserve-x5", | 372 | .llvm_name = "reserve-x5", |
| 373 | .description = "Reserve X5", | 373 | .description = "Reserve X5", |
| 374 | .dependencies = featureSet(&[_]Feature{}), | 374 | .dependencies = featureSet(&[_]Feature{}), |
| 375 | }; | 375 | }; |
| 376 | result[@enumToInt(Feature.reserve_x6)] = .{ | 376 | result[@intFromEnum(Feature.reserve_x6)] = .{ |
| 377 | .llvm_name = "reserve-x6", | 377 | .llvm_name = "reserve-x6", |
| 378 | .description = "Reserve X6", | 378 | .description = "Reserve X6", |
| 379 | .dependencies = featureSet(&[_]Feature{}), | 379 | .dependencies = featureSet(&[_]Feature{}), |
| 380 | }; | 380 | }; |
| 381 | result[@enumToInt(Feature.reserve_x7)] = .{ | 381 | result[@intFromEnum(Feature.reserve_x7)] = .{ |
| 382 | .llvm_name = "reserve-x7", | 382 | .llvm_name = "reserve-x7", |
| 383 | .description = "Reserve X7", | 383 | .description = "Reserve X7", |
| 384 | .dependencies = featureSet(&[_]Feature{}), | 384 | .dependencies = featureSet(&[_]Feature{}), |
| 385 | }; | 385 | }; |
| 386 | result[@enumToInt(Feature.reserve_x8)] = .{ | 386 | result[@intFromEnum(Feature.reserve_x8)] = .{ |
| 387 | .llvm_name = "reserve-x8", | 387 | .llvm_name = "reserve-x8", |
| 388 | .description = "Reserve X8", | 388 | .description = "Reserve X8", |
| 389 | .dependencies = featureSet(&[_]Feature{}), | 389 | .dependencies = featureSet(&[_]Feature{}), |
| 390 | }; | 390 | }; |
| 391 | result[@enumToInt(Feature.reserve_x9)] = .{ | 391 | result[@intFromEnum(Feature.reserve_x9)] = .{ |
| 392 | .llvm_name = "reserve-x9", | 392 | .llvm_name = "reserve-x9", |
| 393 | .description = "Reserve X9", | 393 | .description = "Reserve X9", |
| 394 | .dependencies = featureSet(&[_]Feature{}), | 394 | .dependencies = featureSet(&[_]Feature{}), |
| 395 | }; | 395 | }; |
| 396 | result[@enumToInt(Feature.save_restore)] = .{ | 396 | result[@intFromEnum(Feature.save_restore)] = .{ |
| 397 | .llvm_name = "save-restore", | 397 | .llvm_name = "save-restore", |
| 398 | .description = "Enable save/restore.", | 398 | .description = "Enable save/restore.", |
| 399 | .dependencies = featureSet(&[_]Feature{}), | 399 | .dependencies = featureSet(&[_]Feature{}), |
| 400 | }; | 400 | }; |
| 401 | result[@enumToInt(Feature.short_forward_branch_opt)] = .{ | 401 | result[@intFromEnum(Feature.short_forward_branch_opt)] = .{ |
| 402 | .llvm_name = "short-forward-branch-opt", | 402 | .llvm_name = "short-forward-branch-opt", |
| 403 | .description = "Enable short forward branch optimization", | 403 | .description = "Enable short forward branch optimization", |
| 404 | .dependencies = featureSet(&[_]Feature{}), | 404 | .dependencies = featureSet(&[_]Feature{}), |
| 405 | }; | 405 | }; |
| 406 | result[@enumToInt(Feature.svinval)] = .{ | 406 | result[@intFromEnum(Feature.svinval)] = .{ |
| 407 | .llvm_name = "svinval", | 407 | .llvm_name = "svinval", |
| 408 | .description = "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)", | 408 | .description = "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)", |
| 409 | .dependencies = featureSet(&[_]Feature{}), | 409 | .dependencies = featureSet(&[_]Feature{}), |
| 410 | }; | 410 | }; |
| 411 | result[@enumToInt(Feature.svnapot)] = .{ | 411 | result[@intFromEnum(Feature.svnapot)] = .{ |
| 412 | .llvm_name = "svnapot", | 412 | .llvm_name = "svnapot", |
| 413 | .description = "'Svnapot' (NAPOT Translation Contiguity)", | 413 | .description = "'Svnapot' (NAPOT Translation Contiguity)", |
| 414 | .dependencies = featureSet(&[_]Feature{}), | 414 | .dependencies = featureSet(&[_]Feature{}), |
| 415 | }; | 415 | }; |
| 416 | result[@enumToInt(Feature.svpbmt)] = .{ | 416 | result[@intFromEnum(Feature.svpbmt)] = .{ |
| 417 | .llvm_name = "svpbmt", | 417 | .llvm_name = "svpbmt", |
| 418 | .description = "'Svpbmt' (Page-Based Memory Types)", | 418 | .description = "'Svpbmt' (Page-Based Memory Types)", |
| 419 | .dependencies = featureSet(&[_]Feature{}), | 419 | .dependencies = featureSet(&[_]Feature{}), |
| 420 | }; | 420 | }; |
| 421 | result[@enumToInt(Feature.tagged_globals)] = .{ | 421 | result[@intFromEnum(Feature.tagged_globals)] = .{ |
| 422 | .llvm_name = "tagged-globals", | 422 | .llvm_name = "tagged-globals", |
| 423 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", | 423 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits", |
| 424 | .dependencies = featureSet(&[_]Feature{}), | 424 | .dependencies = featureSet(&[_]Feature{}), |
| 425 | }; | 425 | }; |
| 426 | result[@enumToInt(Feature.unaligned_scalar_mem)] = .{ | 426 | result[@intFromEnum(Feature.unaligned_scalar_mem)] = .{ |
| 427 | .llvm_name = "unaligned-scalar-mem", | 427 | .llvm_name = "unaligned-scalar-mem", |
| 428 | .description = "Has reasonably performant unaligned scalar loads and stores", | 428 | .description = "Has reasonably performant unaligned scalar loads and stores", |
| 429 | .dependencies = featureSet(&[_]Feature{}), | 429 | .dependencies = featureSet(&[_]Feature{}), |
| 430 | }; | 430 | }; |
| 431 | result[@enumToInt(Feature.v)] = .{ | 431 | result[@intFromEnum(Feature.v)] = .{ |
| 432 | .llvm_name = "v", | 432 | .llvm_name = "v", |
| 433 | .description = "'V' (Vector Extension for Application Processors)", | 433 | .description = "'V' (Vector Extension for Application Processors)", |
| 434 | .dependencies = featureSet(&[_]Feature{ | 434 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -437,114 +437,114 @@ pub const all_features = blk: { | ... | @@ -437,114 +437,114 @@ pub const all_features = blk: { |
| 437 | .zvl128b, | 437 | .zvl128b, |
| 438 | }), | 438 | }), |
| 439 | }; | 439 | }; |
| 440 | result[@enumToInt(Feature.xtheadvdot)] = .{ | 440 | result[@intFromEnum(Feature.xtheadvdot)] = .{ |
| 441 | .llvm_name = "xtheadvdot", | 441 | .llvm_name = "xtheadvdot", |
| 442 | .description = "'xtheadvdot' (T-Head Vector Extensions for Dot)", | 442 | .description = "'xtheadvdot' (T-Head Vector Extensions for Dot)", |
| 443 | .dependencies = featureSet(&[_]Feature{ | 443 | .dependencies = featureSet(&[_]Feature{ |
| 444 | .v, | 444 | .v, |
| 445 | }), | 445 | }), |
| 446 | }; | 446 | }; |
| 447 | result[@enumToInt(Feature.xventanacondops)] = .{ | 447 | result[@intFromEnum(Feature.xventanacondops)] = .{ |
| 448 | .llvm_name = "xventanacondops", | 448 | .llvm_name = "xventanacondops", |
| 449 | .description = "'XVentanaCondOps' (Ventana Conditional Ops)", | 449 | .description = "'XVentanaCondOps' (Ventana Conditional Ops)", |
| 450 | .dependencies = featureSet(&[_]Feature{}), | 450 | .dependencies = featureSet(&[_]Feature{}), |
| 451 | }; | 451 | }; |
| 452 | result[@enumToInt(Feature.zba)] = .{ | 452 | result[@intFromEnum(Feature.zba)] = .{ |
| 453 | .llvm_name = "zba", | 453 | .llvm_name = "zba", |
| 454 | .description = "'Zba' (Address Generation Instructions)", | 454 | .description = "'Zba' (Address Generation Instructions)", |
| 455 | .dependencies = featureSet(&[_]Feature{}), | 455 | .dependencies = featureSet(&[_]Feature{}), |
| 456 | }; | 456 | }; |
| 457 | result[@enumToInt(Feature.zbb)] = .{ | 457 | result[@intFromEnum(Feature.zbb)] = .{ |
| 458 | .llvm_name = "zbb", | 458 | .llvm_name = "zbb", |
| 459 | .description = "'Zbb' (Basic Bit-Manipulation)", | 459 | .description = "'Zbb' (Basic Bit-Manipulation)", |
| 460 | .dependencies = featureSet(&[_]Feature{}), | 460 | .dependencies = featureSet(&[_]Feature{}), |
| 461 | }; | 461 | }; |
| 462 | result[@enumToInt(Feature.zbc)] = .{ | 462 | result[@intFromEnum(Feature.zbc)] = .{ |
| 463 | .llvm_name = "zbc", | 463 | .llvm_name = "zbc", |
| 464 | .description = "'Zbc' (Carry-Less Multiplication)", | 464 | .description = "'Zbc' (Carry-Less Multiplication)", |
| 465 | .dependencies = featureSet(&[_]Feature{}), | 465 | .dependencies = featureSet(&[_]Feature{}), |
| 466 | }; | 466 | }; |
| 467 | result[@enumToInt(Feature.zbkb)] = .{ | 467 | result[@intFromEnum(Feature.zbkb)] = .{ |
| 468 | .llvm_name = "zbkb", | 468 | .llvm_name = "zbkb", |
| 469 | .description = "'Zbkb' (Bitmanip instructions for Cryptography)", | 469 | .description = "'Zbkb' (Bitmanip instructions for Cryptography)", |
| 470 | .dependencies = featureSet(&[_]Feature{}), | 470 | .dependencies = featureSet(&[_]Feature{}), |
| 471 | }; | 471 | }; |
| 472 | result[@enumToInt(Feature.zbkc)] = .{ | 472 | result[@intFromEnum(Feature.zbkc)] = .{ |
| 473 | .llvm_name = "zbkc", | 473 | .llvm_name = "zbkc", |
| 474 | .description = "'Zbkc' (Carry-less multiply instructions for Cryptography)", | 474 | .description = "'Zbkc' (Carry-less multiply instructions for Cryptography)", |
| 475 | .dependencies = featureSet(&[_]Feature{}), | 475 | .dependencies = featureSet(&[_]Feature{}), |
| 476 | }; | 476 | }; |
| 477 | result[@enumToInt(Feature.zbkx)] = .{ | 477 | result[@intFromEnum(Feature.zbkx)] = .{ |
| 478 | .llvm_name = "zbkx", | 478 | .llvm_name = "zbkx", |
| 479 | .description = "'Zbkx' (Crossbar permutation instructions)", | 479 | .description = "'Zbkx' (Crossbar permutation instructions)", |
| 480 | .dependencies = featureSet(&[_]Feature{}), | 480 | .dependencies = featureSet(&[_]Feature{}), |
| 481 | }; | 481 | }; |
| 482 | result[@enumToInt(Feature.zbs)] = .{ | 482 | result[@intFromEnum(Feature.zbs)] = .{ |
| 483 | .llvm_name = "zbs", | 483 | .llvm_name = "zbs", |
| 484 | .description = "'Zbs' (Single-Bit Instructions)", | 484 | .description = "'Zbs' (Single-Bit Instructions)", |
| 485 | .dependencies = featureSet(&[_]Feature{}), | 485 | .dependencies = featureSet(&[_]Feature{}), |
| 486 | }; | 486 | }; |
| 487 | result[@enumToInt(Feature.zdinx)] = .{ | 487 | result[@intFromEnum(Feature.zdinx)] = .{ |
| 488 | .llvm_name = "zdinx", | 488 | .llvm_name = "zdinx", |
| 489 | .description = "'Zdinx' (Double in Integer)", | 489 | .description = "'Zdinx' (Double in Integer)", |
| 490 | .dependencies = featureSet(&[_]Feature{ | 490 | .dependencies = featureSet(&[_]Feature{ |
| 491 | .zfinx, | 491 | .zfinx, |
| 492 | }), | 492 | }), |
| 493 | }; | 493 | }; |
| 494 | result[@enumToInt(Feature.zfh)] = .{ | 494 | result[@intFromEnum(Feature.zfh)] = .{ |
| 495 | .llvm_name = "zfh", | 495 | .llvm_name = "zfh", |
| 496 | .description = "'Zfh' (Half-Precision Floating-Point)", | 496 | .description = "'Zfh' (Half-Precision Floating-Point)", |
| 497 | .dependencies = featureSet(&[_]Feature{ | 497 | .dependencies = featureSet(&[_]Feature{ |
| 498 | .f, | 498 | .f, |
| 499 | }), | 499 | }), |
| 500 | }; | 500 | }; |
| 501 | result[@enumToInt(Feature.zfhmin)] = .{ | 501 | result[@intFromEnum(Feature.zfhmin)] = .{ |
| 502 | .llvm_name = "zfhmin", | 502 | .llvm_name = "zfhmin", |
| 503 | .description = "'Zfhmin' (Half-Precision Floating-Point Minimal)", | 503 | .description = "'Zfhmin' (Half-Precision Floating-Point Minimal)", |
| 504 | .dependencies = featureSet(&[_]Feature{ | 504 | .dependencies = featureSet(&[_]Feature{ |
| 505 | .f, | 505 | .f, |
| 506 | }), | 506 | }), |
| 507 | }; | 507 | }; |
| 508 | result[@enumToInt(Feature.zfinx)] = .{ | 508 | result[@intFromEnum(Feature.zfinx)] = .{ |
| 509 | .llvm_name = "zfinx", | 509 | .llvm_name = "zfinx", |
| 510 | .description = "'Zfinx' (Float in Integer)", | 510 | .description = "'Zfinx' (Float in Integer)", |
| 511 | .dependencies = featureSet(&[_]Feature{}), | 511 | .dependencies = featureSet(&[_]Feature{}), |
| 512 | }; | 512 | }; |
| 513 | result[@enumToInt(Feature.zhinx)] = .{ | 513 | result[@intFromEnum(Feature.zhinx)] = .{ |
| 514 | .llvm_name = "zhinx", | 514 | .llvm_name = "zhinx", |
| 515 | .description = "'Zhinx' (Half Float in Integer)", | 515 | .description = "'Zhinx' (Half Float in Integer)", |
| 516 | .dependencies = featureSet(&[_]Feature{ | 516 | .dependencies = featureSet(&[_]Feature{ |
| 517 | .zfinx, | 517 | .zfinx, |
| 518 | }), | 518 | }), |
| 519 | }; | 519 | }; |
| 520 | result[@enumToInt(Feature.zhinxmin)] = .{ | 520 | result[@intFromEnum(Feature.zhinxmin)] = .{ |
| 521 | .llvm_name = "zhinxmin", | 521 | .llvm_name = "zhinxmin", |
| 522 | .description = "'Zhinxmin' (Half Float in Integer Minimal)", | 522 | .description = "'Zhinxmin' (Half Float in Integer Minimal)", |
| 523 | .dependencies = featureSet(&[_]Feature{ | 523 | .dependencies = featureSet(&[_]Feature{ |
| 524 | .zfinx, | 524 | .zfinx, |
| 525 | }), | 525 | }), |
| 526 | }; | 526 | }; |
| 527 | result[@enumToInt(Feature.zicbom)] = .{ | 527 | result[@intFromEnum(Feature.zicbom)] = .{ |
| 528 | .llvm_name = "zicbom", | 528 | .llvm_name = "zicbom", |
| 529 | .description = "'Zicbom' (Cache-Block Management Instructions)", | 529 | .description = "'Zicbom' (Cache-Block Management Instructions)", |
| 530 | .dependencies = featureSet(&[_]Feature{}), | 530 | .dependencies = featureSet(&[_]Feature{}), |
| 531 | }; | 531 | }; |
| 532 | result[@enumToInt(Feature.zicbop)] = .{ | 532 | result[@intFromEnum(Feature.zicbop)] = .{ |
| 533 | .llvm_name = "zicbop", | 533 | .llvm_name = "zicbop", |
| 534 | .description = "'Zicbop' (Cache-Block Prefetch Instructions)", | 534 | .description = "'Zicbop' (Cache-Block Prefetch Instructions)", |
| 535 | .dependencies = featureSet(&[_]Feature{}), | 535 | .dependencies = featureSet(&[_]Feature{}), |
| 536 | }; | 536 | }; |
| 537 | result[@enumToInt(Feature.zicboz)] = .{ | 537 | result[@intFromEnum(Feature.zicboz)] = .{ |
| 538 | .llvm_name = "zicboz", | 538 | .llvm_name = "zicboz", |
| 539 | .description = "'Zicboz' (Cache-Block Zero Instructions)", | 539 | .description = "'Zicboz' (Cache-Block Zero Instructions)", |
| 540 | .dependencies = featureSet(&[_]Feature{}), | 540 | .dependencies = featureSet(&[_]Feature{}), |
| 541 | }; | 541 | }; |
| 542 | result[@enumToInt(Feature.zihintpause)] = .{ | 542 | result[@intFromEnum(Feature.zihintpause)] = .{ |
| 543 | .llvm_name = "zihintpause", | 543 | .llvm_name = "zihintpause", |
| 544 | .description = "'zihintpause' (Pause Hint)", | 544 | .description = "'zihintpause' (Pause Hint)", |
| 545 | .dependencies = featureSet(&[_]Feature{}), | 545 | .dependencies = featureSet(&[_]Feature{}), |
| 546 | }; | 546 | }; |
| 547 | result[@enumToInt(Feature.zk)] = .{ | 547 | result[@intFromEnum(Feature.zk)] = .{ |
| 548 | .llvm_name = "zk", | 548 | .llvm_name = "zk", |
| 549 | .description = "'Zk' (Standard scalar cryptography extension)", | 549 | .description = "'Zk' (Standard scalar cryptography extension)", |
| 550 | .dependencies = featureSet(&[_]Feature{ | 550 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -553,7 +553,7 @@ pub const all_features = blk: { | ... | @@ -553,7 +553,7 @@ pub const all_features = blk: { |
| 553 | .zkt, | 553 | .zkt, |
| 554 | }), | 554 | }), |
| 555 | }; | 555 | }; |
| 556 | result[@enumToInt(Feature.zkn)] = .{ | 556 | result[@intFromEnum(Feature.zkn)] = .{ |
| 557 | .llvm_name = "zkn", | 557 | .llvm_name = "zkn", |
| 558 | .description = "'Zkn' (NIST Algorithm Suite)", | 558 | .description = "'Zkn' (NIST Algorithm Suite)", |
| 559 | .dependencies = featureSet(&[_]Feature{ | 559 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -565,27 +565,27 @@ pub const all_features = blk: { | ... | @@ -565,27 +565,27 @@ pub const all_features = blk: { |
| 565 | .zknh, | 565 | .zknh, |
| 566 | }), | 566 | }), |
| 567 | }; | 567 | }; |
| 568 | result[@enumToInt(Feature.zknd)] = .{ | 568 | result[@intFromEnum(Feature.zknd)] = .{ |
| 569 | .llvm_name = "zknd", | 569 | .llvm_name = "zknd", |
| 570 | .description = "'Zknd' (NIST Suite: AES Decryption)", | 570 | .description = "'Zknd' (NIST Suite: AES Decryption)", |
| 571 | .dependencies = featureSet(&[_]Feature{}), | 571 | .dependencies = featureSet(&[_]Feature{}), |
| 572 | }; | 572 | }; |
| 573 | result[@enumToInt(Feature.zkne)] = .{ | 573 | result[@intFromEnum(Feature.zkne)] = .{ |
| 574 | .llvm_name = "zkne", | 574 | .llvm_name = "zkne", |
| 575 | .description = "'Zkne' (NIST Suite: AES Encryption)", | 575 | .description = "'Zkne' (NIST Suite: AES Encryption)", |
| 576 | .dependencies = featureSet(&[_]Feature{}), | 576 | .dependencies = featureSet(&[_]Feature{}), |
| 577 | }; | 577 | }; |
| 578 | result[@enumToInt(Feature.zknh)] = .{ | 578 | result[@intFromEnum(Feature.zknh)] = .{ |
| 579 | .llvm_name = "zknh", | 579 | .llvm_name = "zknh", |
| 580 | .description = "'Zknh' (NIST Suite: Hash Function Instructions)", | 580 | .description = "'Zknh' (NIST Suite: Hash Function Instructions)", |
| 581 | .dependencies = featureSet(&[_]Feature{}), | 581 | .dependencies = featureSet(&[_]Feature{}), |
| 582 | }; | 582 | }; |
| 583 | result[@enumToInt(Feature.zkr)] = .{ | 583 | result[@intFromEnum(Feature.zkr)] = .{ |
| 584 | .llvm_name = "zkr", | 584 | .llvm_name = "zkr", |
| 585 | .description = "'Zkr' (Entropy Source Extension)", | 585 | .description = "'Zkr' (Entropy Source Extension)", |
| 586 | .dependencies = featureSet(&[_]Feature{}), | 586 | .dependencies = featureSet(&[_]Feature{}), |
| 587 | }; | 587 | }; |
| 588 | result[@enumToInt(Feature.zks)] = .{ | 588 | result[@intFromEnum(Feature.zks)] = .{ |
| 589 | .llvm_name = "zks", | 589 | .llvm_name = "zks", |
| 590 | .description = "'Zks' (ShangMi Algorithm Suite)", | 590 | .description = "'Zks' (ShangMi Algorithm Suite)", |
| 591 | .dependencies = featureSet(&[_]Feature{ | 591 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -596,48 +596,48 @@ pub const all_features = blk: { | ... | @@ -596,48 +596,48 @@ pub const all_features = blk: { |
| 596 | .zksh, | 596 | .zksh, |
| 597 | }), | 597 | }), |
| 598 | }; | 598 | }; |
| 599 | result[@enumToInt(Feature.zksed)] = .{ | 599 | result[@intFromEnum(Feature.zksed)] = .{ |
| 600 | .llvm_name = "zksed", | 600 | .llvm_name = "zksed", |
| 601 | .description = "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)", | 601 | .description = "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)", |
| 602 | .dependencies = featureSet(&[_]Feature{}), | 602 | .dependencies = featureSet(&[_]Feature{}), |
| 603 | }; | 603 | }; |
| 604 | result[@enumToInt(Feature.zksh)] = .{ | 604 | result[@intFromEnum(Feature.zksh)] = .{ |
| 605 | .llvm_name = "zksh", | 605 | .llvm_name = "zksh", |
| 606 | .description = "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)", | 606 | .description = "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)", |
| 607 | .dependencies = featureSet(&[_]Feature{}), | 607 | .dependencies = featureSet(&[_]Feature{}), |
| 608 | }; | 608 | }; |
| 609 | result[@enumToInt(Feature.zkt)] = .{ | 609 | result[@intFromEnum(Feature.zkt)] = .{ |
| 610 | .llvm_name = "zkt", | 610 | .llvm_name = "zkt", |
| 611 | .description = "'Zkt' (Data Independent Execution Latency)", | 611 | .description = "'Zkt' (Data Independent Execution Latency)", |
| 612 | .dependencies = featureSet(&[_]Feature{}), | 612 | .dependencies = featureSet(&[_]Feature{}), |
| 613 | }; | 613 | }; |
| 614 | result[@enumToInt(Feature.zmmul)] = .{ | 614 | result[@intFromEnum(Feature.zmmul)] = .{ |
| 615 | .llvm_name = "zmmul", | 615 | .llvm_name = "zmmul", |
| 616 | .description = "'Zmmul' (Integer Multiplication)", | 616 | .description = "'Zmmul' (Integer Multiplication)", |
| 617 | .dependencies = featureSet(&[_]Feature{}), | 617 | .dependencies = featureSet(&[_]Feature{}), |
| 618 | }; | 618 | }; |
| 619 | result[@enumToInt(Feature.zve32f)] = .{ | 619 | result[@intFromEnum(Feature.zve32f)] = .{ |
| 620 | .llvm_name = "zve32f", | 620 | .llvm_name = "zve32f", |
| 621 | .description = "'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension)", | 621 | .description = "'Zve32f' (Vector Extensions for Embedded Processors with maximal 32 EEW and F extension)", |
| 622 | .dependencies = featureSet(&[_]Feature{ | 622 | .dependencies = featureSet(&[_]Feature{ |
| 623 | .zve32x, | 623 | .zve32x, |
| 624 | }), | 624 | }), |
| 625 | }; | 625 | }; |
| 626 | result[@enumToInt(Feature.zve32x)] = .{ | 626 | result[@intFromEnum(Feature.zve32x)] = .{ |
| 627 | .llvm_name = "zve32x", | 627 | .llvm_name = "zve32x", |
| 628 | .description = "'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW)", | 628 | .description = "'Zve32x' (Vector Extensions for Embedded Processors with maximal 32 EEW)", |
| 629 | .dependencies = featureSet(&[_]Feature{ | 629 | .dependencies = featureSet(&[_]Feature{ |
| 630 | .zvl32b, | 630 | .zvl32b, |
| 631 | }), | 631 | }), |
| 632 | }; | 632 | }; |
| 633 | result[@enumToInt(Feature.zve64d)] = .{ | 633 | result[@intFromEnum(Feature.zve64d)] = .{ |
| 634 | .llvm_name = "zve64d", | 634 | .llvm_name = "zve64d", |
| 635 | .description = "'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension)", | 635 | .description = "'Zve64d' (Vector Extensions for Embedded Processors with maximal 64 EEW, F and D extension)", |
| 636 | .dependencies = featureSet(&[_]Feature{ | 636 | .dependencies = featureSet(&[_]Feature{ |
| 637 | .zve64f, | 637 | .zve64f, |
| 638 | }), | 638 | }), |
| 639 | }; | 639 | }; |
| 640 | result[@enumToInt(Feature.zve64f)] = .{ | 640 | result[@intFromEnum(Feature.zve64f)] = .{ |
| 641 | .llvm_name = "zve64f", | 641 | .llvm_name = "zve64f", |
| 642 | .description = "'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension)", | 642 | .description = "'Zve64f' (Vector Extensions for Embedded Processors with maximal 64 EEW and F extension)", |
| 643 | .dependencies = featureSet(&[_]Feature{ | 643 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -645,7 +645,7 @@ pub const all_features = blk: { | ... | @@ -645,7 +645,7 @@ pub const all_features = blk: { |
| 645 | .zve64x, | 645 | .zve64x, |
| 646 | }), | 646 | }), |
| 647 | }; | 647 | }; |
| 648 | result[@enumToInt(Feature.zve64x)] = .{ | 648 | result[@intFromEnum(Feature.zve64x)] = .{ |
| 649 | .llvm_name = "zve64x", | 649 | .llvm_name = "zve64x", |
| 650 | .description = "'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW)", | 650 | .description = "'Zve64x' (Vector Extensions for Embedded Processors with maximal 64 EEW)", |
| 651 | .dependencies = featureSet(&[_]Feature{ | 651 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -653,82 +653,82 @@ pub const all_features = blk: { | ... | @@ -653,82 +653,82 @@ pub const all_features = blk: { |
| 653 | .zvl64b, | 653 | .zvl64b, |
| 654 | }), | 654 | }), |
| 655 | }; | 655 | }; |
| 656 | result[@enumToInt(Feature.zvl1024b)] = .{ | 656 | result[@intFromEnum(Feature.zvl1024b)] = .{ |
| 657 | .llvm_name = "zvl1024b", | 657 | .llvm_name = "zvl1024b", |
| 658 | .description = "'Zvl' (Minimum Vector Length) 1024", | 658 | .description = "'Zvl' (Minimum Vector Length) 1024", |
| 659 | .dependencies = featureSet(&[_]Feature{ | 659 | .dependencies = featureSet(&[_]Feature{ |
| 660 | .zvl512b, | 660 | .zvl512b, |
| 661 | }), | 661 | }), |
| 662 | }; | 662 | }; |
| 663 | result[@enumToInt(Feature.zvl128b)] = .{ | 663 | result[@intFromEnum(Feature.zvl128b)] = .{ |
| 664 | .llvm_name = "zvl128b", | 664 | .llvm_name = "zvl128b", |
| 665 | .description = "'Zvl' (Minimum Vector Length) 128", | 665 | .description = "'Zvl' (Minimum Vector Length) 128", |
| 666 | .dependencies = featureSet(&[_]Feature{ | 666 | .dependencies = featureSet(&[_]Feature{ |
| 667 | .zvl64b, | 667 | .zvl64b, |
| 668 | }), | 668 | }), |
| 669 | }; | 669 | }; |
| 670 | result[@enumToInt(Feature.zvl16384b)] = .{ | 670 | result[@intFromEnum(Feature.zvl16384b)] = .{ |
| 671 | .llvm_name = "zvl16384b", | 671 | .llvm_name = "zvl16384b", |
| 672 | .description = "'Zvl' (Minimum Vector Length) 16384", | 672 | .description = "'Zvl' (Minimum Vector Length) 16384", |
| 673 | .dependencies = featureSet(&[_]Feature{ | 673 | .dependencies = featureSet(&[_]Feature{ |
| 674 | .zvl8192b, | 674 | .zvl8192b, |
| 675 | }), | 675 | }), |
| 676 | }; | 676 | }; |
| 677 | result[@enumToInt(Feature.zvl2048b)] = .{ | 677 | result[@intFromEnum(Feature.zvl2048b)] = .{ |
| 678 | .llvm_name = "zvl2048b", | 678 | .llvm_name = "zvl2048b", |
| 679 | .description = "'Zvl' (Minimum Vector Length) 2048", | 679 | .description = "'Zvl' (Minimum Vector Length) 2048", |
| 680 | .dependencies = featureSet(&[_]Feature{ | 680 | .dependencies = featureSet(&[_]Feature{ |
| 681 | .zvl1024b, | 681 | .zvl1024b, |
| 682 | }), | 682 | }), |
| 683 | }; | 683 | }; |
| 684 | result[@enumToInt(Feature.zvl256b)] = .{ | 684 | result[@intFromEnum(Feature.zvl256b)] = .{ |
| 685 | .llvm_name = "zvl256b", | 685 | .llvm_name = "zvl256b", |
| 686 | .description = "'Zvl' (Minimum Vector Length) 256", | 686 | .description = "'Zvl' (Minimum Vector Length) 256", |
| 687 | .dependencies = featureSet(&[_]Feature{ | 687 | .dependencies = featureSet(&[_]Feature{ |
| 688 | .zvl128b, | 688 | .zvl128b, |
| 689 | }), | 689 | }), |
| 690 | }; | 690 | }; |
| 691 | result[@enumToInt(Feature.zvl32768b)] = .{ | 691 | result[@intFromEnum(Feature.zvl32768b)] = .{ |
| 692 | .llvm_name = "zvl32768b", | 692 | .llvm_name = "zvl32768b", |
| 693 | .description = "'Zvl' (Minimum Vector Length) 32768", | 693 | .description = "'Zvl' (Minimum Vector Length) 32768", |
| 694 | .dependencies = featureSet(&[_]Feature{ | 694 | .dependencies = featureSet(&[_]Feature{ |
| 695 | .zvl16384b, | 695 | .zvl16384b, |
| 696 | }), | 696 | }), |
| 697 | }; | 697 | }; |
| 698 | result[@enumToInt(Feature.zvl32b)] = .{ | 698 | result[@intFromEnum(Feature.zvl32b)] = .{ |
| 699 | .llvm_name = "zvl32b", | 699 | .llvm_name = "zvl32b", |
| 700 | .description = "'Zvl' (Minimum Vector Length) 32", | 700 | .description = "'Zvl' (Minimum Vector Length) 32", |
| 701 | .dependencies = featureSet(&[_]Feature{}), | 701 | .dependencies = featureSet(&[_]Feature{}), |
| 702 | }; | 702 | }; |
| 703 | result[@enumToInt(Feature.zvl4096b)] = .{ | 703 | result[@intFromEnum(Feature.zvl4096b)] = .{ |
| 704 | .llvm_name = "zvl4096b", | 704 | .llvm_name = "zvl4096b", |
| 705 | .description = "'Zvl' (Minimum Vector Length) 4096", | 705 | .description = "'Zvl' (Minimum Vector Length) 4096", |
| 706 | .dependencies = featureSet(&[_]Feature{ | 706 | .dependencies = featureSet(&[_]Feature{ |
| 707 | .zvl2048b, | 707 | .zvl2048b, |
| 708 | }), | 708 | }), |
| 709 | }; | 709 | }; |
| 710 | result[@enumToInt(Feature.zvl512b)] = .{ | 710 | result[@intFromEnum(Feature.zvl512b)] = .{ |
| 711 | .llvm_name = "zvl512b", | 711 | .llvm_name = "zvl512b", |
| 712 | .description = "'Zvl' (Minimum Vector Length) 512", | 712 | .description = "'Zvl' (Minimum Vector Length) 512", |
| 713 | .dependencies = featureSet(&[_]Feature{ | 713 | .dependencies = featureSet(&[_]Feature{ |
| 714 | .zvl256b, | 714 | .zvl256b, |
| 715 | }), | 715 | }), |
| 716 | }; | 716 | }; |
| 717 | result[@enumToInt(Feature.zvl64b)] = .{ | 717 | result[@intFromEnum(Feature.zvl64b)] = .{ |
| 718 | .llvm_name = "zvl64b", | 718 | .llvm_name = "zvl64b", |
| 719 | .description = "'Zvl' (Minimum Vector Length) 64", | 719 | .description = "'Zvl' (Minimum Vector Length) 64", |
| 720 | .dependencies = featureSet(&[_]Feature{ | 720 | .dependencies = featureSet(&[_]Feature{ |
| 721 | .zvl32b, | 721 | .zvl32b, |
| 722 | }), | 722 | }), |
| 723 | }; | 723 | }; |
| 724 | result[@enumToInt(Feature.zvl65536b)] = .{ | 724 | result[@intFromEnum(Feature.zvl65536b)] = .{ |
| 725 | .llvm_name = "zvl65536b", | 725 | .llvm_name = "zvl65536b", |
| 726 | .description = "'Zvl' (Minimum Vector Length) 65536", | 726 | .description = "'Zvl' (Minimum Vector Length) 65536", |
| 727 | .dependencies = featureSet(&[_]Feature{ | 727 | .dependencies = featureSet(&[_]Feature{ |
| 728 | .zvl32768b, | 728 | .zvl32768b, |
| 729 | }), | 729 | }), |
| 730 | }; | 730 | }; |
| 731 | result[@enumToInt(Feature.zvl8192b)] = .{ | 731 | result[@intFromEnum(Feature.zvl8192b)] = .{ |
| 732 | .llvm_name = "zvl8192b", | 732 | .llvm_name = "zvl8192b", |
| 733 | .description = "'Zvl' (Minimum Vector Length) 8192", | 733 | .description = "'Zvl' (Minimum Vector Length) 8192", |
| 734 | .dependencies = featureSet(&[_]Feature{ | 734 | .dependencies = featureSet(&[_]Feature{ |
lib/std/target/s390x.zig+41-41| ... | @@ -57,207 +57,207 @@ pub const all_features = blk: { | ... | @@ -57,207 +57,207 @@ pub const all_features = blk: { |
| 57 | const len = @typeInfo(Feature).Enum.fields.len; | 57 | const len = @typeInfo(Feature).Enum.fields.len; |
| 58 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 58 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 59 | var result: [len]CpuFeature = undefined; | 59 | var result: [len]CpuFeature = undefined; |
| 60 | result[@enumToInt(Feature.bear_enhancement)] = .{ | 60 | result[@intFromEnum(Feature.bear_enhancement)] = .{ |
| 61 | .llvm_name = "bear-enhancement", | 61 | .llvm_name = "bear-enhancement", |
| 62 | .description = "Assume that the BEAR-enhancement facility is installed", | 62 | .description = "Assume that the BEAR-enhancement facility is installed", |
| 63 | .dependencies = featureSet(&[_]Feature{}), | 63 | .dependencies = featureSet(&[_]Feature{}), |
| 64 | }; | 64 | }; |
| 65 | result[@enumToInt(Feature.deflate_conversion)] = .{ | 65 | result[@intFromEnum(Feature.deflate_conversion)] = .{ |
| 66 | .llvm_name = "deflate-conversion", | 66 | .llvm_name = "deflate-conversion", |
| 67 | .description = "Assume that the deflate-conversion facility is installed", | 67 | .description = "Assume that the deflate-conversion facility is installed", |
| 68 | .dependencies = featureSet(&[_]Feature{}), | 68 | .dependencies = featureSet(&[_]Feature{}), |
| 69 | }; | 69 | }; |
| 70 | result[@enumToInt(Feature.dfp_packed_conversion)] = .{ | 70 | result[@intFromEnum(Feature.dfp_packed_conversion)] = .{ |
| 71 | .llvm_name = "dfp-packed-conversion", | 71 | .llvm_name = "dfp-packed-conversion", |
| 72 | .description = "Assume that the DFP packed-conversion facility is installed", | 72 | .description = "Assume that the DFP packed-conversion facility is installed", |
| 73 | .dependencies = featureSet(&[_]Feature{}), | 73 | .dependencies = featureSet(&[_]Feature{}), |
| 74 | }; | 74 | }; |
| 75 | result[@enumToInt(Feature.dfp_zoned_conversion)] = .{ | 75 | result[@intFromEnum(Feature.dfp_zoned_conversion)] = .{ |
| 76 | .llvm_name = "dfp-zoned-conversion", | 76 | .llvm_name = "dfp-zoned-conversion", |
| 77 | .description = "Assume that the DFP zoned-conversion facility is installed", | 77 | .description = "Assume that the DFP zoned-conversion facility is installed", |
| 78 | .dependencies = featureSet(&[_]Feature{}), | 78 | .dependencies = featureSet(&[_]Feature{}), |
| 79 | }; | 79 | }; |
| 80 | result[@enumToInt(Feature.distinct_ops)] = .{ | 80 | result[@intFromEnum(Feature.distinct_ops)] = .{ |
| 81 | .llvm_name = "distinct-ops", | 81 | .llvm_name = "distinct-ops", |
| 82 | .description = "Assume that the distinct-operands facility is installed", | 82 | .description = "Assume that the distinct-operands facility is installed", |
| 83 | .dependencies = featureSet(&[_]Feature{}), | 83 | .dependencies = featureSet(&[_]Feature{}), |
| 84 | }; | 84 | }; |
| 85 | result[@enumToInt(Feature.enhanced_dat_2)] = .{ | 85 | result[@intFromEnum(Feature.enhanced_dat_2)] = .{ |
| 86 | .llvm_name = "enhanced-dat-2", | 86 | .llvm_name = "enhanced-dat-2", |
| 87 | .description = "Assume that the enhanced-DAT facility 2 is installed", | 87 | .description = "Assume that the enhanced-DAT facility 2 is installed", |
| 88 | .dependencies = featureSet(&[_]Feature{}), | 88 | .dependencies = featureSet(&[_]Feature{}), |
| 89 | }; | 89 | }; |
| 90 | result[@enumToInt(Feature.enhanced_sort)] = .{ | 90 | result[@intFromEnum(Feature.enhanced_sort)] = .{ |
| 91 | .llvm_name = "enhanced-sort", | 91 | .llvm_name = "enhanced-sort", |
| 92 | .description = "Assume that the enhanced-sort facility is installed", | 92 | .description = "Assume that the enhanced-sort facility is installed", |
| 93 | .dependencies = featureSet(&[_]Feature{}), | 93 | .dependencies = featureSet(&[_]Feature{}), |
| 94 | }; | 94 | }; |
| 95 | result[@enumToInt(Feature.execution_hint)] = .{ | 95 | result[@intFromEnum(Feature.execution_hint)] = .{ |
| 96 | .llvm_name = "execution-hint", | 96 | .llvm_name = "execution-hint", |
| 97 | .description = "Assume that the execution-hint facility is installed", | 97 | .description = "Assume that the execution-hint facility is installed", |
| 98 | .dependencies = featureSet(&[_]Feature{}), | 98 | .dependencies = featureSet(&[_]Feature{}), |
| 99 | }; | 99 | }; |
| 100 | result[@enumToInt(Feature.fast_serialization)] = .{ | 100 | result[@intFromEnum(Feature.fast_serialization)] = .{ |
| 101 | .llvm_name = "fast-serialization", | 101 | .llvm_name = "fast-serialization", |
| 102 | .description = "Assume that the fast-serialization facility is installed", | 102 | .description = "Assume that the fast-serialization facility is installed", |
| 103 | .dependencies = featureSet(&[_]Feature{}), | 103 | .dependencies = featureSet(&[_]Feature{}), |
| 104 | }; | 104 | }; |
| 105 | result[@enumToInt(Feature.fp_extension)] = .{ | 105 | result[@intFromEnum(Feature.fp_extension)] = .{ |
| 106 | .llvm_name = "fp-extension", | 106 | .llvm_name = "fp-extension", |
| 107 | .description = "Assume that the floating-point extension facility is installed", | 107 | .description = "Assume that the floating-point extension facility is installed", |
| 108 | .dependencies = featureSet(&[_]Feature{}), | 108 | .dependencies = featureSet(&[_]Feature{}), |
| 109 | }; | 109 | }; |
| 110 | result[@enumToInt(Feature.guarded_storage)] = .{ | 110 | result[@intFromEnum(Feature.guarded_storage)] = .{ |
| 111 | .llvm_name = "guarded-storage", | 111 | .llvm_name = "guarded-storage", |
| 112 | .description = "Assume that the guarded-storage facility is installed", | 112 | .description = "Assume that the guarded-storage facility is installed", |
| 113 | .dependencies = featureSet(&[_]Feature{}), | 113 | .dependencies = featureSet(&[_]Feature{}), |
| 114 | }; | 114 | }; |
| 115 | result[@enumToInt(Feature.high_word)] = .{ | 115 | result[@intFromEnum(Feature.high_word)] = .{ |
| 116 | .llvm_name = "high-word", | 116 | .llvm_name = "high-word", |
| 117 | .description = "Assume that the high-word facility is installed", | 117 | .description = "Assume that the high-word facility is installed", |
| 118 | .dependencies = featureSet(&[_]Feature{}), | 118 | .dependencies = featureSet(&[_]Feature{}), |
| 119 | }; | 119 | }; |
| 120 | result[@enumToInt(Feature.insert_reference_bits_multiple)] = .{ | 120 | result[@intFromEnum(Feature.insert_reference_bits_multiple)] = .{ |
| 121 | .llvm_name = "insert-reference-bits-multiple", | 121 | .llvm_name = "insert-reference-bits-multiple", |
| 122 | .description = "Assume that the insert-reference-bits-multiple facility is installed", | 122 | .description = "Assume that the insert-reference-bits-multiple facility is installed", |
| 123 | .dependencies = featureSet(&[_]Feature{}), | 123 | .dependencies = featureSet(&[_]Feature{}), |
| 124 | }; | 124 | }; |
| 125 | result[@enumToInt(Feature.interlocked_access1)] = .{ | 125 | result[@intFromEnum(Feature.interlocked_access1)] = .{ |
| 126 | .llvm_name = "interlocked-access1", | 126 | .llvm_name = "interlocked-access1", |
| 127 | .description = "Assume that interlocked-access facility 1 is installed", | 127 | .description = "Assume that interlocked-access facility 1 is installed", |
| 128 | .dependencies = featureSet(&[_]Feature{}), | 128 | .dependencies = featureSet(&[_]Feature{}), |
| 129 | }; | 129 | }; |
| 130 | result[@enumToInt(Feature.load_and_trap)] = .{ | 130 | result[@intFromEnum(Feature.load_and_trap)] = .{ |
| 131 | .llvm_name = "load-and-trap", | 131 | .llvm_name = "load-and-trap", |
| 132 | .description = "Assume that the load-and-trap facility is installed", | 132 | .description = "Assume that the load-and-trap facility is installed", |
| 133 | .dependencies = featureSet(&[_]Feature{}), | 133 | .dependencies = featureSet(&[_]Feature{}), |
| 134 | }; | 134 | }; |
| 135 | result[@enumToInt(Feature.load_and_zero_rightmost_byte)] = .{ | 135 | result[@intFromEnum(Feature.load_and_zero_rightmost_byte)] = .{ |
| 136 | .llvm_name = "load-and-zero-rightmost-byte", | 136 | .llvm_name = "load-and-zero-rightmost-byte", |
| 137 | .description = "Assume that the load-and-zero-rightmost-byte facility is installed", | 137 | .description = "Assume that the load-and-zero-rightmost-byte facility is installed", |
| 138 | .dependencies = featureSet(&[_]Feature{}), | 138 | .dependencies = featureSet(&[_]Feature{}), |
| 139 | }; | 139 | }; |
| 140 | result[@enumToInt(Feature.load_store_on_cond)] = .{ | 140 | result[@intFromEnum(Feature.load_store_on_cond)] = .{ |
| 141 | .llvm_name = "load-store-on-cond", | 141 | .llvm_name = "load-store-on-cond", |
| 142 | .description = "Assume that the load/store-on-condition facility is installed", | 142 | .description = "Assume that the load/store-on-condition facility is installed", |
| 143 | .dependencies = featureSet(&[_]Feature{}), | 143 | .dependencies = featureSet(&[_]Feature{}), |
| 144 | }; | 144 | }; |
| 145 | result[@enumToInt(Feature.load_store_on_cond_2)] = .{ | 145 | result[@intFromEnum(Feature.load_store_on_cond_2)] = .{ |
| 146 | .llvm_name = "load-store-on-cond-2", | 146 | .llvm_name = "load-store-on-cond-2", |
| 147 | .description = "Assume that the load/store-on-condition facility 2 is installed", | 147 | .description = "Assume that the load/store-on-condition facility 2 is installed", |
| 148 | .dependencies = featureSet(&[_]Feature{}), | 148 | .dependencies = featureSet(&[_]Feature{}), |
| 149 | }; | 149 | }; |
| 150 | result[@enumToInt(Feature.message_security_assist_extension3)] = .{ | 150 | result[@intFromEnum(Feature.message_security_assist_extension3)] = .{ |
| 151 | .llvm_name = "message-security-assist-extension3", | 151 | .llvm_name = "message-security-assist-extension3", |
| 152 | .description = "Assume that the message-security-assist extension facility 3 is installed", | 152 | .description = "Assume that the message-security-assist extension facility 3 is installed", |
| 153 | .dependencies = featureSet(&[_]Feature{}), | 153 | .dependencies = featureSet(&[_]Feature{}), |
| 154 | }; | 154 | }; |
| 155 | result[@enumToInt(Feature.message_security_assist_extension4)] = .{ | 155 | result[@intFromEnum(Feature.message_security_assist_extension4)] = .{ |
| 156 | .llvm_name = "message-security-assist-extension4", | 156 | .llvm_name = "message-security-assist-extension4", |
| 157 | .description = "Assume that the message-security-assist extension facility 4 is installed", | 157 | .description = "Assume that the message-security-assist extension facility 4 is installed", |
| 158 | .dependencies = featureSet(&[_]Feature{}), | 158 | .dependencies = featureSet(&[_]Feature{}), |
| 159 | }; | 159 | }; |
| 160 | result[@enumToInt(Feature.message_security_assist_extension5)] = .{ | 160 | result[@intFromEnum(Feature.message_security_assist_extension5)] = .{ |
| 161 | .llvm_name = "message-security-assist-extension5", | 161 | .llvm_name = "message-security-assist-extension5", |
| 162 | .description = "Assume that the message-security-assist extension facility 5 is installed", | 162 | .description = "Assume that the message-security-assist extension facility 5 is installed", |
| 163 | .dependencies = featureSet(&[_]Feature{}), | 163 | .dependencies = featureSet(&[_]Feature{}), |
| 164 | }; | 164 | }; |
| 165 | result[@enumToInt(Feature.message_security_assist_extension7)] = .{ | 165 | result[@intFromEnum(Feature.message_security_assist_extension7)] = .{ |
| 166 | .llvm_name = "message-security-assist-extension7", | 166 | .llvm_name = "message-security-assist-extension7", |
| 167 | .description = "Assume that the message-security-assist extension facility 7 is installed", | 167 | .description = "Assume that the message-security-assist extension facility 7 is installed", |
| 168 | .dependencies = featureSet(&[_]Feature{}), | 168 | .dependencies = featureSet(&[_]Feature{}), |
| 169 | }; | 169 | }; |
| 170 | result[@enumToInt(Feature.message_security_assist_extension8)] = .{ | 170 | result[@intFromEnum(Feature.message_security_assist_extension8)] = .{ |
| 171 | .llvm_name = "message-security-assist-extension8", | 171 | .llvm_name = "message-security-assist-extension8", |
| 172 | .description = "Assume that the message-security-assist extension facility 8 is installed", | 172 | .description = "Assume that the message-security-assist extension facility 8 is installed", |
| 173 | .dependencies = featureSet(&[_]Feature{}), | 173 | .dependencies = featureSet(&[_]Feature{}), |
| 174 | }; | 174 | }; |
| 175 | result[@enumToInt(Feature.message_security_assist_extension9)] = .{ | 175 | result[@intFromEnum(Feature.message_security_assist_extension9)] = .{ |
| 176 | .llvm_name = "message-security-assist-extension9", | 176 | .llvm_name = "message-security-assist-extension9", |
| 177 | .description = "Assume that the message-security-assist extension facility 9 is installed", | 177 | .description = "Assume that the message-security-assist extension facility 9 is installed", |
| 178 | .dependencies = featureSet(&[_]Feature{}), | 178 | .dependencies = featureSet(&[_]Feature{}), |
| 179 | }; | 179 | }; |
| 180 | result[@enumToInt(Feature.miscellaneous_extensions)] = .{ | 180 | result[@intFromEnum(Feature.miscellaneous_extensions)] = .{ |
| 181 | .llvm_name = "miscellaneous-extensions", | 181 | .llvm_name = "miscellaneous-extensions", |
| 182 | .description = "Assume that the miscellaneous-extensions facility is installed", | 182 | .description = "Assume that the miscellaneous-extensions facility is installed", |
| 183 | .dependencies = featureSet(&[_]Feature{}), | 183 | .dependencies = featureSet(&[_]Feature{}), |
| 184 | }; | 184 | }; |
| 185 | result[@enumToInt(Feature.miscellaneous_extensions_2)] = .{ | 185 | result[@intFromEnum(Feature.miscellaneous_extensions_2)] = .{ |
| 186 | .llvm_name = "miscellaneous-extensions-2", | 186 | .llvm_name = "miscellaneous-extensions-2", |
| 187 | .description = "Assume that the miscellaneous-extensions facility 2 is installed", | 187 | .description = "Assume that the miscellaneous-extensions facility 2 is installed", |
| 188 | .dependencies = featureSet(&[_]Feature{}), | 188 | .dependencies = featureSet(&[_]Feature{}), |
| 189 | }; | 189 | }; |
| 190 | result[@enumToInt(Feature.miscellaneous_extensions_3)] = .{ | 190 | result[@intFromEnum(Feature.miscellaneous_extensions_3)] = .{ |
| 191 | .llvm_name = "miscellaneous-extensions-3", | 191 | .llvm_name = "miscellaneous-extensions-3", |
| 192 | .description = "Assume that the miscellaneous-extensions facility 3 is installed", | 192 | .description = "Assume that the miscellaneous-extensions facility 3 is installed", |
| 193 | .dependencies = featureSet(&[_]Feature{}), | 193 | .dependencies = featureSet(&[_]Feature{}), |
| 194 | }; | 194 | }; |
| 195 | result[@enumToInt(Feature.nnp_assist)] = .{ | 195 | result[@intFromEnum(Feature.nnp_assist)] = .{ |
| 196 | .llvm_name = "nnp-assist", | 196 | .llvm_name = "nnp-assist", |
| 197 | .description = "Assume that the NNP-assist facility is installed", | 197 | .description = "Assume that the NNP-assist facility is installed", |
| 198 | .dependencies = featureSet(&[_]Feature{}), | 198 | .dependencies = featureSet(&[_]Feature{}), |
| 199 | }; | 199 | }; |
| 200 | result[@enumToInt(Feature.population_count)] = .{ | 200 | result[@intFromEnum(Feature.population_count)] = .{ |
| 201 | .llvm_name = "population-count", | 201 | .llvm_name = "population-count", |
| 202 | .description = "Assume that the population-count facility is installed", | 202 | .description = "Assume that the population-count facility is installed", |
| 203 | .dependencies = featureSet(&[_]Feature{}), | 203 | .dependencies = featureSet(&[_]Feature{}), |
| 204 | }; | 204 | }; |
| 205 | result[@enumToInt(Feature.processor_activity_instrumentation)] = .{ | 205 | result[@intFromEnum(Feature.processor_activity_instrumentation)] = .{ |
| 206 | .llvm_name = "processor-activity-instrumentation", | 206 | .llvm_name = "processor-activity-instrumentation", |
| 207 | .description = "Assume that the processor-activity-instrumentation facility is installed", | 207 | .description = "Assume that the processor-activity-instrumentation facility is installed", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@enumToInt(Feature.processor_assist)] = .{ | 210 | result[@intFromEnum(Feature.processor_assist)] = .{ |
| 211 | .llvm_name = "processor-assist", | 211 | .llvm_name = "processor-assist", |
| 212 | .description = "Assume that the processor-assist facility is installed", | 212 | .description = "Assume that the processor-assist facility is installed", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@enumToInt(Feature.reset_dat_protection)] = .{ | 215 | result[@intFromEnum(Feature.reset_dat_protection)] = .{ |
| 216 | .llvm_name = "reset-dat-protection", | 216 | .llvm_name = "reset-dat-protection", |
| 217 | .description = "Assume that the reset-DAT-protection facility is installed", | 217 | .description = "Assume that the reset-DAT-protection facility is installed", |
| 218 | .dependencies = featureSet(&[_]Feature{}), | 218 | .dependencies = featureSet(&[_]Feature{}), |
| 219 | }; | 219 | }; |
| 220 | result[@enumToInt(Feature.reset_reference_bits_multiple)] = .{ | 220 | result[@intFromEnum(Feature.reset_reference_bits_multiple)] = .{ |
| 221 | .llvm_name = "reset-reference-bits-multiple", | 221 | .llvm_name = "reset-reference-bits-multiple", |
| 222 | .description = "Assume that the reset-reference-bits-multiple facility is installed", | 222 | .description = "Assume that the reset-reference-bits-multiple facility is installed", |
| 223 | .dependencies = featureSet(&[_]Feature{}), | 223 | .dependencies = featureSet(&[_]Feature{}), |
| 224 | }; | 224 | }; |
| 225 | result[@enumToInt(Feature.soft_float)] = .{ | 225 | result[@intFromEnum(Feature.soft_float)] = .{ |
| 226 | .llvm_name = "soft-float", | 226 | .llvm_name = "soft-float", |
| 227 | .description = "Use software emulation for floating point", | 227 | .description = "Use software emulation for floating point", |
| 228 | .dependencies = featureSet(&[_]Feature{}), | 228 | .dependencies = featureSet(&[_]Feature{}), |
| 229 | }; | 229 | }; |
| 230 | result[@enumToInt(Feature.transactional_execution)] = .{ | 230 | result[@intFromEnum(Feature.transactional_execution)] = .{ |
| 231 | .llvm_name = "transactional-execution", | 231 | .llvm_name = "transactional-execution", |
| 232 | .description = "Assume that the transactional-execution facility is installed", | 232 | .description = "Assume that the transactional-execution facility is installed", |
| 233 | .dependencies = featureSet(&[_]Feature{}), | 233 | .dependencies = featureSet(&[_]Feature{}), |
| 234 | }; | 234 | }; |
| 235 | result[@enumToInt(Feature.vector)] = .{ | 235 | result[@intFromEnum(Feature.vector)] = .{ |
| 236 | .llvm_name = "vector", | 236 | .llvm_name = "vector", |
| 237 | .description = "Assume that the vectory facility is installed", | 237 | .description = "Assume that the vectory facility is installed", |
| 238 | .dependencies = featureSet(&[_]Feature{}), | 238 | .dependencies = featureSet(&[_]Feature{}), |
| 239 | }; | 239 | }; |
| 240 | result[@enumToInt(Feature.vector_enhancements_1)] = .{ | 240 | result[@intFromEnum(Feature.vector_enhancements_1)] = .{ |
| 241 | .llvm_name = "vector-enhancements-1", | 241 | .llvm_name = "vector-enhancements-1", |
| 242 | .description = "Assume that the vector enhancements facility 1 is installed", | 242 | .description = "Assume that the vector enhancements facility 1 is installed", |
| 243 | .dependencies = featureSet(&[_]Feature{}), | 243 | .dependencies = featureSet(&[_]Feature{}), |
| 244 | }; | 244 | }; |
| 245 | result[@enumToInt(Feature.vector_enhancements_2)] = .{ | 245 | result[@intFromEnum(Feature.vector_enhancements_2)] = .{ |
| 246 | .llvm_name = "vector-enhancements-2", | 246 | .llvm_name = "vector-enhancements-2", |
| 247 | .description = "Assume that the vector enhancements facility 2 is installed", | 247 | .description = "Assume that the vector enhancements facility 2 is installed", |
| 248 | .dependencies = featureSet(&[_]Feature{}), | 248 | .dependencies = featureSet(&[_]Feature{}), |
| 249 | }; | 249 | }; |
| 250 | result[@enumToInt(Feature.vector_packed_decimal)] = .{ | 250 | result[@intFromEnum(Feature.vector_packed_decimal)] = .{ |
| 251 | .llvm_name = "vector-packed-decimal", | 251 | .llvm_name = "vector-packed-decimal", |
| 252 | .description = "Assume that the vector packed decimal facility is installed", | 252 | .description = "Assume that the vector packed decimal facility is installed", |
| 253 | .dependencies = featureSet(&[_]Feature{}), | 253 | .dependencies = featureSet(&[_]Feature{}), |
| 254 | }; | 254 | }; |
| 255 | result[@enumToInt(Feature.vector_packed_decimal_enhancement)] = .{ | 255 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement)] = .{ |
| 256 | .llvm_name = "vector-packed-decimal-enhancement", | 256 | .llvm_name = "vector-packed-decimal-enhancement", |
| 257 | .description = "Assume that the vector packed decimal enhancement facility is installed", | 257 | .description = "Assume that the vector packed decimal enhancement facility is installed", |
| 258 | .dependencies = featureSet(&[_]Feature{}), | 258 | .dependencies = featureSet(&[_]Feature{}), |
| 259 | }; | 259 | }; |
| 260 | result[@enumToInt(Feature.vector_packed_decimal_enhancement_2)] = .{ | 260 | result[@intFromEnum(Feature.vector_packed_decimal_enhancement_2)] = .{ |
| 261 | .llvm_name = "vector-packed-decimal-enhancement-2", | 261 | .llvm_name = "vector-packed-decimal-enhancement-2", |
| 262 | .description = "Assume that the vector packed decimal enhancement facility 2 is installed", | 262 | .description = "Assume that the vector packed decimal enhancement facility 2 is installed", |
| 263 | .dependencies = featureSet(&[_]Feature{}), | 263 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/sparc.zig+19-19| ... | @@ -35,97 +35,97 @@ pub const all_features = blk: { | ... | @@ -35,97 +35,97 @@ pub const all_features = blk: { |
| 35 | const len = @typeInfo(Feature).Enum.fields.len; | 35 | const len = @typeInfo(Feature).Enum.fields.len; |
| 36 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 36 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 37 | var result: [len]CpuFeature = undefined; | 37 | var result: [len]CpuFeature = undefined; |
| 38 | result[@enumToInt(Feature.deprecated_v8)] = .{ | 38 | result[@intFromEnum(Feature.deprecated_v8)] = .{ |
| 39 | .llvm_name = "deprecated-v8", | 39 | .llvm_name = "deprecated-v8", |
| 40 | .description = "Enable deprecated V8 instructions in V9 mode", | 40 | .description = "Enable deprecated V8 instructions in V9 mode", |
| 41 | .dependencies = featureSet(&[_]Feature{}), | 41 | .dependencies = featureSet(&[_]Feature{}), |
| 42 | }; | 42 | }; |
| 43 | result[@enumToInt(Feature.detectroundchange)] = .{ | 43 | result[@intFromEnum(Feature.detectroundchange)] = .{ |
| 44 | .llvm_name = "detectroundchange", | 44 | .llvm_name = "detectroundchange", |
| 45 | .description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode", | 45 | .description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode", |
| 46 | .dependencies = featureSet(&[_]Feature{}), | 46 | .dependencies = featureSet(&[_]Feature{}), |
| 47 | }; | 47 | }; |
| 48 | result[@enumToInt(Feature.fixallfdivsqrt)] = .{ | 48 | result[@intFromEnum(Feature.fixallfdivsqrt)] = .{ |
| 49 | .llvm_name = "fixallfdivsqrt", | 49 | .llvm_name = "fixallfdivsqrt", |
| 50 | .description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store", | 50 | .description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store", |
| 51 | .dependencies = featureSet(&[_]Feature{}), | 51 | .dependencies = featureSet(&[_]Feature{}), |
| 52 | }; | 52 | }; |
| 53 | result[@enumToInt(Feature.hard_quad_float)] = .{ | 53 | result[@intFromEnum(Feature.hard_quad_float)] = .{ |
| 54 | .llvm_name = "hard-quad-float", | 54 | .llvm_name = "hard-quad-float", |
| 55 | .description = "Enable quad-word floating point instructions", | 55 | .description = "Enable quad-word floating point instructions", |
| 56 | .dependencies = featureSet(&[_]Feature{}), | 56 | .dependencies = featureSet(&[_]Feature{}), |
| 57 | }; | 57 | }; |
| 58 | result[@enumToInt(Feature.hasleoncasa)] = .{ | 58 | result[@intFromEnum(Feature.hasleoncasa)] = .{ |
| 59 | .llvm_name = "hasleoncasa", | 59 | .llvm_name = "hasleoncasa", |
| 60 | .description = "Enable CASA instruction for LEON3 and LEON4 processors", | 60 | .description = "Enable CASA instruction for LEON3 and LEON4 processors", |
| 61 | .dependencies = featureSet(&[_]Feature{}), | 61 | .dependencies = featureSet(&[_]Feature{}), |
| 62 | }; | 62 | }; |
| 63 | result[@enumToInt(Feature.hasumacsmac)] = .{ | 63 | result[@intFromEnum(Feature.hasumacsmac)] = .{ |
| 64 | .llvm_name = "hasumacsmac", | 64 | .llvm_name = "hasumacsmac", |
| 65 | .description = "Enable UMAC and SMAC for LEON3 and LEON4 processors", | 65 | .description = "Enable UMAC and SMAC for LEON3 and LEON4 processors", |
| 66 | .dependencies = featureSet(&[_]Feature{}), | 66 | .dependencies = featureSet(&[_]Feature{}), |
| 67 | }; | 67 | }; |
| 68 | result[@enumToInt(Feature.insertnopload)] = .{ | 68 | result[@intFromEnum(Feature.insertnopload)] = .{ |
| 69 | .llvm_name = "insertnopload", | 69 | .llvm_name = "insertnopload", |
| 70 | .description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction", | 70 | .description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction", |
| 71 | .dependencies = featureSet(&[_]Feature{}), | 71 | .dependencies = featureSet(&[_]Feature{}), |
| 72 | }; | 72 | }; |
| 73 | result[@enumToInt(Feature.leon)] = .{ | 73 | result[@intFromEnum(Feature.leon)] = .{ |
| 74 | .llvm_name = "leon", | 74 | .llvm_name = "leon", |
| 75 | .description = "Enable LEON extensions", | 75 | .description = "Enable LEON extensions", |
| 76 | .dependencies = featureSet(&[_]Feature{}), | 76 | .dependencies = featureSet(&[_]Feature{}), |
| 77 | }; | 77 | }; |
| 78 | result[@enumToInt(Feature.leoncyclecounter)] = .{ | 78 | result[@intFromEnum(Feature.leoncyclecounter)] = .{ |
| 79 | .llvm_name = "leoncyclecounter", | 79 | .llvm_name = "leoncyclecounter", |
| 80 | .description = "Use the Leon cycle counter register", | 80 | .description = "Use the Leon cycle counter register", |
| 81 | .dependencies = featureSet(&[_]Feature{}), | 81 | .dependencies = featureSet(&[_]Feature{}), |
| 82 | }; | 82 | }; |
| 83 | result[@enumToInt(Feature.leonpwrpsr)] = .{ | 83 | result[@intFromEnum(Feature.leonpwrpsr)] = .{ |
| 84 | .llvm_name = "leonpwrpsr", | 84 | .llvm_name = "leonpwrpsr", |
| 85 | .description = "Enable the PWRPSR instruction", | 85 | .description = "Enable the PWRPSR instruction", |
| 86 | .dependencies = featureSet(&[_]Feature{}), | 86 | .dependencies = featureSet(&[_]Feature{}), |
| 87 | }; | 87 | }; |
| 88 | result[@enumToInt(Feature.no_fmuls)] = .{ | 88 | result[@intFromEnum(Feature.no_fmuls)] = .{ |
| 89 | .llvm_name = "no-fmuls", | 89 | .llvm_name = "no-fmuls", |
| 90 | .description = "Disable the fmuls instruction.", | 90 | .description = "Disable the fmuls instruction.", |
| 91 | .dependencies = featureSet(&[_]Feature{}), | 91 | .dependencies = featureSet(&[_]Feature{}), |
| 92 | }; | 92 | }; |
| 93 | result[@enumToInt(Feature.no_fsmuld)] = .{ | 93 | result[@intFromEnum(Feature.no_fsmuld)] = .{ |
| 94 | .llvm_name = "no-fsmuld", | 94 | .llvm_name = "no-fsmuld", |
| 95 | .description = "Disable the fsmuld instruction.", | 95 | .description = "Disable the fsmuld instruction.", |
| 96 | .dependencies = featureSet(&[_]Feature{}), | 96 | .dependencies = featureSet(&[_]Feature{}), |
| 97 | }; | 97 | }; |
| 98 | result[@enumToInt(Feature.popc)] = .{ | 98 | result[@intFromEnum(Feature.popc)] = .{ |
| 99 | .llvm_name = "popc", | 99 | .llvm_name = "popc", |
| 100 | .description = "Use the popc (population count) instruction", | 100 | .description = "Use the popc (population count) instruction", |
| 101 | .dependencies = featureSet(&[_]Feature{}), | 101 | .dependencies = featureSet(&[_]Feature{}), |
| 102 | }; | 102 | }; |
| 103 | result[@enumToInt(Feature.soft_float)] = .{ | 103 | result[@intFromEnum(Feature.soft_float)] = .{ |
| 104 | .llvm_name = "soft-float", | 104 | .llvm_name = "soft-float", |
| 105 | .description = "Use software emulation for floating point", | 105 | .description = "Use software emulation for floating point", |
| 106 | .dependencies = featureSet(&[_]Feature{}), | 106 | .dependencies = featureSet(&[_]Feature{}), |
| 107 | }; | 107 | }; |
| 108 | result[@enumToInt(Feature.soft_mul_div)] = .{ | 108 | result[@intFromEnum(Feature.soft_mul_div)] = .{ |
| 109 | .llvm_name = "soft-mul-div", | 109 | .llvm_name = "soft-mul-div", |
| 110 | .description = "Use software emulation for integer multiply and divide", | 110 | .description = "Use software emulation for integer multiply and divide", |
| 111 | .dependencies = featureSet(&[_]Feature{}), | 111 | .dependencies = featureSet(&[_]Feature{}), |
| 112 | }; | 112 | }; |
| 113 | result[@enumToInt(Feature.v9)] = .{ | 113 | result[@intFromEnum(Feature.v9)] = .{ |
| 114 | .llvm_name = "v9", | 114 | .llvm_name = "v9", |
| 115 | .description = "Enable SPARC-V9 instructions", | 115 | .description = "Enable SPARC-V9 instructions", |
| 116 | .dependencies = featureSet(&[_]Feature{}), | 116 | .dependencies = featureSet(&[_]Feature{}), |
| 117 | }; | 117 | }; |
| 118 | result[@enumToInt(Feature.vis)] = .{ | 118 | result[@intFromEnum(Feature.vis)] = .{ |
| 119 | .llvm_name = "vis", | 119 | .llvm_name = "vis", |
| 120 | .description = "Enable UltraSPARC Visual Instruction Set extensions", | 120 | .description = "Enable UltraSPARC Visual Instruction Set extensions", |
| 121 | .dependencies = featureSet(&[_]Feature{}), | 121 | .dependencies = featureSet(&[_]Feature{}), |
| 122 | }; | 122 | }; |
| 123 | result[@enumToInt(Feature.vis2)] = .{ | 123 | result[@intFromEnum(Feature.vis2)] = .{ |
| 124 | .llvm_name = "vis2", | 124 | .llvm_name = "vis2", |
| 125 | .description = "Enable Visual Instruction Set extensions II", | 125 | .description = "Enable Visual Instruction Set extensions II", |
| 126 | .dependencies = featureSet(&[_]Feature{}), | 126 | .dependencies = featureSet(&[_]Feature{}), |
| 127 | }; | 127 | }; |
| 128 | result[@enumToInt(Feature.vis3)] = .{ | 128 | result[@intFromEnum(Feature.vis3)] = .{ |
| 129 | .llvm_name = "vis3", | 129 | .llvm_name = "vis3", |
| 130 | .description = "Enable Visual Instruction Set extensions III", | 130 | .description = "Enable Visual Instruction Set extensions III", |
| 131 | .dependencies = featureSet(&[_]Feature{}), | 131 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/spirv.zig+284-284| ... | @@ -304,803 +304,803 @@ pub const all_features = blk: { | ... | @@ -304,803 +304,803 @@ pub const all_features = blk: { |
| 304 | const len = @typeInfo(Feature).Enum.fields.len; | 304 | const len = @typeInfo(Feature).Enum.fields.len; |
| 305 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 305 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 306 | var result: [len]CpuFeature = undefined; | 306 | var result: [len]CpuFeature = undefined; |
| 307 | result[@enumToInt(Feature.v1_1)] = .{ | 307 | result[@intFromEnum(Feature.v1_1)] = .{ |
| 308 | .llvm_name = null, | 308 | .llvm_name = null, |
| 309 | .description = "SPIR-V version 1.1", | 309 | .description = "SPIR-V version 1.1", |
| 310 | .dependencies = featureSet(&[_]Feature{}), | 310 | .dependencies = featureSet(&[_]Feature{}), |
| 311 | }; | 311 | }; |
| 312 | result[@enumToInt(Feature.v1_2)] = .{ | 312 | result[@intFromEnum(Feature.v1_2)] = .{ |
| 313 | .llvm_name = null, | 313 | .llvm_name = null, |
| 314 | .description = "SPIR-V version 1.2", | 314 | .description = "SPIR-V version 1.2", |
| 315 | .dependencies = featureSet(&[_]Feature{ | 315 | .dependencies = featureSet(&[_]Feature{ |
| 316 | .v1_1, | 316 | .v1_1, |
| 317 | }), | 317 | }), |
| 318 | }; | 318 | }; |
| 319 | result[@enumToInt(Feature.v1_3)] = .{ | 319 | result[@intFromEnum(Feature.v1_3)] = .{ |
| 320 | .llvm_name = null, | 320 | .llvm_name = null, |
| 321 | .description = "SPIR-V version 1.3", | 321 | .description = "SPIR-V version 1.3", |
| 322 | .dependencies = featureSet(&[_]Feature{ | 322 | .dependencies = featureSet(&[_]Feature{ |
| 323 | .v1_2, | 323 | .v1_2, |
| 324 | }), | 324 | }), |
| 325 | }; | 325 | }; |
| 326 | result[@enumToInt(Feature.v1_4)] = .{ | 326 | result[@intFromEnum(Feature.v1_4)] = .{ |
| 327 | .llvm_name = null, | 327 | .llvm_name = null, |
| 328 | .description = "SPIR-V version 1.4", | 328 | .description = "SPIR-V version 1.4", |
| 329 | .dependencies = featureSet(&[_]Feature{ | 329 | .dependencies = featureSet(&[_]Feature{ |
| 330 | .v1_3, | 330 | .v1_3, |
| 331 | }), | 331 | }), |
| 332 | }; | 332 | }; |
| 333 | result[@enumToInt(Feature.v1_5)] = .{ | 333 | result[@intFromEnum(Feature.v1_5)] = .{ |
| 334 | .llvm_name = null, | 334 | .llvm_name = null, |
| 335 | .description = "SPIR-V version 1.5", | 335 | .description = "SPIR-V version 1.5", |
| 336 | .dependencies = featureSet(&[_]Feature{ | 336 | .dependencies = featureSet(&[_]Feature{ |
| 337 | .v1_4, | 337 | .v1_4, |
| 338 | }), | 338 | }), |
| 339 | }; | 339 | }; |
| 340 | result[@enumToInt(Feature.SPV_AMD_shader_fragment_mask)] = .{ | 340 | result[@intFromEnum(Feature.SPV_AMD_shader_fragment_mask)] = .{ |
| 341 | .llvm_name = null, | 341 | .llvm_name = null, |
| 342 | .description = "SPIR-V extension SPV_AMD_shader_fragment_mask", | 342 | .description = "SPIR-V extension SPV_AMD_shader_fragment_mask", |
| 343 | .dependencies = featureSet(&[_]Feature{}), | 343 | .dependencies = featureSet(&[_]Feature{}), |
| 344 | }; | 344 | }; |
| 345 | result[@enumToInt(Feature.SPV_AMD_gpu_shader_int16)] = .{ | 345 | result[@intFromEnum(Feature.SPV_AMD_gpu_shader_int16)] = .{ |
| 346 | .llvm_name = null, | 346 | .llvm_name = null, |
| 347 | .description = "SPIR-V extension SPV_AMD_gpu_shader_int16", | 347 | .description = "SPIR-V extension SPV_AMD_gpu_shader_int16", |
| 348 | .dependencies = featureSet(&[_]Feature{}), | 348 | .dependencies = featureSet(&[_]Feature{}), |
| 349 | }; | 349 | }; |
| 350 | result[@enumToInt(Feature.SPV_AMD_gpu_shader_half_float)] = .{ | 350 | result[@intFromEnum(Feature.SPV_AMD_gpu_shader_half_float)] = .{ |
| 351 | .llvm_name = null, | 351 | .llvm_name = null, |
| 352 | .description = "SPIR-V extension SPV_AMD_gpu_shader_half_float", | 352 | .description = "SPIR-V extension SPV_AMD_gpu_shader_half_float", |
| 353 | .dependencies = featureSet(&[_]Feature{}), | 353 | .dependencies = featureSet(&[_]Feature{}), |
| 354 | }; | 354 | }; |
| 355 | result[@enumToInt(Feature.SPV_AMD_texture_gather_bias_lod)] = .{ | 355 | result[@intFromEnum(Feature.SPV_AMD_texture_gather_bias_lod)] = .{ |
| 356 | .llvm_name = null, | 356 | .llvm_name = null, |
| 357 | .description = "SPIR-V extension SPV_AMD_texture_gather_bias_lod", | 357 | .description = "SPIR-V extension SPV_AMD_texture_gather_bias_lod", |
| 358 | .dependencies = featureSet(&[_]Feature{}), | 358 | .dependencies = featureSet(&[_]Feature{}), |
| 359 | }; | 359 | }; |
| 360 | result[@enumToInt(Feature.SPV_AMD_shader_ballot)] = .{ | 360 | result[@intFromEnum(Feature.SPV_AMD_shader_ballot)] = .{ |
| 361 | .llvm_name = null, | 361 | .llvm_name = null, |
| 362 | .description = "SPIR-V extension SPV_AMD_shader_ballot", | 362 | .description = "SPIR-V extension SPV_AMD_shader_ballot", |
| 363 | .dependencies = featureSet(&[_]Feature{}), | 363 | .dependencies = featureSet(&[_]Feature{}), |
| 364 | }; | 364 | }; |
| 365 | result[@enumToInt(Feature.SPV_AMD_gcn_shader)] = .{ | 365 | result[@intFromEnum(Feature.SPV_AMD_gcn_shader)] = .{ |
| 366 | .llvm_name = null, | 366 | .llvm_name = null, |
| 367 | .description = "SPIR-V extension SPV_AMD_gcn_shader", | 367 | .description = "SPIR-V extension SPV_AMD_gcn_shader", |
| 368 | .dependencies = featureSet(&[_]Feature{}), | 368 | .dependencies = featureSet(&[_]Feature{}), |
| 369 | }; | 369 | }; |
| 370 | result[@enumToInt(Feature.SPV_AMD_shader_image_load_store_lod)] = .{ | 370 | result[@intFromEnum(Feature.SPV_AMD_shader_image_load_store_lod)] = .{ |
| 371 | .llvm_name = null, | 371 | .llvm_name = null, |
| 372 | .description = "SPIR-V extension SPV_AMD_shader_image_load_store_lod", | 372 | .description = "SPIR-V extension SPV_AMD_shader_image_load_store_lod", |
| 373 | .dependencies = featureSet(&[_]Feature{}), | 373 | .dependencies = featureSet(&[_]Feature{}), |
| 374 | }; | 374 | }; |
| 375 | result[@enumToInt(Feature.SPV_AMD_shader_explicit_vertex_parameter)] = .{ | 375 | result[@intFromEnum(Feature.SPV_AMD_shader_explicit_vertex_parameter)] = .{ |
| 376 | .llvm_name = null, | 376 | .llvm_name = null, |
| 377 | .description = "SPIR-V extension SPV_AMD_shader_explicit_vertex_parameter", | 377 | .description = "SPIR-V extension SPV_AMD_shader_explicit_vertex_parameter", |
| 378 | .dependencies = featureSet(&[_]Feature{}), | 378 | .dependencies = featureSet(&[_]Feature{}), |
| 379 | }; | 379 | }; |
| 380 | result[@enumToInt(Feature.SPV_AMD_shader_trinary_minmax)] = .{ | 380 | result[@intFromEnum(Feature.SPV_AMD_shader_trinary_minmax)] = .{ |
| 381 | .llvm_name = null, | 381 | .llvm_name = null, |
| 382 | .description = "SPIR-V extension SPV_AMD_shader_trinary_minmax", | 382 | .description = "SPIR-V extension SPV_AMD_shader_trinary_minmax", |
| 383 | .dependencies = featureSet(&[_]Feature{}), | 383 | .dependencies = featureSet(&[_]Feature{}), |
| 384 | }; | 384 | }; |
| 385 | result[@enumToInt(Feature.SPV_AMD_gpu_shader_half_float_fetch)] = .{ | 385 | result[@intFromEnum(Feature.SPV_AMD_gpu_shader_half_float_fetch)] = .{ |
| 386 | .llvm_name = null, | 386 | .llvm_name = null, |
| 387 | .description = "SPIR-V extension SPV_AMD_gpu_shader_half_float_fetch", | 387 | .description = "SPIR-V extension SPV_AMD_gpu_shader_half_float_fetch", |
| 388 | .dependencies = featureSet(&[_]Feature{}), | 388 | .dependencies = featureSet(&[_]Feature{}), |
| 389 | }; | 389 | }; |
| 390 | result[@enumToInt(Feature.SPV_GOOGLE_hlsl_functionality1)] = .{ | 390 | result[@intFromEnum(Feature.SPV_GOOGLE_hlsl_functionality1)] = .{ |
| 391 | .llvm_name = null, | 391 | .llvm_name = null, |
| 392 | .description = "SPIR-V extension SPV_GOOGLE_hlsl_functionality1", | 392 | .description = "SPIR-V extension SPV_GOOGLE_hlsl_functionality1", |
| 393 | .dependencies = featureSet(&[_]Feature{}), | 393 | .dependencies = featureSet(&[_]Feature{}), |
| 394 | }; | 394 | }; |
| 395 | result[@enumToInt(Feature.SPV_GOOGLE_user_type)] = .{ | 395 | result[@intFromEnum(Feature.SPV_GOOGLE_user_type)] = .{ |
| 396 | .llvm_name = null, | 396 | .llvm_name = null, |
| 397 | .description = "SPIR-V extension SPV_GOOGLE_user_type", | 397 | .description = "SPIR-V extension SPV_GOOGLE_user_type", |
| 398 | .dependencies = featureSet(&[_]Feature{}), | 398 | .dependencies = featureSet(&[_]Feature{}), |
| 399 | }; | 399 | }; |
| 400 | result[@enumToInt(Feature.SPV_GOOGLE_decorate_string)] = .{ | 400 | result[@intFromEnum(Feature.SPV_GOOGLE_decorate_string)] = .{ |
| 401 | .llvm_name = null, | 401 | .llvm_name = null, |
| 402 | .description = "SPIR-V extension SPV_GOOGLE_decorate_string", | 402 | .description = "SPIR-V extension SPV_GOOGLE_decorate_string", |
| 403 | .dependencies = featureSet(&[_]Feature{}), | 403 | .dependencies = featureSet(&[_]Feature{}), |
| 404 | }; | 404 | }; |
| 405 | result[@enumToInt(Feature.SPV_EXT_demote_to_helper_invocation)] = .{ | 405 | result[@intFromEnum(Feature.SPV_EXT_demote_to_helper_invocation)] = .{ |
| 406 | .llvm_name = null, | 406 | .llvm_name = null, |
| 407 | .description = "SPIR-V extension SPV_EXT_demote_to_helper_invocation", | 407 | .description = "SPIR-V extension SPV_EXT_demote_to_helper_invocation", |
| 408 | .dependencies = featureSet(&[_]Feature{}), | 408 | .dependencies = featureSet(&[_]Feature{}), |
| 409 | }; | 409 | }; |
| 410 | result[@enumToInt(Feature.SPV_EXT_descriptor_indexing)] = .{ | 410 | result[@intFromEnum(Feature.SPV_EXT_descriptor_indexing)] = .{ |
| 411 | .llvm_name = null, | 411 | .llvm_name = null, |
| 412 | .description = "SPIR-V extension SPV_EXT_descriptor_indexing", | 412 | .description = "SPIR-V extension SPV_EXT_descriptor_indexing", |
| 413 | .dependencies = featureSet(&[_]Feature{}), | 413 | .dependencies = featureSet(&[_]Feature{}), |
| 414 | }; | 414 | }; |
| 415 | result[@enumToInt(Feature.SPV_EXT_fragment_fully_covered)] = .{ | 415 | result[@intFromEnum(Feature.SPV_EXT_fragment_fully_covered)] = .{ |
| 416 | .llvm_name = null, | 416 | .llvm_name = null, |
| 417 | .description = "SPIR-V extension SPV_EXT_fragment_fully_covered", | 417 | .description = "SPIR-V extension SPV_EXT_fragment_fully_covered", |
| 418 | .dependencies = featureSet(&[_]Feature{}), | 418 | .dependencies = featureSet(&[_]Feature{}), |
| 419 | }; | 419 | }; |
| 420 | result[@enumToInt(Feature.SPV_EXT_shader_stencil_export)] = .{ | 420 | result[@intFromEnum(Feature.SPV_EXT_shader_stencil_export)] = .{ |
| 421 | .llvm_name = null, | 421 | .llvm_name = null, |
| 422 | .description = "SPIR-V extension SPV_EXT_shader_stencil_export", | 422 | .description = "SPIR-V extension SPV_EXT_shader_stencil_export", |
| 423 | .dependencies = featureSet(&[_]Feature{}), | 423 | .dependencies = featureSet(&[_]Feature{}), |
| 424 | }; | 424 | }; |
| 425 | result[@enumToInt(Feature.SPV_EXT_physical_storage_buffer)] = .{ | 425 | result[@intFromEnum(Feature.SPV_EXT_physical_storage_buffer)] = .{ |
| 426 | .llvm_name = null, | 426 | .llvm_name = null, |
| 427 | .description = "SPIR-V extension SPV_EXT_physical_storage_buffer", | 427 | .description = "SPIR-V extension SPV_EXT_physical_storage_buffer", |
| 428 | .dependencies = featureSet(&[_]Feature{}), | 428 | .dependencies = featureSet(&[_]Feature{}), |
| 429 | }; | 429 | }; |
| 430 | result[@enumToInt(Feature.SPV_EXT_shader_atomic_float_add)] = .{ | 430 | result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_add)] = .{ |
| 431 | .llvm_name = null, | 431 | .llvm_name = null, |
| 432 | .description = "SPIR-V extension SPV_EXT_shader_atomic_float_add", | 432 | .description = "SPIR-V extension SPV_EXT_shader_atomic_float_add", |
| 433 | .dependencies = featureSet(&[_]Feature{}), | 433 | .dependencies = featureSet(&[_]Feature{}), |
| 434 | }; | 434 | }; |
| 435 | result[@enumToInt(Feature.SPV_EXT_shader_atomic_float_min_max)] = .{ | 435 | result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_min_max)] = .{ |
| 436 | .llvm_name = null, | 436 | .llvm_name = null, |
| 437 | .description = "SPIR-V extension SPV_EXT_shader_atomic_float_min_max", | 437 | .description = "SPIR-V extension SPV_EXT_shader_atomic_float_min_max", |
| 438 | .dependencies = featureSet(&[_]Feature{}), | 438 | .dependencies = featureSet(&[_]Feature{}), |
| 439 | }; | 439 | }; |
| 440 | result[@enumToInt(Feature.SPV_EXT_shader_image_int64)] = .{ | 440 | result[@intFromEnum(Feature.SPV_EXT_shader_image_int64)] = .{ |
| 441 | .llvm_name = null, | 441 | .llvm_name = null, |
| 442 | .description = "SPIR-V extension SPV_EXT_shader_image_int64", | 442 | .description = "SPIR-V extension SPV_EXT_shader_image_int64", |
| 443 | .dependencies = featureSet(&[_]Feature{}), | 443 | .dependencies = featureSet(&[_]Feature{}), |
| 444 | }; | 444 | }; |
| 445 | result[@enumToInt(Feature.SPV_EXT_fragment_shader_interlock)] = .{ | 445 | result[@intFromEnum(Feature.SPV_EXT_fragment_shader_interlock)] = .{ |
| 446 | .llvm_name = null, | 446 | .llvm_name = null, |
| 447 | .description = "SPIR-V extension SPV_EXT_fragment_shader_interlock", | 447 | .description = "SPIR-V extension SPV_EXT_fragment_shader_interlock", |
| 448 | .dependencies = featureSet(&[_]Feature{}), | 448 | .dependencies = featureSet(&[_]Feature{}), |
| 449 | }; | 449 | }; |
| 450 | result[@enumToInt(Feature.SPV_EXT_fragment_invocation_density)] = .{ | 450 | result[@intFromEnum(Feature.SPV_EXT_fragment_invocation_density)] = .{ |
| 451 | .llvm_name = null, | 451 | .llvm_name = null, |
| 452 | .description = "SPIR-V extension SPV_EXT_fragment_invocation_density", | 452 | .description = "SPIR-V extension SPV_EXT_fragment_invocation_density", |
| 453 | .dependencies = featureSet(&[_]Feature{}), | 453 | .dependencies = featureSet(&[_]Feature{}), |
| 454 | }; | 454 | }; |
| 455 | result[@enumToInt(Feature.SPV_EXT_shader_viewport_index_layer)] = .{ | 455 | result[@intFromEnum(Feature.SPV_EXT_shader_viewport_index_layer)] = .{ |
| 456 | .llvm_name = null, | 456 | .llvm_name = null, |
| 457 | .description = "SPIR-V extension SPV_EXT_shader_viewport_index_layer", | 457 | .description = "SPIR-V extension SPV_EXT_shader_viewport_index_layer", |
| 458 | .dependencies = featureSet(&[_]Feature{}), | 458 | .dependencies = featureSet(&[_]Feature{}), |
| 459 | }; | 459 | }; |
| 460 | result[@enumToInt(Feature.SPV_INTEL_loop_fuse)] = .{ | 460 | result[@intFromEnum(Feature.SPV_INTEL_loop_fuse)] = .{ |
| 461 | .llvm_name = null, | 461 | .llvm_name = null, |
| 462 | .description = "SPIR-V extension SPV_INTEL_loop_fuse", | 462 | .description = "SPIR-V extension SPV_INTEL_loop_fuse", |
| 463 | .dependencies = featureSet(&[_]Feature{}), | 463 | .dependencies = featureSet(&[_]Feature{}), |
| 464 | }; | 464 | }; |
| 465 | result[@enumToInt(Feature.SPV_INTEL_fpga_dsp_control)] = .{ | 465 | result[@intFromEnum(Feature.SPV_INTEL_fpga_dsp_control)] = .{ |
| 466 | .llvm_name = null, | 466 | .llvm_name = null, |
| 467 | .description = "SPIR-V extension SPV_INTEL_fpga_dsp_control", | 467 | .description = "SPIR-V extension SPV_INTEL_fpga_dsp_control", |
| 468 | .dependencies = featureSet(&[_]Feature{}), | 468 | .dependencies = featureSet(&[_]Feature{}), |
| 469 | }; | 469 | }; |
| 470 | result[@enumToInt(Feature.SPV_INTEL_fpga_reg)] = .{ | 470 | result[@intFromEnum(Feature.SPV_INTEL_fpga_reg)] = .{ |
| 471 | .llvm_name = null, | 471 | .llvm_name = null, |
| 472 | .description = "SPIR-V extension SPV_INTEL_fpga_reg", | 472 | .description = "SPIR-V extension SPV_INTEL_fpga_reg", |
| 473 | .dependencies = featureSet(&[_]Feature{}), | 473 | .dependencies = featureSet(&[_]Feature{}), |
| 474 | }; | 474 | }; |
| 475 | result[@enumToInt(Feature.SPV_INTEL_fpga_memory_accesses)] = .{ | 475 | result[@intFromEnum(Feature.SPV_INTEL_fpga_memory_accesses)] = .{ |
| 476 | .llvm_name = null, | 476 | .llvm_name = null, |
| 477 | .description = "SPIR-V extension SPV_INTEL_fpga_memory_accesses", | 477 | .description = "SPIR-V extension SPV_INTEL_fpga_memory_accesses", |
| 478 | .dependencies = featureSet(&[_]Feature{}), | 478 | .dependencies = featureSet(&[_]Feature{}), |
| 479 | }; | 479 | }; |
| 480 | result[@enumToInt(Feature.SPV_INTEL_fpga_loop_controls)] = .{ | 480 | result[@intFromEnum(Feature.SPV_INTEL_fpga_loop_controls)] = .{ |
| 481 | .llvm_name = null, | 481 | .llvm_name = null, |
| 482 | .description = "SPIR-V extension SPV_INTEL_fpga_loop_controls", | 482 | .description = "SPIR-V extension SPV_INTEL_fpga_loop_controls", |
| 483 | .dependencies = featureSet(&[_]Feature{}), | 483 | .dependencies = featureSet(&[_]Feature{}), |
| 484 | }; | 484 | }; |
| 485 | result[@enumToInt(Feature.SPV_INTEL_io_pipes)] = .{ | 485 | result[@intFromEnum(Feature.SPV_INTEL_io_pipes)] = .{ |
| 486 | .llvm_name = null, | 486 | .llvm_name = null, |
| 487 | .description = "SPIR-V extension SPV_INTEL_io_pipes", | 487 | .description = "SPIR-V extension SPV_INTEL_io_pipes", |
| 488 | .dependencies = featureSet(&[_]Feature{}), | 488 | .dependencies = featureSet(&[_]Feature{}), |
| 489 | }; | 489 | }; |
| 490 | result[@enumToInt(Feature.SPV_INTEL_unstructured_loop_controls)] = .{ | 490 | result[@intFromEnum(Feature.SPV_INTEL_unstructured_loop_controls)] = .{ |
| 491 | .llvm_name = null, | 491 | .llvm_name = null, |
| 492 | .description = "SPIR-V extension SPV_INTEL_unstructured_loop_controls", | 492 | .description = "SPIR-V extension SPV_INTEL_unstructured_loop_controls", |
| 493 | .dependencies = featureSet(&[_]Feature{}), | 493 | .dependencies = featureSet(&[_]Feature{}), |
| 494 | }; | 494 | }; |
| 495 | result[@enumToInt(Feature.SPV_INTEL_blocking_pipes)] = .{ | 495 | result[@intFromEnum(Feature.SPV_INTEL_blocking_pipes)] = .{ |
| 496 | .llvm_name = null, | 496 | .llvm_name = null, |
| 497 | .description = "SPIR-V extension SPV_INTEL_blocking_pipes", | 497 | .description = "SPIR-V extension SPV_INTEL_blocking_pipes", |
| 498 | .dependencies = featureSet(&[_]Feature{}), | 498 | .dependencies = featureSet(&[_]Feature{}), |
| 499 | }; | 499 | }; |
| 500 | result[@enumToInt(Feature.SPV_INTEL_device_side_avc_motion_estimation)] = .{ | 500 | result[@intFromEnum(Feature.SPV_INTEL_device_side_avc_motion_estimation)] = .{ |
| 501 | .llvm_name = null, | 501 | .llvm_name = null, |
| 502 | .description = "SPIR-V extension SPV_INTEL_device_side_avc_motion_estimation", | 502 | .description = "SPIR-V extension SPV_INTEL_device_side_avc_motion_estimation", |
| 503 | .dependencies = featureSet(&[_]Feature{}), | 503 | .dependencies = featureSet(&[_]Feature{}), |
| 504 | }; | 504 | }; |
| 505 | result[@enumToInt(Feature.SPV_INTEL_fpga_memory_attributes)] = .{ | 505 | result[@intFromEnum(Feature.SPV_INTEL_fpga_memory_attributes)] = .{ |
| 506 | .llvm_name = null, | 506 | .llvm_name = null, |
| 507 | .description = "SPIR-V extension SPV_INTEL_fpga_memory_attributes", | 507 | .description = "SPIR-V extension SPV_INTEL_fpga_memory_attributes", |
| 508 | .dependencies = featureSet(&[_]Feature{}), | 508 | .dependencies = featureSet(&[_]Feature{}), |
| 509 | }; | 509 | }; |
| 510 | result[@enumToInt(Feature.SPV_INTEL_fp_fast_math_mode)] = .{ | 510 | result[@intFromEnum(Feature.SPV_INTEL_fp_fast_math_mode)] = .{ |
| 511 | .llvm_name = null, | 511 | .llvm_name = null, |
| 512 | .description = "SPIR-V extension SPV_INTEL_fp_fast_math_mode", | 512 | .description = "SPIR-V extension SPV_INTEL_fp_fast_math_mode", |
| 513 | .dependencies = featureSet(&[_]Feature{}), | 513 | .dependencies = featureSet(&[_]Feature{}), |
| 514 | }; | 514 | }; |
| 515 | result[@enumToInt(Feature.SPV_INTEL_media_block_io)] = .{ | 515 | result[@intFromEnum(Feature.SPV_INTEL_media_block_io)] = .{ |
| 516 | .llvm_name = null, | 516 | .llvm_name = null, |
| 517 | .description = "SPIR-V extension SPV_INTEL_media_block_io", | 517 | .description = "SPIR-V extension SPV_INTEL_media_block_io", |
| 518 | .dependencies = featureSet(&[_]Feature{}), | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | }; | 519 | }; |
| 520 | result[@enumToInt(Feature.SPV_INTEL_shader_integer_functions2)] = .{ | 520 | result[@intFromEnum(Feature.SPV_INTEL_shader_integer_functions2)] = .{ |
| 521 | .llvm_name = null, | 521 | .llvm_name = null, |
| 522 | .description = "SPIR-V extension SPV_INTEL_shader_integer_functions2", | 522 | .description = "SPIR-V extension SPV_INTEL_shader_integer_functions2", |
| 523 | .dependencies = featureSet(&[_]Feature{}), | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | }; | 524 | }; |
| 525 | result[@enumToInt(Feature.SPV_INTEL_subgroups)] = .{ | 525 | result[@intFromEnum(Feature.SPV_INTEL_subgroups)] = .{ |
| 526 | .llvm_name = null, | 526 | .llvm_name = null, |
| 527 | .description = "SPIR-V extension SPV_INTEL_subgroups", | 527 | .description = "SPIR-V extension SPV_INTEL_subgroups", |
| 528 | .dependencies = featureSet(&[_]Feature{}), | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | }; | 529 | }; |
| 530 | result[@enumToInt(Feature.SPV_INTEL_fpga_cluster_attributes)] = .{ | 530 | result[@intFromEnum(Feature.SPV_INTEL_fpga_cluster_attributes)] = .{ |
| 531 | .llvm_name = null, | 531 | .llvm_name = null, |
| 532 | .description = "SPIR-V extension SPV_INTEL_fpga_cluster_attributes", | 532 | .description = "SPIR-V extension SPV_INTEL_fpga_cluster_attributes", |
| 533 | .dependencies = featureSet(&[_]Feature{}), | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | }; | 534 | }; |
| 535 | result[@enumToInt(Feature.SPV_INTEL_kernel_attributes)] = .{ | 535 | result[@intFromEnum(Feature.SPV_INTEL_kernel_attributes)] = .{ |
| 536 | .llvm_name = null, | 536 | .llvm_name = null, |
| 537 | .description = "SPIR-V extension SPV_INTEL_kernel_attributes", | 537 | .description = "SPIR-V extension SPV_INTEL_kernel_attributes", |
| 538 | .dependencies = featureSet(&[_]Feature{}), | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | }; | 539 | }; |
| 540 | result[@enumToInt(Feature.SPV_INTEL_arbitrary_precision_integers)] = .{ | 540 | result[@intFromEnum(Feature.SPV_INTEL_arbitrary_precision_integers)] = .{ |
| 541 | .llvm_name = null, | 541 | .llvm_name = null, |
| 542 | .description = "SPIR-V extension SPV_INTEL_arbitrary_precision_integers", | 542 | .description = "SPIR-V extension SPV_INTEL_arbitrary_precision_integers", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@enumToInt(Feature.SPV_KHR_8bit_storage)] = .{ | 545 | result[@intFromEnum(Feature.SPV_KHR_8bit_storage)] = .{ |
| 546 | .llvm_name = null, | 546 | .llvm_name = null, |
| 547 | .description = "SPIR-V extension SPV_KHR_8bit_storage", | 547 | .description = "SPIR-V extension SPV_KHR_8bit_storage", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@enumToInt(Feature.SPV_KHR_shader_clock)] = .{ | 550 | result[@intFromEnum(Feature.SPV_KHR_shader_clock)] = .{ |
| 551 | .llvm_name = null, | 551 | .llvm_name = null, |
| 552 | .description = "SPIR-V extension SPV_KHR_shader_clock", | 552 | .description = "SPIR-V extension SPV_KHR_shader_clock", |
| 553 | .dependencies = featureSet(&[_]Feature{}), | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | }; | 554 | }; |
| 555 | result[@enumToInt(Feature.SPV_KHR_device_group)] = .{ | 555 | result[@intFromEnum(Feature.SPV_KHR_device_group)] = .{ |
| 556 | .llvm_name = null, | 556 | .llvm_name = null, |
| 557 | .description = "SPIR-V extension SPV_KHR_device_group", | 557 | .description = "SPIR-V extension SPV_KHR_device_group", |
| 558 | .dependencies = featureSet(&[_]Feature{}), | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | }; | 559 | }; |
| 560 | result[@enumToInt(Feature.SPV_KHR_16bit_storage)] = .{ | 560 | result[@intFromEnum(Feature.SPV_KHR_16bit_storage)] = .{ |
| 561 | .llvm_name = null, | 561 | .llvm_name = null, |
| 562 | .description = "SPIR-V extension SPV_KHR_16bit_storage", | 562 | .description = "SPIR-V extension SPV_KHR_16bit_storage", |
| 563 | .dependencies = featureSet(&[_]Feature{}), | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | }; | 564 | }; |
| 565 | result[@enumToInt(Feature.SPV_KHR_variable_pointers)] = .{ | 565 | result[@intFromEnum(Feature.SPV_KHR_variable_pointers)] = .{ |
| 566 | .llvm_name = null, | 566 | .llvm_name = null, |
| 567 | .description = "SPIR-V extension SPV_KHR_variable_pointers", | 567 | .description = "SPIR-V extension SPV_KHR_variable_pointers", |
| 568 | .dependencies = featureSet(&[_]Feature{}), | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | }; | 569 | }; |
| 570 | result[@enumToInt(Feature.SPV_KHR_no_integer_wrap_decoration)] = .{ | 570 | result[@intFromEnum(Feature.SPV_KHR_no_integer_wrap_decoration)] = .{ |
| 571 | .llvm_name = null, | 571 | .llvm_name = null, |
| 572 | .description = "SPIR-V extension SPV_KHR_no_integer_wrap_decoration", | 572 | .description = "SPIR-V extension SPV_KHR_no_integer_wrap_decoration", |
| 573 | .dependencies = featureSet(&[_]Feature{}), | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | }; | 574 | }; |
| 575 | result[@enumToInt(Feature.SPV_KHR_subgroup_vote)] = .{ | 575 | result[@intFromEnum(Feature.SPV_KHR_subgroup_vote)] = .{ |
| 576 | .llvm_name = null, | 576 | .llvm_name = null, |
| 577 | .description = "SPIR-V extension SPV_KHR_subgroup_vote", | 577 | .description = "SPIR-V extension SPV_KHR_subgroup_vote", |
| 578 | .dependencies = featureSet(&[_]Feature{}), | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | }; | 579 | }; |
| 580 | result[@enumToInt(Feature.SPV_KHR_multiview)] = .{ | 580 | result[@intFromEnum(Feature.SPV_KHR_multiview)] = .{ |
| 581 | .llvm_name = null, | 581 | .llvm_name = null, |
| 582 | .description = "SPIR-V extension SPV_KHR_multiview", | 582 | .description = "SPIR-V extension SPV_KHR_multiview", |
| 583 | .dependencies = featureSet(&[_]Feature{}), | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | }; | 584 | }; |
| 585 | result[@enumToInt(Feature.SPV_KHR_shader_ballot)] = .{ | 585 | result[@intFromEnum(Feature.SPV_KHR_shader_ballot)] = .{ |
| 586 | .llvm_name = null, | 586 | .llvm_name = null, |
| 587 | .description = "SPIR-V extension SPV_KHR_shader_ballot", | 587 | .description = "SPIR-V extension SPV_KHR_shader_ballot", |
| 588 | .dependencies = featureSet(&[_]Feature{}), | 588 | .dependencies = featureSet(&[_]Feature{}), |
| 589 | }; | 589 | }; |
| 590 | result[@enumToInt(Feature.SPV_KHR_vulkan_memory_model)] = .{ | 590 | result[@intFromEnum(Feature.SPV_KHR_vulkan_memory_model)] = .{ |
| 591 | .llvm_name = null, | 591 | .llvm_name = null, |
| 592 | .description = "SPIR-V extension SPV_KHR_vulkan_memory_model", | 592 | .description = "SPIR-V extension SPV_KHR_vulkan_memory_model", |
| 593 | .dependencies = featureSet(&[_]Feature{}), | 593 | .dependencies = featureSet(&[_]Feature{}), |
| 594 | }; | 594 | }; |
| 595 | result[@enumToInt(Feature.SPV_KHR_physical_storage_buffer)] = .{ | 595 | result[@intFromEnum(Feature.SPV_KHR_physical_storage_buffer)] = .{ |
| 596 | .llvm_name = null, | 596 | .llvm_name = null, |
| 597 | .description = "SPIR-V extension SPV_KHR_physical_storage_buffer", | 597 | .description = "SPIR-V extension SPV_KHR_physical_storage_buffer", |
| 598 | .dependencies = featureSet(&[_]Feature{}), | 598 | .dependencies = featureSet(&[_]Feature{}), |
| 599 | }; | 599 | }; |
| 600 | result[@enumToInt(Feature.SPV_KHR_workgroup_memory_explicit_layout)] = .{ | 600 | result[@intFromEnum(Feature.SPV_KHR_workgroup_memory_explicit_layout)] = .{ |
| 601 | .llvm_name = null, | 601 | .llvm_name = null, |
| 602 | .description = "SPIR-V extension SPV_KHR_workgroup_memory_explicit_layout", | 602 | .description = "SPIR-V extension SPV_KHR_workgroup_memory_explicit_layout", |
| 603 | .dependencies = featureSet(&[_]Feature{}), | 603 | .dependencies = featureSet(&[_]Feature{}), |
| 604 | }; | 604 | }; |
| 605 | result[@enumToInt(Feature.SPV_KHR_fragment_shading_rate)] = .{ | 605 | result[@intFromEnum(Feature.SPV_KHR_fragment_shading_rate)] = .{ |
| 606 | .llvm_name = null, | 606 | .llvm_name = null, |
| 607 | .description = "SPIR-V extension SPV_KHR_fragment_shading_rate", | 607 | .description = "SPIR-V extension SPV_KHR_fragment_shading_rate", |
| 608 | .dependencies = featureSet(&[_]Feature{}), | 608 | .dependencies = featureSet(&[_]Feature{}), |
| 609 | }; | 609 | }; |
| 610 | result[@enumToInt(Feature.SPV_KHR_shader_atomic_counter_ops)] = .{ | 610 | result[@intFromEnum(Feature.SPV_KHR_shader_atomic_counter_ops)] = .{ |
| 611 | .llvm_name = null, | 611 | .llvm_name = null, |
| 612 | .description = "SPIR-V extension SPV_KHR_shader_atomic_counter_ops", | 612 | .description = "SPIR-V extension SPV_KHR_shader_atomic_counter_ops", |
| 613 | .dependencies = featureSet(&[_]Feature{}), | 613 | .dependencies = featureSet(&[_]Feature{}), |
| 614 | }; | 614 | }; |
| 615 | result[@enumToInt(Feature.SPV_KHR_shader_draw_parameters)] = .{ | 615 | result[@intFromEnum(Feature.SPV_KHR_shader_draw_parameters)] = .{ |
| 616 | .llvm_name = null, | 616 | .llvm_name = null, |
| 617 | .description = "SPIR-V extension SPV_KHR_shader_draw_parameters", | 617 | .description = "SPIR-V extension SPV_KHR_shader_draw_parameters", |
| 618 | .dependencies = featureSet(&[_]Feature{}), | 618 | .dependencies = featureSet(&[_]Feature{}), |
| 619 | }; | 619 | }; |
| 620 | result[@enumToInt(Feature.SPV_KHR_storage_buffer_storage_class)] = .{ | 620 | result[@intFromEnum(Feature.SPV_KHR_storage_buffer_storage_class)] = .{ |
| 621 | .llvm_name = null, | 621 | .llvm_name = null, |
| 622 | .description = "SPIR-V extension SPV_KHR_storage_buffer_storage_class", | 622 | .description = "SPIR-V extension SPV_KHR_storage_buffer_storage_class", |
| 623 | .dependencies = featureSet(&[_]Feature{}), | 623 | .dependencies = featureSet(&[_]Feature{}), |
| 624 | }; | 624 | }; |
| 625 | result[@enumToInt(Feature.SPV_KHR_linkonce_odr)] = .{ | 625 | result[@intFromEnum(Feature.SPV_KHR_linkonce_odr)] = .{ |
| 626 | .llvm_name = null, | 626 | .llvm_name = null, |
| 627 | .description = "SPIR-V extension SPV_KHR_linkonce_odr", | 627 | .description = "SPIR-V extension SPV_KHR_linkonce_odr", |
| 628 | .dependencies = featureSet(&[_]Feature{}), | 628 | .dependencies = featureSet(&[_]Feature{}), |
| 629 | }; | 629 | }; |
| 630 | result[@enumToInt(Feature.SPV_KHR_terminate_invocation)] = .{ | 630 | result[@intFromEnum(Feature.SPV_KHR_terminate_invocation)] = .{ |
| 631 | .llvm_name = null, | 631 | .llvm_name = null, |
| 632 | .description = "SPIR-V extension SPV_KHR_terminate_invocation", | 632 | .description = "SPIR-V extension SPV_KHR_terminate_invocation", |
| 633 | .dependencies = featureSet(&[_]Feature{}), | 633 | .dependencies = featureSet(&[_]Feature{}), |
| 634 | }; | 634 | }; |
| 635 | result[@enumToInt(Feature.SPV_KHR_non_semantic_info)] = .{ | 635 | result[@intFromEnum(Feature.SPV_KHR_non_semantic_info)] = .{ |
| 636 | .llvm_name = null, | 636 | .llvm_name = null, |
| 637 | .description = "SPIR-V extension SPV_KHR_non_semantic_info", | 637 | .description = "SPIR-V extension SPV_KHR_non_semantic_info", |
| 638 | .dependencies = featureSet(&[_]Feature{}), | 638 | .dependencies = featureSet(&[_]Feature{}), |
| 639 | }; | 639 | }; |
| 640 | result[@enumToInt(Feature.SPV_KHR_post_depth_coverage)] = .{ | 640 | result[@intFromEnum(Feature.SPV_KHR_post_depth_coverage)] = .{ |
| 641 | .llvm_name = null, | 641 | .llvm_name = null, |
| 642 | .description = "SPIR-V extension SPV_KHR_post_depth_coverage", | 642 | .description = "SPIR-V extension SPV_KHR_post_depth_coverage", |
| 643 | .dependencies = featureSet(&[_]Feature{}), | 643 | .dependencies = featureSet(&[_]Feature{}), |
| 644 | }; | 644 | }; |
| 645 | result[@enumToInt(Feature.SPV_KHR_expect_assume)] = .{ | 645 | result[@intFromEnum(Feature.SPV_KHR_expect_assume)] = .{ |
| 646 | .llvm_name = null, | 646 | .llvm_name = null, |
| 647 | .description = "SPIR-V extension SPV_KHR_expect_assume", | 647 | .description = "SPIR-V extension SPV_KHR_expect_assume", |
| 648 | .dependencies = featureSet(&[_]Feature{}), | 648 | .dependencies = featureSet(&[_]Feature{}), |
| 649 | }; | 649 | }; |
| 650 | result[@enumToInt(Feature.SPV_KHR_ray_tracing)] = .{ | 650 | result[@intFromEnum(Feature.SPV_KHR_ray_tracing)] = .{ |
| 651 | .llvm_name = null, | 651 | .llvm_name = null, |
| 652 | .description = "SPIR-V extension SPV_KHR_ray_tracing", | 652 | .description = "SPIR-V extension SPV_KHR_ray_tracing", |
| 653 | .dependencies = featureSet(&[_]Feature{}), | 653 | .dependencies = featureSet(&[_]Feature{}), |
| 654 | }; | 654 | }; |
| 655 | result[@enumToInt(Feature.SPV_KHR_ray_query)] = .{ | 655 | result[@intFromEnum(Feature.SPV_KHR_ray_query)] = .{ |
| 656 | .llvm_name = null, | 656 | .llvm_name = null, |
| 657 | .description = "SPIR-V extension SPV_KHR_ray_query", | 657 | .description = "SPIR-V extension SPV_KHR_ray_query", |
| 658 | .dependencies = featureSet(&[_]Feature{}), | 658 | .dependencies = featureSet(&[_]Feature{}), |
| 659 | }; | 659 | }; |
| 660 | result[@enumToInt(Feature.SPV_KHR_float_controls)] = .{ | 660 | result[@intFromEnum(Feature.SPV_KHR_float_controls)] = .{ |
| 661 | .llvm_name = null, | 661 | .llvm_name = null, |
| 662 | .description = "SPIR-V extension SPV_KHR_float_controls", | 662 | .description = "SPIR-V extension SPV_KHR_float_controls", |
| 663 | .dependencies = featureSet(&[_]Feature{}), | 663 | .dependencies = featureSet(&[_]Feature{}), |
| 664 | }; | 664 | }; |
| 665 | result[@enumToInt(Feature.SPV_NV_viewport_array2)] = .{ | 665 | result[@intFromEnum(Feature.SPV_NV_viewport_array2)] = .{ |
| 666 | .llvm_name = null, | 666 | .llvm_name = null, |
| 667 | .description = "SPIR-V extension SPV_NV_viewport_array2", | 667 | .description = "SPIR-V extension SPV_NV_viewport_array2", |
| 668 | .dependencies = featureSet(&[_]Feature{}), | 668 | .dependencies = featureSet(&[_]Feature{}), |
| 669 | }; | 669 | }; |
| 670 | result[@enumToInt(Feature.SPV_NV_shader_subgroup_partitioned)] = .{ | 670 | result[@intFromEnum(Feature.SPV_NV_shader_subgroup_partitioned)] = .{ |
| 671 | .llvm_name = null, | 671 | .llvm_name = null, |
| 672 | .description = "SPIR-V extension SPV_NV_shader_subgroup_partitioned", | 672 | .description = "SPIR-V extension SPV_NV_shader_subgroup_partitioned", |
| 673 | .dependencies = featureSet(&[_]Feature{}), | 673 | .dependencies = featureSet(&[_]Feature{}), |
| 674 | }; | 674 | }; |
| 675 | result[@enumToInt(Feature.SPV_NVX_multiview_per_view_attributes)] = .{ | 675 | result[@intFromEnum(Feature.SPV_NVX_multiview_per_view_attributes)] = .{ |
| 676 | .llvm_name = null, | 676 | .llvm_name = null, |
| 677 | .description = "SPIR-V extension SPV_NVX_multiview_per_view_attributes", | 677 | .description = "SPIR-V extension SPV_NVX_multiview_per_view_attributes", |
| 678 | .dependencies = featureSet(&[_]Feature{}), | 678 | .dependencies = featureSet(&[_]Feature{}), |
| 679 | }; | 679 | }; |
| 680 | result[@enumToInt(Feature.SPV_NV_ray_tracing)] = .{ | 680 | result[@intFromEnum(Feature.SPV_NV_ray_tracing)] = .{ |
| 681 | .llvm_name = null, | 681 | .llvm_name = null, |
| 682 | .description = "SPIR-V extension SPV_NV_ray_tracing", | 682 | .description = "SPIR-V extension SPV_NV_ray_tracing", |
| 683 | .dependencies = featureSet(&[_]Feature{}), | 683 | .dependencies = featureSet(&[_]Feature{}), |
| 684 | }; | 684 | }; |
| 685 | result[@enumToInt(Feature.SPV_NV_shader_image_footprint)] = .{ | 685 | result[@intFromEnum(Feature.SPV_NV_shader_image_footprint)] = .{ |
| 686 | .llvm_name = null, | 686 | .llvm_name = null, |
| 687 | .description = "SPIR-V extension SPV_NV_shader_image_footprint", | 687 | .description = "SPIR-V extension SPV_NV_shader_image_footprint", |
| 688 | .dependencies = featureSet(&[_]Feature{}), | 688 | .dependencies = featureSet(&[_]Feature{}), |
| 689 | }; | 689 | }; |
| 690 | result[@enumToInt(Feature.SPV_NV_shading_rate)] = .{ | 690 | result[@intFromEnum(Feature.SPV_NV_shading_rate)] = .{ |
| 691 | .llvm_name = null, | 691 | .llvm_name = null, |
| 692 | .description = "SPIR-V extension SPV_NV_shading_rate", | 692 | .description = "SPIR-V extension SPV_NV_shading_rate", |
| 693 | .dependencies = featureSet(&[_]Feature{}), | 693 | .dependencies = featureSet(&[_]Feature{}), |
| 694 | }; | 694 | }; |
| 695 | result[@enumToInt(Feature.SPV_NV_stereo_view_rendering)] = .{ | 695 | result[@intFromEnum(Feature.SPV_NV_stereo_view_rendering)] = .{ |
| 696 | .llvm_name = null, | 696 | .llvm_name = null, |
| 697 | .description = "SPIR-V extension SPV_NV_stereo_view_rendering", | 697 | .description = "SPIR-V extension SPV_NV_stereo_view_rendering", |
| 698 | .dependencies = featureSet(&[_]Feature{}), | 698 | .dependencies = featureSet(&[_]Feature{}), |
| 699 | }; | 699 | }; |
| 700 | result[@enumToInt(Feature.SPV_NV_compute_shader_derivatives)] = .{ | 700 | result[@intFromEnum(Feature.SPV_NV_compute_shader_derivatives)] = .{ |
| 701 | .llvm_name = null, | 701 | .llvm_name = null, |
| 702 | .description = "SPIR-V extension SPV_NV_compute_shader_derivatives", | 702 | .description = "SPIR-V extension SPV_NV_compute_shader_derivatives", |
| 703 | .dependencies = featureSet(&[_]Feature{}), | 703 | .dependencies = featureSet(&[_]Feature{}), |
| 704 | }; | 704 | }; |
| 705 | result[@enumToInt(Feature.SPV_NV_shader_sm_builtins)] = .{ | 705 | result[@intFromEnum(Feature.SPV_NV_shader_sm_builtins)] = .{ |
| 706 | .llvm_name = null, | 706 | .llvm_name = null, |
| 707 | .description = "SPIR-V extension SPV_NV_shader_sm_builtins", | 707 | .description = "SPIR-V extension SPV_NV_shader_sm_builtins", |
| 708 | .dependencies = featureSet(&[_]Feature{}), | 708 | .dependencies = featureSet(&[_]Feature{}), |
| 709 | }; | 709 | }; |
| 710 | result[@enumToInt(Feature.SPV_NV_mesh_shader)] = .{ | 710 | result[@intFromEnum(Feature.SPV_NV_mesh_shader)] = .{ |
| 711 | .llvm_name = null, | 711 | .llvm_name = null, |
| 712 | .description = "SPIR-V extension SPV_NV_mesh_shader", | 712 | .description = "SPIR-V extension SPV_NV_mesh_shader", |
| 713 | .dependencies = featureSet(&[_]Feature{}), | 713 | .dependencies = featureSet(&[_]Feature{}), |
| 714 | }; | 714 | }; |
| 715 | result[@enumToInt(Feature.SPV_NV_geometry_shader_passthrough)] = .{ | 715 | result[@intFromEnum(Feature.SPV_NV_geometry_shader_passthrough)] = .{ |
| 716 | .llvm_name = null, | 716 | .llvm_name = null, |
| 717 | .description = "SPIR-V extension SPV_NV_geometry_shader_passthrough", | 717 | .description = "SPIR-V extension SPV_NV_geometry_shader_passthrough", |
| 718 | .dependencies = featureSet(&[_]Feature{}), | 718 | .dependencies = featureSet(&[_]Feature{}), |
| 719 | }; | 719 | }; |
| 720 | result[@enumToInt(Feature.SPV_NV_fragment_shader_barycentric)] = .{ | 720 | result[@intFromEnum(Feature.SPV_NV_fragment_shader_barycentric)] = .{ |
| 721 | .llvm_name = null, | 721 | .llvm_name = null, |
| 722 | .description = "SPIR-V extension SPV_NV_fragment_shader_barycentric", | 722 | .description = "SPIR-V extension SPV_NV_fragment_shader_barycentric", |
| 723 | .dependencies = featureSet(&[_]Feature{}), | 723 | .dependencies = featureSet(&[_]Feature{}), |
| 724 | }; | 724 | }; |
| 725 | result[@enumToInt(Feature.SPV_NV_cooperative_matrix)] = .{ | 725 | result[@intFromEnum(Feature.SPV_NV_cooperative_matrix)] = .{ |
| 726 | .llvm_name = null, | 726 | .llvm_name = null, |
| 727 | .description = "SPIR-V extension SPV_NV_cooperative_matrix", | 727 | .description = "SPIR-V extension SPV_NV_cooperative_matrix", |
| 728 | .dependencies = featureSet(&[_]Feature{}), | 728 | .dependencies = featureSet(&[_]Feature{}), |
| 729 | }; | 729 | }; |
| 730 | result[@enumToInt(Feature.SPV_NV_sample_mask_override_coverage)] = .{ | 730 | result[@intFromEnum(Feature.SPV_NV_sample_mask_override_coverage)] = .{ |
| 731 | .llvm_name = null, | 731 | .llvm_name = null, |
| 732 | .description = "SPIR-V extension SPV_NV_sample_mask_override_coverage", | 732 | .description = "SPIR-V extension SPV_NV_sample_mask_override_coverage", |
| 733 | .dependencies = featureSet(&[_]Feature{}), | 733 | .dependencies = featureSet(&[_]Feature{}), |
| 734 | }; | 734 | }; |
| 735 | result[@enumToInt(Feature.Matrix)] = .{ | 735 | result[@intFromEnum(Feature.Matrix)] = .{ |
| 736 | .llvm_name = null, | 736 | .llvm_name = null, |
| 737 | .description = "Enable SPIR-V capability Matrix", | 737 | .description = "Enable SPIR-V capability Matrix", |
| 738 | .dependencies = featureSet(&[_]Feature{}), | 738 | .dependencies = featureSet(&[_]Feature{}), |
| 739 | }; | 739 | }; |
| 740 | result[@enumToInt(Feature.Shader)] = .{ | 740 | result[@intFromEnum(Feature.Shader)] = .{ |
| 741 | .llvm_name = null, | 741 | .llvm_name = null, |
| 742 | .description = "Enable SPIR-V capability Shader", | 742 | .description = "Enable SPIR-V capability Shader", |
| 743 | .dependencies = featureSet(&[_]Feature{ | 743 | .dependencies = featureSet(&[_]Feature{ |
| 744 | .Matrix, | 744 | .Matrix, |
| 745 | }), | 745 | }), |
| 746 | }; | 746 | }; |
| 747 | result[@enumToInt(Feature.Geometry)] = .{ | 747 | result[@intFromEnum(Feature.Geometry)] = .{ |
| 748 | .llvm_name = null, | 748 | .llvm_name = null, |
| 749 | .description = "Enable SPIR-V capability Geometry", | 749 | .description = "Enable SPIR-V capability Geometry", |
| 750 | .dependencies = featureSet(&[_]Feature{ | 750 | .dependencies = featureSet(&[_]Feature{ |
| 751 | .Shader, | 751 | .Shader, |
| 752 | }), | 752 | }), |
| 753 | }; | 753 | }; |
| 754 | result[@enumToInt(Feature.Tessellation)] = .{ | 754 | result[@intFromEnum(Feature.Tessellation)] = .{ |
| 755 | .llvm_name = null, | 755 | .llvm_name = null, |
| 756 | .description = "Enable SPIR-V capability Tessellation", | 756 | .description = "Enable SPIR-V capability Tessellation", |
| 757 | .dependencies = featureSet(&[_]Feature{ | 757 | .dependencies = featureSet(&[_]Feature{ |
| 758 | .Shader, | 758 | .Shader, |
| 759 | }), | 759 | }), |
| 760 | }; | 760 | }; |
| 761 | result[@enumToInt(Feature.Addresses)] = .{ | 761 | result[@intFromEnum(Feature.Addresses)] = .{ |
| 762 | .llvm_name = null, | 762 | .llvm_name = null, |
| 763 | .description = "Enable SPIR-V capability Addresses", | 763 | .description = "Enable SPIR-V capability Addresses", |
| 764 | .dependencies = featureSet(&[_]Feature{}), | 764 | .dependencies = featureSet(&[_]Feature{}), |
| 765 | }; | 765 | }; |
| 766 | result[@enumToInt(Feature.Linkage)] = .{ | 766 | result[@intFromEnum(Feature.Linkage)] = .{ |
| 767 | .llvm_name = null, | 767 | .llvm_name = null, |
| 768 | .description = "Enable SPIR-V capability Linkage", | 768 | .description = "Enable SPIR-V capability Linkage", |
| 769 | .dependencies = featureSet(&[_]Feature{}), | 769 | .dependencies = featureSet(&[_]Feature{}), |
| 770 | }; | 770 | }; |
| 771 | result[@enumToInt(Feature.Kernel)] = .{ | 771 | result[@intFromEnum(Feature.Kernel)] = .{ |
| 772 | .llvm_name = null, | 772 | .llvm_name = null, |
| 773 | .description = "Enable SPIR-V capability Kernel", | 773 | .description = "Enable SPIR-V capability Kernel", |
| 774 | .dependencies = featureSet(&[_]Feature{}), | 774 | .dependencies = featureSet(&[_]Feature{}), |
| 775 | }; | 775 | }; |
| 776 | result[@enumToInt(Feature.Vector16)] = .{ | 776 | result[@intFromEnum(Feature.Vector16)] = .{ |
| 777 | .llvm_name = null, | 777 | .llvm_name = null, |
| 778 | .description = "Enable SPIR-V capability Vector16", | 778 | .description = "Enable SPIR-V capability Vector16", |
| 779 | .dependencies = featureSet(&[_]Feature{ | 779 | .dependencies = featureSet(&[_]Feature{ |
| 780 | .Kernel, | 780 | .Kernel, |
| 781 | }), | 781 | }), |
| 782 | }; | 782 | }; |
| 783 | result[@enumToInt(Feature.Float16Buffer)] = .{ | 783 | result[@intFromEnum(Feature.Float16Buffer)] = .{ |
| 784 | .llvm_name = null, | 784 | .llvm_name = null, |
| 785 | .description = "Enable SPIR-V capability Float16Buffer", | 785 | .description = "Enable SPIR-V capability Float16Buffer", |
| 786 | .dependencies = featureSet(&[_]Feature{ | 786 | .dependencies = featureSet(&[_]Feature{ |
| 787 | .Kernel, | 787 | .Kernel, |
| 788 | }), | 788 | }), |
| 789 | }; | 789 | }; |
| 790 | result[@enumToInt(Feature.Float16)] = .{ | 790 | result[@intFromEnum(Feature.Float16)] = .{ |
| 791 | .llvm_name = null, | 791 | .llvm_name = null, |
| 792 | .description = "Enable SPIR-V capability Float16", | 792 | .description = "Enable SPIR-V capability Float16", |
| 793 | .dependencies = featureSet(&[_]Feature{}), | 793 | .dependencies = featureSet(&[_]Feature{}), |
| 794 | }; | 794 | }; |
| 795 | result[@enumToInt(Feature.Float64)] = .{ | 795 | result[@intFromEnum(Feature.Float64)] = .{ |
| 796 | .llvm_name = null, | 796 | .llvm_name = null, |
| 797 | .description = "Enable SPIR-V capability Float64", | 797 | .description = "Enable SPIR-V capability Float64", |
| 798 | .dependencies = featureSet(&[_]Feature{}), | 798 | .dependencies = featureSet(&[_]Feature{}), |
| 799 | }; | 799 | }; |
| 800 | result[@enumToInt(Feature.Int64)] = .{ | 800 | result[@intFromEnum(Feature.Int64)] = .{ |
| 801 | .llvm_name = null, | 801 | .llvm_name = null, |
| 802 | .description = "Enable SPIR-V capability Int64", | 802 | .description = "Enable SPIR-V capability Int64", |
| 803 | .dependencies = featureSet(&[_]Feature{}), | 803 | .dependencies = featureSet(&[_]Feature{}), |
| 804 | }; | 804 | }; |
| 805 | result[@enumToInt(Feature.Int64Atomics)] = .{ | 805 | result[@intFromEnum(Feature.Int64Atomics)] = .{ |
| 806 | .llvm_name = null, | 806 | .llvm_name = null, |
| 807 | .description = "Enable SPIR-V capability Int64Atomics", | 807 | .description = "Enable SPIR-V capability Int64Atomics", |
| 808 | .dependencies = featureSet(&[_]Feature{ | 808 | .dependencies = featureSet(&[_]Feature{ |
| 809 | .Int64, | 809 | .Int64, |
| 810 | }), | 810 | }), |
| 811 | }; | 811 | }; |
| 812 | result[@enumToInt(Feature.ImageBasic)] = .{ | 812 | result[@intFromEnum(Feature.ImageBasic)] = .{ |
| 813 | .llvm_name = null, | 813 | .llvm_name = null, |
| 814 | .description = "Enable SPIR-V capability ImageBasic", | 814 | .description = "Enable SPIR-V capability ImageBasic", |
| 815 | .dependencies = featureSet(&[_]Feature{ | 815 | .dependencies = featureSet(&[_]Feature{ |
| 816 | .Kernel, | 816 | .Kernel, |
| 817 | }), | 817 | }), |
| 818 | }; | 818 | }; |
| 819 | result[@enumToInt(Feature.ImageReadWrite)] = .{ | 819 | result[@intFromEnum(Feature.ImageReadWrite)] = .{ |
| 820 | .llvm_name = null, | 820 | .llvm_name = null, |
| 821 | .description = "Enable SPIR-V capability ImageReadWrite", | 821 | .description = "Enable SPIR-V capability ImageReadWrite", |
| 822 | .dependencies = featureSet(&[_]Feature{ | 822 | .dependencies = featureSet(&[_]Feature{ |
| 823 | .ImageBasic, | 823 | .ImageBasic, |
| 824 | }), | 824 | }), |
| 825 | }; | 825 | }; |
| 826 | result[@enumToInt(Feature.ImageMipmap)] = .{ | 826 | result[@intFromEnum(Feature.ImageMipmap)] = .{ |
| 827 | .llvm_name = null, | 827 | .llvm_name = null, |
| 828 | .description = "Enable SPIR-V capability ImageMipmap", | 828 | .description = "Enable SPIR-V capability ImageMipmap", |
| 829 | .dependencies = featureSet(&[_]Feature{ | 829 | .dependencies = featureSet(&[_]Feature{ |
| 830 | .ImageBasic, | 830 | .ImageBasic, |
| 831 | }), | 831 | }), |
| 832 | }; | 832 | }; |
| 833 | result[@enumToInt(Feature.Pipes)] = .{ | 833 | result[@intFromEnum(Feature.Pipes)] = .{ |
| 834 | .llvm_name = null, | 834 | .llvm_name = null, |
| 835 | .description = "Enable SPIR-V capability Pipes", | 835 | .description = "Enable SPIR-V capability Pipes", |
| 836 | .dependencies = featureSet(&[_]Feature{ | 836 | .dependencies = featureSet(&[_]Feature{ |
| 837 | .Kernel, | 837 | .Kernel, |
| 838 | }), | 838 | }), |
| 839 | }; | 839 | }; |
| 840 | result[@enumToInt(Feature.Groups)] = .{ | 840 | result[@intFromEnum(Feature.Groups)] = .{ |
| 841 | .llvm_name = null, | 841 | .llvm_name = null, |
| 842 | .description = "Enable SPIR-V capability Groups", | 842 | .description = "Enable SPIR-V capability Groups", |
| 843 | .dependencies = featureSet(&[_]Feature{}), | 843 | .dependencies = featureSet(&[_]Feature{}), |
| 844 | }; | 844 | }; |
| 845 | result[@enumToInt(Feature.DeviceEnqueue)] = .{ | 845 | result[@intFromEnum(Feature.DeviceEnqueue)] = .{ |
| 846 | .llvm_name = null, | 846 | .llvm_name = null, |
| 847 | .description = "Enable SPIR-V capability DeviceEnqueue", | 847 | .description = "Enable SPIR-V capability DeviceEnqueue", |
| 848 | .dependencies = featureSet(&[_]Feature{ | 848 | .dependencies = featureSet(&[_]Feature{ |
| 849 | .Kernel, | 849 | .Kernel, |
| 850 | }), | 850 | }), |
| 851 | }; | 851 | }; |
| 852 | result[@enumToInt(Feature.LiteralSampler)] = .{ | 852 | result[@intFromEnum(Feature.LiteralSampler)] = .{ |
| 853 | .llvm_name = null, | 853 | .llvm_name = null, |
| 854 | .description = "Enable SPIR-V capability LiteralSampler", | 854 | .description = "Enable SPIR-V capability LiteralSampler", |
| 855 | .dependencies = featureSet(&[_]Feature{ | 855 | .dependencies = featureSet(&[_]Feature{ |
| 856 | .Kernel, | 856 | .Kernel, |
| 857 | }), | 857 | }), |
| 858 | }; | 858 | }; |
| 859 | result[@enumToInt(Feature.AtomicStorage)] = .{ | 859 | result[@intFromEnum(Feature.AtomicStorage)] = .{ |
| 860 | .llvm_name = null, | 860 | .llvm_name = null, |
| 861 | .description = "Enable SPIR-V capability AtomicStorage", | 861 | .description = "Enable SPIR-V capability AtomicStorage", |
| 862 | .dependencies = featureSet(&[_]Feature{ | 862 | .dependencies = featureSet(&[_]Feature{ |
| 863 | .Shader, | 863 | .Shader, |
| 864 | }), | 864 | }), |
| 865 | }; | 865 | }; |
| 866 | result[@enumToInt(Feature.Int16)] = .{ | 866 | result[@intFromEnum(Feature.Int16)] = .{ |
| 867 | .llvm_name = null, | 867 | .llvm_name = null, |
| 868 | .description = "Enable SPIR-V capability Int16", | 868 | .description = "Enable SPIR-V capability Int16", |
| 869 | .dependencies = featureSet(&[_]Feature{}), | 869 | .dependencies = featureSet(&[_]Feature{}), |
| 870 | }; | 870 | }; |
| 871 | result[@enumToInt(Feature.TessellationPointSize)] = .{ | 871 | result[@intFromEnum(Feature.TessellationPointSize)] = .{ |
| 872 | .llvm_name = null, | 872 | .llvm_name = null, |
| 873 | .description = "Enable SPIR-V capability TessellationPointSize", | 873 | .description = "Enable SPIR-V capability TessellationPointSize", |
| 874 | .dependencies = featureSet(&[_]Feature{ | 874 | .dependencies = featureSet(&[_]Feature{ |
| 875 | .Tessellation, | 875 | .Tessellation, |
| 876 | }), | 876 | }), |
| 877 | }; | 877 | }; |
| 878 | result[@enumToInt(Feature.GeometryPointSize)] = .{ | 878 | result[@intFromEnum(Feature.GeometryPointSize)] = .{ |
| 879 | .llvm_name = null, | 879 | .llvm_name = null, |
| 880 | .description = "Enable SPIR-V capability GeometryPointSize", | 880 | .description = "Enable SPIR-V capability GeometryPointSize", |
| 881 | .dependencies = featureSet(&[_]Feature{ | 881 | .dependencies = featureSet(&[_]Feature{ |
| 882 | .Geometry, | 882 | .Geometry, |
| 883 | }), | 883 | }), |
| 884 | }; | 884 | }; |
| 885 | result[@enumToInt(Feature.ImageGatherExtended)] = .{ | 885 | result[@intFromEnum(Feature.ImageGatherExtended)] = .{ |
| 886 | .llvm_name = null, | 886 | .llvm_name = null, |
| 887 | .description = "Enable SPIR-V capability ImageGatherExtended", | 887 | .description = "Enable SPIR-V capability ImageGatherExtended", |
| 888 | .dependencies = featureSet(&[_]Feature{ | 888 | .dependencies = featureSet(&[_]Feature{ |
| 889 | .Shader, | 889 | .Shader, |
| 890 | }), | 890 | }), |
| 891 | }; | 891 | }; |
| 892 | result[@enumToInt(Feature.StorageImageMultisample)] = .{ | 892 | result[@intFromEnum(Feature.StorageImageMultisample)] = .{ |
| 893 | .llvm_name = null, | 893 | .llvm_name = null, |
| 894 | .description = "Enable SPIR-V capability StorageImageMultisample", | 894 | .description = "Enable SPIR-V capability StorageImageMultisample", |
| 895 | .dependencies = featureSet(&[_]Feature{ | 895 | .dependencies = featureSet(&[_]Feature{ |
| 896 | .Shader, | 896 | .Shader, |
| 897 | }), | 897 | }), |
| 898 | }; | 898 | }; |
| 899 | result[@enumToInt(Feature.UniformBufferArrayDynamicIndexing)] = .{ | 899 | result[@intFromEnum(Feature.UniformBufferArrayDynamicIndexing)] = .{ |
| 900 | .llvm_name = null, | 900 | .llvm_name = null, |
| 901 | .description = "Enable SPIR-V capability UniformBufferArrayDynamicIndexing", | 901 | .description = "Enable SPIR-V capability UniformBufferArrayDynamicIndexing", |
| 902 | .dependencies = featureSet(&[_]Feature{ | 902 | .dependencies = featureSet(&[_]Feature{ |
| 903 | .Shader, | 903 | .Shader, |
| 904 | }), | 904 | }), |
| 905 | }; | 905 | }; |
| 906 | result[@enumToInt(Feature.SampledImageArrayDynamicIndexing)] = .{ | 906 | result[@intFromEnum(Feature.SampledImageArrayDynamicIndexing)] = .{ |
| 907 | .llvm_name = null, | 907 | .llvm_name = null, |
| 908 | .description = "Enable SPIR-V capability SampledImageArrayDynamicIndexing", | 908 | .description = "Enable SPIR-V capability SampledImageArrayDynamicIndexing", |
| 909 | .dependencies = featureSet(&[_]Feature{ | 909 | .dependencies = featureSet(&[_]Feature{ |
| 910 | .Shader, | 910 | .Shader, |
| 911 | }), | 911 | }), |
| 912 | }; | 912 | }; |
| 913 | result[@enumToInt(Feature.StorageBufferArrayDynamicIndexing)] = .{ | 913 | result[@intFromEnum(Feature.StorageBufferArrayDynamicIndexing)] = .{ |
| 914 | .llvm_name = null, | 914 | .llvm_name = null, |
| 915 | .description = "Enable SPIR-V capability StorageBufferArrayDynamicIndexing", | 915 | .description = "Enable SPIR-V capability StorageBufferArrayDynamicIndexing", |
| 916 | .dependencies = featureSet(&[_]Feature{ | 916 | .dependencies = featureSet(&[_]Feature{ |
| 917 | .Shader, | 917 | .Shader, |
| 918 | }), | 918 | }), |
| 919 | }; | 919 | }; |
| 920 | result[@enumToInt(Feature.StorageImageArrayDynamicIndexing)] = .{ | 920 | result[@intFromEnum(Feature.StorageImageArrayDynamicIndexing)] = .{ |
| 921 | .llvm_name = null, | 921 | .llvm_name = null, |
| 922 | .description = "Enable SPIR-V capability StorageImageArrayDynamicIndexing", | 922 | .description = "Enable SPIR-V capability StorageImageArrayDynamicIndexing", |
| 923 | .dependencies = featureSet(&[_]Feature{ | 923 | .dependencies = featureSet(&[_]Feature{ |
| 924 | .Shader, | 924 | .Shader, |
| 925 | }), | 925 | }), |
| 926 | }; | 926 | }; |
| 927 | result[@enumToInt(Feature.ClipDistance)] = .{ | 927 | result[@intFromEnum(Feature.ClipDistance)] = .{ |
| 928 | .llvm_name = null, | 928 | .llvm_name = null, |
| 929 | .description = "Enable SPIR-V capability ClipDistance", | 929 | .description = "Enable SPIR-V capability ClipDistance", |
| 930 | .dependencies = featureSet(&[_]Feature{ | 930 | .dependencies = featureSet(&[_]Feature{ |
| 931 | .Shader, | 931 | .Shader, |
| 932 | }), | 932 | }), |
| 933 | }; | 933 | }; |
| 934 | result[@enumToInt(Feature.CullDistance)] = .{ | 934 | result[@intFromEnum(Feature.CullDistance)] = .{ |
| 935 | .llvm_name = null, | 935 | .llvm_name = null, |
| 936 | .description = "Enable SPIR-V capability CullDistance", | 936 | .description = "Enable SPIR-V capability CullDistance", |
| 937 | .dependencies = featureSet(&[_]Feature{ | 937 | .dependencies = featureSet(&[_]Feature{ |
| 938 | .Shader, | 938 | .Shader, |
| 939 | }), | 939 | }), |
| 940 | }; | 940 | }; |
| 941 | result[@enumToInt(Feature.ImageCubeArray)] = .{ | 941 | result[@intFromEnum(Feature.ImageCubeArray)] = .{ |
| 942 | .llvm_name = null, | 942 | .llvm_name = null, |
| 943 | .description = "Enable SPIR-V capability ImageCubeArray", | 943 | .description = "Enable SPIR-V capability ImageCubeArray", |
| 944 | .dependencies = featureSet(&[_]Feature{ | 944 | .dependencies = featureSet(&[_]Feature{ |
| 945 | .SampledCubeArray, | 945 | .SampledCubeArray, |
| 946 | }), | 946 | }), |
| 947 | }; | 947 | }; |
| 948 | result[@enumToInt(Feature.SampleRateShading)] = .{ | 948 | result[@intFromEnum(Feature.SampleRateShading)] = .{ |
| 949 | .llvm_name = null, | 949 | .llvm_name = null, |
| 950 | .description = "Enable SPIR-V capability SampleRateShading", | 950 | .description = "Enable SPIR-V capability SampleRateShading", |
| 951 | .dependencies = featureSet(&[_]Feature{ | 951 | .dependencies = featureSet(&[_]Feature{ |
| 952 | .Shader, | 952 | .Shader, |
| 953 | }), | 953 | }), |
| 954 | }; | 954 | }; |
| 955 | result[@enumToInt(Feature.ImageRect)] = .{ | 955 | result[@intFromEnum(Feature.ImageRect)] = .{ |
| 956 | .llvm_name = null, | 956 | .llvm_name = null, |
| 957 | .description = "Enable SPIR-V capability ImageRect", | 957 | .description = "Enable SPIR-V capability ImageRect", |
| 958 | .dependencies = featureSet(&[_]Feature{ | 958 | .dependencies = featureSet(&[_]Feature{ |
| 959 | .SampledRect, | 959 | .SampledRect, |
| 960 | }), | 960 | }), |
| 961 | }; | 961 | }; |
| 962 | result[@enumToInt(Feature.SampledRect)] = .{ | 962 | result[@intFromEnum(Feature.SampledRect)] = .{ |
| 963 | .llvm_name = null, | 963 | .llvm_name = null, |
| 964 | .description = "Enable SPIR-V capability SampledRect", | 964 | .description = "Enable SPIR-V capability SampledRect", |
| 965 | .dependencies = featureSet(&[_]Feature{ | 965 | .dependencies = featureSet(&[_]Feature{ |
| 966 | .Shader, | 966 | .Shader, |
| 967 | }), | 967 | }), |
| 968 | }; | 968 | }; |
| 969 | result[@enumToInt(Feature.GenericPointer)] = .{ | 969 | result[@intFromEnum(Feature.GenericPointer)] = .{ |
| 970 | .llvm_name = null, | 970 | .llvm_name = null, |
| 971 | .description = "Enable SPIR-V capability GenericPointer", | 971 | .description = "Enable SPIR-V capability GenericPointer", |
| 972 | .dependencies = featureSet(&[_]Feature{ | 972 | .dependencies = featureSet(&[_]Feature{ |
| 973 | .Addresses, | 973 | .Addresses, |
| 974 | }), | 974 | }), |
| 975 | }; | 975 | }; |
| 976 | result[@enumToInt(Feature.Int8)] = .{ | 976 | result[@intFromEnum(Feature.Int8)] = .{ |
| 977 | .llvm_name = null, | 977 | .llvm_name = null, |
| 978 | .description = "Enable SPIR-V capability Int8", | 978 | .description = "Enable SPIR-V capability Int8", |
| 979 | .dependencies = featureSet(&[_]Feature{}), | 979 | .dependencies = featureSet(&[_]Feature{}), |
| 980 | }; | 980 | }; |
| 981 | result[@enumToInt(Feature.InputAttachment)] = .{ | 981 | result[@intFromEnum(Feature.InputAttachment)] = .{ |
| 982 | .llvm_name = null, | 982 | .llvm_name = null, |
| 983 | .description = "Enable SPIR-V capability InputAttachment", | 983 | .description = "Enable SPIR-V capability InputAttachment", |
| 984 | .dependencies = featureSet(&[_]Feature{ | 984 | .dependencies = featureSet(&[_]Feature{ |
| 985 | .Shader, | 985 | .Shader, |
| 986 | }), | 986 | }), |
| 987 | }; | 987 | }; |
| 988 | result[@enumToInt(Feature.SparseResidency)] = .{ | 988 | result[@intFromEnum(Feature.SparseResidency)] = .{ |
| 989 | .llvm_name = null, | 989 | .llvm_name = null, |
| 990 | .description = "Enable SPIR-V capability SparseResidency", | 990 | .description = "Enable SPIR-V capability SparseResidency", |
| 991 | .dependencies = featureSet(&[_]Feature{ | 991 | .dependencies = featureSet(&[_]Feature{ |
| 992 | .Shader, | 992 | .Shader, |
| 993 | }), | 993 | }), |
| 994 | }; | 994 | }; |
| 995 | result[@enumToInt(Feature.MinLod)] = .{ | 995 | result[@intFromEnum(Feature.MinLod)] = .{ |
| 996 | .llvm_name = null, | 996 | .llvm_name = null, |
| 997 | .description = "Enable SPIR-V capability MinLod", | 997 | .description = "Enable SPIR-V capability MinLod", |
| 998 | .dependencies = featureSet(&[_]Feature{ | 998 | .dependencies = featureSet(&[_]Feature{ |
| 999 | .Shader, | 999 | .Shader, |
| 1000 | }), | 1000 | }), |
| 1001 | }; | 1001 | }; |
| 1002 | result[@enumToInt(Feature.Sampled1D)] = .{ | 1002 | result[@intFromEnum(Feature.Sampled1D)] = .{ |
| 1003 | .llvm_name = null, | 1003 | .llvm_name = null, |
| 1004 | .description = "Enable SPIR-V capability Sampled1D", | 1004 | .description = "Enable SPIR-V capability Sampled1D", |
| 1005 | .dependencies = featureSet(&[_]Feature{}), | 1005 | .dependencies = featureSet(&[_]Feature{}), |
| 1006 | }; | 1006 | }; |
| 1007 | result[@enumToInt(Feature.Image1D)] = .{ | 1007 | result[@intFromEnum(Feature.Image1D)] = .{ |
| 1008 | .llvm_name = null, | 1008 | .llvm_name = null, |
| 1009 | .description = "Enable SPIR-V capability Image1D", | 1009 | .description = "Enable SPIR-V capability Image1D", |
| 1010 | .dependencies = featureSet(&[_]Feature{ | 1010 | .dependencies = featureSet(&[_]Feature{ |
| 1011 | .Sampled1D, | 1011 | .Sampled1D, |
| 1012 | }), | 1012 | }), |
| 1013 | }; | 1013 | }; |
| 1014 | result[@enumToInt(Feature.SampledCubeArray)] = .{ | 1014 | result[@intFromEnum(Feature.SampledCubeArray)] = .{ |
| 1015 | .llvm_name = null, | 1015 | .llvm_name = null, |
| 1016 | .description = "Enable SPIR-V capability SampledCubeArray", | 1016 | .description = "Enable SPIR-V capability SampledCubeArray", |
| 1017 | .dependencies = featureSet(&[_]Feature{ | 1017 | .dependencies = featureSet(&[_]Feature{ |
| 1018 | .Shader, | 1018 | .Shader, |
| 1019 | }), | 1019 | }), |
| 1020 | }; | 1020 | }; |
| 1021 | result[@enumToInt(Feature.SampledBuffer)] = .{ | 1021 | result[@intFromEnum(Feature.SampledBuffer)] = .{ |
| 1022 | .llvm_name = null, | 1022 | .llvm_name = null, |
| 1023 | .description = "Enable SPIR-V capability SampledBuffer", | 1023 | .description = "Enable SPIR-V capability SampledBuffer", |
| 1024 | .dependencies = featureSet(&[_]Feature{}), | 1024 | .dependencies = featureSet(&[_]Feature{}), |
| 1025 | }; | 1025 | }; |
| 1026 | result[@enumToInt(Feature.ImageBuffer)] = .{ | 1026 | result[@intFromEnum(Feature.ImageBuffer)] = .{ |
| 1027 | .llvm_name = null, | 1027 | .llvm_name = null, |
| 1028 | .description = "Enable SPIR-V capability ImageBuffer", | 1028 | .description = "Enable SPIR-V capability ImageBuffer", |
| 1029 | .dependencies = featureSet(&[_]Feature{ | 1029 | .dependencies = featureSet(&[_]Feature{ |
| 1030 | .SampledBuffer, | 1030 | .SampledBuffer, |
| 1031 | }), | 1031 | }), |
| 1032 | }; | 1032 | }; |
| 1033 | result[@enumToInt(Feature.ImageMSArray)] = .{ | 1033 | result[@intFromEnum(Feature.ImageMSArray)] = .{ |
| 1034 | .llvm_name = null, | 1034 | .llvm_name = null, |
| 1035 | .description = "Enable SPIR-V capability ImageMSArray", | 1035 | .description = "Enable SPIR-V capability ImageMSArray", |
| 1036 | .dependencies = featureSet(&[_]Feature{ | 1036 | .dependencies = featureSet(&[_]Feature{ |
| 1037 | .Shader, | 1037 | .Shader, |
| 1038 | }), | 1038 | }), |
| 1039 | }; | 1039 | }; |
| 1040 | result[@enumToInt(Feature.StorageImageExtendedFormats)] = .{ | 1040 | result[@intFromEnum(Feature.StorageImageExtendedFormats)] = .{ |
| 1041 | .llvm_name = null, | 1041 | .llvm_name = null, |
| 1042 | .description = "Enable SPIR-V capability StorageImageExtendedFormats", | 1042 | .description = "Enable SPIR-V capability StorageImageExtendedFormats", |
| 1043 | .dependencies = featureSet(&[_]Feature{ | 1043 | .dependencies = featureSet(&[_]Feature{ |
| 1044 | .Shader, | 1044 | .Shader, |
| 1045 | }), | 1045 | }), |
| 1046 | }; | 1046 | }; |
| 1047 | result[@enumToInt(Feature.ImageQuery)] = .{ | 1047 | result[@intFromEnum(Feature.ImageQuery)] = .{ |
| 1048 | .llvm_name = null, | 1048 | .llvm_name = null, |
| 1049 | .description = "Enable SPIR-V capability ImageQuery", | 1049 | .description = "Enable SPIR-V capability ImageQuery", |
| 1050 | .dependencies = featureSet(&[_]Feature{ | 1050 | .dependencies = featureSet(&[_]Feature{ |
| 1051 | .Shader, | 1051 | .Shader, |
| 1052 | }), | 1052 | }), |
| 1053 | }; | 1053 | }; |
| 1054 | result[@enumToInt(Feature.DerivativeControl)] = .{ | 1054 | result[@intFromEnum(Feature.DerivativeControl)] = .{ |
| 1055 | .llvm_name = null, | 1055 | .llvm_name = null, |
| 1056 | .description = "Enable SPIR-V capability DerivativeControl", | 1056 | .description = "Enable SPIR-V capability DerivativeControl", |
| 1057 | .dependencies = featureSet(&[_]Feature{ | 1057 | .dependencies = featureSet(&[_]Feature{ |
| 1058 | .Shader, | 1058 | .Shader, |
| 1059 | }), | 1059 | }), |
| 1060 | }; | 1060 | }; |
| 1061 | result[@enumToInt(Feature.InterpolationFunction)] = .{ | 1061 | result[@intFromEnum(Feature.InterpolationFunction)] = .{ |
| 1062 | .llvm_name = null, | 1062 | .llvm_name = null, |
| 1063 | .description = "Enable SPIR-V capability InterpolationFunction", | 1063 | .description = "Enable SPIR-V capability InterpolationFunction", |
| 1064 | .dependencies = featureSet(&[_]Feature{ | 1064 | .dependencies = featureSet(&[_]Feature{ |
| 1065 | .Shader, | 1065 | .Shader, |
| 1066 | }), | 1066 | }), |
| 1067 | }; | 1067 | }; |
| 1068 | result[@enumToInt(Feature.TransformFeedback)] = .{ | 1068 | result[@intFromEnum(Feature.TransformFeedback)] = .{ |
| 1069 | .llvm_name = null, | 1069 | .llvm_name = null, |
| 1070 | .description = "Enable SPIR-V capability TransformFeedback", | 1070 | .description = "Enable SPIR-V capability TransformFeedback", |
| 1071 | .dependencies = featureSet(&[_]Feature{ | 1071 | .dependencies = featureSet(&[_]Feature{ |
| 1072 | .Shader, | 1072 | .Shader, |
| 1073 | }), | 1073 | }), |
| 1074 | }; | 1074 | }; |
| 1075 | result[@enumToInt(Feature.GeometryStreams)] = .{ | 1075 | result[@intFromEnum(Feature.GeometryStreams)] = .{ |
| 1076 | .llvm_name = null, | 1076 | .llvm_name = null, |
| 1077 | .description = "Enable SPIR-V capability GeometryStreams", | 1077 | .description = "Enable SPIR-V capability GeometryStreams", |
| 1078 | .dependencies = featureSet(&[_]Feature{ | 1078 | .dependencies = featureSet(&[_]Feature{ |
| 1079 | .Geometry, | 1079 | .Geometry, |
| 1080 | }), | 1080 | }), |
| 1081 | }; | 1081 | }; |
| 1082 | result[@enumToInt(Feature.StorageImageReadWithoutFormat)] = .{ | 1082 | result[@intFromEnum(Feature.StorageImageReadWithoutFormat)] = .{ |
| 1083 | .llvm_name = null, | 1083 | .llvm_name = null, |
| 1084 | .description = "Enable SPIR-V capability StorageImageReadWithoutFormat", | 1084 | .description = "Enable SPIR-V capability StorageImageReadWithoutFormat", |
| 1085 | .dependencies = featureSet(&[_]Feature{ | 1085 | .dependencies = featureSet(&[_]Feature{ |
| 1086 | .Shader, | 1086 | .Shader, |
| 1087 | }), | 1087 | }), |
| 1088 | }; | 1088 | }; |
| 1089 | result[@enumToInt(Feature.StorageImageWriteWithoutFormat)] = .{ | 1089 | result[@intFromEnum(Feature.StorageImageWriteWithoutFormat)] = .{ |
| 1090 | .llvm_name = null, | 1090 | .llvm_name = null, |
| 1091 | .description = "Enable SPIR-V capability StorageImageWriteWithoutFormat", | 1091 | .description = "Enable SPIR-V capability StorageImageWriteWithoutFormat", |
| 1092 | .dependencies = featureSet(&[_]Feature{ | 1092 | .dependencies = featureSet(&[_]Feature{ |
| 1093 | .Shader, | 1093 | .Shader, |
| 1094 | }), | 1094 | }), |
| 1095 | }; | 1095 | }; |
| 1096 | result[@enumToInt(Feature.MultiViewport)] = .{ | 1096 | result[@intFromEnum(Feature.MultiViewport)] = .{ |
| 1097 | .llvm_name = null, | 1097 | .llvm_name = null, |
| 1098 | .description = "Enable SPIR-V capability MultiViewport", | 1098 | .description = "Enable SPIR-V capability MultiViewport", |
| 1099 | .dependencies = featureSet(&[_]Feature{ | 1099 | .dependencies = featureSet(&[_]Feature{ |
| 1100 | .Geometry, | 1100 | .Geometry, |
| 1101 | }), | 1101 | }), |
| 1102 | }; | 1102 | }; |
| 1103 | result[@enumToInt(Feature.SubgroupDispatch)] = .{ | 1103 | result[@intFromEnum(Feature.SubgroupDispatch)] = .{ |
| 1104 | .llvm_name = null, | 1104 | .llvm_name = null, |
| 1105 | .description = "Enable SPIR-V capability SubgroupDispatch", | 1105 | .description = "Enable SPIR-V capability SubgroupDispatch", |
| 1106 | .dependencies = featureSet(&[_]Feature{ | 1106 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1108,7 +1108,7 @@ pub const all_features = blk: { | ... | @@ -1108,7 +1108,7 @@ pub const all_features = blk: { |
| 1108 | .DeviceEnqueue, | 1108 | .DeviceEnqueue, |
| 1109 | }), | 1109 | }), |
| 1110 | }; | 1110 | }; |
| 1111 | result[@enumToInt(Feature.NamedBarrier)] = .{ | 1111 | result[@intFromEnum(Feature.NamedBarrier)] = .{ |
| 1112 | .llvm_name = null, | 1112 | .llvm_name = null, |
| 1113 | .description = "Enable SPIR-V capability NamedBarrier", | 1113 | .description = "Enable SPIR-V capability NamedBarrier", |
| 1114 | .dependencies = featureSet(&[_]Feature{ | 1114 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1116,7 +1116,7 @@ pub const all_features = blk: { | ... | @@ -1116,7 +1116,7 @@ pub const all_features = blk: { |
| 1116 | .Kernel, | 1116 | .Kernel, |
| 1117 | }), | 1117 | }), |
| 1118 | }; | 1118 | }; |
| 1119 | result[@enumToInt(Feature.PipeStorage)] = .{ | 1119 | result[@intFromEnum(Feature.PipeStorage)] = .{ |
| 1120 | .llvm_name = null, | 1120 | .llvm_name = null, |
| 1121 | .description = "Enable SPIR-V capability PipeStorage", | 1121 | .description = "Enable SPIR-V capability PipeStorage", |
| 1122 | .dependencies = featureSet(&[_]Feature{ | 1122 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1124,14 +1124,14 @@ pub const all_features = blk: { | ... | @@ -1124,14 +1124,14 @@ pub const all_features = blk: { |
| 1124 | .Pipes, | 1124 | .Pipes, |
| 1125 | }), | 1125 | }), |
| 1126 | }; | 1126 | }; |
| 1127 | result[@enumToInt(Feature.GroupNonUniform)] = .{ | 1127 | result[@intFromEnum(Feature.GroupNonUniform)] = .{ |
| 1128 | .llvm_name = null, | 1128 | .llvm_name = null, |
| 1129 | .description = "Enable SPIR-V capability GroupNonUniform", | 1129 | .description = "Enable SPIR-V capability GroupNonUniform", |
| 1130 | .dependencies = featureSet(&[_]Feature{ | 1130 | .dependencies = featureSet(&[_]Feature{ |
| 1131 | .v1_3, | 1131 | .v1_3, |
| 1132 | }), | 1132 | }), |
| 1133 | }; | 1133 | }; |
| 1134 | result[@enumToInt(Feature.GroupNonUniformVote)] = .{ | 1134 | result[@intFromEnum(Feature.GroupNonUniformVote)] = .{ |
| 1135 | .llvm_name = null, | 1135 | .llvm_name = null, |
| 1136 | .description = "Enable SPIR-V capability GroupNonUniformVote", | 1136 | .description = "Enable SPIR-V capability GroupNonUniformVote", |
| 1137 | .dependencies = featureSet(&[_]Feature{ | 1137 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1139,7 +1139,7 @@ pub const all_features = blk: { | ... | @@ -1139,7 +1139,7 @@ pub const all_features = blk: { |
| 1139 | .GroupNonUniform, | 1139 | .GroupNonUniform, |
| 1140 | }), | 1140 | }), |
| 1141 | }; | 1141 | }; |
| 1142 | result[@enumToInt(Feature.GroupNonUniformArithmetic)] = .{ | 1142 | result[@intFromEnum(Feature.GroupNonUniformArithmetic)] = .{ |
| 1143 | .llvm_name = null, | 1143 | .llvm_name = null, |
| 1144 | .description = "Enable SPIR-V capability GroupNonUniformArithmetic", | 1144 | .description = "Enable SPIR-V capability GroupNonUniformArithmetic", |
| 1145 | .dependencies = featureSet(&[_]Feature{ | 1145 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1147,7 +1147,7 @@ pub const all_features = blk: { | ... | @@ -1147,7 +1147,7 @@ pub const all_features = blk: { |
| 1147 | .GroupNonUniform, | 1147 | .GroupNonUniform, |
| 1148 | }), | 1148 | }), |
| 1149 | }; | 1149 | }; |
| 1150 | result[@enumToInt(Feature.GroupNonUniformBallot)] = .{ | 1150 | result[@intFromEnum(Feature.GroupNonUniformBallot)] = .{ |
| 1151 | .llvm_name = null, | 1151 | .llvm_name = null, |
| 1152 | .description = "Enable SPIR-V capability GroupNonUniformBallot", | 1152 | .description = "Enable SPIR-V capability GroupNonUniformBallot", |
| 1153 | .dependencies = featureSet(&[_]Feature{ | 1153 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1155,7 +1155,7 @@ pub const all_features = blk: { | ... | @@ -1155,7 +1155,7 @@ pub const all_features = blk: { |
| 1155 | .GroupNonUniform, | 1155 | .GroupNonUniform, |
| 1156 | }), | 1156 | }), |
| 1157 | }; | 1157 | }; |
| 1158 | result[@enumToInt(Feature.GroupNonUniformShuffle)] = .{ | 1158 | result[@intFromEnum(Feature.GroupNonUniformShuffle)] = .{ |
| 1159 | .llvm_name = null, | 1159 | .llvm_name = null, |
| 1160 | .description = "Enable SPIR-V capability GroupNonUniformShuffle", | 1160 | .description = "Enable SPIR-V capability GroupNonUniformShuffle", |
| 1161 | .dependencies = featureSet(&[_]Feature{ | 1161 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1163,7 +1163,7 @@ pub const all_features = blk: { | ... | @@ -1163,7 +1163,7 @@ pub const all_features = blk: { |
| 1163 | .GroupNonUniform, | 1163 | .GroupNonUniform, |
| 1164 | }), | 1164 | }), |
| 1165 | }; | 1165 | }; |
| 1166 | result[@enumToInt(Feature.GroupNonUniformShuffleRelative)] = .{ | 1166 | result[@intFromEnum(Feature.GroupNonUniformShuffleRelative)] = .{ |
| 1167 | .llvm_name = null, | 1167 | .llvm_name = null, |
| 1168 | .description = "Enable SPIR-V capability GroupNonUniformShuffleRelative", | 1168 | .description = "Enable SPIR-V capability GroupNonUniformShuffleRelative", |
| 1169 | .dependencies = featureSet(&[_]Feature{ | 1169 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1171,7 +1171,7 @@ pub const all_features = blk: { | ... | @@ -1171,7 +1171,7 @@ pub const all_features = blk: { |
| 1171 | .GroupNonUniform, | 1171 | .GroupNonUniform, |
| 1172 | }), | 1172 | }), |
| 1173 | }; | 1173 | }; |
| 1174 | result[@enumToInt(Feature.GroupNonUniformClustered)] = .{ | 1174 | result[@intFromEnum(Feature.GroupNonUniformClustered)] = .{ |
| 1175 | .llvm_name = null, | 1175 | .llvm_name = null, |
| 1176 | .description = "Enable SPIR-V capability GroupNonUniformClustered", | 1176 | .description = "Enable SPIR-V capability GroupNonUniformClustered", |
| 1177 | .dependencies = featureSet(&[_]Feature{ | 1177 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1179,7 +1179,7 @@ pub const all_features = blk: { | ... | @@ -1179,7 +1179,7 @@ pub const all_features = blk: { |
| 1179 | .GroupNonUniform, | 1179 | .GroupNonUniform, |
| 1180 | }), | 1180 | }), |
| 1181 | }; | 1181 | }; |
| 1182 | result[@enumToInt(Feature.GroupNonUniformQuad)] = .{ | 1182 | result[@intFromEnum(Feature.GroupNonUniformQuad)] = .{ |
| 1183 | .llvm_name = null, | 1183 | .llvm_name = null, |
| 1184 | .description = "Enable SPIR-V capability GroupNonUniformQuad", | 1184 | .description = "Enable SPIR-V capability GroupNonUniformQuad", |
| 1185 | .dependencies = featureSet(&[_]Feature{ | 1185 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1187,33 +1187,33 @@ pub const all_features = blk: { | ... | @@ -1187,33 +1187,33 @@ pub const all_features = blk: { |
| 1187 | .GroupNonUniform, | 1187 | .GroupNonUniform, |
| 1188 | }), | 1188 | }), |
| 1189 | }; | 1189 | }; |
| 1190 | result[@enumToInt(Feature.ShaderLayer)] = .{ | 1190 | result[@intFromEnum(Feature.ShaderLayer)] = .{ |
| 1191 | .llvm_name = null, | 1191 | .llvm_name = null, |
| 1192 | .description = "Enable SPIR-V capability ShaderLayer", | 1192 | .description = "Enable SPIR-V capability ShaderLayer", |
| 1193 | .dependencies = featureSet(&[_]Feature{ | 1193 | .dependencies = featureSet(&[_]Feature{ |
| 1194 | .v1_5, | 1194 | .v1_5, |
| 1195 | }), | 1195 | }), |
| 1196 | }; | 1196 | }; |
| 1197 | result[@enumToInt(Feature.ShaderViewportIndex)] = .{ | 1197 | result[@intFromEnum(Feature.ShaderViewportIndex)] = .{ |
| 1198 | .llvm_name = null, | 1198 | .llvm_name = null, |
| 1199 | .description = "Enable SPIR-V capability ShaderViewportIndex", | 1199 | .description = "Enable SPIR-V capability ShaderViewportIndex", |
| 1200 | .dependencies = featureSet(&[_]Feature{ | 1200 | .dependencies = featureSet(&[_]Feature{ |
| 1201 | .v1_5, | 1201 | .v1_5, |
| 1202 | }), | 1202 | }), |
| 1203 | }; | 1203 | }; |
| 1204 | result[@enumToInt(Feature.FragmentShadingRateKHR)] = .{ | 1204 | result[@intFromEnum(Feature.FragmentShadingRateKHR)] = .{ |
| 1205 | .llvm_name = null, | 1205 | .llvm_name = null, |
| 1206 | .description = "Enable SPIR-V capability FragmentShadingRateKHR", | 1206 | .description = "Enable SPIR-V capability FragmentShadingRateKHR", |
| 1207 | .dependencies = featureSet(&[_]Feature{ | 1207 | .dependencies = featureSet(&[_]Feature{ |
| 1208 | .Shader, | 1208 | .Shader, |
| 1209 | }), | 1209 | }), |
| 1210 | }; | 1210 | }; |
| 1211 | result[@enumToInt(Feature.SubgroupBallotKHR)] = .{ | 1211 | result[@intFromEnum(Feature.SubgroupBallotKHR)] = .{ |
| 1212 | .llvm_name = null, | 1212 | .llvm_name = null, |
| 1213 | .description = "Enable SPIR-V capability SubgroupBallotKHR", | 1213 | .description = "Enable SPIR-V capability SubgroupBallotKHR", |
| 1214 | .dependencies = featureSet(&[_]Feature{}), | 1214 | .dependencies = featureSet(&[_]Feature{}), |
| 1215 | }; | 1215 | }; |
| 1216 | result[@enumToInt(Feature.DrawParameters)] = .{ | 1216 | result[@intFromEnum(Feature.DrawParameters)] = .{ |
| 1217 | .llvm_name = null, | 1217 | .llvm_name = null, |
| 1218 | .description = "Enable SPIR-V capability DrawParameters", | 1218 | .description = "Enable SPIR-V capability DrawParameters", |
| 1219 | .dependencies = featureSet(&[_]Feature{ | 1219 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1221,47 +1221,47 @@ pub const all_features = blk: { | ... | @@ -1221,47 +1221,47 @@ pub const all_features = blk: { |
| 1221 | .Shader, | 1221 | .Shader, |
| 1222 | }), | 1222 | }), |
| 1223 | }; | 1223 | }; |
| 1224 | result[@enumToInt(Feature.WorkgroupMemoryExplicitLayoutKHR)] = .{ | 1224 | result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayoutKHR)] = .{ |
| 1225 | .llvm_name = null, | 1225 | .llvm_name = null, |
| 1226 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayoutKHR", | 1226 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayoutKHR", |
| 1227 | .dependencies = featureSet(&[_]Feature{ | 1227 | .dependencies = featureSet(&[_]Feature{ |
| 1228 | .Shader, | 1228 | .Shader, |
| 1229 | }), | 1229 | }), |
| 1230 | }; | 1230 | }; |
| 1231 | result[@enumToInt(Feature.WorkgroupMemoryExplicitLayout8BitAccessKHR)] = .{ | 1231 | result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayout8BitAccessKHR)] = .{ |
| 1232 | .llvm_name = null, | 1232 | .llvm_name = null, |
| 1233 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout8BitAccessKHR", | 1233 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout8BitAccessKHR", |
| 1234 | .dependencies = featureSet(&[_]Feature{ | 1234 | .dependencies = featureSet(&[_]Feature{ |
| 1235 | .WorkgroupMemoryExplicitLayoutKHR, | 1235 | .WorkgroupMemoryExplicitLayoutKHR, |
| 1236 | }), | 1236 | }), |
| 1237 | }; | 1237 | }; |
| 1238 | result[@enumToInt(Feature.WorkgroupMemoryExplicitLayout16BitAccessKHR)] = .{ | 1238 | result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayout16BitAccessKHR)] = .{ |
| 1239 | .llvm_name = null, | 1239 | .llvm_name = null, |
| 1240 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout16BitAccessKHR", | 1240 | .description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout16BitAccessKHR", |
| 1241 | .dependencies = featureSet(&[_]Feature{ | 1241 | .dependencies = featureSet(&[_]Feature{ |
| 1242 | .Shader, | 1242 | .Shader, |
| 1243 | }), | 1243 | }), |
| 1244 | }; | 1244 | }; |
| 1245 | result[@enumToInt(Feature.SubgroupVoteKHR)] = .{ | 1245 | result[@intFromEnum(Feature.SubgroupVoteKHR)] = .{ |
| 1246 | .llvm_name = null, | 1246 | .llvm_name = null, |
| 1247 | .description = "Enable SPIR-V capability SubgroupVoteKHR", | 1247 | .description = "Enable SPIR-V capability SubgroupVoteKHR", |
| 1248 | .dependencies = featureSet(&[_]Feature{}), | 1248 | .dependencies = featureSet(&[_]Feature{}), |
| 1249 | }; | 1249 | }; |
| 1250 | result[@enumToInt(Feature.StorageBuffer16BitAccess)] = .{ | 1250 | result[@intFromEnum(Feature.StorageBuffer16BitAccess)] = .{ |
| 1251 | .llvm_name = null, | 1251 | .llvm_name = null, |
| 1252 | .description = "Enable SPIR-V capability StorageBuffer16BitAccess", | 1252 | .description = "Enable SPIR-V capability StorageBuffer16BitAccess", |
| 1253 | .dependencies = featureSet(&[_]Feature{ | 1253 | .dependencies = featureSet(&[_]Feature{ |
| 1254 | .v1_3, | 1254 | .v1_3, |
| 1255 | }), | 1255 | }), |
| 1256 | }; | 1256 | }; |
| 1257 | result[@enumToInt(Feature.StorageUniformBufferBlock16)] = .{ | 1257 | result[@intFromEnum(Feature.StorageUniformBufferBlock16)] = .{ |
| 1258 | .llvm_name = null, | 1258 | .llvm_name = null, |
| 1259 | .description = "Enable SPIR-V capability StorageUniformBufferBlock16", | 1259 | .description = "Enable SPIR-V capability StorageUniformBufferBlock16", |
| 1260 | .dependencies = featureSet(&[_]Feature{ | 1260 | .dependencies = featureSet(&[_]Feature{ |
| 1261 | .v1_3, | 1261 | .v1_3, |
| 1262 | }), | 1262 | }), |
| 1263 | }; | 1263 | }; |
| 1264 | result[@enumToInt(Feature.UniformAndStorageBuffer16BitAccess)] = .{ | 1264 | result[@intFromEnum(Feature.UniformAndStorageBuffer16BitAccess)] = .{ |
| 1265 | .llvm_name = null, | 1265 | .llvm_name = null, |
| 1266 | .description = "Enable SPIR-V capability UniformAndStorageBuffer16BitAccess", | 1266 | .description = "Enable SPIR-V capability UniformAndStorageBuffer16BitAccess", |
| 1267 | .dependencies = featureSet(&[_]Feature{ | 1267 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1270,7 +1270,7 @@ pub const all_features = blk: { | ... | @@ -1270,7 +1270,7 @@ pub const all_features = blk: { |
| 1270 | .StorageUniformBufferBlock16, | 1270 | .StorageUniformBufferBlock16, |
| 1271 | }), | 1271 | }), |
| 1272 | }; | 1272 | }; |
| 1273 | result[@enumToInt(Feature.StorageUniform16)] = .{ | 1273 | result[@intFromEnum(Feature.StorageUniform16)] = .{ |
| 1274 | .llvm_name = null, | 1274 | .llvm_name = null, |
| 1275 | .description = "Enable SPIR-V capability StorageUniform16", | 1275 | .description = "Enable SPIR-V capability StorageUniform16", |
| 1276 | .dependencies = featureSet(&[_]Feature{ | 1276 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1279,28 +1279,28 @@ pub const all_features = blk: { | ... | @@ -1279,28 +1279,28 @@ pub const all_features = blk: { |
| 1279 | .StorageUniformBufferBlock16, | 1279 | .StorageUniformBufferBlock16, |
| 1280 | }), | 1280 | }), |
| 1281 | }; | 1281 | }; |
| 1282 | result[@enumToInt(Feature.StoragePushConstant16)] = .{ | 1282 | result[@intFromEnum(Feature.StoragePushConstant16)] = .{ |
| 1283 | .llvm_name = null, | 1283 | .llvm_name = null, |
| 1284 | .description = "Enable SPIR-V capability StoragePushConstant16", | 1284 | .description = "Enable SPIR-V capability StoragePushConstant16", |
| 1285 | .dependencies = featureSet(&[_]Feature{ | 1285 | .dependencies = featureSet(&[_]Feature{ |
| 1286 | .v1_3, | 1286 | .v1_3, |
| 1287 | }), | 1287 | }), |
| 1288 | }; | 1288 | }; |
| 1289 | result[@enumToInt(Feature.StorageInputOutput16)] = .{ | 1289 | result[@intFromEnum(Feature.StorageInputOutput16)] = .{ |
| 1290 | .llvm_name = null, | 1290 | .llvm_name = null, |
| 1291 | .description = "Enable SPIR-V capability StorageInputOutput16", | 1291 | .description = "Enable SPIR-V capability StorageInputOutput16", |
| 1292 | .dependencies = featureSet(&[_]Feature{ | 1292 | .dependencies = featureSet(&[_]Feature{ |
| 1293 | .v1_3, | 1293 | .v1_3, |
| 1294 | }), | 1294 | }), |
| 1295 | }; | 1295 | }; |
| 1296 | result[@enumToInt(Feature.DeviceGroup)] = .{ | 1296 | result[@intFromEnum(Feature.DeviceGroup)] = .{ |
| 1297 | .llvm_name = null, | 1297 | .llvm_name = null, |
| 1298 | .description = "Enable SPIR-V capability DeviceGroup", | 1298 | .description = "Enable SPIR-V capability DeviceGroup", |
| 1299 | .dependencies = featureSet(&[_]Feature{ | 1299 | .dependencies = featureSet(&[_]Feature{ |
| 1300 | .v1_3, | 1300 | .v1_3, |
| 1301 | }), | 1301 | }), |
| 1302 | }; | 1302 | }; |
| 1303 | result[@enumToInt(Feature.MultiView)] = .{ | 1303 | result[@intFromEnum(Feature.MultiView)] = .{ |
| 1304 | .llvm_name = null, | 1304 | .llvm_name = null, |
| 1305 | .description = "Enable SPIR-V capability MultiView", | 1305 | .description = "Enable SPIR-V capability MultiView", |
| 1306 | .dependencies = featureSet(&[_]Feature{ | 1306 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1308,7 +1308,7 @@ pub const all_features = blk: { | ... | @@ -1308,7 +1308,7 @@ pub const all_features = blk: { |
| 1308 | .Shader, | 1308 | .Shader, |
| 1309 | }), | 1309 | }), |
| 1310 | }; | 1310 | }; |
| 1311 | result[@enumToInt(Feature.VariablePointersStorageBuffer)] = .{ | 1311 | result[@intFromEnum(Feature.VariablePointersStorageBuffer)] = .{ |
| 1312 | .llvm_name = null, | 1312 | .llvm_name = null, |
| 1313 | .description = "Enable SPIR-V capability VariablePointersStorageBuffer", | 1313 | .description = "Enable SPIR-V capability VariablePointersStorageBuffer", |
| 1314 | .dependencies = featureSet(&[_]Feature{ | 1314 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1316,7 +1316,7 @@ pub const all_features = blk: { | ... | @@ -1316,7 +1316,7 @@ pub const all_features = blk: { |
| 1316 | .Shader, | 1316 | .Shader, |
| 1317 | }), | 1317 | }), |
| 1318 | }; | 1318 | }; |
| 1319 | result[@enumToInt(Feature.VariablePointers)] = .{ | 1319 | result[@intFromEnum(Feature.VariablePointers)] = .{ |
| 1320 | .llvm_name = null, | 1320 | .llvm_name = null, |
| 1321 | .description = "Enable SPIR-V capability VariablePointers", | 1321 | .description = "Enable SPIR-V capability VariablePointers", |
| 1322 | .dependencies = featureSet(&[_]Feature{ | 1322 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1324,24 +1324,24 @@ pub const all_features = blk: { | ... | @@ -1324,24 +1324,24 @@ pub const all_features = blk: { |
| 1324 | .VariablePointersStorageBuffer, | 1324 | .VariablePointersStorageBuffer, |
| 1325 | }), | 1325 | }), |
| 1326 | }; | 1326 | }; |
| 1327 | result[@enumToInt(Feature.AtomicStorageOps)] = .{ | 1327 | result[@intFromEnum(Feature.AtomicStorageOps)] = .{ |
| 1328 | .llvm_name = null, | 1328 | .llvm_name = null, |
| 1329 | .description = "Enable SPIR-V capability AtomicStorageOps", | 1329 | .description = "Enable SPIR-V capability AtomicStorageOps", |
| 1330 | .dependencies = featureSet(&[_]Feature{}), | 1330 | .dependencies = featureSet(&[_]Feature{}), |
| 1331 | }; | 1331 | }; |
| 1332 | result[@enumToInt(Feature.SampleMaskPostDepthCoverage)] = .{ | 1332 | result[@intFromEnum(Feature.SampleMaskPostDepthCoverage)] = .{ |
| 1333 | .llvm_name = null, | 1333 | .llvm_name = null, |
| 1334 | .description = "Enable SPIR-V capability SampleMaskPostDepthCoverage", | 1334 | .description = "Enable SPIR-V capability SampleMaskPostDepthCoverage", |
| 1335 | .dependencies = featureSet(&[_]Feature{}), | 1335 | .dependencies = featureSet(&[_]Feature{}), |
| 1336 | }; | 1336 | }; |
| 1337 | result[@enumToInt(Feature.StorageBuffer8BitAccess)] = .{ | 1337 | result[@intFromEnum(Feature.StorageBuffer8BitAccess)] = .{ |
| 1338 | .llvm_name = null, | 1338 | .llvm_name = null, |
| 1339 | .description = "Enable SPIR-V capability StorageBuffer8BitAccess", | 1339 | .description = "Enable SPIR-V capability StorageBuffer8BitAccess", |
| 1340 | .dependencies = featureSet(&[_]Feature{ | 1340 | .dependencies = featureSet(&[_]Feature{ |
| 1341 | .v1_5, | 1341 | .v1_5, |
| 1342 | }), | 1342 | }), |
| 1343 | }; | 1343 | }; |
| 1344 | result[@enumToInt(Feature.UniformAndStorageBuffer8BitAccess)] = .{ | 1344 | result[@intFromEnum(Feature.UniformAndStorageBuffer8BitAccess)] = .{ |
| 1345 | .llvm_name = null, | 1345 | .llvm_name = null, |
| 1346 | .description = "Enable SPIR-V capability UniformAndStorageBuffer8BitAccess", | 1346 | .description = "Enable SPIR-V capability UniformAndStorageBuffer8BitAccess", |
| 1347 | .dependencies = featureSet(&[_]Feature{ | 1347 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1349,63 +1349,63 @@ pub const all_features = blk: { | ... | @@ -1349,63 +1349,63 @@ pub const all_features = blk: { |
| 1349 | .StorageBuffer8BitAccess, | 1349 | .StorageBuffer8BitAccess, |
| 1350 | }), | 1350 | }), |
| 1351 | }; | 1351 | }; |
| 1352 | result[@enumToInt(Feature.StoragePushConstant8)] = .{ | 1352 | result[@intFromEnum(Feature.StoragePushConstant8)] = .{ |
| 1353 | .llvm_name = null, | 1353 | .llvm_name = null, |
| 1354 | .description = "Enable SPIR-V capability StoragePushConstant8", | 1354 | .description = "Enable SPIR-V capability StoragePushConstant8", |
| 1355 | .dependencies = featureSet(&[_]Feature{ | 1355 | .dependencies = featureSet(&[_]Feature{ |
| 1356 | .v1_5, | 1356 | .v1_5, |
| 1357 | }), | 1357 | }), |
| 1358 | }; | 1358 | }; |
| 1359 | result[@enumToInt(Feature.DenormPreserve)] = .{ | 1359 | result[@intFromEnum(Feature.DenormPreserve)] = .{ |
| 1360 | .llvm_name = null, | 1360 | .llvm_name = null, |
| 1361 | .description = "Enable SPIR-V capability DenormPreserve", | 1361 | .description = "Enable SPIR-V capability DenormPreserve", |
| 1362 | .dependencies = featureSet(&[_]Feature{ | 1362 | .dependencies = featureSet(&[_]Feature{ |
| 1363 | .v1_4, | 1363 | .v1_4, |
| 1364 | }), | 1364 | }), |
| 1365 | }; | 1365 | }; |
| 1366 | result[@enumToInt(Feature.DenormFlushToZero)] = .{ | 1366 | result[@intFromEnum(Feature.DenormFlushToZero)] = .{ |
| 1367 | .llvm_name = null, | 1367 | .llvm_name = null, |
| 1368 | .description = "Enable SPIR-V capability DenormFlushToZero", | 1368 | .description = "Enable SPIR-V capability DenormFlushToZero", |
| 1369 | .dependencies = featureSet(&[_]Feature{ | 1369 | .dependencies = featureSet(&[_]Feature{ |
| 1370 | .v1_4, | 1370 | .v1_4, |
| 1371 | }), | 1371 | }), |
| 1372 | }; | 1372 | }; |
| 1373 | result[@enumToInt(Feature.SignedZeroInfNanPreserve)] = .{ | 1373 | result[@intFromEnum(Feature.SignedZeroInfNanPreserve)] = .{ |
| 1374 | .llvm_name = null, | 1374 | .llvm_name = null, |
| 1375 | .description = "Enable SPIR-V capability SignedZeroInfNanPreserve", | 1375 | .description = "Enable SPIR-V capability SignedZeroInfNanPreserve", |
| 1376 | .dependencies = featureSet(&[_]Feature{ | 1376 | .dependencies = featureSet(&[_]Feature{ |
| 1377 | .v1_4, | 1377 | .v1_4, |
| 1378 | }), | 1378 | }), |
| 1379 | }; | 1379 | }; |
| 1380 | result[@enumToInt(Feature.RoundingModeRTE)] = .{ | 1380 | result[@intFromEnum(Feature.RoundingModeRTE)] = .{ |
| 1381 | .llvm_name = null, | 1381 | .llvm_name = null, |
| 1382 | .description = "Enable SPIR-V capability RoundingModeRTE", | 1382 | .description = "Enable SPIR-V capability RoundingModeRTE", |
| 1383 | .dependencies = featureSet(&[_]Feature{ | 1383 | .dependencies = featureSet(&[_]Feature{ |
| 1384 | .v1_4, | 1384 | .v1_4, |
| 1385 | }), | 1385 | }), |
| 1386 | }; | 1386 | }; |
| 1387 | result[@enumToInt(Feature.RoundingModeRTZ)] = .{ | 1387 | result[@intFromEnum(Feature.RoundingModeRTZ)] = .{ |
| 1388 | .llvm_name = null, | 1388 | .llvm_name = null, |
| 1389 | .description = "Enable SPIR-V capability RoundingModeRTZ", | 1389 | .description = "Enable SPIR-V capability RoundingModeRTZ", |
| 1390 | .dependencies = featureSet(&[_]Feature{ | 1390 | .dependencies = featureSet(&[_]Feature{ |
| 1391 | .v1_4, | 1391 | .v1_4, |
| 1392 | }), | 1392 | }), |
| 1393 | }; | 1393 | }; |
| 1394 | result[@enumToInt(Feature.RayQueryProvisionalKHR)] = .{ | 1394 | result[@intFromEnum(Feature.RayQueryProvisionalKHR)] = .{ |
| 1395 | .llvm_name = null, | 1395 | .llvm_name = null, |
| 1396 | .description = "Enable SPIR-V capability RayQueryProvisionalKHR", | 1396 | .description = "Enable SPIR-V capability RayQueryProvisionalKHR", |
| 1397 | .dependencies = featureSet(&[_]Feature{ | 1397 | .dependencies = featureSet(&[_]Feature{ |
| 1398 | .Shader, | 1398 | .Shader, |
| 1399 | }), | 1399 | }), |
| 1400 | }; | 1400 | }; |
| 1401 | result[@enumToInt(Feature.RayQueryKHR)] = .{ | 1401 | result[@intFromEnum(Feature.RayQueryKHR)] = .{ |
| 1402 | .llvm_name = null, | 1402 | .llvm_name = null, |
| 1403 | .description = "Enable SPIR-V capability RayQueryKHR", | 1403 | .description = "Enable SPIR-V capability RayQueryKHR", |
| 1404 | .dependencies = featureSet(&[_]Feature{ | 1404 | .dependencies = featureSet(&[_]Feature{ |
| 1405 | .Shader, | 1405 | .Shader, |
| 1406 | }), | 1406 | }), |
| 1407 | }; | 1407 | }; |
| 1408 | result[@enumToInt(Feature.RayTraversalPrimitiveCullingKHR)] = .{ | 1408 | result[@intFromEnum(Feature.RayTraversalPrimitiveCullingKHR)] = .{ |
| 1409 | .llvm_name = null, | 1409 | .llvm_name = null, |
| 1410 | .description = "Enable SPIR-V capability RayTraversalPrimitiveCullingKHR", | 1410 | .description = "Enable SPIR-V capability RayTraversalPrimitiveCullingKHR", |
| 1411 | .dependencies = featureSet(&[_]Feature{ | 1411 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1413,160 +1413,160 @@ pub const all_features = blk: { | ... | @@ -1413,160 +1413,160 @@ pub const all_features = blk: { |
| 1413 | .RayTracingKHR, | 1413 | .RayTracingKHR, |
| 1414 | }), | 1414 | }), |
| 1415 | }; | 1415 | }; |
| 1416 | result[@enumToInt(Feature.RayTracingKHR)] = .{ | 1416 | result[@intFromEnum(Feature.RayTracingKHR)] = .{ |
| 1417 | .llvm_name = null, | 1417 | .llvm_name = null, |
| 1418 | .description = "Enable SPIR-V capability RayTracingKHR", | 1418 | .description = "Enable SPIR-V capability RayTracingKHR", |
| 1419 | .dependencies = featureSet(&[_]Feature{ | 1419 | .dependencies = featureSet(&[_]Feature{ |
| 1420 | .Shader, | 1420 | .Shader, |
| 1421 | }), | 1421 | }), |
| 1422 | }; | 1422 | }; |
| 1423 | result[@enumToInt(Feature.Float16ImageAMD)] = .{ | 1423 | result[@intFromEnum(Feature.Float16ImageAMD)] = .{ |
| 1424 | .llvm_name = null, | 1424 | .llvm_name = null, |
| 1425 | .description = "Enable SPIR-V capability Float16ImageAMD", | 1425 | .description = "Enable SPIR-V capability Float16ImageAMD", |
| 1426 | .dependencies = featureSet(&[_]Feature{ | 1426 | .dependencies = featureSet(&[_]Feature{ |
| 1427 | .Shader, | 1427 | .Shader, |
| 1428 | }), | 1428 | }), |
| 1429 | }; | 1429 | }; |
| 1430 | result[@enumToInt(Feature.ImageGatherBiasLodAMD)] = .{ | 1430 | result[@intFromEnum(Feature.ImageGatherBiasLodAMD)] = .{ |
| 1431 | .llvm_name = null, | 1431 | .llvm_name = null, |
| 1432 | .description = "Enable SPIR-V capability ImageGatherBiasLodAMD", | 1432 | .description = "Enable SPIR-V capability ImageGatherBiasLodAMD", |
| 1433 | .dependencies = featureSet(&[_]Feature{ | 1433 | .dependencies = featureSet(&[_]Feature{ |
| 1434 | .Shader, | 1434 | .Shader, |
| 1435 | }), | 1435 | }), |
| 1436 | }; | 1436 | }; |
| 1437 | result[@enumToInt(Feature.FragmentMaskAMD)] = .{ | 1437 | result[@intFromEnum(Feature.FragmentMaskAMD)] = .{ |
| 1438 | .llvm_name = null, | 1438 | .llvm_name = null, |
| 1439 | .description = "Enable SPIR-V capability FragmentMaskAMD", | 1439 | .description = "Enable SPIR-V capability FragmentMaskAMD", |
| 1440 | .dependencies = featureSet(&[_]Feature{ | 1440 | .dependencies = featureSet(&[_]Feature{ |
| 1441 | .Shader, | 1441 | .Shader, |
| 1442 | }), | 1442 | }), |
| 1443 | }; | 1443 | }; |
| 1444 | result[@enumToInt(Feature.StencilExportEXT)] = .{ | 1444 | result[@intFromEnum(Feature.StencilExportEXT)] = .{ |
| 1445 | .llvm_name = null, | 1445 | .llvm_name = null, |
| 1446 | .description = "Enable SPIR-V capability StencilExportEXT", | 1446 | .description = "Enable SPIR-V capability StencilExportEXT", |
| 1447 | .dependencies = featureSet(&[_]Feature{ | 1447 | .dependencies = featureSet(&[_]Feature{ |
| 1448 | .Shader, | 1448 | .Shader, |
| 1449 | }), | 1449 | }), |
| 1450 | }; | 1450 | }; |
| 1451 | result[@enumToInt(Feature.ImageReadWriteLodAMD)] = .{ | 1451 | result[@intFromEnum(Feature.ImageReadWriteLodAMD)] = .{ |
| 1452 | .llvm_name = null, | 1452 | .llvm_name = null, |
| 1453 | .description = "Enable SPIR-V capability ImageReadWriteLodAMD", | 1453 | .description = "Enable SPIR-V capability ImageReadWriteLodAMD", |
| 1454 | .dependencies = featureSet(&[_]Feature{ | 1454 | .dependencies = featureSet(&[_]Feature{ |
| 1455 | .Shader, | 1455 | .Shader, |
| 1456 | }), | 1456 | }), |
| 1457 | }; | 1457 | }; |
| 1458 | result[@enumToInt(Feature.Int64ImageEXT)] = .{ | 1458 | result[@intFromEnum(Feature.Int64ImageEXT)] = .{ |
| 1459 | .llvm_name = null, | 1459 | .llvm_name = null, |
| 1460 | .description = "Enable SPIR-V capability Int64ImageEXT", | 1460 | .description = "Enable SPIR-V capability Int64ImageEXT", |
| 1461 | .dependencies = featureSet(&[_]Feature{ | 1461 | .dependencies = featureSet(&[_]Feature{ |
| 1462 | .Shader, | 1462 | .Shader, |
| 1463 | }), | 1463 | }), |
| 1464 | }; | 1464 | }; |
| 1465 | result[@enumToInt(Feature.ShaderClockKHR)] = .{ | 1465 | result[@intFromEnum(Feature.ShaderClockKHR)] = .{ |
| 1466 | .llvm_name = null, | 1466 | .llvm_name = null, |
| 1467 | .description = "Enable SPIR-V capability ShaderClockKHR", | 1467 | .description = "Enable SPIR-V capability ShaderClockKHR", |
| 1468 | .dependencies = featureSet(&[_]Feature{ | 1468 | .dependencies = featureSet(&[_]Feature{ |
| 1469 | .Shader, | 1469 | .Shader, |
| 1470 | }), | 1470 | }), |
| 1471 | }; | 1471 | }; |
| 1472 | result[@enumToInt(Feature.SampleMaskOverrideCoverageNV)] = .{ | 1472 | result[@intFromEnum(Feature.SampleMaskOverrideCoverageNV)] = .{ |
| 1473 | .llvm_name = null, | 1473 | .llvm_name = null, |
| 1474 | .description = "Enable SPIR-V capability SampleMaskOverrideCoverageNV", | 1474 | .description = "Enable SPIR-V capability SampleMaskOverrideCoverageNV", |
| 1475 | .dependencies = featureSet(&[_]Feature{ | 1475 | .dependencies = featureSet(&[_]Feature{ |
| 1476 | .SampleRateShading, | 1476 | .SampleRateShading, |
| 1477 | }), | 1477 | }), |
| 1478 | }; | 1478 | }; |
| 1479 | result[@enumToInt(Feature.GeometryShaderPassthroughNV)] = .{ | 1479 | result[@intFromEnum(Feature.GeometryShaderPassthroughNV)] = .{ |
| 1480 | .llvm_name = null, | 1480 | .llvm_name = null, |
| 1481 | .description = "Enable SPIR-V capability GeometryShaderPassthroughNV", | 1481 | .description = "Enable SPIR-V capability GeometryShaderPassthroughNV", |
| 1482 | .dependencies = featureSet(&[_]Feature{ | 1482 | .dependencies = featureSet(&[_]Feature{ |
| 1483 | .Geometry, | 1483 | .Geometry, |
| 1484 | }), | 1484 | }), |
| 1485 | }; | 1485 | }; |
| 1486 | result[@enumToInt(Feature.ShaderViewportIndexLayerEXT)] = .{ | 1486 | result[@intFromEnum(Feature.ShaderViewportIndexLayerEXT)] = .{ |
| 1487 | .llvm_name = null, | 1487 | .llvm_name = null, |
| 1488 | .description = "Enable SPIR-V capability ShaderViewportIndexLayerEXT", | 1488 | .description = "Enable SPIR-V capability ShaderViewportIndexLayerEXT", |
| 1489 | .dependencies = featureSet(&[_]Feature{ | 1489 | .dependencies = featureSet(&[_]Feature{ |
| 1490 | .MultiViewport, | 1490 | .MultiViewport, |
| 1491 | }), | 1491 | }), |
| 1492 | }; | 1492 | }; |
| 1493 | result[@enumToInt(Feature.ShaderViewportIndexLayerNV)] = .{ | 1493 | result[@intFromEnum(Feature.ShaderViewportIndexLayerNV)] = .{ |
| 1494 | .llvm_name = null, | 1494 | .llvm_name = null, |
| 1495 | .description = "Enable SPIR-V capability ShaderViewportIndexLayerNV", | 1495 | .description = "Enable SPIR-V capability ShaderViewportIndexLayerNV", |
| 1496 | .dependencies = featureSet(&[_]Feature{ | 1496 | .dependencies = featureSet(&[_]Feature{ |
| 1497 | .MultiViewport, | 1497 | .MultiViewport, |
| 1498 | }), | 1498 | }), |
| 1499 | }; | 1499 | }; |
| 1500 | result[@enumToInt(Feature.ShaderViewportMaskNV)] = .{ | 1500 | result[@intFromEnum(Feature.ShaderViewportMaskNV)] = .{ |
| 1501 | .llvm_name = null, | 1501 | .llvm_name = null, |
| 1502 | .description = "Enable SPIR-V capability ShaderViewportMaskNV", | 1502 | .description = "Enable SPIR-V capability ShaderViewportMaskNV", |
| 1503 | .dependencies = featureSet(&[_]Feature{ | 1503 | .dependencies = featureSet(&[_]Feature{ |
| 1504 | .ShaderViewportIndexLayerNV, | 1504 | .ShaderViewportIndexLayerNV, |
| 1505 | }), | 1505 | }), |
| 1506 | }; | 1506 | }; |
| 1507 | result[@enumToInt(Feature.ShaderStereoViewNV)] = .{ | 1507 | result[@intFromEnum(Feature.ShaderStereoViewNV)] = .{ |
| 1508 | .llvm_name = null, | 1508 | .llvm_name = null, |
| 1509 | .description = "Enable SPIR-V capability ShaderStereoViewNV", | 1509 | .description = "Enable SPIR-V capability ShaderStereoViewNV", |
| 1510 | .dependencies = featureSet(&[_]Feature{ | 1510 | .dependencies = featureSet(&[_]Feature{ |
| 1511 | .ShaderViewportMaskNV, | 1511 | .ShaderViewportMaskNV, |
| 1512 | }), | 1512 | }), |
| 1513 | }; | 1513 | }; |
| 1514 | result[@enumToInt(Feature.PerViewAttributesNV)] = .{ | 1514 | result[@intFromEnum(Feature.PerViewAttributesNV)] = .{ |
| 1515 | .llvm_name = null, | 1515 | .llvm_name = null, |
| 1516 | .description = "Enable SPIR-V capability PerViewAttributesNV", | 1516 | .description = "Enable SPIR-V capability PerViewAttributesNV", |
| 1517 | .dependencies = featureSet(&[_]Feature{ | 1517 | .dependencies = featureSet(&[_]Feature{ |
| 1518 | .MultiView, | 1518 | .MultiView, |
| 1519 | }), | 1519 | }), |
| 1520 | }; | 1520 | }; |
| 1521 | result[@enumToInt(Feature.FragmentFullyCoveredEXT)] = .{ | 1521 | result[@intFromEnum(Feature.FragmentFullyCoveredEXT)] = .{ |
| 1522 | .llvm_name = null, | 1522 | .llvm_name = null, |
| 1523 | .description = "Enable SPIR-V capability FragmentFullyCoveredEXT", | 1523 | .description = "Enable SPIR-V capability FragmentFullyCoveredEXT", |
| 1524 | .dependencies = featureSet(&[_]Feature{ | 1524 | .dependencies = featureSet(&[_]Feature{ |
| 1525 | .Shader, | 1525 | .Shader, |
| 1526 | }), | 1526 | }), |
| 1527 | }; | 1527 | }; |
| 1528 | result[@enumToInt(Feature.MeshShadingNV)] = .{ | 1528 | result[@intFromEnum(Feature.MeshShadingNV)] = .{ |
| 1529 | .llvm_name = null, | 1529 | .llvm_name = null, |
| 1530 | .description = "Enable SPIR-V capability MeshShadingNV", | 1530 | .description = "Enable SPIR-V capability MeshShadingNV", |
| 1531 | .dependencies = featureSet(&[_]Feature{ | 1531 | .dependencies = featureSet(&[_]Feature{ |
| 1532 | .Shader, | 1532 | .Shader, |
| 1533 | }), | 1533 | }), |
| 1534 | }; | 1534 | }; |
| 1535 | result[@enumToInt(Feature.ImageFootprintNV)] = .{ | 1535 | result[@intFromEnum(Feature.ImageFootprintNV)] = .{ |
| 1536 | .llvm_name = null, | 1536 | .llvm_name = null, |
| 1537 | .description = "Enable SPIR-V capability ImageFootprintNV", | 1537 | .description = "Enable SPIR-V capability ImageFootprintNV", |
| 1538 | .dependencies = featureSet(&[_]Feature{}), | 1538 | .dependencies = featureSet(&[_]Feature{}), |
| 1539 | }; | 1539 | }; |
| 1540 | result[@enumToInt(Feature.FragmentBarycentricNV)] = .{ | 1540 | result[@intFromEnum(Feature.FragmentBarycentricNV)] = .{ |
| 1541 | .llvm_name = null, | 1541 | .llvm_name = null, |
| 1542 | .description = "Enable SPIR-V capability FragmentBarycentricNV", | 1542 | .description = "Enable SPIR-V capability FragmentBarycentricNV", |
| 1543 | .dependencies = featureSet(&[_]Feature{}), | 1543 | .dependencies = featureSet(&[_]Feature{}), |
| 1544 | }; | 1544 | }; |
| 1545 | result[@enumToInt(Feature.ComputeDerivativeGroupQuadsNV)] = .{ | 1545 | result[@intFromEnum(Feature.ComputeDerivativeGroupQuadsNV)] = .{ |
| 1546 | .llvm_name = null, | 1546 | .llvm_name = null, |
| 1547 | .description = "Enable SPIR-V capability ComputeDerivativeGroupQuadsNV", | 1547 | .description = "Enable SPIR-V capability ComputeDerivativeGroupQuadsNV", |
| 1548 | .dependencies = featureSet(&[_]Feature{}), | 1548 | .dependencies = featureSet(&[_]Feature{}), |
| 1549 | }; | 1549 | }; |
| 1550 | result[@enumToInt(Feature.FragmentDensityEXT)] = .{ | 1550 | result[@intFromEnum(Feature.FragmentDensityEXT)] = .{ |
| 1551 | .llvm_name = null, | 1551 | .llvm_name = null, |
| 1552 | .description = "Enable SPIR-V capability FragmentDensityEXT", | 1552 | .description = "Enable SPIR-V capability FragmentDensityEXT", |
| 1553 | .dependencies = featureSet(&[_]Feature{ | 1553 | .dependencies = featureSet(&[_]Feature{ |
| 1554 | .Shader, | 1554 | .Shader, |
| 1555 | }), | 1555 | }), |
| 1556 | }; | 1556 | }; |
| 1557 | result[@enumToInt(Feature.ShadingRateNV)] = .{ | 1557 | result[@intFromEnum(Feature.ShadingRateNV)] = .{ |
| 1558 | .llvm_name = null, | 1558 | .llvm_name = null, |
| 1559 | .description = "Enable SPIR-V capability ShadingRateNV", | 1559 | .description = "Enable SPIR-V capability ShadingRateNV", |
| 1560 | .dependencies = featureSet(&[_]Feature{ | 1560 | .dependencies = featureSet(&[_]Feature{ |
| 1561 | .Shader, | 1561 | .Shader, |
| 1562 | }), | 1562 | }), |
| 1563 | }; | 1563 | }; |
| 1564 | result[@enumToInt(Feature.GroupNonUniformPartitionedNV)] = .{ | 1564 | result[@intFromEnum(Feature.GroupNonUniformPartitionedNV)] = .{ |
| 1565 | .llvm_name = null, | 1565 | .llvm_name = null, |
| 1566 | .description = "Enable SPIR-V capability GroupNonUniformPartitionedNV", | 1566 | .description = "Enable SPIR-V capability GroupNonUniformPartitionedNV", |
| 1567 | .dependencies = featureSet(&[_]Feature{}), | 1567 | .dependencies = featureSet(&[_]Feature{}), |
| 1568 | }; | 1568 | }; |
| 1569 | result[@enumToInt(Feature.ShaderNonUniform)] = .{ | 1569 | result[@intFromEnum(Feature.ShaderNonUniform)] = .{ |
| 1570 | .llvm_name = null, | 1570 | .llvm_name = null, |
| 1571 | .description = "Enable SPIR-V capability ShaderNonUniform", | 1571 | .description = "Enable SPIR-V capability ShaderNonUniform", |
| 1572 | .dependencies = featureSet(&[_]Feature{ | 1572 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1574,7 +1574,7 @@ pub const all_features = blk: { | ... | @@ -1574,7 +1574,7 @@ pub const all_features = blk: { |
| 1574 | .Shader, | 1574 | .Shader, |
| 1575 | }), | 1575 | }), |
| 1576 | }; | 1576 | }; |
| 1577 | result[@enumToInt(Feature.ShaderNonUniformEXT)] = .{ | 1577 | result[@intFromEnum(Feature.ShaderNonUniformEXT)] = .{ |
| 1578 | .llvm_name = null, | 1578 | .llvm_name = null, |
| 1579 | .description = "Enable SPIR-V capability ShaderNonUniformEXT", | 1579 | .description = "Enable SPIR-V capability ShaderNonUniformEXT", |
| 1580 | .dependencies = featureSet(&[_]Feature{ | 1580 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1582,7 +1582,7 @@ pub const all_features = blk: { | ... | @@ -1582,7 +1582,7 @@ pub const all_features = blk: { |
| 1582 | .Shader, | 1582 | .Shader, |
| 1583 | }), | 1583 | }), |
| 1584 | }; | 1584 | }; |
| 1585 | result[@enumToInt(Feature.RuntimeDescriptorArray)] = .{ | 1585 | result[@intFromEnum(Feature.RuntimeDescriptorArray)] = .{ |
| 1586 | .llvm_name = null, | 1586 | .llvm_name = null, |
| 1587 | .description = "Enable SPIR-V capability RuntimeDescriptorArray", | 1587 | .description = "Enable SPIR-V capability RuntimeDescriptorArray", |
| 1588 | .dependencies = featureSet(&[_]Feature{ | 1588 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1590,7 +1590,7 @@ pub const all_features = blk: { | ... | @@ -1590,7 +1590,7 @@ pub const all_features = blk: { |
| 1590 | .Shader, | 1590 | .Shader, |
| 1591 | }), | 1591 | }), |
| 1592 | }; | 1592 | }; |
| 1593 | result[@enumToInt(Feature.RuntimeDescriptorArrayEXT)] = .{ | 1593 | result[@intFromEnum(Feature.RuntimeDescriptorArrayEXT)] = .{ |
| 1594 | .llvm_name = null, | 1594 | .llvm_name = null, |
| 1595 | .description = "Enable SPIR-V capability RuntimeDescriptorArrayEXT", | 1595 | .description = "Enable SPIR-V capability RuntimeDescriptorArrayEXT", |
| 1596 | .dependencies = featureSet(&[_]Feature{ | 1596 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1598,7 +1598,7 @@ pub const all_features = blk: { | ... | @@ -1598,7 +1598,7 @@ pub const all_features = blk: { |
| 1598 | .Shader, | 1598 | .Shader, |
| 1599 | }), | 1599 | }), |
| 1600 | }; | 1600 | }; |
| 1601 | result[@enumToInt(Feature.InputAttachmentArrayDynamicIndexing)] = .{ | 1601 | result[@intFromEnum(Feature.InputAttachmentArrayDynamicIndexing)] = .{ |
| 1602 | .llvm_name = null, | 1602 | .llvm_name = null, |
| 1603 | .description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexing", | 1603 | .description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexing", |
| 1604 | .dependencies = featureSet(&[_]Feature{ | 1604 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1606,7 +1606,7 @@ pub const all_features = blk: { | ... | @@ -1606,7 +1606,7 @@ pub const all_features = blk: { |
| 1606 | .InputAttachment, | 1606 | .InputAttachment, |
| 1607 | }), | 1607 | }), |
| 1608 | }; | 1608 | }; |
| 1609 | result[@enumToInt(Feature.InputAttachmentArrayDynamicIndexingEXT)] = .{ | 1609 | result[@intFromEnum(Feature.InputAttachmentArrayDynamicIndexingEXT)] = .{ |
| 1610 | .llvm_name = null, | 1610 | .llvm_name = null, |
| 1611 | .description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexingEXT", | 1611 | .description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexingEXT", |
| 1612 | .dependencies = featureSet(&[_]Feature{ | 1612 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1614,7 +1614,7 @@ pub const all_features = blk: { | ... | @@ -1614,7 +1614,7 @@ pub const all_features = blk: { |
| 1614 | .InputAttachment, | 1614 | .InputAttachment, |
| 1615 | }), | 1615 | }), |
| 1616 | }; | 1616 | }; |
| 1617 | result[@enumToInt(Feature.UniformTexelBufferArrayDynamicIndexing)] = .{ | 1617 | result[@intFromEnum(Feature.UniformTexelBufferArrayDynamicIndexing)] = .{ |
| 1618 | .llvm_name = null, | 1618 | .llvm_name = null, |
| 1619 | .description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexing", | 1619 | .description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexing", |
| 1620 | .dependencies = featureSet(&[_]Feature{ | 1620 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1622,7 +1622,7 @@ pub const all_features = blk: { | ... | @@ -1622,7 +1622,7 @@ pub const all_features = blk: { |
| 1622 | .SampledBuffer, | 1622 | .SampledBuffer, |
| 1623 | }), | 1623 | }), |
| 1624 | }; | 1624 | }; |
| 1625 | result[@enumToInt(Feature.UniformTexelBufferArrayDynamicIndexingEXT)] = .{ | 1625 | result[@intFromEnum(Feature.UniformTexelBufferArrayDynamicIndexingEXT)] = .{ |
| 1626 | .llvm_name = null, | 1626 | .llvm_name = null, |
| 1627 | .description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexingEXT", | 1627 | .description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexingEXT", |
| 1628 | .dependencies = featureSet(&[_]Feature{ | 1628 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1630,7 +1630,7 @@ pub const all_features = blk: { | ... | @@ -1630,7 +1630,7 @@ pub const all_features = blk: { |
| 1630 | .SampledBuffer, | 1630 | .SampledBuffer, |
| 1631 | }), | 1631 | }), |
| 1632 | }; | 1632 | }; |
| 1633 | result[@enumToInt(Feature.StorageTexelBufferArrayDynamicIndexing)] = .{ | 1633 | result[@intFromEnum(Feature.StorageTexelBufferArrayDynamicIndexing)] = .{ |
| 1634 | .llvm_name = null, | 1634 | .llvm_name = null, |
| 1635 | .description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexing", | 1635 | .description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexing", |
| 1636 | .dependencies = featureSet(&[_]Feature{ | 1636 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1638,7 +1638,7 @@ pub const all_features = blk: { | ... | @@ -1638,7 +1638,7 @@ pub const all_features = blk: { |
| 1638 | .ImageBuffer, | 1638 | .ImageBuffer, |
| 1639 | }), | 1639 | }), |
| 1640 | }; | 1640 | }; |
| 1641 | result[@enumToInt(Feature.StorageTexelBufferArrayDynamicIndexingEXT)] = .{ | 1641 | result[@intFromEnum(Feature.StorageTexelBufferArrayDynamicIndexingEXT)] = .{ |
| 1642 | .llvm_name = null, | 1642 | .llvm_name = null, |
| 1643 | .description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexingEXT", | 1643 | .description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexingEXT", |
| 1644 | .dependencies = featureSet(&[_]Feature{ | 1644 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1646,7 +1646,7 @@ pub const all_features = blk: { | ... | @@ -1646,7 +1646,7 @@ pub const all_features = blk: { |
| 1646 | .ImageBuffer, | 1646 | .ImageBuffer, |
| 1647 | }), | 1647 | }), |
| 1648 | }; | 1648 | }; |
| 1649 | result[@enumToInt(Feature.UniformBufferArrayNonUniformIndexing)] = .{ | 1649 | result[@intFromEnum(Feature.UniformBufferArrayNonUniformIndexing)] = .{ |
| 1650 | .llvm_name = null, | 1650 | .llvm_name = null, |
| 1651 | .description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexing", | 1651 | .description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexing", |
| 1652 | .dependencies = featureSet(&[_]Feature{ | 1652 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1654,7 +1654,7 @@ pub const all_features = blk: { | ... | @@ -1654,7 +1654,7 @@ pub const all_features = blk: { |
| 1654 | .ShaderNonUniform, | 1654 | .ShaderNonUniform, |
| 1655 | }), | 1655 | }), |
| 1656 | }; | 1656 | }; |
| 1657 | result[@enumToInt(Feature.UniformBufferArrayNonUniformIndexingEXT)] = .{ | 1657 | result[@intFromEnum(Feature.UniformBufferArrayNonUniformIndexingEXT)] = .{ |
| 1658 | .llvm_name = null, | 1658 | .llvm_name = null, |
| 1659 | .description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexingEXT", | 1659 | .description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexingEXT", |
| 1660 | .dependencies = featureSet(&[_]Feature{ | 1660 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1662,7 +1662,7 @@ pub const all_features = blk: { | ... | @@ -1662,7 +1662,7 @@ pub const all_features = blk: { |
| 1662 | .ShaderNonUniform, | 1662 | .ShaderNonUniform, |
| 1663 | }), | 1663 | }), |
| 1664 | }; | 1664 | }; |
| 1665 | result[@enumToInt(Feature.SampledImageArrayNonUniformIndexing)] = .{ | 1665 | result[@intFromEnum(Feature.SampledImageArrayNonUniformIndexing)] = .{ |
| 1666 | .llvm_name = null, | 1666 | .llvm_name = null, |
| 1667 | .description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexing", | 1667 | .description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexing", |
| 1668 | .dependencies = featureSet(&[_]Feature{ | 1668 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1670,7 +1670,7 @@ pub const all_features = blk: { | ... | @@ -1670,7 +1670,7 @@ pub const all_features = blk: { |
| 1670 | .ShaderNonUniform, | 1670 | .ShaderNonUniform, |
| 1671 | }), | 1671 | }), |
| 1672 | }; | 1672 | }; |
| 1673 | result[@enumToInt(Feature.SampledImageArrayNonUniformIndexingEXT)] = .{ | 1673 | result[@intFromEnum(Feature.SampledImageArrayNonUniformIndexingEXT)] = .{ |
| 1674 | .llvm_name = null, | 1674 | .llvm_name = null, |
| 1675 | .description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexingEXT", | 1675 | .description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexingEXT", |
| 1676 | .dependencies = featureSet(&[_]Feature{ | 1676 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1678,7 +1678,7 @@ pub const all_features = blk: { | ... | @@ -1678,7 +1678,7 @@ pub const all_features = blk: { |
| 1678 | .ShaderNonUniform, | 1678 | .ShaderNonUniform, |
| 1679 | }), | 1679 | }), |
| 1680 | }; | 1680 | }; |
| 1681 | result[@enumToInt(Feature.StorageBufferArrayNonUniformIndexing)] = .{ | 1681 | result[@intFromEnum(Feature.StorageBufferArrayNonUniformIndexing)] = .{ |
| 1682 | .llvm_name = null, | 1682 | .llvm_name = null, |
| 1683 | .description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexing", | 1683 | .description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexing", |
| 1684 | .dependencies = featureSet(&[_]Feature{ | 1684 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1686,7 +1686,7 @@ pub const all_features = blk: { | ... | @@ -1686,7 +1686,7 @@ pub const all_features = blk: { |
| 1686 | .ShaderNonUniform, | 1686 | .ShaderNonUniform, |
| 1687 | }), | 1687 | }), |
| 1688 | }; | 1688 | }; |
| 1689 | result[@enumToInt(Feature.StorageBufferArrayNonUniformIndexingEXT)] = .{ | 1689 | result[@intFromEnum(Feature.StorageBufferArrayNonUniformIndexingEXT)] = .{ |
| 1690 | .llvm_name = null, | 1690 | .llvm_name = null, |
| 1691 | .description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexingEXT", | 1691 | .description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexingEXT", |
| 1692 | .dependencies = featureSet(&[_]Feature{ | 1692 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1694,7 +1694,7 @@ pub const all_features = blk: { | ... | @@ -1694,7 +1694,7 @@ pub const all_features = blk: { |
| 1694 | .ShaderNonUniform, | 1694 | .ShaderNonUniform, |
| 1695 | }), | 1695 | }), |
| 1696 | }; | 1696 | }; |
| 1697 | result[@enumToInt(Feature.StorageImageArrayNonUniformIndexing)] = .{ | 1697 | result[@intFromEnum(Feature.StorageImageArrayNonUniformIndexing)] = .{ |
| 1698 | .llvm_name = null, | 1698 | .llvm_name = null, |
| 1699 | .description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexing", | 1699 | .description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexing", |
| 1700 | .dependencies = featureSet(&[_]Feature{ | 1700 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1702,7 +1702,7 @@ pub const all_features = blk: { | ... | @@ -1702,7 +1702,7 @@ pub const all_features = blk: { |
| 1702 | .ShaderNonUniform, | 1702 | .ShaderNonUniform, |
| 1703 | }), | 1703 | }), |
| 1704 | }; | 1704 | }; |
| 1705 | result[@enumToInt(Feature.StorageImageArrayNonUniformIndexingEXT)] = .{ | 1705 | result[@intFromEnum(Feature.StorageImageArrayNonUniformIndexingEXT)] = .{ |
| 1706 | .llvm_name = null, | 1706 | .llvm_name = null, |
| 1707 | .description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexingEXT", | 1707 | .description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexingEXT", |
| 1708 | .dependencies = featureSet(&[_]Feature{ | 1708 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1710,7 +1710,7 @@ pub const all_features = blk: { | ... | @@ -1710,7 +1710,7 @@ pub const all_features = blk: { |
| 1710 | .ShaderNonUniform, | 1710 | .ShaderNonUniform, |
| 1711 | }), | 1711 | }), |
| 1712 | }; | 1712 | }; |
| 1713 | result[@enumToInt(Feature.InputAttachmentArrayNonUniformIndexing)] = .{ | 1713 | result[@intFromEnum(Feature.InputAttachmentArrayNonUniformIndexing)] = .{ |
| 1714 | .llvm_name = null, | 1714 | .llvm_name = null, |
| 1715 | .description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexing", | 1715 | .description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexing", |
| 1716 | .dependencies = featureSet(&[_]Feature{ | 1716 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1719,7 +1719,7 @@ pub const all_features = blk: { | ... | @@ -1719,7 +1719,7 @@ pub const all_features = blk: { |
| 1719 | .ShaderNonUniform, | 1719 | .ShaderNonUniform, |
| 1720 | }), | 1720 | }), |
| 1721 | }; | 1721 | }; |
| 1722 | result[@enumToInt(Feature.InputAttachmentArrayNonUniformIndexingEXT)] = .{ | 1722 | result[@intFromEnum(Feature.InputAttachmentArrayNonUniformIndexingEXT)] = .{ |
| 1723 | .llvm_name = null, | 1723 | .llvm_name = null, |
| 1724 | .description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexingEXT", | 1724 | .description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexingEXT", |
| 1725 | .dependencies = featureSet(&[_]Feature{ | 1725 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1728,7 +1728,7 @@ pub const all_features = blk: { | ... | @@ -1728,7 +1728,7 @@ pub const all_features = blk: { |
| 1728 | .ShaderNonUniform, | 1728 | .ShaderNonUniform, |
| 1729 | }), | 1729 | }), |
| 1730 | }; | 1730 | }; |
| 1731 | result[@enumToInt(Feature.UniformTexelBufferArrayNonUniformIndexing)] = .{ | 1731 | result[@intFromEnum(Feature.UniformTexelBufferArrayNonUniformIndexing)] = .{ |
| 1732 | .llvm_name = null, | 1732 | .llvm_name = null, |
| 1733 | .description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexing", | 1733 | .description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexing", |
| 1734 | .dependencies = featureSet(&[_]Feature{ | 1734 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1737,7 +1737,7 @@ pub const all_features = blk: { | ... | @@ -1737,7 +1737,7 @@ pub const all_features = blk: { |
| 1737 | .ShaderNonUniform, | 1737 | .ShaderNonUniform, |
| 1738 | }), | 1738 | }), |
| 1739 | }; | 1739 | }; |
| 1740 | result[@enumToInt(Feature.UniformTexelBufferArrayNonUniformIndexingEXT)] = .{ | 1740 | result[@intFromEnum(Feature.UniformTexelBufferArrayNonUniformIndexingEXT)] = .{ |
| 1741 | .llvm_name = null, | 1741 | .llvm_name = null, |
| 1742 | .description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexingEXT", | 1742 | .description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexingEXT", |
| 1743 | .dependencies = featureSet(&[_]Feature{ | 1743 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1746,7 +1746,7 @@ pub const all_features = blk: { | ... | @@ -1746,7 +1746,7 @@ pub const all_features = blk: { |
| 1746 | .ShaderNonUniform, | 1746 | .ShaderNonUniform, |
| 1747 | }), | 1747 | }), |
| 1748 | }; | 1748 | }; |
| 1749 | result[@enumToInt(Feature.StorageTexelBufferArrayNonUniformIndexing)] = .{ | 1749 | result[@intFromEnum(Feature.StorageTexelBufferArrayNonUniformIndexing)] = .{ |
| 1750 | .llvm_name = null, | 1750 | .llvm_name = null, |
| 1751 | .description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexing", | 1751 | .description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexing", |
| 1752 | .dependencies = featureSet(&[_]Feature{ | 1752 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1755,7 +1755,7 @@ pub const all_features = blk: { | ... | @@ -1755,7 +1755,7 @@ pub const all_features = blk: { |
| 1755 | .ShaderNonUniform, | 1755 | .ShaderNonUniform, |
| 1756 | }), | 1756 | }), |
| 1757 | }; | 1757 | }; |
| 1758 | result[@enumToInt(Feature.StorageTexelBufferArrayNonUniformIndexingEXT)] = .{ | 1758 | result[@intFromEnum(Feature.StorageTexelBufferArrayNonUniformIndexingEXT)] = .{ |
| 1759 | .llvm_name = null, | 1759 | .llvm_name = null, |
| 1760 | .description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexingEXT", | 1760 | .description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexingEXT", |
| 1761 | .dependencies = featureSet(&[_]Feature{ | 1761 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1764,42 +1764,42 @@ pub const all_features = blk: { | ... | @@ -1764,42 +1764,42 @@ pub const all_features = blk: { |
| 1764 | .ShaderNonUniform, | 1764 | .ShaderNonUniform, |
| 1765 | }), | 1765 | }), |
| 1766 | }; | 1766 | }; |
| 1767 | result[@enumToInt(Feature.RayTracingNV)] = .{ | 1767 | result[@intFromEnum(Feature.RayTracingNV)] = .{ |
| 1768 | .llvm_name = null, | 1768 | .llvm_name = null, |
| 1769 | .description = "Enable SPIR-V capability RayTracingNV", | 1769 | .description = "Enable SPIR-V capability RayTracingNV", |
| 1770 | .dependencies = featureSet(&[_]Feature{ | 1770 | .dependencies = featureSet(&[_]Feature{ |
| 1771 | .Shader, | 1771 | .Shader, |
| 1772 | }), | 1772 | }), |
| 1773 | }; | 1773 | }; |
| 1774 | result[@enumToInt(Feature.VulkanMemoryModel)] = .{ | 1774 | result[@intFromEnum(Feature.VulkanMemoryModel)] = .{ |
| 1775 | .llvm_name = null, | 1775 | .llvm_name = null, |
| 1776 | .description = "Enable SPIR-V capability VulkanMemoryModel", | 1776 | .description = "Enable SPIR-V capability VulkanMemoryModel", |
| 1777 | .dependencies = featureSet(&[_]Feature{ | 1777 | .dependencies = featureSet(&[_]Feature{ |
| 1778 | .v1_5, | 1778 | .v1_5, |
| 1779 | }), | 1779 | }), |
| 1780 | }; | 1780 | }; |
| 1781 | result[@enumToInt(Feature.VulkanMemoryModelKHR)] = .{ | 1781 | result[@intFromEnum(Feature.VulkanMemoryModelKHR)] = .{ |
| 1782 | .llvm_name = null, | 1782 | .llvm_name = null, |
| 1783 | .description = "Enable SPIR-V capability VulkanMemoryModelKHR", | 1783 | .description = "Enable SPIR-V capability VulkanMemoryModelKHR", |
| 1784 | .dependencies = featureSet(&[_]Feature{ | 1784 | .dependencies = featureSet(&[_]Feature{ |
| 1785 | .v1_5, | 1785 | .v1_5, |
| 1786 | }), | 1786 | }), |
| 1787 | }; | 1787 | }; |
| 1788 | result[@enumToInt(Feature.VulkanMemoryModelDeviceScope)] = .{ | 1788 | result[@intFromEnum(Feature.VulkanMemoryModelDeviceScope)] = .{ |
| 1789 | .llvm_name = null, | 1789 | .llvm_name = null, |
| 1790 | .description = "Enable SPIR-V capability VulkanMemoryModelDeviceScope", | 1790 | .description = "Enable SPIR-V capability VulkanMemoryModelDeviceScope", |
| 1791 | .dependencies = featureSet(&[_]Feature{ | 1791 | .dependencies = featureSet(&[_]Feature{ |
| 1792 | .v1_5, | 1792 | .v1_5, |
| 1793 | }), | 1793 | }), |
| 1794 | }; | 1794 | }; |
| 1795 | result[@enumToInt(Feature.VulkanMemoryModelDeviceScopeKHR)] = .{ | 1795 | result[@intFromEnum(Feature.VulkanMemoryModelDeviceScopeKHR)] = .{ |
| 1796 | .llvm_name = null, | 1796 | .llvm_name = null, |
| 1797 | .description = "Enable SPIR-V capability VulkanMemoryModelDeviceScopeKHR", | 1797 | .description = "Enable SPIR-V capability VulkanMemoryModelDeviceScopeKHR", |
| 1798 | .dependencies = featureSet(&[_]Feature{ | 1798 | .dependencies = featureSet(&[_]Feature{ |
| 1799 | .v1_5, | 1799 | .v1_5, |
| 1800 | }), | 1800 | }), |
| 1801 | }; | 1801 | }; |
| 1802 | result[@enumToInt(Feature.PhysicalStorageBufferAddresses)] = .{ | 1802 | result[@intFromEnum(Feature.PhysicalStorageBufferAddresses)] = .{ |
| 1803 | .llvm_name = null, | 1803 | .llvm_name = null, |
| 1804 | .description = "Enable SPIR-V capability PhysicalStorageBufferAddresses", | 1804 | .description = "Enable SPIR-V capability PhysicalStorageBufferAddresses", |
| 1805 | .dependencies = featureSet(&[_]Feature{ | 1805 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1807,7 +1807,7 @@ pub const all_features = blk: { | ... | @@ -1807,7 +1807,7 @@ pub const all_features = blk: { |
| 1807 | .Shader, | 1807 | .Shader, |
| 1808 | }), | 1808 | }), |
| 1809 | }; | 1809 | }; |
| 1810 | result[@enumToInt(Feature.PhysicalStorageBufferAddressesEXT)] = .{ | 1810 | result[@intFromEnum(Feature.PhysicalStorageBufferAddressesEXT)] = .{ |
| 1811 | .llvm_name = null, | 1811 | .llvm_name = null, |
| 1812 | .description = "Enable SPIR-V capability PhysicalStorageBufferAddressesEXT", | 1812 | .description = "Enable SPIR-V capability PhysicalStorageBufferAddressesEXT", |
| 1813 | .dependencies = featureSet(&[_]Feature{ | 1813 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1815,261 +1815,261 @@ pub const all_features = blk: { | ... | @@ -1815,261 +1815,261 @@ pub const all_features = blk: { |
| 1815 | .Shader, | 1815 | .Shader, |
| 1816 | }), | 1816 | }), |
| 1817 | }; | 1817 | }; |
| 1818 | result[@enumToInt(Feature.ComputeDerivativeGroupLinearNV)] = .{ | 1818 | result[@intFromEnum(Feature.ComputeDerivativeGroupLinearNV)] = .{ |
| 1819 | .llvm_name = null, | 1819 | .llvm_name = null, |
| 1820 | .description = "Enable SPIR-V capability ComputeDerivativeGroupLinearNV", | 1820 | .description = "Enable SPIR-V capability ComputeDerivativeGroupLinearNV", |
| 1821 | .dependencies = featureSet(&[_]Feature{}), | 1821 | .dependencies = featureSet(&[_]Feature{}), |
| 1822 | }; | 1822 | }; |
| 1823 | result[@enumToInt(Feature.RayTracingProvisionalKHR)] = .{ | 1823 | result[@intFromEnum(Feature.RayTracingProvisionalKHR)] = .{ |
| 1824 | .llvm_name = null, | 1824 | .llvm_name = null, |
| 1825 | .description = "Enable SPIR-V capability RayTracingProvisionalKHR", | 1825 | .description = "Enable SPIR-V capability RayTracingProvisionalKHR", |
| 1826 | .dependencies = featureSet(&[_]Feature{ | 1826 | .dependencies = featureSet(&[_]Feature{ |
| 1827 | .Shader, | 1827 | .Shader, |
| 1828 | }), | 1828 | }), |
| 1829 | }; | 1829 | }; |
| 1830 | result[@enumToInt(Feature.CooperativeMatrixNV)] = .{ | 1830 | result[@intFromEnum(Feature.CooperativeMatrixNV)] = .{ |
| 1831 | .llvm_name = null, | 1831 | .llvm_name = null, |
| 1832 | .description = "Enable SPIR-V capability CooperativeMatrixNV", | 1832 | .description = "Enable SPIR-V capability CooperativeMatrixNV", |
| 1833 | .dependencies = featureSet(&[_]Feature{ | 1833 | .dependencies = featureSet(&[_]Feature{ |
| 1834 | .Shader, | 1834 | .Shader, |
| 1835 | }), | 1835 | }), |
| 1836 | }; | 1836 | }; |
| 1837 | result[@enumToInt(Feature.FragmentShaderSampleInterlockEXT)] = .{ | 1837 | result[@intFromEnum(Feature.FragmentShaderSampleInterlockEXT)] = .{ |
| 1838 | .llvm_name = null, | 1838 | .llvm_name = null, |
| 1839 | .description = "Enable SPIR-V capability FragmentShaderSampleInterlockEXT", | 1839 | .description = "Enable SPIR-V capability FragmentShaderSampleInterlockEXT", |
| 1840 | .dependencies = featureSet(&[_]Feature{ | 1840 | .dependencies = featureSet(&[_]Feature{ |
| 1841 | .Shader, | 1841 | .Shader, |
| 1842 | }), | 1842 | }), |
| 1843 | }; | 1843 | }; |
| 1844 | result[@enumToInt(Feature.FragmentShaderShadingRateInterlockEXT)] = .{ | 1844 | result[@intFromEnum(Feature.FragmentShaderShadingRateInterlockEXT)] = .{ |
| 1845 | .llvm_name = null, | 1845 | .llvm_name = null, |
| 1846 | .description = "Enable SPIR-V capability FragmentShaderShadingRateInterlockEXT", | 1846 | .description = "Enable SPIR-V capability FragmentShaderShadingRateInterlockEXT", |
| 1847 | .dependencies = featureSet(&[_]Feature{ | 1847 | .dependencies = featureSet(&[_]Feature{ |
| 1848 | .Shader, | 1848 | .Shader, |
| 1849 | }), | 1849 | }), |
| 1850 | }; | 1850 | }; |
| 1851 | result[@enumToInt(Feature.ShaderSMBuiltinsNV)] = .{ | 1851 | result[@intFromEnum(Feature.ShaderSMBuiltinsNV)] = .{ |
| 1852 | .llvm_name = null, | 1852 | .llvm_name = null, |
| 1853 | .description = "Enable SPIR-V capability ShaderSMBuiltinsNV", | 1853 | .description = "Enable SPIR-V capability ShaderSMBuiltinsNV", |
| 1854 | .dependencies = featureSet(&[_]Feature{ | 1854 | .dependencies = featureSet(&[_]Feature{ |
| 1855 | .Shader, | 1855 | .Shader, |
| 1856 | }), | 1856 | }), |
| 1857 | }; | 1857 | }; |
| 1858 | result[@enumToInt(Feature.FragmentShaderPixelInterlockEXT)] = .{ | 1858 | result[@intFromEnum(Feature.FragmentShaderPixelInterlockEXT)] = .{ |
| 1859 | .llvm_name = null, | 1859 | .llvm_name = null, |
| 1860 | .description = "Enable SPIR-V capability FragmentShaderPixelInterlockEXT", | 1860 | .description = "Enable SPIR-V capability FragmentShaderPixelInterlockEXT", |
| 1861 | .dependencies = featureSet(&[_]Feature{ | 1861 | .dependencies = featureSet(&[_]Feature{ |
| 1862 | .Shader, | 1862 | .Shader, |
| 1863 | }), | 1863 | }), |
| 1864 | }; | 1864 | }; |
| 1865 | result[@enumToInt(Feature.DemoteToHelperInvocationEXT)] = .{ | 1865 | result[@intFromEnum(Feature.DemoteToHelperInvocationEXT)] = .{ |
| 1866 | .llvm_name = null, | 1866 | .llvm_name = null, |
| 1867 | .description = "Enable SPIR-V capability DemoteToHelperInvocationEXT", | 1867 | .description = "Enable SPIR-V capability DemoteToHelperInvocationEXT", |
| 1868 | .dependencies = featureSet(&[_]Feature{ | 1868 | .dependencies = featureSet(&[_]Feature{ |
| 1869 | .Shader, | 1869 | .Shader, |
| 1870 | }), | 1870 | }), |
| 1871 | }; | 1871 | }; |
| 1872 | result[@enumToInt(Feature.SubgroupShuffleINTEL)] = .{ | 1872 | result[@intFromEnum(Feature.SubgroupShuffleINTEL)] = .{ |
| 1873 | .llvm_name = null, | 1873 | .llvm_name = null, |
| 1874 | .description = "Enable SPIR-V capability SubgroupShuffleINTEL", | 1874 | .description = "Enable SPIR-V capability SubgroupShuffleINTEL", |
| 1875 | .dependencies = featureSet(&[_]Feature{}), | 1875 | .dependencies = featureSet(&[_]Feature{}), |
| 1876 | }; | 1876 | }; |
| 1877 | result[@enumToInt(Feature.SubgroupBufferBlockIOINTEL)] = .{ | 1877 | result[@intFromEnum(Feature.SubgroupBufferBlockIOINTEL)] = .{ |
| 1878 | .llvm_name = null, | 1878 | .llvm_name = null, |
| 1879 | .description = "Enable SPIR-V capability SubgroupBufferBlockIOINTEL", | 1879 | .description = "Enable SPIR-V capability SubgroupBufferBlockIOINTEL", |
| 1880 | .dependencies = featureSet(&[_]Feature{}), | 1880 | .dependencies = featureSet(&[_]Feature{}), |
| 1881 | }; | 1881 | }; |
| 1882 | result[@enumToInt(Feature.SubgroupImageBlockIOINTEL)] = .{ | 1882 | result[@intFromEnum(Feature.SubgroupImageBlockIOINTEL)] = .{ |
| 1883 | .llvm_name = null, | 1883 | .llvm_name = null, |
| 1884 | .description = "Enable SPIR-V capability SubgroupImageBlockIOINTEL", | 1884 | .description = "Enable SPIR-V capability SubgroupImageBlockIOINTEL", |
| 1885 | .dependencies = featureSet(&[_]Feature{}), | 1885 | .dependencies = featureSet(&[_]Feature{}), |
| 1886 | }; | 1886 | }; |
| 1887 | result[@enumToInt(Feature.SubgroupImageMediaBlockIOINTEL)] = .{ | 1887 | result[@intFromEnum(Feature.SubgroupImageMediaBlockIOINTEL)] = .{ |
| 1888 | .llvm_name = null, | 1888 | .llvm_name = null, |
| 1889 | .description = "Enable SPIR-V capability SubgroupImageMediaBlockIOINTEL", | 1889 | .description = "Enable SPIR-V capability SubgroupImageMediaBlockIOINTEL", |
| 1890 | .dependencies = featureSet(&[_]Feature{}), | 1890 | .dependencies = featureSet(&[_]Feature{}), |
| 1891 | }; | 1891 | }; |
| 1892 | result[@enumToInt(Feature.RoundToInfinityINTEL)] = .{ | 1892 | result[@intFromEnum(Feature.RoundToInfinityINTEL)] = .{ |
| 1893 | .llvm_name = null, | 1893 | .llvm_name = null, |
| 1894 | .description = "Enable SPIR-V capability RoundToInfinityINTEL", | 1894 | .description = "Enable SPIR-V capability RoundToInfinityINTEL", |
| 1895 | .dependencies = featureSet(&[_]Feature{}), | 1895 | .dependencies = featureSet(&[_]Feature{}), |
| 1896 | }; | 1896 | }; |
| 1897 | result[@enumToInt(Feature.FloatingPointModeINTEL)] = .{ | 1897 | result[@intFromEnum(Feature.FloatingPointModeINTEL)] = .{ |
| 1898 | .llvm_name = null, | 1898 | .llvm_name = null, |
| 1899 | .description = "Enable SPIR-V capability FloatingPointModeINTEL", | 1899 | .description = "Enable SPIR-V capability FloatingPointModeINTEL", |
| 1900 | .dependencies = featureSet(&[_]Feature{}), | 1900 | .dependencies = featureSet(&[_]Feature{}), |
| 1901 | }; | 1901 | }; |
| 1902 | result[@enumToInt(Feature.IntegerFunctions2INTEL)] = .{ | 1902 | result[@intFromEnum(Feature.IntegerFunctions2INTEL)] = .{ |
| 1903 | .llvm_name = null, | 1903 | .llvm_name = null, |
| 1904 | .description = "Enable SPIR-V capability IntegerFunctions2INTEL", | 1904 | .description = "Enable SPIR-V capability IntegerFunctions2INTEL", |
| 1905 | .dependencies = featureSet(&[_]Feature{ | 1905 | .dependencies = featureSet(&[_]Feature{ |
| 1906 | .Shader, | 1906 | .Shader, |
| 1907 | }), | 1907 | }), |
| 1908 | }; | 1908 | }; |
| 1909 | result[@enumToInt(Feature.FunctionPointersINTEL)] = .{ | 1909 | result[@intFromEnum(Feature.FunctionPointersINTEL)] = .{ |
| 1910 | .llvm_name = null, | 1910 | .llvm_name = null, |
| 1911 | .description = "Enable SPIR-V capability FunctionPointersINTEL", | 1911 | .description = "Enable SPIR-V capability FunctionPointersINTEL", |
| 1912 | .dependencies = featureSet(&[_]Feature{}), | 1912 | .dependencies = featureSet(&[_]Feature{}), |
| 1913 | }; | 1913 | }; |
| 1914 | result[@enumToInt(Feature.IndirectReferencesINTEL)] = .{ | 1914 | result[@intFromEnum(Feature.IndirectReferencesINTEL)] = .{ |
| 1915 | .llvm_name = null, | 1915 | .llvm_name = null, |
| 1916 | .description = "Enable SPIR-V capability IndirectReferencesINTEL", | 1916 | .description = "Enable SPIR-V capability IndirectReferencesINTEL", |
| 1917 | .dependencies = featureSet(&[_]Feature{}), | 1917 | .dependencies = featureSet(&[_]Feature{}), |
| 1918 | }; | 1918 | }; |
| 1919 | result[@enumToInt(Feature.AsmINTEL)] = .{ | 1919 | result[@intFromEnum(Feature.AsmINTEL)] = .{ |
| 1920 | .llvm_name = null, | 1920 | .llvm_name = null, |
| 1921 | .description = "Enable SPIR-V capability AsmINTEL", | 1921 | .description = "Enable SPIR-V capability AsmINTEL", |
| 1922 | .dependencies = featureSet(&[_]Feature{}), | 1922 | .dependencies = featureSet(&[_]Feature{}), |
| 1923 | }; | 1923 | }; |
| 1924 | result[@enumToInt(Feature.AtomicFloat32MinMaxEXT)] = .{ | 1924 | result[@intFromEnum(Feature.AtomicFloat32MinMaxEXT)] = .{ |
| 1925 | .llvm_name = null, | 1925 | .llvm_name = null, |
| 1926 | .description = "Enable SPIR-V capability AtomicFloat32MinMaxEXT", | 1926 | .description = "Enable SPIR-V capability AtomicFloat32MinMaxEXT", |
| 1927 | .dependencies = featureSet(&[_]Feature{}), | 1927 | .dependencies = featureSet(&[_]Feature{}), |
| 1928 | }; | 1928 | }; |
| 1929 | result[@enumToInt(Feature.AtomicFloat64MinMaxEXT)] = .{ | 1929 | result[@intFromEnum(Feature.AtomicFloat64MinMaxEXT)] = .{ |
| 1930 | .llvm_name = null, | 1930 | .llvm_name = null, |
| 1931 | .description = "Enable SPIR-V capability AtomicFloat64MinMaxEXT", | 1931 | .description = "Enable SPIR-V capability AtomicFloat64MinMaxEXT", |
| 1932 | .dependencies = featureSet(&[_]Feature{}), | 1932 | .dependencies = featureSet(&[_]Feature{}), |
| 1933 | }; | 1933 | }; |
| 1934 | result[@enumToInt(Feature.AtomicFloat16MinMaxEXT)] = .{ | 1934 | result[@intFromEnum(Feature.AtomicFloat16MinMaxEXT)] = .{ |
| 1935 | .llvm_name = null, | 1935 | .llvm_name = null, |
| 1936 | .description = "Enable SPIR-V capability AtomicFloat16MinMaxEXT", | 1936 | .description = "Enable SPIR-V capability AtomicFloat16MinMaxEXT", |
| 1937 | .dependencies = featureSet(&[_]Feature{}), | 1937 | .dependencies = featureSet(&[_]Feature{}), |
| 1938 | }; | 1938 | }; |
| 1939 | result[@enumToInt(Feature.VectorComputeINTEL)] = .{ | 1939 | result[@intFromEnum(Feature.VectorComputeINTEL)] = .{ |
| 1940 | .llvm_name = null, | 1940 | .llvm_name = null, |
| 1941 | .description = "Enable SPIR-V capability VectorComputeINTEL", | 1941 | .description = "Enable SPIR-V capability VectorComputeINTEL", |
| 1942 | .dependencies = featureSet(&[_]Feature{ | 1942 | .dependencies = featureSet(&[_]Feature{ |
| 1943 | .VectorAnyINTEL, | 1943 | .VectorAnyINTEL, |
| 1944 | }), | 1944 | }), |
| 1945 | }; | 1945 | }; |
| 1946 | result[@enumToInt(Feature.VectorAnyINTEL)] = .{ | 1946 | result[@intFromEnum(Feature.VectorAnyINTEL)] = .{ |
| 1947 | .llvm_name = null, | 1947 | .llvm_name = null, |
| 1948 | .description = "Enable SPIR-V capability VectorAnyINTEL", | 1948 | .description = "Enable SPIR-V capability VectorAnyINTEL", |
| 1949 | .dependencies = featureSet(&[_]Feature{}), | 1949 | .dependencies = featureSet(&[_]Feature{}), |
| 1950 | }; | 1950 | }; |
| 1951 | result[@enumToInt(Feature.ExpectAssumeKHR)] = .{ | 1951 | result[@intFromEnum(Feature.ExpectAssumeKHR)] = .{ |
| 1952 | .llvm_name = null, | 1952 | .llvm_name = null, |
| 1953 | .description = "Enable SPIR-V capability ExpectAssumeKHR", | 1953 | .description = "Enable SPIR-V capability ExpectAssumeKHR", |
| 1954 | .dependencies = featureSet(&[_]Feature{}), | 1954 | .dependencies = featureSet(&[_]Feature{}), |
| 1955 | }; | 1955 | }; |
| 1956 | result[@enumToInt(Feature.SubgroupAvcMotionEstimationINTEL)] = .{ | 1956 | result[@intFromEnum(Feature.SubgroupAvcMotionEstimationINTEL)] = .{ |
| 1957 | .llvm_name = null, | 1957 | .llvm_name = null, |
| 1958 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationINTEL", | 1958 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationINTEL", |
| 1959 | .dependencies = featureSet(&[_]Feature{}), | 1959 | .dependencies = featureSet(&[_]Feature{}), |
| 1960 | }; | 1960 | }; |
| 1961 | result[@enumToInt(Feature.SubgroupAvcMotionEstimationIntraINTEL)] = .{ | 1961 | result[@intFromEnum(Feature.SubgroupAvcMotionEstimationIntraINTEL)] = .{ |
| 1962 | .llvm_name = null, | 1962 | .llvm_name = null, |
| 1963 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationIntraINTEL", | 1963 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationIntraINTEL", |
| 1964 | .dependencies = featureSet(&[_]Feature{}), | 1964 | .dependencies = featureSet(&[_]Feature{}), |
| 1965 | }; | 1965 | }; |
| 1966 | result[@enumToInt(Feature.SubgroupAvcMotionEstimationChromaINTEL)] = .{ | 1966 | result[@intFromEnum(Feature.SubgroupAvcMotionEstimationChromaINTEL)] = .{ |
| 1967 | .llvm_name = null, | 1967 | .llvm_name = null, |
| 1968 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationChromaINTEL", | 1968 | .description = "Enable SPIR-V capability SubgroupAvcMotionEstimationChromaINTEL", |
| 1969 | .dependencies = featureSet(&[_]Feature{}), | 1969 | .dependencies = featureSet(&[_]Feature{}), |
| 1970 | }; | 1970 | }; |
| 1971 | result[@enumToInt(Feature.VariableLengthArrayINTEL)] = .{ | 1971 | result[@intFromEnum(Feature.VariableLengthArrayINTEL)] = .{ |
| 1972 | .llvm_name = null, | 1972 | .llvm_name = null, |
| 1973 | .description = "Enable SPIR-V capability VariableLengthArrayINTEL", | 1973 | .description = "Enable SPIR-V capability VariableLengthArrayINTEL", |
| 1974 | .dependencies = featureSet(&[_]Feature{}), | 1974 | .dependencies = featureSet(&[_]Feature{}), |
| 1975 | }; | 1975 | }; |
| 1976 | result[@enumToInt(Feature.FunctionFloatControlINTEL)] = .{ | 1976 | result[@intFromEnum(Feature.FunctionFloatControlINTEL)] = .{ |
| 1977 | .llvm_name = null, | 1977 | .llvm_name = null, |
| 1978 | .description = "Enable SPIR-V capability FunctionFloatControlINTEL", | 1978 | .description = "Enable SPIR-V capability FunctionFloatControlINTEL", |
| 1979 | .dependencies = featureSet(&[_]Feature{}), | 1979 | .dependencies = featureSet(&[_]Feature{}), |
| 1980 | }; | 1980 | }; |
| 1981 | result[@enumToInt(Feature.FPGAMemoryAttributesINTEL)] = .{ | 1981 | result[@intFromEnum(Feature.FPGAMemoryAttributesINTEL)] = .{ |
| 1982 | .llvm_name = null, | 1982 | .llvm_name = null, |
| 1983 | .description = "Enable SPIR-V capability FPGAMemoryAttributesINTEL", | 1983 | .description = "Enable SPIR-V capability FPGAMemoryAttributesINTEL", |
| 1984 | .dependencies = featureSet(&[_]Feature{}), | 1984 | .dependencies = featureSet(&[_]Feature{}), |
| 1985 | }; | 1985 | }; |
| 1986 | result[@enumToInt(Feature.FPFastMathModeINTEL)] = .{ | 1986 | result[@intFromEnum(Feature.FPFastMathModeINTEL)] = .{ |
| 1987 | .llvm_name = null, | 1987 | .llvm_name = null, |
| 1988 | .description = "Enable SPIR-V capability FPFastMathModeINTEL", | 1988 | .description = "Enable SPIR-V capability FPFastMathModeINTEL", |
| 1989 | .dependencies = featureSet(&[_]Feature{ | 1989 | .dependencies = featureSet(&[_]Feature{ |
| 1990 | .Kernel, | 1990 | .Kernel, |
| 1991 | }), | 1991 | }), |
| 1992 | }; | 1992 | }; |
| 1993 | result[@enumToInt(Feature.ArbitraryPrecisionIntegersINTEL)] = .{ | 1993 | result[@intFromEnum(Feature.ArbitraryPrecisionIntegersINTEL)] = .{ |
| 1994 | .llvm_name = null, | 1994 | .llvm_name = null, |
| 1995 | .description = "Enable SPIR-V capability ArbitraryPrecisionIntegersINTEL", | 1995 | .description = "Enable SPIR-V capability ArbitraryPrecisionIntegersINTEL", |
| 1996 | .dependencies = featureSet(&[_]Feature{}), | 1996 | .dependencies = featureSet(&[_]Feature{}), |
| 1997 | }; | 1997 | }; |
| 1998 | result[@enumToInt(Feature.UnstructuredLoopControlsINTEL)] = .{ | 1998 | result[@intFromEnum(Feature.UnstructuredLoopControlsINTEL)] = .{ |
| 1999 | .llvm_name = null, | 1999 | .llvm_name = null, |
| 2000 | .description = "Enable SPIR-V capability UnstructuredLoopControlsINTEL", | 2000 | .description = "Enable SPIR-V capability UnstructuredLoopControlsINTEL", |
| 2001 | .dependencies = featureSet(&[_]Feature{}), | 2001 | .dependencies = featureSet(&[_]Feature{}), |
| 2002 | }; | 2002 | }; |
| 2003 | result[@enumToInt(Feature.FPGALoopControlsINTEL)] = .{ | 2003 | result[@intFromEnum(Feature.FPGALoopControlsINTEL)] = .{ |
| 2004 | .llvm_name = null, | 2004 | .llvm_name = null, |
| 2005 | .description = "Enable SPIR-V capability FPGALoopControlsINTEL", | 2005 | .description = "Enable SPIR-V capability FPGALoopControlsINTEL", |
| 2006 | .dependencies = featureSet(&[_]Feature{}), | 2006 | .dependencies = featureSet(&[_]Feature{}), |
| 2007 | }; | 2007 | }; |
| 2008 | result[@enumToInt(Feature.KernelAttributesINTEL)] = .{ | 2008 | result[@intFromEnum(Feature.KernelAttributesINTEL)] = .{ |
| 2009 | .llvm_name = null, | 2009 | .llvm_name = null, |
| 2010 | .description = "Enable SPIR-V capability KernelAttributesINTEL", | 2010 | .description = "Enable SPIR-V capability KernelAttributesINTEL", |
| 2011 | .dependencies = featureSet(&[_]Feature{}), | 2011 | .dependencies = featureSet(&[_]Feature{}), |
| 2012 | }; | 2012 | }; |
| 2013 | result[@enumToInt(Feature.FPGAKernelAttributesINTEL)] = .{ | 2013 | result[@intFromEnum(Feature.FPGAKernelAttributesINTEL)] = .{ |
| 2014 | .llvm_name = null, | 2014 | .llvm_name = null, |
| 2015 | .description = "Enable SPIR-V capability FPGAKernelAttributesINTEL", | 2015 | .description = "Enable SPIR-V capability FPGAKernelAttributesINTEL", |
| 2016 | .dependencies = featureSet(&[_]Feature{}), | 2016 | .dependencies = featureSet(&[_]Feature{}), |
| 2017 | }; | 2017 | }; |
| 2018 | result[@enumToInt(Feature.FPGAMemoryAccessesINTEL)] = .{ | 2018 | result[@intFromEnum(Feature.FPGAMemoryAccessesINTEL)] = .{ |
| 2019 | .llvm_name = null, | 2019 | .llvm_name = null, |
| 2020 | .description = "Enable SPIR-V capability FPGAMemoryAccessesINTEL", | 2020 | .description = "Enable SPIR-V capability FPGAMemoryAccessesINTEL", |
| 2021 | .dependencies = featureSet(&[_]Feature{}), | 2021 | .dependencies = featureSet(&[_]Feature{}), |
| 2022 | }; | 2022 | }; |
| 2023 | result[@enumToInt(Feature.FPGAClusterAttributesINTEL)] = .{ | 2023 | result[@intFromEnum(Feature.FPGAClusterAttributesINTEL)] = .{ |
| 2024 | .llvm_name = null, | 2024 | .llvm_name = null, |
| 2025 | .description = "Enable SPIR-V capability FPGAClusterAttributesINTEL", | 2025 | .description = "Enable SPIR-V capability FPGAClusterAttributesINTEL", |
| 2026 | .dependencies = featureSet(&[_]Feature{}), | 2026 | .dependencies = featureSet(&[_]Feature{}), |
| 2027 | }; | 2027 | }; |
| 2028 | result[@enumToInt(Feature.LoopFuseINTEL)] = .{ | 2028 | result[@intFromEnum(Feature.LoopFuseINTEL)] = .{ |
| 2029 | .llvm_name = null, | 2029 | .llvm_name = null, |
| 2030 | .description = "Enable SPIR-V capability LoopFuseINTEL", | 2030 | .description = "Enable SPIR-V capability LoopFuseINTEL", |
| 2031 | .dependencies = featureSet(&[_]Feature{}), | 2031 | .dependencies = featureSet(&[_]Feature{}), |
| 2032 | }; | 2032 | }; |
| 2033 | result[@enumToInt(Feature.FPGABufferLocationINTEL)] = .{ | 2033 | result[@intFromEnum(Feature.FPGABufferLocationINTEL)] = .{ |
| 2034 | .llvm_name = null, | 2034 | .llvm_name = null, |
| 2035 | .description = "Enable SPIR-V capability FPGABufferLocationINTEL", | 2035 | .description = "Enable SPIR-V capability FPGABufferLocationINTEL", |
| 2036 | .dependencies = featureSet(&[_]Feature{}), | 2036 | .dependencies = featureSet(&[_]Feature{}), |
| 2037 | }; | 2037 | }; |
| 2038 | result[@enumToInt(Feature.USMStorageClassesINTEL)] = .{ | 2038 | result[@intFromEnum(Feature.USMStorageClassesINTEL)] = .{ |
| 2039 | .llvm_name = null, | 2039 | .llvm_name = null, |
| 2040 | .description = "Enable SPIR-V capability USMStorageClassesINTEL", | 2040 | .description = "Enable SPIR-V capability USMStorageClassesINTEL", |
| 2041 | .dependencies = featureSet(&[_]Feature{}), | 2041 | .dependencies = featureSet(&[_]Feature{}), |
| 2042 | }; | 2042 | }; |
| 2043 | result[@enumToInt(Feature.IOPipesINTEL)] = .{ | 2043 | result[@intFromEnum(Feature.IOPipesINTEL)] = .{ |
| 2044 | .llvm_name = null, | 2044 | .llvm_name = null, |
| 2045 | .description = "Enable SPIR-V capability IOPipesINTEL", | 2045 | .description = "Enable SPIR-V capability IOPipesINTEL", |
| 2046 | .dependencies = featureSet(&[_]Feature{}), | 2046 | .dependencies = featureSet(&[_]Feature{}), |
| 2047 | }; | 2047 | }; |
| 2048 | result[@enumToInt(Feature.BlockingPipesINTEL)] = .{ | 2048 | result[@intFromEnum(Feature.BlockingPipesINTEL)] = .{ |
| 2049 | .llvm_name = null, | 2049 | .llvm_name = null, |
| 2050 | .description = "Enable SPIR-V capability BlockingPipesINTEL", | 2050 | .description = "Enable SPIR-V capability BlockingPipesINTEL", |
| 2051 | .dependencies = featureSet(&[_]Feature{}), | 2051 | .dependencies = featureSet(&[_]Feature{}), |
| 2052 | }; | 2052 | }; |
| 2053 | result[@enumToInt(Feature.FPGARegINTEL)] = .{ | 2053 | result[@intFromEnum(Feature.FPGARegINTEL)] = .{ |
| 2054 | .llvm_name = null, | 2054 | .llvm_name = null, |
| 2055 | .description = "Enable SPIR-V capability FPGARegINTEL", | 2055 | .description = "Enable SPIR-V capability FPGARegINTEL", |
| 2056 | .dependencies = featureSet(&[_]Feature{}), | 2056 | .dependencies = featureSet(&[_]Feature{}), |
| 2057 | }; | 2057 | }; |
| 2058 | result[@enumToInt(Feature.AtomicFloat32AddEXT)] = .{ | 2058 | result[@intFromEnum(Feature.AtomicFloat32AddEXT)] = .{ |
| 2059 | .llvm_name = null, | 2059 | .llvm_name = null, |
| 2060 | .description = "Enable SPIR-V capability AtomicFloat32AddEXT", | 2060 | .description = "Enable SPIR-V capability AtomicFloat32AddEXT", |
| 2061 | .dependencies = featureSet(&[_]Feature{ | 2061 | .dependencies = featureSet(&[_]Feature{ |
| 2062 | .Shader, | 2062 | .Shader, |
| 2063 | }), | 2063 | }), |
| 2064 | }; | 2064 | }; |
| 2065 | result[@enumToInt(Feature.AtomicFloat64AddEXT)] = .{ | 2065 | result[@intFromEnum(Feature.AtomicFloat64AddEXT)] = .{ |
| 2066 | .llvm_name = null, | 2066 | .llvm_name = null, |
| 2067 | .description = "Enable SPIR-V capability AtomicFloat64AddEXT", | 2067 | .description = "Enable SPIR-V capability AtomicFloat64AddEXT", |
| 2068 | .dependencies = featureSet(&[_]Feature{ | 2068 | .dependencies = featureSet(&[_]Feature{ |
| 2069 | .Shader, | 2069 | .Shader, |
| 2070 | }), | 2070 | }), |
| 2071 | }; | 2071 | }; |
| 2072 | result[@enumToInt(Feature.LongConstantCompositeINTEL)] = .{ | 2072 | result[@intFromEnum(Feature.LongConstantCompositeINTEL)] = .{ |
| 2073 | .llvm_name = null, | 2073 | .llvm_name = null, |
| 2074 | .description = "Enable SPIR-V capability LongConstantCompositeINTEL", | 2074 | .description = "Enable SPIR-V capability LongConstantCompositeINTEL", |
| 2075 | .dependencies = featureSet(&[_]Feature{}), | 2075 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/ve.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).Enum.fields.len; | 17 | const len = @typeInfo(Feature).Enum.fields.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@enumToInt(Feature.vpu)] = .{ | 20 | result[@intFromEnum(Feature.vpu)] = .{ |
| 21 | .llvm_name = "vpu", | 21 | .llvm_name = "vpu", |
| 22 | .description = "Enable the VPU", | 22 | .description = "Enable the VPU", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/wasm.zig+12-12| ... | @@ -28,62 +28,62 @@ pub const all_features = blk: { | ... | @@ -28,62 +28,62 @@ pub const all_features = blk: { |
| 28 | const len = @typeInfo(Feature).Enum.fields.len; | 28 | const len = @typeInfo(Feature).Enum.fields.len; |
| 29 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 29 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 30 | var result: [len]CpuFeature = undefined; | 30 | var result: [len]CpuFeature = undefined; |
| 31 | result[@enumToInt(Feature.atomics)] = .{ | 31 | result[@intFromEnum(Feature.atomics)] = .{ |
| 32 | .llvm_name = "atomics", | 32 | .llvm_name = "atomics", |
| 33 | .description = "Enable Atomics", | 33 | .description = "Enable Atomics", |
| 34 | .dependencies = featureSet(&[_]Feature{}), | 34 | .dependencies = featureSet(&[_]Feature{}), |
| 35 | }; | 35 | }; |
| 36 | result[@enumToInt(Feature.bulk_memory)] = .{ | 36 | result[@intFromEnum(Feature.bulk_memory)] = .{ |
| 37 | .llvm_name = "bulk-memory", | 37 | .llvm_name = "bulk-memory", |
| 38 | .description = "Enable bulk memory operations", | 38 | .description = "Enable bulk memory operations", |
| 39 | .dependencies = featureSet(&[_]Feature{}), | 39 | .dependencies = featureSet(&[_]Feature{}), |
| 40 | }; | 40 | }; |
| 41 | result[@enumToInt(Feature.exception_handling)] = .{ | 41 | result[@intFromEnum(Feature.exception_handling)] = .{ |
| 42 | .llvm_name = "exception-handling", | 42 | .llvm_name = "exception-handling", |
| 43 | .description = "Enable Wasm exception handling", | 43 | .description = "Enable Wasm exception handling", |
| 44 | .dependencies = featureSet(&[_]Feature{}), | 44 | .dependencies = featureSet(&[_]Feature{}), |
| 45 | }; | 45 | }; |
| 46 | result[@enumToInt(Feature.extended_const)] = .{ | 46 | result[@intFromEnum(Feature.extended_const)] = .{ |
| 47 | .llvm_name = "extended-const", | 47 | .llvm_name = "extended-const", |
| 48 | .description = "Enable extended const expressions", | 48 | .description = "Enable extended const expressions", |
| 49 | .dependencies = featureSet(&[_]Feature{}), | 49 | .dependencies = featureSet(&[_]Feature{}), |
| 50 | }; | 50 | }; |
| 51 | result[@enumToInt(Feature.multivalue)] = .{ | 51 | result[@intFromEnum(Feature.multivalue)] = .{ |
| 52 | .llvm_name = "multivalue", | 52 | .llvm_name = "multivalue", |
| 53 | .description = "Enable multivalue blocks, instructions, and functions", | 53 | .description = "Enable multivalue blocks, instructions, and functions", |
| 54 | .dependencies = featureSet(&[_]Feature{}), | 54 | .dependencies = featureSet(&[_]Feature{}), |
| 55 | }; | 55 | }; |
| 56 | result[@enumToInt(Feature.mutable_globals)] = .{ | 56 | result[@intFromEnum(Feature.mutable_globals)] = .{ |
| 57 | .llvm_name = "mutable-globals", | 57 | .llvm_name = "mutable-globals", |
| 58 | .description = "Enable mutable globals", | 58 | .description = "Enable mutable globals", |
| 59 | .dependencies = featureSet(&[_]Feature{}), | 59 | .dependencies = featureSet(&[_]Feature{}), |
| 60 | }; | 60 | }; |
| 61 | result[@enumToInt(Feature.nontrapping_fptoint)] = .{ | 61 | result[@intFromEnum(Feature.nontrapping_fptoint)] = .{ |
| 62 | .llvm_name = "nontrapping-fptoint", | 62 | .llvm_name = "nontrapping-fptoint", |
| 63 | .description = "Enable non-trapping float-to-int conversion operators", | 63 | .description = "Enable non-trapping float-to-int conversion operators", |
| 64 | .dependencies = featureSet(&[_]Feature{}), | 64 | .dependencies = featureSet(&[_]Feature{}), |
| 65 | }; | 65 | }; |
| 66 | result[@enumToInt(Feature.reference_types)] = .{ | 66 | result[@intFromEnum(Feature.reference_types)] = .{ |
| 67 | .llvm_name = "reference-types", | 67 | .llvm_name = "reference-types", |
| 68 | .description = "Enable reference types", | 68 | .description = "Enable reference types", |
| 69 | .dependencies = featureSet(&[_]Feature{}), | 69 | .dependencies = featureSet(&[_]Feature{}), |
| 70 | }; | 70 | }; |
| 71 | result[@enumToInt(Feature.relaxed_simd)] = .{ | 71 | result[@intFromEnum(Feature.relaxed_simd)] = .{ |
| 72 | .llvm_name = "relaxed-simd", | 72 | .llvm_name = "relaxed-simd", |
| 73 | .description = "Enable relaxed-simd instructions", | 73 | .description = "Enable relaxed-simd instructions", |
| 74 | .dependencies = featureSet(&[_]Feature{}), | 74 | .dependencies = featureSet(&[_]Feature{}), |
| 75 | }; | 75 | }; |
| 76 | result[@enumToInt(Feature.sign_ext)] = .{ | 76 | result[@intFromEnum(Feature.sign_ext)] = .{ |
| 77 | .llvm_name = "sign-ext", | 77 | .llvm_name = "sign-ext", |
| 78 | .description = "Enable sign extension operators", | 78 | .description = "Enable sign extension operators", |
| 79 | .dependencies = featureSet(&[_]Feature{}), | 79 | .dependencies = featureSet(&[_]Feature{}), |
| 80 | }; | 80 | }; |
| 81 | result[@enumToInt(Feature.simd128)] = .{ | 81 | result[@intFromEnum(Feature.simd128)] = .{ |
| 82 | .llvm_name = "simd128", | 82 | .llvm_name = "simd128", |
| 83 | .description = "Enable 128-bit SIMD", | 83 | .description = "Enable 128-bit SIMD", |
| 84 | .dependencies = featureSet(&[_]Feature{}), | 84 | .dependencies = featureSet(&[_]Feature{}), |
| 85 | }; | 85 | }; |
| 86 | result[@enumToInt(Feature.tail_call)] = .{ | 86 | result[@intFromEnum(Feature.tail_call)] = .{ |
| 87 | .llvm_name = "tail-call", | 87 | .llvm_name = "tail-call", |
| 88 | .description = "Enable tail call instructions", | 88 | .description = "Enable tail call instructions", |
| 89 | .dependencies = featureSet(&[_]Feature{}), | 89 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/target/x86.zig+162-162| ... | @@ -178,135 +178,135 @@ pub const all_features = blk: { | ... | @@ -178,135 +178,135 @@ pub const all_features = blk: { |
| 178 | const len = @typeInfo(Feature).Enum.fields.len; | 178 | const len = @typeInfo(Feature).Enum.fields.len; |
| 179 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 179 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 180 | var result: [len]CpuFeature = undefined; | 180 | var result: [len]CpuFeature = undefined; |
| 181 | result[@enumToInt(Feature.@"16bit_mode")] = .{ | 181 | result[@intFromEnum(Feature.@"16bit_mode")] = .{ |
| 182 | .llvm_name = "16bit-mode", | 182 | .llvm_name = "16bit-mode", |
| 183 | .description = "16-bit mode (i8086)", | 183 | .description = "16-bit mode (i8086)", |
| 184 | .dependencies = featureSet(&[_]Feature{}), | 184 | .dependencies = featureSet(&[_]Feature{}), |
| 185 | }; | 185 | }; |
| 186 | result[@enumToInt(Feature.@"32bit_mode")] = .{ | 186 | result[@intFromEnum(Feature.@"32bit_mode")] = .{ |
| 187 | .llvm_name = "32bit-mode", | 187 | .llvm_name = "32bit-mode", |
| 188 | .description = "32-bit mode (80386)", | 188 | .description = "32-bit mode (80386)", |
| 189 | .dependencies = featureSet(&[_]Feature{}), | 189 | .dependencies = featureSet(&[_]Feature{}), |
| 190 | }; | 190 | }; |
| 191 | result[@enumToInt(Feature.@"3dnow")] = .{ | 191 | result[@intFromEnum(Feature.@"3dnow")] = .{ |
| 192 | .llvm_name = "3dnow", | 192 | .llvm_name = "3dnow", |
| 193 | .description = "Enable 3DNow! instructions", | 193 | .description = "Enable 3DNow! instructions", |
| 194 | .dependencies = featureSet(&[_]Feature{ | 194 | .dependencies = featureSet(&[_]Feature{ |
| 195 | .mmx, | 195 | .mmx, |
| 196 | }), | 196 | }), |
| 197 | }; | 197 | }; |
| 198 | result[@enumToInt(Feature.@"3dnowa")] = .{ | 198 | result[@intFromEnum(Feature.@"3dnowa")] = .{ |
| 199 | .llvm_name = "3dnowa", | 199 | .llvm_name = "3dnowa", |
| 200 | .description = "Enable 3DNow! Athlon instructions", | 200 | .description = "Enable 3DNow! Athlon instructions", |
| 201 | .dependencies = featureSet(&[_]Feature{ | 201 | .dependencies = featureSet(&[_]Feature{ |
| 202 | .@"3dnow", | 202 | .@"3dnow", |
| 203 | }), | 203 | }), |
| 204 | }; | 204 | }; |
| 205 | result[@enumToInt(Feature.@"64bit")] = .{ | 205 | result[@intFromEnum(Feature.@"64bit")] = .{ |
| 206 | .llvm_name = "64bit", | 206 | .llvm_name = "64bit", |
| 207 | .description = "Support 64-bit instructions", | 207 | .description = "Support 64-bit instructions", |
| 208 | .dependencies = featureSet(&[_]Feature{}), | 208 | .dependencies = featureSet(&[_]Feature{}), |
| 209 | }; | 209 | }; |
| 210 | result[@enumToInt(Feature.adx)] = .{ | 210 | result[@intFromEnum(Feature.adx)] = .{ |
| 211 | .llvm_name = "adx", | 211 | .llvm_name = "adx", |
| 212 | .description = "Support ADX instructions", | 212 | .description = "Support ADX instructions", |
| 213 | .dependencies = featureSet(&[_]Feature{}), | 213 | .dependencies = featureSet(&[_]Feature{}), |
| 214 | }; | 214 | }; |
| 215 | result[@enumToInt(Feature.aes)] = .{ | 215 | result[@intFromEnum(Feature.aes)] = .{ |
| 216 | .llvm_name = "aes", | 216 | .llvm_name = "aes", |
| 217 | .description = "Enable AES instructions", | 217 | .description = "Enable AES instructions", |
| 218 | .dependencies = featureSet(&[_]Feature{ | 218 | .dependencies = featureSet(&[_]Feature{ |
| 219 | .sse2, | 219 | .sse2, |
| 220 | }), | 220 | }), |
| 221 | }; | 221 | }; |
| 222 | result[@enumToInt(Feature.allow_light_256_bit)] = .{ | 222 | result[@intFromEnum(Feature.allow_light_256_bit)] = .{ |
| 223 | .llvm_name = "allow-light-256-bit", | 223 | .llvm_name = "allow-light-256-bit", |
| 224 | .description = "Enable generation of 256-bit load/stores even if we prefer 128-bit", | 224 | .description = "Enable generation of 256-bit load/stores even if we prefer 128-bit", |
| 225 | .dependencies = featureSet(&[_]Feature{}), | 225 | .dependencies = featureSet(&[_]Feature{}), |
| 226 | }; | 226 | }; |
| 227 | result[@enumToInt(Feature.amx_bf16)] = .{ | 227 | result[@intFromEnum(Feature.amx_bf16)] = .{ |
| 228 | .llvm_name = "amx-bf16", | 228 | .llvm_name = "amx-bf16", |
| 229 | .description = "Support AMX-BF16 instructions", | 229 | .description = "Support AMX-BF16 instructions", |
| 230 | .dependencies = featureSet(&[_]Feature{ | 230 | .dependencies = featureSet(&[_]Feature{ |
| 231 | .amx_tile, | 231 | .amx_tile, |
| 232 | }), | 232 | }), |
| 233 | }; | 233 | }; |
| 234 | result[@enumToInt(Feature.amx_fp16)] = .{ | 234 | result[@intFromEnum(Feature.amx_fp16)] = .{ |
| 235 | .llvm_name = "amx-fp16", | 235 | .llvm_name = "amx-fp16", |
| 236 | .description = "Support AMX amx-fp16 instructions", | 236 | .description = "Support AMX amx-fp16 instructions", |
| 237 | .dependencies = featureSet(&[_]Feature{ | 237 | .dependencies = featureSet(&[_]Feature{ |
| 238 | .amx_tile, | 238 | .amx_tile, |
| 239 | }), | 239 | }), |
| 240 | }; | 240 | }; |
| 241 | result[@enumToInt(Feature.amx_int8)] = .{ | 241 | result[@intFromEnum(Feature.amx_int8)] = .{ |
| 242 | .llvm_name = "amx-int8", | 242 | .llvm_name = "amx-int8", |
| 243 | .description = "Support AMX-INT8 instructions", | 243 | .description = "Support AMX-INT8 instructions", |
| 244 | .dependencies = featureSet(&[_]Feature{ | 244 | .dependencies = featureSet(&[_]Feature{ |
| 245 | .amx_tile, | 245 | .amx_tile, |
| 246 | }), | 246 | }), |
| 247 | }; | 247 | }; |
| 248 | result[@enumToInt(Feature.amx_tile)] = .{ | 248 | result[@intFromEnum(Feature.amx_tile)] = .{ |
| 249 | .llvm_name = "amx-tile", | 249 | .llvm_name = "amx-tile", |
| 250 | .description = "Support AMX-TILE instructions", | 250 | .description = "Support AMX-TILE instructions", |
| 251 | .dependencies = featureSet(&[_]Feature{}), | 251 | .dependencies = featureSet(&[_]Feature{}), |
| 252 | }; | 252 | }; |
| 253 | result[@enumToInt(Feature.avx)] = .{ | 253 | result[@intFromEnum(Feature.avx)] = .{ |
| 254 | .llvm_name = "avx", | 254 | .llvm_name = "avx", |
| 255 | .description = "Enable AVX instructions", | 255 | .description = "Enable AVX instructions", |
| 256 | .dependencies = featureSet(&[_]Feature{ | 256 | .dependencies = featureSet(&[_]Feature{ |
| 257 | .sse4_2, | 257 | .sse4_2, |
| 258 | }), | 258 | }), |
| 259 | }; | 259 | }; |
| 260 | result[@enumToInt(Feature.avx2)] = .{ | 260 | result[@intFromEnum(Feature.avx2)] = .{ |
| 261 | .llvm_name = "avx2", | 261 | .llvm_name = "avx2", |
| 262 | .description = "Enable AVX2 instructions", | 262 | .description = "Enable AVX2 instructions", |
| 263 | .dependencies = featureSet(&[_]Feature{ | 263 | .dependencies = featureSet(&[_]Feature{ |
| 264 | .avx, | 264 | .avx, |
| 265 | }), | 265 | }), |
| 266 | }; | 266 | }; |
| 267 | result[@enumToInt(Feature.avx512bf16)] = .{ | 267 | result[@intFromEnum(Feature.avx512bf16)] = .{ |
| 268 | .llvm_name = "avx512bf16", | 268 | .llvm_name = "avx512bf16", |
| 269 | .description = "Support bfloat16 floating point", | 269 | .description = "Support bfloat16 floating point", |
| 270 | .dependencies = featureSet(&[_]Feature{ | 270 | .dependencies = featureSet(&[_]Feature{ |
| 271 | .avx512bw, | 271 | .avx512bw, |
| 272 | }), | 272 | }), |
| 273 | }; | 273 | }; |
| 274 | result[@enumToInt(Feature.avx512bitalg)] = .{ | 274 | result[@intFromEnum(Feature.avx512bitalg)] = .{ |
| 275 | .llvm_name = "avx512bitalg", | 275 | .llvm_name = "avx512bitalg", |
| 276 | .description = "Enable AVX-512 Bit Algorithms", | 276 | .description = "Enable AVX-512 Bit Algorithms", |
| 277 | .dependencies = featureSet(&[_]Feature{ | 277 | .dependencies = featureSet(&[_]Feature{ |
| 278 | .avx512bw, | 278 | .avx512bw, |
| 279 | }), | 279 | }), |
| 280 | }; | 280 | }; |
| 281 | result[@enumToInt(Feature.avx512bw)] = .{ | 281 | result[@intFromEnum(Feature.avx512bw)] = .{ |
| 282 | .llvm_name = "avx512bw", | 282 | .llvm_name = "avx512bw", |
| 283 | .description = "Enable AVX-512 Byte and Word Instructions", | 283 | .description = "Enable AVX-512 Byte and Word Instructions", |
| 284 | .dependencies = featureSet(&[_]Feature{ | 284 | .dependencies = featureSet(&[_]Feature{ |
| 285 | .avx512f, | 285 | .avx512f, |
| 286 | }), | 286 | }), |
| 287 | }; | 287 | }; |
| 288 | result[@enumToInt(Feature.avx512cd)] = .{ | 288 | result[@intFromEnum(Feature.avx512cd)] = .{ |
| 289 | .llvm_name = "avx512cd", | 289 | .llvm_name = "avx512cd", |
| 290 | .description = "Enable AVX-512 Conflict Detection Instructions", | 290 | .description = "Enable AVX-512 Conflict Detection Instructions", |
| 291 | .dependencies = featureSet(&[_]Feature{ | 291 | .dependencies = featureSet(&[_]Feature{ |
| 292 | .avx512f, | 292 | .avx512f, |
| 293 | }), | 293 | }), |
| 294 | }; | 294 | }; |
| 295 | result[@enumToInt(Feature.avx512dq)] = .{ | 295 | result[@intFromEnum(Feature.avx512dq)] = .{ |
| 296 | .llvm_name = "avx512dq", | 296 | .llvm_name = "avx512dq", |
| 297 | .description = "Enable AVX-512 Doubleword and Quadword Instructions", | 297 | .description = "Enable AVX-512 Doubleword and Quadword Instructions", |
| 298 | .dependencies = featureSet(&[_]Feature{ | 298 | .dependencies = featureSet(&[_]Feature{ |
| 299 | .avx512f, | 299 | .avx512f, |
| 300 | }), | 300 | }), |
| 301 | }; | 301 | }; |
| 302 | result[@enumToInt(Feature.avx512er)] = .{ | 302 | result[@intFromEnum(Feature.avx512er)] = .{ |
| 303 | .llvm_name = "avx512er", | 303 | .llvm_name = "avx512er", |
| 304 | .description = "Enable AVX-512 Exponential and Reciprocal Instructions", | 304 | .description = "Enable AVX-512 Exponential and Reciprocal Instructions", |
| 305 | .dependencies = featureSet(&[_]Feature{ | 305 | .dependencies = featureSet(&[_]Feature{ |
| 306 | .avx512f, | 306 | .avx512f, |
| 307 | }), | 307 | }), |
| 308 | }; | 308 | }; |
| 309 | result[@enumToInt(Feature.avx512f)] = .{ | 309 | result[@intFromEnum(Feature.avx512f)] = .{ |
| 310 | .llvm_name = "avx512f", | 310 | .llvm_name = "avx512f", |
| 311 | .description = "Enable AVX-512 instructions", | 311 | .description = "Enable AVX-512 instructions", |
| 312 | .dependencies = featureSet(&[_]Feature{ | 312 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -315,7 +315,7 @@ pub const all_features = blk: { | ... | @@ -315,7 +315,7 @@ pub const all_features = blk: { |
| 315 | .fma, | 315 | .fma, |
| 316 | }), | 316 | }), |
| 317 | }; | 317 | }; |
| 318 | result[@enumToInt(Feature.avx512fp16)] = .{ | 318 | result[@intFromEnum(Feature.avx512fp16)] = .{ |
| 319 | .llvm_name = "avx512fp16", | 319 | .llvm_name = "avx512fp16", |
| 320 | .description = "Support 16-bit floating point", | 320 | .description = "Support 16-bit floating point", |
| 321 | .dependencies = featureSet(&[_]Feature{ | 321 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -324,287 +324,287 @@ pub const all_features = blk: { | ... | @@ -324,287 +324,287 @@ pub const all_features = blk: { |
| 324 | .avx512vl, | 324 | .avx512vl, |
| 325 | }), | 325 | }), |
| 326 | }; | 326 | }; |
| 327 | result[@enumToInt(Feature.avx512ifma)] = .{ | 327 | result[@intFromEnum(Feature.avx512ifma)] = .{ |
| 328 | .llvm_name = "avx512ifma", | 328 | .llvm_name = "avx512ifma", |
| 329 | .description = "Enable AVX-512 Integer Fused Multiply-Add", | 329 | .description = "Enable AVX-512 Integer Fused Multiply-Add", |
| 330 | .dependencies = featureSet(&[_]Feature{ | 330 | .dependencies = featureSet(&[_]Feature{ |
| 331 | .avx512f, | 331 | .avx512f, |
| 332 | }), | 332 | }), |
| 333 | }; | 333 | }; |
| 334 | result[@enumToInt(Feature.avx512pf)] = .{ | 334 | result[@intFromEnum(Feature.avx512pf)] = .{ |
| 335 | .llvm_name = "avx512pf", | 335 | .llvm_name = "avx512pf", |
| 336 | .description = "Enable AVX-512 PreFetch Instructions", | 336 | .description = "Enable AVX-512 PreFetch Instructions", |
| 337 | .dependencies = featureSet(&[_]Feature{ | 337 | .dependencies = featureSet(&[_]Feature{ |
| 338 | .avx512f, | 338 | .avx512f, |
| 339 | }), | 339 | }), |
| 340 | }; | 340 | }; |
| 341 | result[@enumToInt(Feature.avx512vbmi)] = .{ | 341 | result[@intFromEnum(Feature.avx512vbmi)] = .{ |
| 342 | .llvm_name = "avx512vbmi", | 342 | .llvm_name = "avx512vbmi", |
| 343 | .description = "Enable AVX-512 Vector Byte Manipulation Instructions", | 343 | .description = "Enable AVX-512 Vector Byte Manipulation Instructions", |
| 344 | .dependencies = featureSet(&[_]Feature{ | 344 | .dependencies = featureSet(&[_]Feature{ |
| 345 | .avx512bw, | 345 | .avx512bw, |
| 346 | }), | 346 | }), |
| 347 | }; | 347 | }; |
| 348 | result[@enumToInt(Feature.avx512vbmi2)] = .{ | 348 | result[@intFromEnum(Feature.avx512vbmi2)] = .{ |
| 349 | .llvm_name = "avx512vbmi2", | 349 | .llvm_name = "avx512vbmi2", |
| 350 | .description = "Enable AVX-512 further Vector Byte Manipulation Instructions", | 350 | .description = "Enable AVX-512 further Vector Byte Manipulation Instructions", |
| 351 | .dependencies = featureSet(&[_]Feature{ | 351 | .dependencies = featureSet(&[_]Feature{ |
| 352 | .avx512bw, | 352 | .avx512bw, |
| 353 | }), | 353 | }), |
| 354 | }; | 354 | }; |
| 355 | result[@enumToInt(Feature.avx512vl)] = .{ | 355 | result[@intFromEnum(Feature.avx512vl)] = .{ |
| 356 | .llvm_name = "avx512vl", | 356 | .llvm_name = "avx512vl", |
| 357 | .description = "Enable AVX-512 Vector Length eXtensions", | 357 | .description = "Enable AVX-512 Vector Length eXtensions", |
| 358 | .dependencies = featureSet(&[_]Feature{ | 358 | .dependencies = featureSet(&[_]Feature{ |
| 359 | .avx512f, | 359 | .avx512f, |
| 360 | }), | 360 | }), |
| 361 | }; | 361 | }; |
| 362 | result[@enumToInt(Feature.avx512vnni)] = .{ | 362 | result[@intFromEnum(Feature.avx512vnni)] = .{ |
| 363 | .llvm_name = "avx512vnni", | 363 | .llvm_name = "avx512vnni", |
| 364 | .description = "Enable AVX-512 Vector Neural Network Instructions", | 364 | .description = "Enable AVX-512 Vector Neural Network Instructions", |
| 365 | .dependencies = featureSet(&[_]Feature{ | 365 | .dependencies = featureSet(&[_]Feature{ |
| 366 | .avx512f, | 366 | .avx512f, |
| 367 | }), | 367 | }), |
| 368 | }; | 368 | }; |
| 369 | result[@enumToInt(Feature.avx512vp2intersect)] = .{ | 369 | result[@intFromEnum(Feature.avx512vp2intersect)] = .{ |
| 370 | .llvm_name = "avx512vp2intersect", | 370 | .llvm_name = "avx512vp2intersect", |
| 371 | .description = "Enable AVX-512 vp2intersect", | 371 | .description = "Enable AVX-512 vp2intersect", |
| 372 | .dependencies = featureSet(&[_]Feature{ | 372 | .dependencies = featureSet(&[_]Feature{ |
| 373 | .avx512f, | 373 | .avx512f, |
| 374 | }), | 374 | }), |
| 375 | }; | 375 | }; |
| 376 | result[@enumToInt(Feature.avx512vpopcntdq)] = .{ | 376 | result[@intFromEnum(Feature.avx512vpopcntdq)] = .{ |
| 377 | .llvm_name = "avx512vpopcntdq", | 377 | .llvm_name = "avx512vpopcntdq", |
| 378 | .description = "Enable AVX-512 Population Count Instructions", | 378 | .description = "Enable AVX-512 Population Count Instructions", |
| 379 | .dependencies = featureSet(&[_]Feature{ | 379 | .dependencies = featureSet(&[_]Feature{ |
| 380 | .avx512f, | 380 | .avx512f, |
| 381 | }), | 381 | }), |
| 382 | }; | 382 | }; |
| 383 | result[@enumToInt(Feature.avxifma)] = .{ | 383 | result[@intFromEnum(Feature.avxifma)] = .{ |
| 384 | .llvm_name = "avxifma", | 384 | .llvm_name = "avxifma", |
| 385 | .description = "Enable AVX-IFMA", | 385 | .description = "Enable AVX-IFMA", |
| 386 | .dependencies = featureSet(&[_]Feature{ | 386 | .dependencies = featureSet(&[_]Feature{ |
| 387 | .avx2, | 387 | .avx2, |
| 388 | }), | 388 | }), |
| 389 | }; | 389 | }; |
| 390 | result[@enumToInt(Feature.avxneconvert)] = .{ | 390 | result[@intFromEnum(Feature.avxneconvert)] = .{ |
| 391 | .llvm_name = "avxneconvert", | 391 | .llvm_name = "avxneconvert", |
| 392 | .description = "Support AVX-NE-CONVERT instructions", | 392 | .description = "Support AVX-NE-CONVERT instructions", |
| 393 | .dependencies = featureSet(&[_]Feature{ | 393 | .dependencies = featureSet(&[_]Feature{ |
| 394 | .avx2, | 394 | .avx2, |
| 395 | }), | 395 | }), |
| 396 | }; | 396 | }; |
| 397 | result[@enumToInt(Feature.avxvnni)] = .{ | 397 | result[@intFromEnum(Feature.avxvnni)] = .{ |
| 398 | .llvm_name = "avxvnni", | 398 | .llvm_name = "avxvnni", |
| 399 | .description = "Support AVX_VNNI encoding", | 399 | .description = "Support AVX_VNNI encoding", |
| 400 | .dependencies = featureSet(&[_]Feature{ | 400 | .dependencies = featureSet(&[_]Feature{ |
| 401 | .avx2, | 401 | .avx2, |
| 402 | }), | 402 | }), |
| 403 | }; | 403 | }; |
| 404 | result[@enumToInt(Feature.avxvnniint8)] = .{ | 404 | result[@intFromEnum(Feature.avxvnniint8)] = .{ |
| 405 | .llvm_name = "avxvnniint8", | 405 | .llvm_name = "avxvnniint8", |
| 406 | .description = "Enable AVX-VNNI-INT8", | 406 | .description = "Enable AVX-VNNI-INT8", |
| 407 | .dependencies = featureSet(&[_]Feature{ | 407 | .dependencies = featureSet(&[_]Feature{ |
| 408 | .avx2, | 408 | .avx2, |
| 409 | }), | 409 | }), |
| 410 | }; | 410 | }; |
| 411 | result[@enumToInt(Feature.bmi)] = .{ | 411 | result[@intFromEnum(Feature.bmi)] = .{ |
| 412 | .llvm_name = "bmi", | 412 | .llvm_name = "bmi", |
| 413 | .description = "Support BMI instructions", | 413 | .description = "Support BMI instructions", |
| 414 | .dependencies = featureSet(&[_]Feature{}), | 414 | .dependencies = featureSet(&[_]Feature{}), |
| 415 | }; | 415 | }; |
| 416 | result[@enumToInt(Feature.bmi2)] = .{ | 416 | result[@intFromEnum(Feature.bmi2)] = .{ |
| 417 | .llvm_name = "bmi2", | 417 | .llvm_name = "bmi2", |
| 418 | .description = "Support BMI2 instructions", | 418 | .description = "Support BMI2 instructions", |
| 419 | .dependencies = featureSet(&[_]Feature{}), | 419 | .dependencies = featureSet(&[_]Feature{}), |
| 420 | }; | 420 | }; |
| 421 | result[@enumToInt(Feature.branchfusion)] = .{ | 421 | result[@intFromEnum(Feature.branchfusion)] = .{ |
| 422 | .llvm_name = "branchfusion", | 422 | .llvm_name = "branchfusion", |
| 423 | .description = "CMP/TEST can be fused with conditional branches", | 423 | .description = "CMP/TEST can be fused with conditional branches", |
| 424 | .dependencies = featureSet(&[_]Feature{}), | 424 | .dependencies = featureSet(&[_]Feature{}), |
| 425 | }; | 425 | }; |
| 426 | result[@enumToInt(Feature.cldemote)] = .{ | 426 | result[@intFromEnum(Feature.cldemote)] = .{ |
| 427 | .llvm_name = "cldemote", | 427 | .llvm_name = "cldemote", |
| 428 | .description = "Enable Cache Line Demote", | 428 | .description = "Enable Cache Line Demote", |
| 429 | .dependencies = featureSet(&[_]Feature{}), | 429 | .dependencies = featureSet(&[_]Feature{}), |
| 430 | }; | 430 | }; |
| 431 | result[@enumToInt(Feature.clflushopt)] = .{ | 431 | result[@intFromEnum(Feature.clflushopt)] = .{ |
| 432 | .llvm_name = "clflushopt", | 432 | .llvm_name = "clflushopt", |
| 433 | .description = "Flush A Cache Line Optimized", | 433 | .description = "Flush A Cache Line Optimized", |
| 434 | .dependencies = featureSet(&[_]Feature{}), | 434 | .dependencies = featureSet(&[_]Feature{}), |
| 435 | }; | 435 | }; |
| 436 | result[@enumToInt(Feature.clwb)] = .{ | 436 | result[@intFromEnum(Feature.clwb)] = .{ |
| 437 | .llvm_name = "clwb", | 437 | .llvm_name = "clwb", |
| 438 | .description = "Cache Line Write Back", | 438 | .description = "Cache Line Write Back", |
| 439 | .dependencies = featureSet(&[_]Feature{}), | 439 | .dependencies = featureSet(&[_]Feature{}), |
| 440 | }; | 440 | }; |
| 441 | result[@enumToInt(Feature.clzero)] = .{ | 441 | result[@intFromEnum(Feature.clzero)] = .{ |
| 442 | .llvm_name = "clzero", | 442 | .llvm_name = "clzero", |
| 443 | .description = "Enable Cache Line Zero", | 443 | .description = "Enable Cache Line Zero", |
| 444 | .dependencies = featureSet(&[_]Feature{}), | 444 | .dependencies = featureSet(&[_]Feature{}), |
| 445 | }; | 445 | }; |
| 446 | result[@enumToInt(Feature.cmov)] = .{ | 446 | result[@intFromEnum(Feature.cmov)] = .{ |
| 447 | .llvm_name = "cmov", | 447 | .llvm_name = "cmov", |
| 448 | .description = "Enable conditional move instructions", | 448 | .description = "Enable conditional move instructions", |
| 449 | .dependencies = featureSet(&[_]Feature{}), | 449 | .dependencies = featureSet(&[_]Feature{}), |
| 450 | }; | 450 | }; |
| 451 | result[@enumToInt(Feature.cmpccxadd)] = .{ | 451 | result[@intFromEnum(Feature.cmpccxadd)] = .{ |
| 452 | .llvm_name = "cmpccxadd", | 452 | .llvm_name = "cmpccxadd", |
| 453 | .description = "Support CMPCCXADD instructions", | 453 | .description = "Support CMPCCXADD instructions", |
| 454 | .dependencies = featureSet(&[_]Feature{}), | 454 | .dependencies = featureSet(&[_]Feature{}), |
| 455 | }; | 455 | }; |
| 456 | result[@enumToInt(Feature.crc32)] = .{ | 456 | result[@intFromEnum(Feature.crc32)] = .{ |
| 457 | .llvm_name = "crc32", | 457 | .llvm_name = "crc32", |
| 458 | .description = "Enable SSE 4.2 CRC32 instruction (used when SSE4.2 is supported but function is GPR only)", | 458 | .description = "Enable SSE 4.2 CRC32 instruction (used when SSE4.2 is supported but function is GPR only)", |
| 459 | .dependencies = featureSet(&[_]Feature{}), | 459 | .dependencies = featureSet(&[_]Feature{}), |
| 460 | }; | 460 | }; |
| 461 | result[@enumToInt(Feature.cx16)] = .{ | 461 | result[@intFromEnum(Feature.cx16)] = .{ |
| 462 | .llvm_name = "cx16", | 462 | .llvm_name = "cx16", |
| 463 | .description = "64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips)", | 463 | .description = "64-bit with cmpxchg16b (this is true for most x86-64 chips, but not the first AMD chips)", |
| 464 | .dependencies = featureSet(&[_]Feature{ | 464 | .dependencies = featureSet(&[_]Feature{ |
| 465 | .cx8, | 465 | .cx8, |
| 466 | }), | 466 | }), |
| 467 | }; | 467 | }; |
| 468 | result[@enumToInt(Feature.cx8)] = .{ | 468 | result[@intFromEnum(Feature.cx8)] = .{ |
| 469 | .llvm_name = "cx8", | 469 | .llvm_name = "cx8", |
| 470 | .description = "Support CMPXCHG8B instructions", | 470 | .description = "Support CMPXCHG8B instructions", |
| 471 | .dependencies = featureSet(&[_]Feature{}), | 471 | .dependencies = featureSet(&[_]Feature{}), |
| 472 | }; | 472 | }; |
| 473 | result[@enumToInt(Feature.enqcmd)] = .{ | 473 | result[@intFromEnum(Feature.enqcmd)] = .{ |
| 474 | .llvm_name = "enqcmd", | 474 | .llvm_name = "enqcmd", |
| 475 | .description = "Has ENQCMD instructions", | 475 | .description = "Has ENQCMD instructions", |
| 476 | .dependencies = featureSet(&[_]Feature{}), | 476 | .dependencies = featureSet(&[_]Feature{}), |
| 477 | }; | 477 | }; |
| 478 | result[@enumToInt(Feature.ermsb)] = .{ | 478 | result[@intFromEnum(Feature.ermsb)] = .{ |
| 479 | .llvm_name = "ermsb", | 479 | .llvm_name = "ermsb", |
| 480 | .description = "REP MOVS/STOS are fast", | 480 | .description = "REP MOVS/STOS are fast", |
| 481 | .dependencies = featureSet(&[_]Feature{}), | 481 | .dependencies = featureSet(&[_]Feature{}), |
| 482 | }; | 482 | }; |
| 483 | result[@enumToInt(Feature.f16c)] = .{ | 483 | result[@intFromEnum(Feature.f16c)] = .{ |
| 484 | .llvm_name = "f16c", | 484 | .llvm_name = "f16c", |
| 485 | .description = "Support 16-bit floating point conversion instructions", | 485 | .description = "Support 16-bit floating point conversion instructions", |
| 486 | .dependencies = featureSet(&[_]Feature{ | 486 | .dependencies = featureSet(&[_]Feature{ |
| 487 | .avx, | 487 | .avx, |
| 488 | }), | 488 | }), |
| 489 | }; | 489 | }; |
| 490 | result[@enumToInt(Feature.false_deps_getmant)] = .{ | 490 | result[@intFromEnum(Feature.false_deps_getmant)] = .{ |
| 491 | .llvm_name = "false-deps-getmant", | 491 | .llvm_name = "false-deps-getmant", |
| 492 | .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register", | 492 | .description = "VGETMANTSS/SD/SH and VGETMANDPS/PD(memory version) has a false dependency on dest register", |
| 493 | .dependencies = featureSet(&[_]Feature{}), | 493 | .dependencies = featureSet(&[_]Feature{}), |
| 494 | }; | 494 | }; |
| 495 | result[@enumToInt(Feature.false_deps_lzcnt_tzcnt)] = .{ | 495 | result[@intFromEnum(Feature.false_deps_lzcnt_tzcnt)] = .{ |
| 496 | .llvm_name = "false-deps-lzcnt-tzcnt", | 496 | .llvm_name = "false-deps-lzcnt-tzcnt", |
| 497 | .description = "LZCNT/TZCNT have a false dependency on dest register", | 497 | .description = "LZCNT/TZCNT have a false dependency on dest register", |
| 498 | .dependencies = featureSet(&[_]Feature{}), | 498 | .dependencies = featureSet(&[_]Feature{}), |
| 499 | }; | 499 | }; |
| 500 | result[@enumToInt(Feature.false_deps_mulc)] = .{ | 500 | result[@intFromEnum(Feature.false_deps_mulc)] = .{ |
| 501 | .llvm_name = "false-deps-mulc", | 501 | .llvm_name = "false-deps-mulc", |
| 502 | .description = "VF[C]MULCPH/SH has a false dependency on dest register", | 502 | .description = "VF[C]MULCPH/SH has a false dependency on dest register", |
| 503 | .dependencies = featureSet(&[_]Feature{}), | 503 | .dependencies = featureSet(&[_]Feature{}), |
| 504 | }; | 504 | }; |
| 505 | result[@enumToInt(Feature.false_deps_mullq)] = .{ | 505 | result[@intFromEnum(Feature.false_deps_mullq)] = .{ |
| 506 | .llvm_name = "false-deps-mullq", | 506 | .llvm_name = "false-deps-mullq", |
| 507 | .description = "VPMULLQ has a false dependency on dest register", | 507 | .description = "VPMULLQ has a false dependency on dest register", |
| 508 | .dependencies = featureSet(&[_]Feature{}), | 508 | .dependencies = featureSet(&[_]Feature{}), |
| 509 | }; | 509 | }; |
| 510 | result[@enumToInt(Feature.false_deps_perm)] = .{ | 510 | result[@intFromEnum(Feature.false_deps_perm)] = .{ |
| 511 | .llvm_name = "false-deps-perm", | 511 | .llvm_name = "false-deps-perm", |
| 512 | .description = "VPERMD/Q/PS/PD has a false dependency on dest register", | 512 | .description = "VPERMD/Q/PS/PD has a false dependency on dest register", |
| 513 | .dependencies = featureSet(&[_]Feature{}), | 513 | .dependencies = featureSet(&[_]Feature{}), |
| 514 | }; | 514 | }; |
| 515 | result[@enumToInt(Feature.false_deps_popcnt)] = .{ | 515 | result[@intFromEnum(Feature.false_deps_popcnt)] = .{ |
| 516 | .llvm_name = "false-deps-popcnt", | 516 | .llvm_name = "false-deps-popcnt", |
| 517 | .description = "POPCNT has a false dependency on dest register", | 517 | .description = "POPCNT has a false dependency on dest register", |
| 518 | .dependencies = featureSet(&[_]Feature{}), | 518 | .dependencies = featureSet(&[_]Feature{}), |
| 519 | }; | 519 | }; |
| 520 | result[@enumToInt(Feature.false_deps_range)] = .{ | 520 | result[@intFromEnum(Feature.false_deps_range)] = .{ |
| 521 | .llvm_name = "false-deps-range", | 521 | .llvm_name = "false-deps-range", |
| 522 | .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register", | 522 | .description = "VRANGEPD/PS/SD/SS has a false dependency on dest register", |
| 523 | .dependencies = featureSet(&[_]Feature{}), | 523 | .dependencies = featureSet(&[_]Feature{}), |
| 524 | }; | 524 | }; |
| 525 | result[@enumToInt(Feature.fast_11bytenop)] = .{ | 525 | result[@intFromEnum(Feature.fast_11bytenop)] = .{ |
| 526 | .llvm_name = "fast-11bytenop", | 526 | .llvm_name = "fast-11bytenop", |
| 527 | .description = "Target can quickly decode up to 11 byte NOPs", | 527 | .description = "Target can quickly decode up to 11 byte NOPs", |
| 528 | .dependencies = featureSet(&[_]Feature{}), | 528 | .dependencies = featureSet(&[_]Feature{}), |
| 529 | }; | 529 | }; |
| 530 | result[@enumToInt(Feature.fast_15bytenop)] = .{ | 530 | result[@intFromEnum(Feature.fast_15bytenop)] = .{ |
| 531 | .llvm_name = "fast-15bytenop", | 531 | .llvm_name = "fast-15bytenop", |
| 532 | .description = "Target can quickly decode up to 15 byte NOPs", | 532 | .description = "Target can quickly decode up to 15 byte NOPs", |
| 533 | .dependencies = featureSet(&[_]Feature{}), | 533 | .dependencies = featureSet(&[_]Feature{}), |
| 534 | }; | 534 | }; |
| 535 | result[@enumToInt(Feature.fast_7bytenop)] = .{ | 535 | result[@intFromEnum(Feature.fast_7bytenop)] = .{ |
| 536 | .llvm_name = "fast-7bytenop", | 536 | .llvm_name = "fast-7bytenop", |
| 537 | .description = "Target can quickly decode up to 7 byte NOPs", | 537 | .description = "Target can quickly decode up to 7 byte NOPs", |
| 538 | .dependencies = featureSet(&[_]Feature{}), | 538 | .dependencies = featureSet(&[_]Feature{}), |
| 539 | }; | 539 | }; |
| 540 | result[@enumToInt(Feature.fast_bextr)] = .{ | 540 | result[@intFromEnum(Feature.fast_bextr)] = .{ |
| 541 | .llvm_name = "fast-bextr", | 541 | .llvm_name = "fast-bextr", |
| 542 | .description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput", | 542 | .description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput", |
| 543 | .dependencies = featureSet(&[_]Feature{}), | 543 | .dependencies = featureSet(&[_]Feature{}), |
| 544 | }; | 544 | }; |
| 545 | result[@enumToInt(Feature.fast_gather)] = .{ | 545 | result[@intFromEnum(Feature.fast_gather)] = .{ |
| 546 | .llvm_name = "fast-gather", | 546 | .llvm_name = "fast-gather", |
| 547 | .description = "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)", | 547 | .description = "Indicates if gather is reasonably fast (this is true for Skylake client and all AVX-512 CPUs)", |
| 548 | .dependencies = featureSet(&[_]Feature{}), | 548 | .dependencies = featureSet(&[_]Feature{}), |
| 549 | }; | 549 | }; |
| 550 | result[@enumToInt(Feature.fast_hops)] = .{ | 550 | result[@intFromEnum(Feature.fast_hops)] = .{ |
| 551 | .llvm_name = "fast-hops", | 551 | .llvm_name = "fast-hops", |
| 552 | .description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles", | 552 | .description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles", |
| 553 | .dependencies = featureSet(&[_]Feature{}), | 553 | .dependencies = featureSet(&[_]Feature{}), |
| 554 | }; | 554 | }; |
| 555 | result[@enumToInt(Feature.fast_lzcnt)] = .{ | 555 | result[@intFromEnum(Feature.fast_lzcnt)] = .{ |
| 556 | .llvm_name = "fast-lzcnt", | 556 | .llvm_name = "fast-lzcnt", |
| 557 | .description = "LZCNT instructions are as fast as most simple integer ops", | 557 | .description = "LZCNT instructions are as fast as most simple integer ops", |
| 558 | .dependencies = featureSet(&[_]Feature{}), | 558 | .dependencies = featureSet(&[_]Feature{}), |
| 559 | }; | 559 | }; |
| 560 | result[@enumToInt(Feature.fast_movbe)] = .{ | 560 | result[@intFromEnum(Feature.fast_movbe)] = .{ |
| 561 | .llvm_name = "fast-movbe", | 561 | .llvm_name = "fast-movbe", |
| 562 | .description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store", | 562 | .description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store", |
| 563 | .dependencies = featureSet(&[_]Feature{}), | 563 | .dependencies = featureSet(&[_]Feature{}), |
| 564 | }; | 564 | }; |
| 565 | result[@enumToInt(Feature.fast_scalar_fsqrt)] = .{ | 565 | result[@intFromEnum(Feature.fast_scalar_fsqrt)] = .{ |
| 566 | .llvm_name = "fast-scalar-fsqrt", | 566 | .llvm_name = "fast-scalar-fsqrt", |
| 567 | .description = "Scalar SQRT is fast (disable Newton-Raphson)", | 567 | .description = "Scalar SQRT is fast (disable Newton-Raphson)", |
| 568 | .dependencies = featureSet(&[_]Feature{}), | 568 | .dependencies = featureSet(&[_]Feature{}), |
| 569 | }; | 569 | }; |
| 570 | result[@enumToInt(Feature.fast_scalar_shift_masks)] = .{ | 570 | result[@intFromEnum(Feature.fast_scalar_shift_masks)] = .{ |
| 571 | .llvm_name = "fast-scalar-shift-masks", | 571 | .llvm_name = "fast-scalar-shift-masks", |
| 572 | .description = "Prefer a left/right scalar logical shift pair over a shift+and pair", | 572 | .description = "Prefer a left/right scalar logical shift pair over a shift+and pair", |
| 573 | .dependencies = featureSet(&[_]Feature{}), | 573 | .dependencies = featureSet(&[_]Feature{}), |
| 574 | }; | 574 | }; |
| 575 | result[@enumToInt(Feature.fast_shld_rotate)] = .{ | 575 | result[@intFromEnum(Feature.fast_shld_rotate)] = .{ |
| 576 | .llvm_name = "fast-shld-rotate", | 576 | .llvm_name = "fast-shld-rotate", |
| 577 | .description = "SHLD can be used as a faster rotate", | 577 | .description = "SHLD can be used as a faster rotate", |
| 578 | .dependencies = featureSet(&[_]Feature{}), | 578 | .dependencies = featureSet(&[_]Feature{}), |
| 579 | }; | 579 | }; |
| 580 | result[@enumToInt(Feature.fast_variable_crosslane_shuffle)] = .{ | 580 | result[@intFromEnum(Feature.fast_variable_crosslane_shuffle)] = .{ |
| 581 | .llvm_name = "fast-variable-crosslane-shuffle", | 581 | .llvm_name = "fast-variable-crosslane-shuffle", |
| 582 | .description = "Cross-lane shuffles with variable masks are fast", | 582 | .description = "Cross-lane shuffles with variable masks are fast", |
| 583 | .dependencies = featureSet(&[_]Feature{}), | 583 | .dependencies = featureSet(&[_]Feature{}), |
| 584 | }; | 584 | }; |
| 585 | result[@enumToInt(Feature.fast_variable_perlane_shuffle)] = .{ | 585 | result[@intFromEnum(Feature.fast_variable_perlane_shuffle)] = .{ |
| 586 | .llvm_name = "fast-variable-perlane-shuffle", | 586 | .llvm_name = "fast-variable-perlane-shuffle", |
| 587 | .description = "Per-lane shuffles with variable masks are fast", | 587 | .description = "Per-lane shuffles with variable masks are fast", |
| 588 | .dependencies = featureSet(&[_]Feature{}), | 588 | .dependencies = featureSet(&[_]Feature{}), |
| 589 | }; | 589 | }; |
| 590 | result[@enumToInt(Feature.fast_vector_fsqrt)] = .{ | 590 | result[@intFromEnum(Feature.fast_vector_fsqrt)] = .{ |
| 591 | .llvm_name = "fast-vector-fsqrt", | 591 | .llvm_name = "fast-vector-fsqrt", |
| 592 | .description = "Vector SQRT is fast (disable Newton-Raphson)", | 592 | .description = "Vector SQRT is fast (disable Newton-Raphson)", |
| 593 | .dependencies = featureSet(&[_]Feature{}), | 593 | .dependencies = featureSet(&[_]Feature{}), |
| 594 | }; | 594 | }; |
| 595 | result[@enumToInt(Feature.fast_vector_shift_masks)] = .{ | 595 | result[@intFromEnum(Feature.fast_vector_shift_masks)] = .{ |
| 596 | .llvm_name = "fast-vector-shift-masks", | 596 | .llvm_name = "fast-vector-shift-masks", |
| 597 | .description = "Prefer a left/right vector logical shift pair over a shift+and pair", | 597 | .description = "Prefer a left/right vector logical shift pair over a shift+and pair", |
| 598 | .dependencies = featureSet(&[_]Feature{}), | 598 | .dependencies = featureSet(&[_]Feature{}), |
| 599 | }; | 599 | }; |
| 600 | result[@enumToInt(Feature.fma)] = .{ | 600 | result[@intFromEnum(Feature.fma)] = .{ |
| 601 | .llvm_name = "fma", | 601 | .llvm_name = "fma", |
| 602 | .description = "Enable three-operand fused multiply-add", | 602 | .description = "Enable three-operand fused multiply-add", |
| 603 | .dependencies = featureSet(&[_]Feature{ | 603 | .dependencies = featureSet(&[_]Feature{ |
| 604 | .avx, | 604 | .avx, |
| 605 | }), | 605 | }), |
| 606 | }; | 606 | }; |
| 607 | result[@enumToInt(Feature.fma4)] = .{ | 607 | result[@intFromEnum(Feature.fma4)] = .{ |
| 608 | .llvm_name = "fma4", | 608 | .llvm_name = "fma4", |
| 609 | .description = "Enable four-operand fused multiply-add", | 609 | .description = "Enable four-operand fused multiply-add", |
| 610 | .dependencies = featureSet(&[_]Feature{ | 610 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -612,218 +612,218 @@ pub const all_features = blk: { | ... | @@ -612,218 +612,218 @@ pub const all_features = blk: { |
| 612 | .sse4a, | 612 | .sse4a, |
| 613 | }), | 613 | }), |
| 614 | }; | 614 | }; |
| 615 | result[@enumToInt(Feature.fsgsbase)] = .{ | 615 | result[@intFromEnum(Feature.fsgsbase)] = .{ |
| 616 | .llvm_name = "fsgsbase", | 616 | .llvm_name = "fsgsbase", |
| 617 | .description = "Support FS/GS Base instructions", | 617 | .description = "Support FS/GS Base instructions", |
| 618 | .dependencies = featureSet(&[_]Feature{}), | 618 | .dependencies = featureSet(&[_]Feature{}), |
| 619 | }; | 619 | }; |
| 620 | result[@enumToInt(Feature.fsrm)] = .{ | 620 | result[@intFromEnum(Feature.fsrm)] = .{ |
| 621 | .llvm_name = "fsrm", | 621 | .llvm_name = "fsrm", |
| 622 | .description = "REP MOVSB of short lengths is faster", | 622 | .description = "REP MOVSB of short lengths is faster", |
| 623 | .dependencies = featureSet(&[_]Feature{}), | 623 | .dependencies = featureSet(&[_]Feature{}), |
| 624 | }; | 624 | }; |
| 625 | result[@enumToInt(Feature.fxsr)] = .{ | 625 | result[@intFromEnum(Feature.fxsr)] = .{ |
| 626 | .llvm_name = "fxsr", | 626 | .llvm_name = "fxsr", |
| 627 | .description = "Support fxsave/fxrestore instructions", | 627 | .description = "Support fxsave/fxrestore instructions", |
| 628 | .dependencies = featureSet(&[_]Feature{}), | 628 | .dependencies = featureSet(&[_]Feature{}), |
| 629 | }; | 629 | }; |
| 630 | result[@enumToInt(Feature.gfni)] = .{ | 630 | result[@intFromEnum(Feature.gfni)] = .{ |
| 631 | .llvm_name = "gfni", | 631 | .llvm_name = "gfni", |
| 632 | .description = "Enable Galois Field Arithmetic Instructions", | 632 | .description = "Enable Galois Field Arithmetic Instructions", |
| 633 | .dependencies = featureSet(&[_]Feature{ | 633 | .dependencies = featureSet(&[_]Feature{ |
| 634 | .sse2, | 634 | .sse2, |
| 635 | }), | 635 | }), |
| 636 | }; | 636 | }; |
| 637 | result[@enumToInt(Feature.harden_sls_ijmp)] = .{ | 637 | result[@intFromEnum(Feature.harden_sls_ijmp)] = .{ |
| 638 | .llvm_name = "harden-sls-ijmp", | 638 | .llvm_name = "harden-sls-ijmp", |
| 639 | .description = "Harden against straight line speculation across indirect JMP instructions.", | 639 | .description = "Harden against straight line speculation across indirect JMP instructions.", |
| 640 | .dependencies = featureSet(&[_]Feature{}), | 640 | .dependencies = featureSet(&[_]Feature{}), |
| 641 | }; | 641 | }; |
| 642 | result[@enumToInt(Feature.harden_sls_ret)] = .{ | 642 | result[@intFromEnum(Feature.harden_sls_ret)] = .{ |
| 643 | .llvm_name = "harden-sls-ret", | 643 | .llvm_name = "harden-sls-ret", |
| 644 | .description = "Harden against straight line speculation across RET instructions.", | 644 | .description = "Harden against straight line speculation across RET instructions.", |
| 645 | .dependencies = featureSet(&[_]Feature{}), | 645 | .dependencies = featureSet(&[_]Feature{}), |
| 646 | }; | 646 | }; |
| 647 | result[@enumToInt(Feature.hreset)] = .{ | 647 | result[@intFromEnum(Feature.hreset)] = .{ |
| 648 | .llvm_name = "hreset", | 648 | .llvm_name = "hreset", |
| 649 | .description = "Has hreset instruction", | 649 | .description = "Has hreset instruction", |
| 650 | .dependencies = featureSet(&[_]Feature{}), | 650 | .dependencies = featureSet(&[_]Feature{}), |
| 651 | }; | 651 | }; |
| 652 | result[@enumToInt(Feature.idivl_to_divb)] = .{ | 652 | result[@intFromEnum(Feature.idivl_to_divb)] = .{ |
| 653 | .llvm_name = "idivl-to-divb", | 653 | .llvm_name = "idivl-to-divb", |
| 654 | .description = "Use 8-bit divide for positive values less than 256", | 654 | .description = "Use 8-bit divide for positive values less than 256", |
| 655 | .dependencies = featureSet(&[_]Feature{}), | 655 | .dependencies = featureSet(&[_]Feature{}), |
| 656 | }; | 656 | }; |
| 657 | result[@enumToInt(Feature.idivq_to_divl)] = .{ | 657 | result[@intFromEnum(Feature.idivq_to_divl)] = .{ |
| 658 | .llvm_name = "idivq-to-divl", | 658 | .llvm_name = "idivq-to-divl", |
| 659 | .description = "Use 32-bit divide for positive values less than 2^32", | 659 | .description = "Use 32-bit divide for positive values less than 2^32", |
| 660 | .dependencies = featureSet(&[_]Feature{}), | 660 | .dependencies = featureSet(&[_]Feature{}), |
| 661 | }; | 661 | }; |
| 662 | result[@enumToInt(Feature.invpcid)] = .{ | 662 | result[@intFromEnum(Feature.invpcid)] = .{ |
| 663 | .llvm_name = "invpcid", | 663 | .llvm_name = "invpcid", |
| 664 | .description = "Invalidate Process-Context Identifier", | 664 | .description = "Invalidate Process-Context Identifier", |
| 665 | .dependencies = featureSet(&[_]Feature{}), | 665 | .dependencies = featureSet(&[_]Feature{}), |
| 666 | }; | 666 | }; |
| 667 | result[@enumToInt(Feature.kl)] = .{ | 667 | result[@intFromEnum(Feature.kl)] = .{ |
| 668 | .llvm_name = "kl", | 668 | .llvm_name = "kl", |
| 669 | .description = "Support Key Locker kl Instructions", | 669 | .description = "Support Key Locker kl Instructions", |
| 670 | .dependencies = featureSet(&[_]Feature{ | 670 | .dependencies = featureSet(&[_]Feature{ |
| 671 | .sse2, | 671 | .sse2, |
| 672 | }), | 672 | }), |
| 673 | }; | 673 | }; |
| 674 | result[@enumToInt(Feature.lea_sp)] = .{ | 674 | result[@intFromEnum(Feature.lea_sp)] = .{ |
| 675 | .llvm_name = "lea-sp", | 675 | .llvm_name = "lea-sp", |
| 676 | .description = "Use LEA for adjusting the stack pointer (this is an optimization for Intel Atom processors)", | 676 | .description = "Use LEA for adjusting the stack pointer (this is an optimization for Intel Atom processors)", |
| 677 | .dependencies = featureSet(&[_]Feature{}), | 677 | .dependencies = featureSet(&[_]Feature{}), |
| 678 | }; | 678 | }; |
| 679 | result[@enumToInt(Feature.lea_uses_ag)] = .{ | 679 | result[@intFromEnum(Feature.lea_uses_ag)] = .{ |
| 680 | .llvm_name = "lea-uses-ag", | 680 | .llvm_name = "lea-uses-ag", |
| 681 | .description = "LEA instruction needs inputs at AG stage", | 681 | .description = "LEA instruction needs inputs at AG stage", |
| 682 | .dependencies = featureSet(&[_]Feature{}), | 682 | .dependencies = featureSet(&[_]Feature{}), |
| 683 | }; | 683 | }; |
| 684 | result[@enumToInt(Feature.lvi_cfi)] = .{ | 684 | result[@intFromEnum(Feature.lvi_cfi)] = .{ |
| 685 | .llvm_name = "lvi-cfi", | 685 | .llvm_name = "lvi-cfi", |
| 686 | .description = "Prevent indirect calls/branches from using a memory operand, and precede all indirect calls/branches from a register with an LFENCE instruction to serialize control flow. Also decompose RET instructions into a POP+LFENCE+JMP sequence.", | 686 | .description = "Prevent indirect calls/branches from using a memory operand, and precede all indirect calls/branches from a register with an LFENCE instruction to serialize control flow. Also decompose RET instructions into a POP+LFENCE+JMP sequence.", |
| 687 | .dependencies = featureSet(&[_]Feature{}), | 687 | .dependencies = featureSet(&[_]Feature{}), |
| 688 | }; | 688 | }; |
| 689 | result[@enumToInt(Feature.lvi_load_hardening)] = .{ | 689 | result[@intFromEnum(Feature.lvi_load_hardening)] = .{ |
| 690 | .llvm_name = "lvi-load-hardening", | 690 | .llvm_name = "lvi-load-hardening", |
| 691 | .description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.", | 691 | .description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.", |
| 692 | .dependencies = featureSet(&[_]Feature{}), | 692 | .dependencies = featureSet(&[_]Feature{}), |
| 693 | }; | 693 | }; |
| 694 | result[@enumToInt(Feature.lwp)] = .{ | 694 | result[@intFromEnum(Feature.lwp)] = .{ |
| 695 | .llvm_name = "lwp", | 695 | .llvm_name = "lwp", |
| 696 | .description = "Enable LWP instructions", | 696 | .description = "Enable LWP instructions", |
| 697 | .dependencies = featureSet(&[_]Feature{}), | 697 | .dependencies = featureSet(&[_]Feature{}), |
| 698 | }; | 698 | }; |
| 699 | result[@enumToInt(Feature.lzcnt)] = .{ | 699 | result[@intFromEnum(Feature.lzcnt)] = .{ |
| 700 | .llvm_name = "lzcnt", | 700 | .llvm_name = "lzcnt", |
| 701 | .description = "Support LZCNT instruction", | 701 | .description = "Support LZCNT instruction", |
| 702 | .dependencies = featureSet(&[_]Feature{}), | 702 | .dependencies = featureSet(&[_]Feature{}), |
| 703 | }; | 703 | }; |
| 704 | result[@enumToInt(Feature.macrofusion)] = .{ | 704 | result[@intFromEnum(Feature.macrofusion)] = .{ |
| 705 | .llvm_name = "macrofusion", | 705 | .llvm_name = "macrofusion", |
| 706 | .description = "Various instructions can be fused with conditional branches", | 706 | .description = "Various instructions can be fused with conditional branches", |
| 707 | .dependencies = featureSet(&[_]Feature{}), | 707 | .dependencies = featureSet(&[_]Feature{}), |
| 708 | }; | 708 | }; |
| 709 | result[@enumToInt(Feature.mmx)] = .{ | 709 | result[@intFromEnum(Feature.mmx)] = .{ |
| 710 | .llvm_name = "mmx", | 710 | .llvm_name = "mmx", |
| 711 | .description = "Enable MMX instructions", | 711 | .description = "Enable MMX instructions", |
| 712 | .dependencies = featureSet(&[_]Feature{}), | 712 | .dependencies = featureSet(&[_]Feature{}), |
| 713 | }; | 713 | }; |
| 714 | result[@enumToInt(Feature.movbe)] = .{ | 714 | result[@intFromEnum(Feature.movbe)] = .{ |
| 715 | .llvm_name = "movbe", | 715 | .llvm_name = "movbe", |
| 716 | .description = "Support MOVBE instruction", | 716 | .description = "Support MOVBE instruction", |
| 717 | .dependencies = featureSet(&[_]Feature{}), | 717 | .dependencies = featureSet(&[_]Feature{}), |
| 718 | }; | 718 | }; |
| 719 | result[@enumToInt(Feature.movdir64b)] = .{ | 719 | result[@intFromEnum(Feature.movdir64b)] = .{ |
| 720 | .llvm_name = "movdir64b", | 720 | .llvm_name = "movdir64b", |
| 721 | .description = "Support movdir64b instruction (direct store 64 bytes)", | 721 | .description = "Support movdir64b instruction (direct store 64 bytes)", |
| 722 | .dependencies = featureSet(&[_]Feature{}), | 722 | .dependencies = featureSet(&[_]Feature{}), |
| 723 | }; | 723 | }; |
| 724 | result[@enumToInt(Feature.movdiri)] = .{ | 724 | result[@intFromEnum(Feature.movdiri)] = .{ |
| 725 | .llvm_name = "movdiri", | 725 | .llvm_name = "movdiri", |
| 726 | .description = "Support movdiri instruction (direct store integer)", | 726 | .description = "Support movdiri instruction (direct store integer)", |
| 727 | .dependencies = featureSet(&[_]Feature{}), | 727 | .dependencies = featureSet(&[_]Feature{}), |
| 728 | }; | 728 | }; |
| 729 | result[@enumToInt(Feature.mwaitx)] = .{ | 729 | result[@intFromEnum(Feature.mwaitx)] = .{ |
| 730 | .llvm_name = "mwaitx", | 730 | .llvm_name = "mwaitx", |
| 731 | .description = "Enable MONITORX/MWAITX timer functionality", | 731 | .description = "Enable MONITORX/MWAITX timer functionality", |
| 732 | .dependencies = featureSet(&[_]Feature{}), | 732 | .dependencies = featureSet(&[_]Feature{}), |
| 733 | }; | 733 | }; |
| 734 | result[@enumToInt(Feature.nopl)] = .{ | 734 | result[@intFromEnum(Feature.nopl)] = .{ |
| 735 | .llvm_name = "nopl", | 735 | .llvm_name = "nopl", |
| 736 | .description = "Enable NOPL instruction (generally pentium pro+)", | 736 | .description = "Enable NOPL instruction (generally pentium pro+)", |
| 737 | .dependencies = featureSet(&[_]Feature{}), | 737 | .dependencies = featureSet(&[_]Feature{}), |
| 738 | }; | 738 | }; |
| 739 | result[@enumToInt(Feature.pad_short_functions)] = .{ | 739 | result[@intFromEnum(Feature.pad_short_functions)] = .{ |
| 740 | .llvm_name = "pad-short-functions", | 740 | .llvm_name = "pad-short-functions", |
| 741 | .description = "Pad short functions (to prevent a stall when returning too early)", | 741 | .description = "Pad short functions (to prevent a stall when returning too early)", |
| 742 | .dependencies = featureSet(&[_]Feature{}), | 742 | .dependencies = featureSet(&[_]Feature{}), |
| 743 | }; | 743 | }; |
| 744 | result[@enumToInt(Feature.pclmul)] = .{ | 744 | result[@intFromEnum(Feature.pclmul)] = .{ |
| 745 | .llvm_name = "pclmul", | 745 | .llvm_name = "pclmul", |
| 746 | .description = "Enable packed carry-less multiplication instructions", | 746 | .description = "Enable packed carry-less multiplication instructions", |
| 747 | .dependencies = featureSet(&[_]Feature{ | 747 | .dependencies = featureSet(&[_]Feature{ |
| 748 | .sse2, | 748 | .sse2, |
| 749 | }), | 749 | }), |
| 750 | }; | 750 | }; |
| 751 | result[@enumToInt(Feature.pconfig)] = .{ | 751 | result[@intFromEnum(Feature.pconfig)] = .{ |
| 752 | .llvm_name = "pconfig", | 752 | .llvm_name = "pconfig", |
| 753 | .description = "platform configuration instruction", | 753 | .description = "platform configuration instruction", |
| 754 | .dependencies = featureSet(&[_]Feature{}), | 754 | .dependencies = featureSet(&[_]Feature{}), |
| 755 | }; | 755 | }; |
| 756 | result[@enumToInt(Feature.pku)] = .{ | 756 | result[@intFromEnum(Feature.pku)] = .{ |
| 757 | .llvm_name = "pku", | 757 | .llvm_name = "pku", |
| 758 | .description = "Enable protection keys", | 758 | .description = "Enable protection keys", |
| 759 | .dependencies = featureSet(&[_]Feature{}), | 759 | .dependencies = featureSet(&[_]Feature{}), |
| 760 | }; | 760 | }; |
| 761 | result[@enumToInt(Feature.popcnt)] = .{ | 761 | result[@intFromEnum(Feature.popcnt)] = .{ |
| 762 | .llvm_name = "popcnt", | 762 | .llvm_name = "popcnt", |
| 763 | .description = "Support POPCNT instruction", | 763 | .description = "Support POPCNT instruction", |
| 764 | .dependencies = featureSet(&[_]Feature{}), | 764 | .dependencies = featureSet(&[_]Feature{}), |
| 765 | }; | 765 | }; |
| 766 | result[@enumToInt(Feature.prefer_128_bit)] = .{ | 766 | result[@intFromEnum(Feature.prefer_128_bit)] = .{ |
| 767 | .llvm_name = "prefer-128-bit", | 767 | .llvm_name = "prefer-128-bit", |
| 768 | .description = "Prefer 128-bit AVX instructions", | 768 | .description = "Prefer 128-bit AVX instructions", |
| 769 | .dependencies = featureSet(&[_]Feature{}), | 769 | .dependencies = featureSet(&[_]Feature{}), |
| 770 | }; | 770 | }; |
| 771 | result[@enumToInt(Feature.prefer_256_bit)] = .{ | 771 | result[@intFromEnum(Feature.prefer_256_bit)] = .{ |
| 772 | .llvm_name = "prefer-256-bit", | 772 | .llvm_name = "prefer-256-bit", |
| 773 | .description = "Prefer 256-bit AVX instructions", | 773 | .description = "Prefer 256-bit AVX instructions", |
| 774 | .dependencies = featureSet(&[_]Feature{}), | 774 | .dependencies = featureSet(&[_]Feature{}), |
| 775 | }; | 775 | }; |
| 776 | result[@enumToInt(Feature.prefer_mask_registers)] = .{ | 776 | result[@intFromEnum(Feature.prefer_mask_registers)] = .{ |
| 777 | .llvm_name = "prefer-mask-registers", | 777 | .llvm_name = "prefer-mask-registers", |
| 778 | .description = "Prefer AVX512 mask registers over PTEST/MOVMSK", | 778 | .description = "Prefer AVX512 mask registers over PTEST/MOVMSK", |
| 779 | .dependencies = featureSet(&[_]Feature{}), | 779 | .dependencies = featureSet(&[_]Feature{}), |
| 780 | }; | 780 | }; |
| 781 | result[@enumToInt(Feature.prefetchi)] = .{ | 781 | result[@intFromEnum(Feature.prefetchi)] = .{ |
| 782 | .llvm_name = "prefetchi", | 782 | .llvm_name = "prefetchi", |
| 783 | .description = "Prefetch instruction with T0 or T1 Hint", | 783 | .description = "Prefetch instruction with T0 or T1 Hint", |
| 784 | .dependencies = featureSet(&[_]Feature{}), | 784 | .dependencies = featureSet(&[_]Feature{}), |
| 785 | }; | 785 | }; |
| 786 | result[@enumToInt(Feature.prefetchwt1)] = .{ | 786 | result[@intFromEnum(Feature.prefetchwt1)] = .{ |
| 787 | .llvm_name = "prefetchwt1", | 787 | .llvm_name = "prefetchwt1", |
| 788 | .description = "Prefetch with Intent to Write and T1 Hint", | 788 | .description = "Prefetch with Intent to Write and T1 Hint", |
| 789 | .dependencies = featureSet(&[_]Feature{}), | 789 | .dependencies = featureSet(&[_]Feature{}), |
| 790 | }; | 790 | }; |
| 791 | result[@enumToInt(Feature.prfchw)] = .{ | 791 | result[@intFromEnum(Feature.prfchw)] = .{ |
| 792 | .llvm_name = "prfchw", | 792 | .llvm_name = "prfchw", |
| 793 | .description = "Support PRFCHW instructions", | 793 | .description = "Support PRFCHW instructions", |
| 794 | .dependencies = featureSet(&[_]Feature{}), | 794 | .dependencies = featureSet(&[_]Feature{}), |
| 795 | }; | 795 | }; |
| 796 | result[@enumToInt(Feature.ptwrite)] = .{ | 796 | result[@intFromEnum(Feature.ptwrite)] = .{ |
| 797 | .llvm_name = "ptwrite", | 797 | .llvm_name = "ptwrite", |
| 798 | .description = "Support ptwrite instruction", | 798 | .description = "Support ptwrite instruction", |
| 799 | .dependencies = featureSet(&[_]Feature{}), | 799 | .dependencies = featureSet(&[_]Feature{}), |
| 800 | }; | 800 | }; |
| 801 | result[@enumToInt(Feature.raoint)] = .{ | 801 | result[@intFromEnum(Feature.raoint)] = .{ |
| 802 | .llvm_name = "raoint", | 802 | .llvm_name = "raoint", |
| 803 | .description = "Support RAO-INT instructions", | 803 | .description = "Support RAO-INT instructions", |
| 804 | .dependencies = featureSet(&[_]Feature{}), | 804 | .dependencies = featureSet(&[_]Feature{}), |
| 805 | }; | 805 | }; |
| 806 | result[@enumToInt(Feature.rdpid)] = .{ | 806 | result[@intFromEnum(Feature.rdpid)] = .{ |
| 807 | .llvm_name = "rdpid", | 807 | .llvm_name = "rdpid", |
| 808 | .description = "Support RDPID instructions", | 808 | .description = "Support RDPID instructions", |
| 809 | .dependencies = featureSet(&[_]Feature{}), | 809 | .dependencies = featureSet(&[_]Feature{}), |
| 810 | }; | 810 | }; |
| 811 | result[@enumToInt(Feature.rdpru)] = .{ | 811 | result[@intFromEnum(Feature.rdpru)] = .{ |
| 812 | .llvm_name = "rdpru", | 812 | .llvm_name = "rdpru", |
| 813 | .description = "Support RDPRU instructions", | 813 | .description = "Support RDPRU instructions", |
| 814 | .dependencies = featureSet(&[_]Feature{}), | 814 | .dependencies = featureSet(&[_]Feature{}), |
| 815 | }; | 815 | }; |
| 816 | result[@enumToInt(Feature.rdrnd)] = .{ | 816 | result[@intFromEnum(Feature.rdrnd)] = .{ |
| 817 | .llvm_name = "rdrnd", | 817 | .llvm_name = "rdrnd", |
| 818 | .description = "Support RDRAND instruction", | 818 | .description = "Support RDRAND instruction", |
| 819 | .dependencies = featureSet(&[_]Feature{}), | 819 | .dependencies = featureSet(&[_]Feature{}), |
| 820 | }; | 820 | }; |
| 821 | result[@enumToInt(Feature.rdseed)] = .{ | 821 | result[@intFromEnum(Feature.rdseed)] = .{ |
| 822 | .llvm_name = "rdseed", | 822 | .llvm_name = "rdseed", |
| 823 | .description = "Support RDSEED instruction", | 823 | .description = "Support RDSEED instruction", |
| 824 | .dependencies = featureSet(&[_]Feature{}), | 824 | .dependencies = featureSet(&[_]Feature{}), |
| 825 | }; | 825 | }; |
| 826 | result[@enumToInt(Feature.retpoline)] = .{ | 826 | result[@intFromEnum(Feature.retpoline)] = .{ |
| 827 | .llvm_name = "retpoline", | 827 | .llvm_name = "retpoline", |
| 828 | .description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct", | 828 | .description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct", |
| 829 | .dependencies = featureSet(&[_]Feature{ | 829 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -831,200 +831,200 @@ pub const all_features = blk: { | ... | @@ -831,200 +831,200 @@ pub const all_features = blk: { |
| 831 | .retpoline_indirect_calls, | 831 | .retpoline_indirect_calls, |
| 832 | }), | 832 | }), |
| 833 | }; | 833 | }; |
| 834 | result[@enumToInt(Feature.retpoline_external_thunk)] = .{ | 834 | result[@intFromEnum(Feature.retpoline_external_thunk)] = .{ |
| 835 | .llvm_name = "retpoline-external-thunk", | 835 | .llvm_name = "retpoline-external-thunk", |
| 836 | .description = "When lowering an indirect call or branch using a `retpoline`, rely on the specified user provided thunk rather than emitting one ourselves. Only has effect when combined with some other retpoline feature", | 836 | .description = "When lowering an indirect call or branch using a `retpoline`, rely on the specified user provided thunk rather than emitting one ourselves. Only has effect when combined with some other retpoline feature", |
| 837 | .dependencies = featureSet(&[_]Feature{ | 837 | .dependencies = featureSet(&[_]Feature{ |
| 838 | .retpoline_indirect_calls, | 838 | .retpoline_indirect_calls, |
| 839 | }), | 839 | }), |
| 840 | }; | 840 | }; |
| 841 | result[@enumToInt(Feature.retpoline_indirect_branches)] = .{ | 841 | result[@intFromEnum(Feature.retpoline_indirect_branches)] = .{ |
| 842 | .llvm_name = "retpoline-indirect-branches", | 842 | .llvm_name = "retpoline-indirect-branches", |
| 843 | .description = "Remove speculation of indirect branches from the generated code", | 843 | .description = "Remove speculation of indirect branches from the generated code", |
| 844 | .dependencies = featureSet(&[_]Feature{}), | 844 | .dependencies = featureSet(&[_]Feature{}), |
| 845 | }; | 845 | }; |
| 846 | result[@enumToInt(Feature.retpoline_indirect_calls)] = .{ | 846 | result[@intFromEnum(Feature.retpoline_indirect_calls)] = .{ |
| 847 | .llvm_name = "retpoline-indirect-calls", | 847 | .llvm_name = "retpoline-indirect-calls", |
| 848 | .description = "Remove speculation of indirect calls from the generated code", | 848 | .description = "Remove speculation of indirect calls from the generated code", |
| 849 | .dependencies = featureSet(&[_]Feature{}), | 849 | .dependencies = featureSet(&[_]Feature{}), |
| 850 | }; | 850 | }; |
| 851 | result[@enumToInt(Feature.rtm)] = .{ | 851 | result[@intFromEnum(Feature.rtm)] = .{ |
| 852 | .llvm_name = "rtm", | 852 | .llvm_name = "rtm", |
| 853 | .description = "Support RTM instructions", | 853 | .description = "Support RTM instructions", |
| 854 | .dependencies = featureSet(&[_]Feature{}), | 854 | .dependencies = featureSet(&[_]Feature{}), |
| 855 | }; | 855 | }; |
| 856 | result[@enumToInt(Feature.sahf)] = .{ | 856 | result[@intFromEnum(Feature.sahf)] = .{ |
| 857 | .llvm_name = "sahf", | 857 | .llvm_name = "sahf", |
| 858 | .description = "Support LAHF and SAHF instructions in 64-bit mode", | 858 | .description = "Support LAHF and SAHF instructions in 64-bit mode", |
| 859 | .dependencies = featureSet(&[_]Feature{}), | 859 | .dependencies = featureSet(&[_]Feature{}), |
| 860 | }; | 860 | }; |
| 861 | result[@enumToInt(Feature.sbb_dep_breaking)] = .{ | 861 | result[@intFromEnum(Feature.sbb_dep_breaking)] = .{ |
| 862 | .llvm_name = "sbb-dep-breaking", | 862 | .llvm_name = "sbb-dep-breaking", |
| 863 | .description = "SBB with same register has no source dependency", | 863 | .description = "SBB with same register has no source dependency", |
| 864 | .dependencies = featureSet(&[_]Feature{}), | 864 | .dependencies = featureSet(&[_]Feature{}), |
| 865 | }; | 865 | }; |
| 866 | result[@enumToInt(Feature.serialize)] = .{ | 866 | result[@intFromEnum(Feature.serialize)] = .{ |
| 867 | .llvm_name = "serialize", | 867 | .llvm_name = "serialize", |
| 868 | .description = "Has serialize instruction", | 868 | .description = "Has serialize instruction", |
| 869 | .dependencies = featureSet(&[_]Feature{}), | 869 | .dependencies = featureSet(&[_]Feature{}), |
| 870 | }; | 870 | }; |
| 871 | result[@enumToInt(Feature.seses)] = .{ | 871 | result[@intFromEnum(Feature.seses)] = .{ |
| 872 | .llvm_name = "seses", | 872 | .llvm_name = "seses", |
| 873 | .description = "Prevent speculative execution side channel timing attacks by inserting a speculation barrier before memory reads, memory writes, and conditional branches. Implies LVI Control Flow integrity.", | 873 | .description = "Prevent speculative execution side channel timing attacks by inserting a speculation barrier before memory reads, memory writes, and conditional branches. Implies LVI Control Flow integrity.", |
| 874 | .dependencies = featureSet(&[_]Feature{ | 874 | .dependencies = featureSet(&[_]Feature{ |
| 875 | .lvi_cfi, | 875 | .lvi_cfi, |
| 876 | }), | 876 | }), |
| 877 | }; | 877 | }; |
| 878 | result[@enumToInt(Feature.sgx)] = .{ | 878 | result[@intFromEnum(Feature.sgx)] = .{ |
| 879 | .llvm_name = "sgx", | 879 | .llvm_name = "sgx", |
| 880 | .description = "Enable Software Guard Extensions", | 880 | .description = "Enable Software Guard Extensions", |
| 881 | .dependencies = featureSet(&[_]Feature{}), | 881 | .dependencies = featureSet(&[_]Feature{}), |
| 882 | }; | 882 | }; |
| 883 | result[@enumToInt(Feature.sha)] = .{ | 883 | result[@intFromEnum(Feature.sha)] = .{ |
| 884 | .llvm_name = "sha", | 884 | .llvm_name = "sha", |
| 885 | .description = "Enable SHA instructions", | 885 | .description = "Enable SHA instructions", |
| 886 | .dependencies = featureSet(&[_]Feature{ | 886 | .dependencies = featureSet(&[_]Feature{ |
| 887 | .sse2, | 887 | .sse2, |
| 888 | }), | 888 | }), |
| 889 | }; | 889 | }; |
| 890 | result[@enumToInt(Feature.shstk)] = .{ | 890 | result[@intFromEnum(Feature.shstk)] = .{ |
| 891 | .llvm_name = "shstk", | 891 | .llvm_name = "shstk", |
| 892 | .description = "Support CET Shadow-Stack instructions", | 892 | .description = "Support CET Shadow-Stack instructions", |
| 893 | .dependencies = featureSet(&[_]Feature{}), | 893 | .dependencies = featureSet(&[_]Feature{}), |
| 894 | }; | 894 | }; |
| 895 | result[@enumToInt(Feature.slow_3ops_lea)] = .{ | 895 | result[@intFromEnum(Feature.slow_3ops_lea)] = .{ |
| 896 | .llvm_name = "slow-3ops-lea", | 896 | .llvm_name = "slow-3ops-lea", |
| 897 | .description = "LEA instruction with 3 ops or certain registers is slow", | 897 | .description = "LEA instruction with 3 ops or certain registers is slow", |
| 898 | .dependencies = featureSet(&[_]Feature{}), | 898 | .dependencies = featureSet(&[_]Feature{}), |
| 899 | }; | 899 | }; |
| 900 | result[@enumToInt(Feature.slow_incdec)] = .{ | 900 | result[@intFromEnum(Feature.slow_incdec)] = .{ |
| 901 | .llvm_name = "slow-incdec", | 901 | .llvm_name = "slow-incdec", |
| 902 | .description = "INC and DEC instructions are slower than ADD and SUB", | 902 | .description = "INC and DEC instructions are slower than ADD and SUB", |
| 903 | .dependencies = featureSet(&[_]Feature{}), | 903 | .dependencies = featureSet(&[_]Feature{}), |
| 904 | }; | 904 | }; |
| 905 | result[@enumToInt(Feature.slow_lea)] = .{ | 905 | result[@intFromEnum(Feature.slow_lea)] = .{ |
| 906 | .llvm_name = "slow-lea", | 906 | .llvm_name = "slow-lea", |
| 907 | .description = "LEA instruction with certain arguments is slow", | 907 | .description = "LEA instruction with certain arguments is slow", |
| 908 | .dependencies = featureSet(&[_]Feature{}), | 908 | .dependencies = featureSet(&[_]Feature{}), |
| 909 | }; | 909 | }; |
| 910 | result[@enumToInt(Feature.slow_pmaddwd)] = .{ | 910 | result[@intFromEnum(Feature.slow_pmaddwd)] = .{ |
| 911 | .llvm_name = "slow-pmaddwd", | 911 | .llvm_name = "slow-pmaddwd", |
| 912 | .description = "PMADDWD is slower than PMULLD", | 912 | .description = "PMADDWD is slower than PMULLD", |
| 913 | .dependencies = featureSet(&[_]Feature{}), | 913 | .dependencies = featureSet(&[_]Feature{}), |
| 914 | }; | 914 | }; |
| 915 | result[@enumToInt(Feature.slow_pmulld)] = .{ | 915 | result[@intFromEnum(Feature.slow_pmulld)] = .{ |
| 916 | .llvm_name = "slow-pmulld", | 916 | .llvm_name = "slow-pmulld", |
| 917 | .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)", | 917 | .description = "PMULLD instruction is slow (compared to PMULLW/PMULHW and PMULUDQ)", |
| 918 | .dependencies = featureSet(&[_]Feature{}), | 918 | .dependencies = featureSet(&[_]Feature{}), |
| 919 | }; | 919 | }; |
| 920 | result[@enumToInt(Feature.slow_shld)] = .{ | 920 | result[@intFromEnum(Feature.slow_shld)] = .{ |
| 921 | .llvm_name = "slow-shld", | 921 | .llvm_name = "slow-shld", |
| 922 | .description = "SHLD instruction is slow", | 922 | .description = "SHLD instruction is slow", |
| 923 | .dependencies = featureSet(&[_]Feature{}), | 923 | .dependencies = featureSet(&[_]Feature{}), |
| 924 | }; | 924 | }; |
| 925 | result[@enumToInt(Feature.slow_two_mem_ops)] = .{ | 925 | result[@intFromEnum(Feature.slow_two_mem_ops)] = .{ |
| 926 | .llvm_name = "slow-two-mem-ops", | 926 | .llvm_name = "slow-two-mem-ops", |
| 927 | .description = "Two memory operand instructions are slow", | 927 | .description = "Two memory operand instructions are slow", |
| 928 | .dependencies = featureSet(&[_]Feature{}), | 928 | .dependencies = featureSet(&[_]Feature{}), |
| 929 | }; | 929 | }; |
| 930 | result[@enumToInt(Feature.slow_unaligned_mem_16)] = .{ | 930 | result[@intFromEnum(Feature.slow_unaligned_mem_16)] = .{ |
| 931 | .llvm_name = "slow-unaligned-mem-16", | 931 | .llvm_name = "slow-unaligned-mem-16", |
| 932 | .description = "Slow unaligned 16-byte memory access", | 932 | .description = "Slow unaligned 16-byte memory access", |
| 933 | .dependencies = featureSet(&[_]Feature{}), | 933 | .dependencies = featureSet(&[_]Feature{}), |
| 934 | }; | 934 | }; |
| 935 | result[@enumToInt(Feature.slow_unaligned_mem_32)] = .{ | 935 | result[@intFromEnum(Feature.slow_unaligned_mem_32)] = .{ |
| 936 | .llvm_name = "slow-unaligned-mem-32", | 936 | .llvm_name = "slow-unaligned-mem-32", |
| 937 | .description = "Slow unaligned 32-byte memory access", | 937 | .description = "Slow unaligned 32-byte memory access", |
| 938 | .dependencies = featureSet(&[_]Feature{}), | 938 | .dependencies = featureSet(&[_]Feature{}), |
| 939 | }; | 939 | }; |
| 940 | result[@enumToInt(Feature.soft_float)] = .{ | 940 | result[@intFromEnum(Feature.soft_float)] = .{ |
| 941 | .llvm_name = "soft-float", | 941 | .llvm_name = "soft-float", |
| 942 | .description = "Use software floating point features", | 942 | .description = "Use software floating point features", |
| 943 | .dependencies = featureSet(&[_]Feature{}), | 943 | .dependencies = featureSet(&[_]Feature{}), |
| 944 | }; | 944 | }; |
| 945 | result[@enumToInt(Feature.sse)] = .{ | 945 | result[@intFromEnum(Feature.sse)] = .{ |
| 946 | .llvm_name = "sse", | 946 | .llvm_name = "sse", |
| 947 | .description = "Enable SSE instructions", | 947 | .description = "Enable SSE instructions", |
| 948 | .dependencies = featureSet(&[_]Feature{}), | 948 | .dependencies = featureSet(&[_]Feature{}), |
| 949 | }; | 949 | }; |
| 950 | result[@enumToInt(Feature.sse2)] = .{ | 950 | result[@intFromEnum(Feature.sse2)] = .{ |
| 951 | .llvm_name = "sse2", | 951 | .llvm_name = "sse2", |
| 952 | .description = "Enable SSE2 instructions", | 952 | .description = "Enable SSE2 instructions", |
| 953 | .dependencies = featureSet(&[_]Feature{ | 953 | .dependencies = featureSet(&[_]Feature{ |
| 954 | .sse, | 954 | .sse, |
| 955 | }), | 955 | }), |
| 956 | }; | 956 | }; |
| 957 | result[@enumToInt(Feature.sse3)] = .{ | 957 | result[@intFromEnum(Feature.sse3)] = .{ |
| 958 | .llvm_name = "sse3", | 958 | .llvm_name = "sse3", |
| 959 | .description = "Enable SSE3 instructions", | 959 | .description = "Enable SSE3 instructions", |
| 960 | .dependencies = featureSet(&[_]Feature{ | 960 | .dependencies = featureSet(&[_]Feature{ |
| 961 | .sse2, | 961 | .sse2, |
| 962 | }), | 962 | }), |
| 963 | }; | 963 | }; |
| 964 | result[@enumToInt(Feature.sse4_1)] = .{ | 964 | result[@intFromEnum(Feature.sse4_1)] = .{ |
| 965 | .llvm_name = "sse4.1", | 965 | .llvm_name = "sse4.1", |
| 966 | .description = "Enable SSE 4.1 instructions", | 966 | .description = "Enable SSE 4.1 instructions", |
| 967 | .dependencies = featureSet(&[_]Feature{ | 967 | .dependencies = featureSet(&[_]Feature{ |
| 968 | .ssse3, | 968 | .ssse3, |
| 969 | }), | 969 | }), |
| 970 | }; | 970 | }; |
| 971 | result[@enumToInt(Feature.sse4_2)] = .{ | 971 | result[@intFromEnum(Feature.sse4_2)] = .{ |
| 972 | .llvm_name = "sse4.2", | 972 | .llvm_name = "sse4.2", |
| 973 | .description = "Enable SSE 4.2 instructions", | 973 | .description = "Enable SSE 4.2 instructions", |
| 974 | .dependencies = featureSet(&[_]Feature{ | 974 | .dependencies = featureSet(&[_]Feature{ |
| 975 | .sse4_1, | 975 | .sse4_1, |
| 976 | }), | 976 | }), |
| 977 | }; | 977 | }; |
| 978 | result[@enumToInt(Feature.sse4a)] = .{ | 978 | result[@intFromEnum(Feature.sse4a)] = .{ |
| 979 | .llvm_name = "sse4a", | 979 | .llvm_name = "sse4a", |
| 980 | .description = "Support SSE 4a instructions", | 980 | .description = "Support SSE 4a instructions", |
| 981 | .dependencies = featureSet(&[_]Feature{ | 981 | .dependencies = featureSet(&[_]Feature{ |
| 982 | .sse3, | 982 | .sse3, |
| 983 | }), | 983 | }), |
| 984 | }; | 984 | }; |
| 985 | result[@enumToInt(Feature.sse_unaligned_mem)] = .{ | 985 | result[@intFromEnum(Feature.sse_unaligned_mem)] = .{ |
| 986 | .llvm_name = "sse-unaligned-mem", | 986 | .llvm_name = "sse-unaligned-mem", |
| 987 | .description = "Allow unaligned memory operands with SSE instructions (this may require setting a configuration bit in the processor)", | 987 | .description = "Allow unaligned memory operands with SSE instructions (this may require setting a configuration bit in the processor)", |
| 988 | .dependencies = featureSet(&[_]Feature{}), | 988 | .dependencies = featureSet(&[_]Feature{}), |
| 989 | }; | 989 | }; |
| 990 | result[@enumToInt(Feature.ssse3)] = .{ | 990 | result[@intFromEnum(Feature.ssse3)] = .{ |
| 991 | .llvm_name = "ssse3", | 991 | .llvm_name = "ssse3", |
| 992 | .description = "Enable SSSE3 instructions", | 992 | .description = "Enable SSSE3 instructions", |
| 993 | .dependencies = featureSet(&[_]Feature{ | 993 | .dependencies = featureSet(&[_]Feature{ |
| 994 | .sse3, | 994 | .sse3, |
| 995 | }), | 995 | }), |
| 996 | }; | 996 | }; |
| 997 | result[@enumToInt(Feature.tagged_globals)] = .{ | 997 | result[@intFromEnum(Feature.tagged_globals)] = .{ |
| 998 | .llvm_name = "tagged-globals", | 998 | .llvm_name = "tagged-globals", |
| 999 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits.", | 999 | .description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits.", |
| 1000 | .dependencies = featureSet(&[_]Feature{}), | 1000 | .dependencies = featureSet(&[_]Feature{}), |
| 1001 | }; | 1001 | }; |
| 1002 | result[@enumToInt(Feature.tbm)] = .{ | 1002 | result[@intFromEnum(Feature.tbm)] = .{ |
| 1003 | .llvm_name = "tbm", | 1003 | .llvm_name = "tbm", |
| 1004 | .description = "Enable TBM instructions", | 1004 | .description = "Enable TBM instructions", |
| 1005 | .dependencies = featureSet(&[_]Feature{}), | 1005 | .dependencies = featureSet(&[_]Feature{}), |
| 1006 | }; | 1006 | }; |
| 1007 | result[@enumToInt(Feature.tsxldtrk)] = .{ | 1007 | result[@intFromEnum(Feature.tsxldtrk)] = .{ |
| 1008 | .llvm_name = "tsxldtrk", | 1008 | .llvm_name = "tsxldtrk", |
| 1009 | .description = "Support TSXLDTRK instructions", | 1009 | .description = "Support TSXLDTRK instructions", |
| 1010 | .dependencies = featureSet(&[_]Feature{}), | 1010 | .dependencies = featureSet(&[_]Feature{}), |
| 1011 | }; | 1011 | }; |
| 1012 | result[@enumToInt(Feature.uintr)] = .{ | 1012 | result[@intFromEnum(Feature.uintr)] = .{ |
| 1013 | .llvm_name = "uintr", | 1013 | .llvm_name = "uintr", |
| 1014 | .description = "Has UINTR Instructions", | 1014 | .description = "Has UINTR Instructions", |
| 1015 | .dependencies = featureSet(&[_]Feature{}), | 1015 | .dependencies = featureSet(&[_]Feature{}), |
| 1016 | }; | 1016 | }; |
| 1017 | result[@enumToInt(Feature.use_glm_div_sqrt_costs)] = .{ | 1017 | result[@intFromEnum(Feature.use_glm_div_sqrt_costs)] = .{ |
| 1018 | .llvm_name = "use-glm-div-sqrt-costs", | 1018 | .llvm_name = "use-glm-div-sqrt-costs", |
| 1019 | .description = "Use Goldmont specific floating point div/sqrt costs", | 1019 | .description = "Use Goldmont specific floating point div/sqrt costs", |
| 1020 | .dependencies = featureSet(&[_]Feature{}), | 1020 | .dependencies = featureSet(&[_]Feature{}), |
| 1021 | }; | 1021 | }; |
| 1022 | result[@enumToInt(Feature.use_slm_arith_costs)] = .{ | 1022 | result[@intFromEnum(Feature.use_slm_arith_costs)] = .{ |
| 1023 | .llvm_name = "use-slm-arith-costs", | 1023 | .llvm_name = "use-slm-arith-costs", |
| 1024 | .description = "Use Silvermont specific arithmetic costs", | 1024 | .description = "Use Silvermont specific arithmetic costs", |
| 1025 | .dependencies = featureSet(&[_]Feature{}), | 1025 | .dependencies = featureSet(&[_]Feature{}), |
| 1026 | }; | 1026 | }; |
| 1027 | result[@enumToInt(Feature.vaes)] = .{ | 1027 | result[@intFromEnum(Feature.vaes)] = .{ |
| 1028 | .llvm_name = "vaes", | 1028 | .llvm_name = "vaes", |
| 1029 | .description = "Promote selected AES instructions to AVX512/AVX registers", | 1029 | .description = "Promote selected AES instructions to AVX512/AVX registers", |
| 1030 | .dependencies = featureSet(&[_]Feature{ | 1030 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1032,7 +1032,7 @@ pub const all_features = blk: { | ... | @@ -1032,7 +1032,7 @@ pub const all_features = blk: { |
| 1032 | .avx, | 1032 | .avx, |
| 1033 | }), | 1033 | }), |
| 1034 | }; | 1034 | }; |
| 1035 | result[@enumToInt(Feature.vpclmulqdq)] = .{ | 1035 | result[@intFromEnum(Feature.vpclmulqdq)] = .{ |
| 1036 | .llvm_name = "vpclmulqdq", | 1036 | .llvm_name = "vpclmulqdq", |
| 1037 | .description = "Enable vpclmulqdq instructions", | 1037 | .description = "Enable vpclmulqdq instructions", |
| 1038 | .dependencies = featureSet(&[_]Feature{ | 1038 | .dependencies = featureSet(&[_]Feature{ |
| ... | @@ -1040,60 +1040,60 @@ pub const all_features = blk: { | ... | @@ -1040,60 +1040,60 @@ pub const all_features = blk: { |
| 1040 | .pclmul, | 1040 | .pclmul, |
| 1041 | }), | 1041 | }), |
| 1042 | }; | 1042 | }; |
| 1043 | result[@enumToInt(Feature.vzeroupper)] = .{ | 1043 | result[@intFromEnum(Feature.vzeroupper)] = .{ |
| 1044 | .llvm_name = "vzeroupper", | 1044 | .llvm_name = "vzeroupper", |
| 1045 | .description = "Should insert vzeroupper instructions", | 1045 | .description = "Should insert vzeroupper instructions", |
| 1046 | .dependencies = featureSet(&[_]Feature{}), | 1046 | .dependencies = featureSet(&[_]Feature{}), |
| 1047 | }; | 1047 | }; |
| 1048 | result[@enumToInt(Feature.waitpkg)] = .{ | 1048 | result[@intFromEnum(Feature.waitpkg)] = .{ |
| 1049 | .llvm_name = "waitpkg", | 1049 | .llvm_name = "waitpkg", |
| 1050 | .description = "Wait and pause enhancements", | 1050 | .description = "Wait and pause enhancements", |
| 1051 | .dependencies = featureSet(&[_]Feature{}), | 1051 | .dependencies = featureSet(&[_]Feature{}), |
| 1052 | }; | 1052 | }; |
| 1053 | result[@enumToInt(Feature.wbnoinvd)] = .{ | 1053 | result[@intFromEnum(Feature.wbnoinvd)] = .{ |
| 1054 | .llvm_name = "wbnoinvd", | 1054 | .llvm_name = "wbnoinvd", |
| 1055 | .description = "Write Back No Invalidate", | 1055 | .description = "Write Back No Invalidate", |
| 1056 | .dependencies = featureSet(&[_]Feature{}), | 1056 | .dependencies = featureSet(&[_]Feature{}), |
| 1057 | }; | 1057 | }; |
| 1058 | result[@enumToInt(Feature.widekl)] = .{ | 1058 | result[@intFromEnum(Feature.widekl)] = .{ |
| 1059 | .llvm_name = "widekl", | 1059 | .llvm_name = "widekl", |
| 1060 | .description = "Support Key Locker wide Instructions", | 1060 | .description = "Support Key Locker wide Instructions", |
| 1061 | .dependencies = featureSet(&[_]Feature{ | 1061 | .dependencies = featureSet(&[_]Feature{ |
| 1062 | .kl, | 1062 | .kl, |
| 1063 | }), | 1063 | }), |
| 1064 | }; | 1064 | }; |
| 1065 | result[@enumToInt(Feature.x87)] = .{ | 1065 | result[@intFromEnum(Feature.x87)] = .{ |
| 1066 | .llvm_name = "x87", | 1066 | .llvm_name = "x87", |
| 1067 | .description = "Enable X87 float instructions", | 1067 | .description = "Enable X87 float instructions", |
| 1068 | .dependencies = featureSet(&[_]Feature{}), | 1068 | .dependencies = featureSet(&[_]Feature{}), |
| 1069 | }; | 1069 | }; |
| 1070 | result[@enumToInt(Feature.xop)] = .{ | 1070 | result[@intFromEnum(Feature.xop)] = .{ |
| 1071 | .llvm_name = "xop", | 1071 | .llvm_name = "xop", |
| 1072 | .description = "Enable XOP instructions", | 1072 | .description = "Enable XOP instructions", |
| 1073 | .dependencies = featureSet(&[_]Feature{ | 1073 | .dependencies = featureSet(&[_]Feature{ |
| 1074 | .fma4, | 1074 | .fma4, |
| 1075 | }), | 1075 | }), |
| 1076 | }; | 1076 | }; |
| 1077 | result[@enumToInt(Feature.xsave)] = .{ | 1077 | result[@intFromEnum(Feature.xsave)] = .{ |
| 1078 | .llvm_name = "xsave", | 1078 | .llvm_name = "xsave", |
| 1079 | .description = "Support xsave instructions", | 1079 | .description = "Support xsave instructions", |
| 1080 | .dependencies = featureSet(&[_]Feature{}), | 1080 | .dependencies = featureSet(&[_]Feature{}), |
| 1081 | }; | 1081 | }; |
| 1082 | result[@enumToInt(Feature.xsavec)] = .{ | 1082 | result[@intFromEnum(Feature.xsavec)] = .{ |
| 1083 | .llvm_name = "xsavec", | 1083 | .llvm_name = "xsavec", |
| 1084 | .description = "Support xsavec instructions", | 1084 | .description = "Support xsavec instructions", |
| 1085 | .dependencies = featureSet(&[_]Feature{ | 1085 | .dependencies = featureSet(&[_]Feature{ |
| 1086 | .xsave, | 1086 | .xsave, |
| 1087 | }), | 1087 | }), |
| 1088 | }; | 1088 | }; |
| 1089 | result[@enumToInt(Feature.xsaveopt)] = .{ | 1089 | result[@intFromEnum(Feature.xsaveopt)] = .{ |
| 1090 | .llvm_name = "xsaveopt", | 1090 | .llvm_name = "xsaveopt", |
| 1091 | .description = "Support xsaveopt instructions", | 1091 | .description = "Support xsaveopt instructions", |
| 1092 | .dependencies = featureSet(&[_]Feature{ | 1092 | .dependencies = featureSet(&[_]Feature{ |
| 1093 | .xsave, | 1093 | .xsave, |
| 1094 | }), | 1094 | }), |
| 1095 | }; | 1095 | }; |
| 1096 | result[@enumToInt(Feature.xsaves)] = .{ | 1096 | result[@intFromEnum(Feature.xsaves)] = .{ |
| 1097 | .llvm_name = "xsaves", | 1097 | .llvm_name = "xsaves", |
| 1098 | .description = "Support xsaves instructions", | 1098 | .description = "Support xsaves instructions", |
| 1099 | .dependencies = featureSet(&[_]Feature{ | 1099 | .dependencies = featureSet(&[_]Feature{ |
lib/std/target/xtensa.zig+1-1| ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { | ... | @@ -17,7 +17,7 @@ pub const all_features = blk: { |
| 17 | const len = @typeInfo(Feature).Enum.fields.len; | 17 | const len = @typeInfo(Feature).Enum.fields.len; |
| 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); | 18 | std.debug.assert(len <= CpuFeature.Set.needed_bit_count); |
| 19 | var result: [len]CpuFeature = undefined; | 19 | var result: [len]CpuFeature = undefined; |
| 20 | result[@enumToInt(Feature.density)] = .{ | 20 | result[@intFromEnum(Feature.density)] = .{ |
| 21 | .llvm_name = "density", | 21 | .llvm_name = "density", |
| 22 | .description = "Enable Density instructions", | 22 | .description = "Enable Density instructions", |
| 23 | .dependencies = featureSet(&[_]Feature{}), | 23 | .dependencies = featureSet(&[_]Feature{}), |
lib/std/time/epoch.zig+2-2| ... | @@ -83,7 +83,7 @@ pub const Month = enum(u4) { | ... | @@ -83,7 +83,7 @@ pub const Month = enum(u4) { |
| 83 | /// return the numeric calendar value for the given month | 83 | /// return the numeric calendar value for the given month |
| 84 | /// i.e. jan=1, feb=2, etc | 84 | /// i.e. jan=1, feb=2, etc |
| 85 | pub fn numeric(self: Month) u4 { | 85 | pub fn numeric(self: Month) u4 { |
| 86 | return @enumToInt(self); | 86 | return @intFromEnum(self); |
| 87 | } | 87 | } |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| ... | @@ -122,7 +122,7 @@ pub const YearAndDay = struct { | ... | @@ -122,7 +122,7 @@ pub const YearAndDay = struct { |
| 122 | if (days_left < days_in_month) | 122 | if (days_left < days_in_month) |
| 123 | break; | 123 | break; |
| 124 | days_left -= days_in_month; | 124 | days_left -= days_in_month; |
| 125 | month = @intToEnum(Month, @enumToInt(month) + 1); | 125 | month = @enumFromInt(Month, @intFromEnum(month) + 1); |
| 126 | } | 126 | } |
| 127 | return .{ .month = month, .day_index = @intCast(u5, days_left) }; | 127 | return .{ .month = month, .day_index = @intCast(u5, days_left) }; |
| 128 | } | 128 | } |
lib/std/treap.zig+11-11| ... | @@ -159,7 +159,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -159,7 +159,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 159 | if (order == .eq) break; | 159 | if (order == .eq) break; |
| 160 | 160 | ||
| 161 | parent_ref.* = current; | 161 | parent_ref.* = current; |
| 162 | node = current.children[@boolToInt(order == .gt)]; | 162 | node = current.children[@intFromBool(order == .gt)]; |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | return node; | 165 | return node; |
| ... | @@ -168,12 +168,12 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -168,12 +168,12 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 168 | fn insert(self: *Self, key: Key, parent: ?*Node, node: *Node) void { | 168 | fn insert(self: *Self, key: Key, parent: ?*Node, node: *Node) void { |
| 169 | // generate a random priority & prepare the node to be inserted into the tree | 169 | // generate a random priority & prepare the node to be inserted into the tree |
| 170 | node.key = key; | 170 | node.key = key; |
| 171 | node.priority = self.prng.random(@ptrToInt(node)); | 171 | node.priority = self.prng.random(@intFromPtr(node)); |
| 172 | node.parent = parent; | 172 | node.parent = parent; |
| 173 | node.children = [_]?*Node{ null, null }; | 173 | node.children = [_]?*Node{ null, null }; |
| 174 | 174 | ||
| 175 | // point the parent at the new node | 175 | // point the parent at the new node |
| 176 | const link = if (parent) |p| &p.children[@boolToInt(compare(key, p.key) == .gt)] else &self.root; | 176 | const link = if (parent) |p| &p.children[@intFromBool(compare(key, p.key) == .gt)] else &self.root; |
| 177 | assert(link.* == null); | 177 | assert(link.* == null); |
| 178 | link.* = node; | 178 | link.* = node; |
| 179 | 179 | ||
| ... | @@ -182,7 +182,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -182,7 +182,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 182 | if (p.priority <= node.priority) break; | 182 | if (p.priority <= node.priority) break; |
| 183 | 183 | ||
| 184 | const is_right = p.children[1] == node; | 184 | const is_right = p.children[1] == node; |
| 185 | assert(p.children[@boolToInt(is_right)] == node); | 185 | assert(p.children[@intFromBool(is_right)] == node); |
| 186 | 186 | ||
| 187 | const rotate_right = !is_right; | 187 | const rotate_right = !is_right; |
| 188 | self.rotate(p, rotate_right); | 188 | self.rotate(p, rotate_right); |
| ... | @@ -197,7 +197,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -197,7 +197,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 197 | new.children = old.children; | 197 | new.children = old.children; |
| 198 | 198 | ||
| 199 | // point the parent at the new node | 199 | // point the parent at the new node |
| 200 | const link = if (old.parent) |p| &p.children[@boolToInt(p.children[1] == old)] else &self.root; | 200 | const link = if (old.parent) |p| &p.children[@intFromBool(p.children[1] == old)] else &self.root; |
| 201 | assert(link.* == old); | 201 | assert(link.* == old); |
| 202 | link.* = new; | 202 | link.* = new; |
| 203 | 203 | ||
| ... | @@ -220,7 +220,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -220,7 +220,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | // node is a now a leaf; remove by nulling out the parent's reference to it. | 222 | // node is a now a leaf; remove by nulling out the parent's reference to it. |
| 223 | const link = if (node.parent) |p| &p.children[@boolToInt(p.children[1] == node)] else &self.root; | 223 | const link = if (node.parent) |p| &p.children[@intFromBool(p.children[1] == node)] else &self.root; |
| 224 | assert(link.* == node); | 224 | assert(link.* == node); |
| 225 | link.* = null; | 225 | link.* = null; |
| 226 | 226 | ||
| ... | @@ -240,12 +240,12 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -240,12 +240,12 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 240 | // parent -> (node (target YY adjacent) XX) | 240 | // parent -> (node (target YY adjacent) XX) |
| 241 | // parent -> (target YY (node adjacent XX)) | 241 | // parent -> (target YY (node adjacent XX)) |
| 242 | const parent = node.parent; | 242 | const parent = node.parent; |
| 243 | const target = node.children[@boolToInt(!right)] orelse unreachable; | 243 | const target = node.children[@intFromBool(!right)] orelse unreachable; |
| 244 | const adjacent = target.children[@boolToInt(right)]; | 244 | const adjacent = target.children[@intFromBool(right)]; |
| 245 | 245 | ||
| 246 | // rotate the children | 246 | // rotate the children |
| 247 | target.children[@boolToInt(right)] = node; | 247 | target.children[@intFromBool(right)] = node; |
| 248 | node.children[@boolToInt(!right)] = adjacent; | 248 | node.children[@intFromBool(!right)] = adjacent; |
| 249 | 249 | ||
| 250 | // rotate the parents | 250 | // rotate the parents |
| 251 | node.parent = target; | 251 | node.parent = target; |
| ... | @@ -253,7 +253,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { | ... | @@ -253,7 +253,7 @@ pub fn Treap(comptime Key: type, comptime compareFn: anytype) type { |
| 253 | if (adjacent) |adj| adj.parent = node; | 253 | if (adjacent) |adj| adj.parent = node; |
| 254 | 254 | ||
| 255 | // fix the parent link | 255 | // fix the parent link |
| 256 | const link = if (parent) |p| &p.children[@boolToInt(p.children[1] == node)] else &self.root; | 256 | const link = if (parent) |p| &p.children[@intFromBool(p.children[1] == node)] else &self.root; |
| 257 | assert(link.* == node); | 257 | assert(link.* == node); |
| 258 | link.* = target; | 258 | link.* = target; |
| 259 | } | 259 | } |
lib/std/unicode/throughput_test.zig+2-2| ... | @@ -32,8 +32,8 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { | ... | @@ -32,8 +32,8 @@ fn benchmarkCodepointCount(buf: []const u8) !ResultCount { |
| 32 | } | 32 | } |
| 33 | const end = timer.read(); | 33 | const end = timer.read(); |
| 34 | 34 | ||
| 35 | const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s; | 35 | const elapsed_s = @floatFromInt(f64, end - start) / time.ns_per_s; |
| 36 | const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s); | 36 | const throughput = @intFromFloat(u64, @floatFromInt(f64, bytes) / elapsed_s); |
| 37 | 37 | ||
| 38 | return ResultCount{ .count = r, .throughput = throughput }; | 38 | return ResultCount{ .count = r, .throughput = throughput }; |
| 39 | } | 39 | } |
lib/std/valgrind.zig+20-20| ... | @@ -94,7 +94,7 @@ pub fn IsTool(base: [2]u8, code: usize) bool { | ... | @@ -94,7 +94,7 @@ pub fn IsTool(base: [2]u8, code: usize) bool { |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 96 | fn doClientRequestExpr(default: usize, request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 97 | return doClientRequest(default, @intCast(usize, @enumToInt(request)), a1, a2, a3, a4, a5); | 97 | return doClientRequest(default, @intCast(usize, @intFromEnum(request)), a1, a2, a3, a4, a5); |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 100 | fn doClientRequestStmt(request: ClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
| ... | @@ -117,7 +117,7 @@ test "works whether running on valgrind or not" { | ... | @@ -117,7 +117,7 @@ test "works whether running on valgrind or not" { |
| 117 | /// a JITter or some such, since it provides a way to make sure valgrind will | 117 | /// a JITter or some such, since it provides a way to make sure valgrind will |
| 118 | /// retranslate the invalidated area. Returns no value. | 118 | /// retranslate the invalidated area. Returns no value. |
| 119 | pub fn discardTranslations(qzz: []const u8) void { | 119 | pub fn discardTranslations(qzz: []const u8) void { |
| 120 | doClientRequestStmt(.DiscardTranslations, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0); | 120 | doClientRequestStmt(.DiscardTranslations, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | pub fn innerThreads(qzz: [*]u8) void { | 123 | pub fn innerThreads(qzz: [*]u8) void { |
| ... | @@ -125,19 +125,19 @@ pub fn innerThreads(qzz: [*]u8) void { | ... | @@ -125,19 +125,19 @@ pub fn innerThreads(qzz: [*]u8) void { |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | pub fn nonSIMDCall0(func: fn (usize) usize) usize { | 127 | pub fn nonSIMDCall0(func: fn (usize) usize) usize { |
| 128 | return doClientRequestExpr(0, .ClientCall0, @ptrToInt(func), 0, 0, 0, 0); | 128 | return doClientRequestExpr(0, .ClientCall0, @intFromPtr(func), 0, 0, 0, 0); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | pub fn nonSIMDCall1(func: fn (usize, usize) usize, a1: usize) usize { | 131 | pub fn nonSIMDCall1(func: fn (usize, usize) usize, a1: usize) usize { |
| 132 | return doClientRequestExpr(0, .ClientCall1, @ptrToInt(func), a1, 0, 0, 0); | 132 | return doClientRequestExpr(0, .ClientCall1, @intFromPtr(func), a1, 0, 0, 0); |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | pub fn nonSIMDCall2(func: fn (usize, usize, usize) usize, a1: usize, a2: usize) usize { | 135 | pub fn nonSIMDCall2(func: fn (usize, usize, usize) usize, a1: usize, a2: usize) usize { |
| 136 | return doClientRequestExpr(0, .ClientCall2, @ptrToInt(func), a1, a2, 0, 0); | 136 | return doClientRequestExpr(0, .ClientCall2, @intFromPtr(func), a1, a2, 0, 0); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | pub fn nonSIMDCall3(func: fn (usize, usize, usize, usize) usize, a1: usize, a2: usize, a3: usize) usize { | 139 | pub fn nonSIMDCall3(func: fn (usize, usize, usize, usize) usize, a1: usize, a2: usize, a3: usize) usize { |
| 140 | return doClientRequestExpr(0, .ClientCall3, @ptrToInt(func), a1, a2, a3, 0); | 140 | return doClientRequestExpr(0, .ClientCall3, @intFromPtr(func), a1, a2, a3, 0); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | /// Counts the number of errors that have been recorded by a tool. Nb: | 143 | /// Counts the number of errors that have been recorded by a tool. Nb: |
| ... | @@ -149,15 +149,15 @@ pub fn countErrors() usize { | ... | @@ -149,15 +149,15 @@ pub fn countErrors() usize { |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | pub fn mallocLikeBlock(mem: []u8, rzB: usize, is_zeroed: bool) void { | 151 | pub fn mallocLikeBlock(mem: []u8, rzB: usize, is_zeroed: bool) void { |
| 152 | doClientRequestStmt(.MalloclikeBlock, @ptrToInt(mem.ptr), mem.len, rzB, @boolToInt(is_zeroed), 0); | 152 | doClientRequestStmt(.MalloclikeBlock, @intFromPtr(mem.ptr), mem.len, rzB, @intFromBool(is_zeroed), 0); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | pub fn resizeInPlaceBlock(oldmem: []u8, newsize: usize, rzB: usize) void { | 155 | pub fn resizeInPlaceBlock(oldmem: []u8, newsize: usize, rzB: usize) void { |
| 156 | doClientRequestStmt(.ResizeinplaceBlock, @ptrToInt(oldmem.ptr), oldmem.len, newsize, rzB, 0); | 156 | doClientRequestStmt(.ResizeinplaceBlock, @intFromPtr(oldmem.ptr), oldmem.len, newsize, rzB, 0); |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | pub fn freeLikeBlock(addr: [*]u8, rzB: usize) void { | 159 | pub fn freeLikeBlock(addr: [*]u8, rzB: usize) void { |
| 160 | doClientRequestStmt(.FreelikeBlock, @ptrToInt(addr), rzB, 0, 0, 0); | 160 | doClientRequestStmt(.FreelikeBlock, @intFromPtr(addr), rzB, 0, 0, 0); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /// Create a memory pool. | 163 | /// Create a memory pool. |
| ... | @@ -166,7 +166,7 @@ pub const MempoolFlags = struct { | ... | @@ -166,7 +166,7 @@ pub const MempoolFlags = struct { |
| 166 | pub const MetaPool = 2; | 166 | pub const MetaPool = 2; |
| 167 | }; | 167 | }; |
| 168 | pub fn createMempool(pool: [*]u8, rzB: usize, is_zeroed: bool, flags: usize) void { | 168 | pub fn createMempool(pool: [*]u8, rzB: usize, is_zeroed: bool, flags: usize) void { |
| 169 | doClientRequestStmt(.CreateMempool, @ptrToInt(pool), rzB, @boolToInt(is_zeroed), flags, 0); | 169 | doClientRequestStmt(.CreateMempool, @intFromPtr(pool), rzB, @intFromBool(is_zeroed), flags, 0); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | /// Destroy a memory pool. | 172 | /// Destroy a memory pool. |
| ... | @@ -176,39 +176,39 @@ pub fn destroyMempool(pool: [*]u8) void { | ... | @@ -176,39 +176,39 @@ pub fn destroyMempool(pool: [*]u8) void { |
| 176 | 176 | ||
| 177 | /// Associate a piece of memory with a memory pool. | 177 | /// Associate a piece of memory with a memory pool. |
| 178 | pub fn mempoolAlloc(pool: [*]u8, mem: []u8) void { | 178 | pub fn mempoolAlloc(pool: [*]u8, mem: []u8) void { |
| 179 | doClientRequestStmt(.MempoolAlloc, @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len, 0, 0); | 179 | doClientRequestStmt(.MempoolAlloc, @intFromPtr(pool), @intFromPtr(mem.ptr), mem.len, 0, 0); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | /// Disassociate a piece of memory from a memory pool. | 182 | /// Disassociate a piece of memory from a memory pool. |
| 183 | pub fn mempoolFree(pool: [*]u8, addr: [*]u8) void { | 183 | pub fn mempoolFree(pool: [*]u8, addr: [*]u8) void { |
| 184 | doClientRequestStmt(.MempoolFree, @ptrToInt(pool), @ptrToInt(addr), 0, 0, 0); | 184 | doClientRequestStmt(.MempoolFree, @intFromPtr(pool), @intFromPtr(addr), 0, 0, 0); |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | /// Disassociate any pieces outside a particular range. | 187 | /// Disassociate any pieces outside a particular range. |
| 188 | pub fn mempoolTrim(pool: [*]u8, mem: []u8) void { | 188 | pub fn mempoolTrim(pool: [*]u8, mem: []u8) void { |
| 189 | doClientRequestStmt(.MempoolTrim, @ptrToInt(pool), @ptrToInt(mem.ptr), mem.len, 0, 0); | 189 | doClientRequestStmt(.MempoolTrim, @intFromPtr(pool), @intFromPtr(mem.ptr), mem.len, 0, 0); |
| 190 | } | 190 | } |
| 191 | 191 | ||
| 192 | /// Resize and/or move a piece associated with a memory pool. | 192 | /// Resize and/or move a piece associated with a memory pool. |
| 193 | pub fn moveMempool(poolA: [*]u8, poolB: [*]u8) void { | 193 | pub fn moveMempool(poolA: [*]u8, poolB: [*]u8) void { |
| 194 | doClientRequestStmt(.MoveMempool, @ptrToInt(poolA), @ptrToInt(poolB), 0, 0, 0); | 194 | doClientRequestStmt(.MoveMempool, @intFromPtr(poolA), @intFromPtr(poolB), 0, 0, 0); |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | /// Resize and/or move a piece associated with a memory pool. | 197 | /// Resize and/or move a piece associated with a memory pool. |
| 198 | pub fn mempoolChange(pool: [*]u8, addrA: [*]u8, mem: []u8) void { | 198 | pub fn mempoolChange(pool: [*]u8, addrA: [*]u8, mem: []u8) void { |
| 199 | doClientRequestStmt(.MempoolChange, @ptrToInt(pool), @ptrToInt(addrA), @ptrToInt(mem.ptr), mem.len, 0); | 199 | doClientRequestStmt(.MempoolChange, @intFromPtr(pool), @intFromPtr(addrA), @intFromPtr(mem.ptr), mem.len, 0); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | /// Return if a mempool exists. | 202 | /// Return if a mempool exists. |
| 203 | pub fn mempoolExists(pool: [*]u8) bool { | 203 | pub fn mempoolExists(pool: [*]u8) bool { |
| 204 | return doClientRequestExpr(0, .MempoolExists, @ptrToInt(pool), 0, 0, 0, 0) != 0; | 204 | return doClientRequestExpr(0, .MempoolExists, @intFromPtr(pool), 0, 0, 0, 0) != 0; |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | /// Mark a piece of memory as being a stack. Returns a stack id. | 207 | /// Mark a piece of memory as being a stack. Returns a stack id. |
| 208 | /// start is the lowest addressable stack byte, end is the highest | 208 | /// start is the lowest addressable stack byte, end is the highest |
| 209 | /// addressable stack byte. | 209 | /// addressable stack byte. |
| 210 | pub fn stackRegister(stack: []u8) usize { | 210 | pub fn stackRegister(stack: []u8) usize { |
| 211 | return doClientRequestExpr(0, .StackRegister, @ptrToInt(stack.ptr), @ptrToInt(stack.ptr) + stack.len, 0, 0, 0); | 211 | return doClientRequestExpr(0, .StackRegister, @intFromPtr(stack.ptr), @intFromPtr(stack.ptr) + stack.len, 0, 0, 0); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /// Unmark the piece of memory associated with a stack id as being a stack. | 214 | /// Unmark the piece of memory associated with a stack id as being a stack. |
| ... | @@ -220,7 +220,7 @@ pub fn stackDeregister(id: usize) void { | ... | @@ -220,7 +220,7 @@ pub fn stackDeregister(id: usize) void { |
| 220 | /// start is the new lowest addressable stack byte, end is the new highest | 220 | /// start is the new lowest addressable stack byte, end is the new highest |
| 221 | /// addressable stack byte. | 221 | /// addressable stack byte. |
| 222 | pub fn stackChange(id: usize, newstack: []u8) void { | 222 | pub fn stackChange(id: usize, newstack: []u8) void { |
| 223 | doClientRequestStmt(.StackChange, id, @ptrToInt(newstack.ptr), @ptrToInt(newstack.ptr) + newstack.len, 0, 0); | 223 | doClientRequestStmt(.StackChange, id, @intFromPtr(newstack.ptr), @intFromPtr(newstack.ptr) + newstack.len, 0, 0); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | // Load PDB debug info for Wine PE image_map. | 226 | // Load PDB debug info for Wine PE image_map. |
| ... | @@ -235,7 +235,7 @@ pub fn stackChange(id: usize, newstack: []u8) void { | ... | @@ -235,7 +235,7 @@ pub fn stackChange(id: usize, newstack: []u8) void { |
| 235 | /// result will be dumped in there and is guaranteed to be zero | 235 | /// result will be dumped in there and is guaranteed to be zero |
| 236 | /// terminated. If no info is found, the first byte is set to zero. | 236 | /// terminated. If no info is found, the first byte is set to zero. |
| 237 | pub fn mapIpToSrcloc(addr: *const u8, buf64: [64]u8) usize { | 237 | pub fn mapIpToSrcloc(addr: *const u8, buf64: [64]u8) usize { |
| 238 | return doClientRequestExpr(0, .MapIpToSrcloc, @ptrToInt(addr), @ptrToInt(&buf64[0]), 0, 0, 0); | 238 | return doClientRequestExpr(0, .MapIpToSrcloc, @intFromPtr(addr), @intFromPtr(&buf64[0]), 0, 0, 0); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | /// Disable error reporting for this thread. Behaves in a stack like | 241 | /// Disable error reporting for this thread. Behaves in a stack like |
| ... | @@ -261,7 +261,7 @@ pub fn enableErrorReporting() void { | ... | @@ -261,7 +261,7 @@ pub fn enableErrorReporting() void { |
| 261 | /// If no connection is opened, output will go to the log output. | 261 | /// If no connection is opened, output will go to the log output. |
| 262 | /// Returns 1 if command not recognised, 0 otherwise. | 262 | /// Returns 1 if command not recognised, 0 otherwise. |
| 263 | pub fn monitorCommand(command: [*]u8) bool { | 263 | pub fn monitorCommand(command: [*]u8) bool { |
| 264 | return doClientRequestExpr(0, .GdbMonitorCommand, @ptrToInt(command.ptr), 0, 0, 0, 0) != 0; | 264 | return doClientRequestExpr(0, .GdbMonitorCommand, @intFromPtr(command.ptr), 0, 0, 0, 0) != 0; |
| 265 | } | 265 | } |
| 266 | 266 | ||
| 267 | pub const memcheck = @import("valgrind/memcheck.zig"); | 267 | pub const memcheck = @import("valgrind/memcheck.zig"); |
lib/std/valgrind/callgrind.zig+2-2| ... | @@ -11,7 +11,7 @@ pub const CallgrindClientRequest = enum(usize) { | ... | @@ -11,7 +11,7 @@ pub const CallgrindClientRequest = enum(usize) { |
| 11 | }; | 11 | }; |
| 12 | 12 | ||
| 13 | fn doCallgrindClientRequestExpr(default: usize, request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 13 | fn doCallgrindClientRequestExpr(default: usize, request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 14 | return valgrind.doClientRequest(default, @intCast(usize, @enumToInt(request)), a1, a2, a3, a4, a5); | 14 | return valgrind.doClientRequest(default, @intCast(usize, @intFromEnum(request)), a1, a2, a3, a4, a5); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | fn doCallgrindClientRequestStmt(request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 17 | fn doCallgrindClientRequestStmt(request: CallgrindClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
| ... | @@ -28,7 +28,7 @@ pub fn dumpStats() void { | ... | @@ -28,7 +28,7 @@ pub fn dumpStats() void { |
| 28 | /// the dump. This string is written as a description field into the | 28 | /// the dump. This string is written as a description field into the |
| 29 | /// profile data dump. | 29 | /// profile data dump. |
| 30 | pub fn dumpStatsAt(pos_str: [*]u8) void { | 30 | pub fn dumpStatsAt(pos_str: [*]u8) void { |
| 31 | doCallgrindClientRequestStmt(.DumpStatsAt, @ptrToInt(pos_str), 0, 0, 0, 0); | 31 | doCallgrindClientRequestStmt(.DumpStatsAt, @intFromPtr(pos_str), 0, 0, 0, 0); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | /// Zero cost centers | 34 | /// Zero cost centers |
lib/std/valgrind/memcheck.zig+20-20| ... | @@ -21,7 +21,7 @@ pub const MemCheckClientRequest = enum(usize) { | ... | @@ -21,7 +21,7 @@ pub const MemCheckClientRequest = enum(usize) { |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | fn doMemCheckClientRequestExpr(default: usize, request: MemCheckClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { | 23 | fn doMemCheckClientRequestExpr(default: usize, request: MemCheckClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) usize { |
| 24 | return valgrind.doClientRequest(default, @intCast(usize, @enumToInt(request)), a1, a2, a3, a4, a5); | 24 | return valgrind.doClientRequest(default, @intCast(usize, @intFromEnum(request)), a1, a2, a3, a4, a5); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | fn doMemCheckClientRequestStmt(request: MemCheckClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { | 27 | fn doMemCheckClientRequestStmt(request: MemCheckClientRequest, a1: usize, a2: usize, a3: usize, a4: usize, a5: usize) void { |
| ... | @@ -32,7 +32,7 @@ fn doMemCheckClientRequestStmt(request: MemCheckClientRequest, a1: usize, a2: us | ... | @@ -32,7 +32,7 @@ fn doMemCheckClientRequestStmt(request: MemCheckClientRequest, a1: usize, a2: us |
| 32 | /// This returns -1 when run on Valgrind and 0 otherwise. | 32 | /// This returns -1 when run on Valgrind and 0 otherwise. |
| 33 | pub fn makeMemNoAccess(qzz: []u8) i1 { | 33 | pub fn makeMemNoAccess(qzz: []u8) i1 { |
| 34 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return | 34 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 35 | .MakeMemNoAccess, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); | 35 | .MakeMemNoAccess, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0)); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | /// Similarly, mark memory at qzz.ptr as addressable but undefined | 38 | /// Similarly, mark memory at qzz.ptr as addressable but undefined |
| ... | @@ -40,7 +40,7 @@ pub fn makeMemNoAccess(qzz: []u8) i1 { | ... | @@ -40,7 +40,7 @@ pub fn makeMemNoAccess(qzz: []u8) i1 { |
| 40 | /// This returns -1 when run on Valgrind and 0 otherwise. | 40 | /// This returns -1 when run on Valgrind and 0 otherwise. |
| 41 | pub fn makeMemUndefined(qzz: []u8) i1 { | 41 | pub fn makeMemUndefined(qzz: []u8) i1 { |
| 42 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return | 42 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 43 | .MakeMemUndefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); | 43 | .MakeMemUndefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0)); |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | /// Similarly, mark memory at qzz.ptr as addressable and defined | 46 | /// Similarly, mark memory at qzz.ptr as addressable and defined |
| ... | @@ -48,7 +48,7 @@ pub fn makeMemUndefined(qzz: []u8) i1 { | ... | @@ -48,7 +48,7 @@ pub fn makeMemUndefined(qzz: []u8) i1 { |
| 48 | pub fn makeMemDefined(qzz: []u8) i1 { | 48 | pub fn makeMemDefined(qzz: []u8) i1 { |
| 49 | // This returns -1 when run on Valgrind and 0 otherwise. | 49 | // This returns -1 when run on Valgrind and 0 otherwise. |
| 50 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return | 50 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 51 | .MakeMemDefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); | 51 | .MakeMemDefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0)); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | /// Similar to makeMemDefined except that addressability is | 54 | /// Similar to makeMemDefined except that addressability is |
| ... | @@ -57,7 +57,7 @@ pub fn makeMemDefined(qzz: []u8) i1 { | ... | @@ -57,7 +57,7 @@ pub fn makeMemDefined(qzz: []u8) i1 { |
| 57 | /// This returns -1 when run on Valgrind and 0 otherwise. | 57 | /// This returns -1 when run on Valgrind and 0 otherwise. |
| 58 | pub fn makeMemDefinedIfAddressable(qzz: []u8) i1 { | 58 | pub fn makeMemDefinedIfAddressable(qzz: []u8) i1 { |
| 59 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return | 59 | return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 60 | .MakeMemDefinedIfAddressable, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); | 60 | .MakeMemDefinedIfAddressable, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0)); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | /// Create a block-description handle. The description is an ascii | 63 | /// Create a block-description handle. The description is an ascii |
| ... | @@ -66,7 +66,7 @@ pub fn makeMemDefinedIfAddressable(qzz: []u8) i1 { | ... | @@ -66,7 +66,7 @@ pub fn makeMemDefinedIfAddressable(qzz: []u8) i1 { |
| 66 | /// properties of the memory range. | 66 | /// properties of the memory range. |
| 67 | pub fn createBlock(qzz: []u8, desc: [*]u8) usize { | 67 | pub fn createBlock(qzz: []u8, desc: [*]u8) usize { |
| 68 | return doMemCheckClientRequestExpr(0, // default return | 68 | return doMemCheckClientRequestExpr(0, // default return |
| 69 | .CreateBlock, @ptrToInt(qzz.ptr), qzz.len, @ptrToInt(desc), 0, 0); | 69 | .CreateBlock, @intFromPtr(qzz.ptr), qzz.len, @intFromPtr(desc), 0, 0); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | /// Discard a block-description-handle. Returns 1 for an | 72 | /// Discard a block-description-handle. Returns 1 for an |
| ... | @@ -81,7 +81,7 @@ pub fn discard(blkindex: usize) bool { | ... | @@ -81,7 +81,7 @@ pub fn discard(blkindex: usize) bool { |
| 81 | /// error message and returns the address of the first offending byte. | 81 | /// error message and returns the address of the first offending byte. |
| 82 | /// Otherwise it returns zero. | 82 | /// Otherwise it returns zero. |
| 83 | pub fn checkMemIsAddressable(qzz: []u8) usize { | 83 | pub fn checkMemIsAddressable(qzz: []u8) usize { |
| 84 | return doMemCheckClientRequestExpr(0, .CheckMemIsAddressable, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0); | 84 | return doMemCheckClientRequestExpr(0, .CheckMemIsAddressable, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0); |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | /// Check that memory at qzz.ptr is addressable and defined for | 87 | /// Check that memory at qzz.ptr is addressable and defined for |
| ... | @@ -89,7 +89,7 @@ pub fn checkMemIsAddressable(qzz: []u8) usize { | ... | @@ -89,7 +89,7 @@ pub fn checkMemIsAddressable(qzz: []u8) usize { |
| 89 | /// established, Valgrind prints an error message and returns the | 89 | /// established, Valgrind prints an error message and returns the |
| 90 | /// address of the first offending byte. Otherwise it returns zero. | 90 | /// address of the first offending byte. Otherwise it returns zero. |
| 91 | pub fn checkMemIsDefined(qzz: []u8) usize { | 91 | pub fn checkMemIsDefined(qzz: []u8) usize { |
| 92 | return doMemCheckClientRequestExpr(0, .CheckMemIsDefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0); | 92 | return doMemCheckClientRequestExpr(0, .CheckMemIsDefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /// Do a full memory leak check (like --leak-check=full) mid-execution. | 95 | /// Do a full memory leak check (like --leak-check=full) mid-execution. |
| ... | @@ -134,10 +134,10 @@ pub fn countLeaks() CountResult { | ... | @@ -134,10 +134,10 @@ pub fn countLeaks() CountResult { |
| 134 | }; | 134 | }; |
| 135 | doMemCheckClientRequestStmt( | 135 | doMemCheckClientRequestStmt( |
| 136 | .CountLeaks, | 136 | .CountLeaks, |
| 137 | @ptrToInt(&res.leaked), | 137 | @intFromPtr(&res.leaked), |
| 138 | @ptrToInt(&res.dubious), | 138 | @intFromPtr(&res.dubious), |
| 139 | @ptrToInt(&res.reachable), | 139 | @intFromPtr(&res.reachable), |
| 140 | @ptrToInt(&res.suppressed), | 140 | @intFromPtr(&res.suppressed), |
| 141 | 0, | 141 | 0, |
| 142 | ); | 142 | ); |
| 143 | return res; | 143 | return res; |
| ... | @@ -164,10 +164,10 @@ pub fn countLeakBlocks() CountResult { | ... | @@ -164,10 +164,10 @@ pub fn countLeakBlocks() CountResult { |
| 164 | }; | 164 | }; |
| 165 | doMemCheckClientRequestStmt( | 165 | doMemCheckClientRequestStmt( |
| 166 | .CountLeakBlocks, | 166 | .CountLeakBlocks, |
| 167 | @ptrToInt(&res.leaked), | 167 | @intFromPtr(&res.leaked), |
| 168 | @ptrToInt(&res.dubious), | 168 | @intFromPtr(&res.dubious), |
| 169 | @ptrToInt(&res.reachable), | 169 | @intFromPtr(&res.reachable), |
| 170 | @ptrToInt(&res.suppressed), | 170 | @intFromPtr(&res.suppressed), |
| 171 | 0, | 171 | 0, |
| 172 | ); | 172 | ); |
| 173 | return res; | 173 | return res; |
| ... | @@ -195,7 +195,7 @@ test "countLeakBlocks" { | ... | @@ -195,7 +195,7 @@ test "countLeakBlocks" { |
| 195 | /// impossible to segfault your system by using this call. | 195 | /// impossible to segfault your system by using this call. |
| 196 | pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { | 196 | pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { |
| 197 | std.debug.assert(zzvbits.len >= zza.len / 8); | 197 | std.debug.assert(zzvbits.len >= zza.len / 8); |
| 198 | return @intCast(u2, doMemCheckClientRequestExpr(0, .GetVbits, @ptrToInt(zza.ptr), @ptrToInt(zzvbits), zza.len, 0, 0)); | 198 | return @intCast(u2, doMemCheckClientRequestExpr(0, .GetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0)); |
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | /// Set the validity data for addresses zza, copying it | 201 | /// Set the validity data for addresses zza, copying it |
| ... | @@ -208,17 +208,17 @@ pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { | ... | @@ -208,17 +208,17 @@ pub fn getVbits(zza: []u8, zzvbits: []u8) u2 { |
| 208 | /// impossible to segfault your system by using this call. | 208 | /// impossible to segfault your system by using this call. |
| 209 | pub fn setVbits(zzvbits: []u8, zza: []u8) u2 { | 209 | pub fn setVbits(zzvbits: []u8, zza: []u8) u2 { |
| 210 | std.debug.assert(zzvbits.len >= zza.len / 8); | 210 | std.debug.assert(zzvbits.len >= zza.len / 8); |
| 211 | return @intCast(u2, doMemCheckClientRequestExpr(0, .SetVbits, @ptrToInt(zza.ptr), @ptrToInt(zzvbits), zza.len, 0, 0)); | 211 | return @intCast(u2, doMemCheckClientRequestExpr(0, .SetVbits, @intFromPtr(zza.ptr), @intFromPtr(zzvbits), zza.len, 0, 0)); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /// Disable and re-enable reporting of addressing errors in the | 214 | /// Disable and re-enable reporting of addressing errors in the |
| 215 | /// specified address range. | 215 | /// specified address range. |
| 216 | pub fn disableAddrErrorReportingInRange(qzz: []u8) usize { | 216 | pub fn disableAddrErrorReportingInRange(qzz: []u8) usize { |
| 217 | return doMemCheckClientRequestExpr(0, // default return | 217 | return doMemCheckClientRequestExpr(0, // default return |
| 218 | .DisableAddrErrorReportingInRange, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0); | 218 | .DisableAddrErrorReportingInRange, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | pub fn enableAddrErrorReportingInRange(qzz: []u8) usize { | 221 | pub fn enableAddrErrorReportingInRange(qzz: []u8) usize { |
| 222 | return doMemCheckClientRequestExpr(0, // default return | 222 | return doMemCheckClientRequestExpr(0, // default return |
| 223 | .EnableAddrErrorReportingInRange, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0); | 223 | .EnableAddrErrorReportingInRange, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0); |
| 224 | } | 224 | } |
lib/std/wasm.zig+10-10| ... | @@ -198,7 +198,7 @@ pub const Opcode = enum(u8) { | ... | @@ -198,7 +198,7 @@ pub const Opcode = enum(u8) { |
| 198 | /// Returns the integer value of an `Opcode`. Used by the Zig compiler | 198 | /// Returns the integer value of an `Opcode`. Used by the Zig compiler |
| 199 | /// to write instructions to the wasm binary file | 199 | /// to write instructions to the wasm binary file |
| 200 | pub fn opcode(op: Opcode) u8 { | 200 | pub fn opcode(op: Opcode) u8 { |
| 201 | return @enumToInt(op); | 201 | return @intFromEnum(op); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | test "Wasm - opcodes" { | 204 | test "Wasm - opcodes" { |
| ... | @@ -244,7 +244,7 @@ pub const MiscOpcode = enum(u32) { | ... | @@ -244,7 +244,7 @@ pub const MiscOpcode = enum(u32) { |
| 244 | /// Returns the integer value of an `MiscOpcode`. Used by the Zig compiler | 244 | /// Returns the integer value of an `MiscOpcode`. Used by the Zig compiler |
| 245 | /// to write instructions to the wasm binary file | 245 | /// to write instructions to the wasm binary file |
| 246 | pub fn miscOpcode(op: MiscOpcode) u32 { | 246 | pub fn miscOpcode(op: MiscOpcode) u32 { |
| 247 | return @enumToInt(op); | 247 | return @intFromEnum(op); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| 250 | /// Simd opcodes that require a prefix `0xFD`. | 250 | /// Simd opcodes that require a prefix `0xFD`. |
| ... | @@ -515,7 +515,7 @@ pub const SimdOpcode = enum(u32) { | ... | @@ -515,7 +515,7 @@ pub const SimdOpcode = enum(u32) { |
| 515 | /// Returns the integer value of an `SimdOpcode`. Used by the Zig compiler | 515 | /// Returns the integer value of an `SimdOpcode`. Used by the Zig compiler |
| 516 | /// to write instructions to the wasm binary file | 516 | /// to write instructions to the wasm binary file |
| 517 | pub fn simdOpcode(op: SimdOpcode) u32 { | 517 | pub fn simdOpcode(op: SimdOpcode) u32 { |
| 518 | return @enumToInt(op); | 518 | return @intFromEnum(op); |
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | /// Simd opcodes that require a prefix `0xFE`. | 521 | /// Simd opcodes that require a prefix `0xFE`. |
| ... | @@ -595,7 +595,7 @@ pub const AtomicsOpcode = enum(u32) { | ... | @@ -595,7 +595,7 @@ pub const AtomicsOpcode = enum(u32) { |
| 595 | /// Returns the integer value of an `AtomicsOpcode`. Used by the Zig compiler | 595 | /// Returns the integer value of an `AtomicsOpcode`. Used by the Zig compiler |
| 596 | /// to write instructions to the wasm binary file | 596 | /// to write instructions to the wasm binary file |
| 597 | pub fn atomicsOpcode(op: AtomicsOpcode) u32 { | 597 | pub fn atomicsOpcode(op: AtomicsOpcode) u32 { |
| 598 | return @enumToInt(op); | 598 | return @intFromEnum(op); |
| 599 | } | 599 | } |
| 600 | 600 | ||
| 601 | /// Enum representing all Wasm value types as per spec: | 601 | /// Enum representing all Wasm value types as per spec: |
| ... | @@ -610,7 +610,7 @@ pub const Valtype = enum(u8) { | ... | @@ -610,7 +610,7 @@ pub const Valtype = enum(u8) { |
| 610 | 610 | ||
| 611 | /// Returns the integer value of a `Valtype` | 611 | /// Returns the integer value of a `Valtype` |
| 612 | pub fn valtype(value: Valtype) u8 { | 612 | pub fn valtype(value: Valtype) u8 { |
| 613 | return @enumToInt(value); | 613 | return @intFromEnum(value); |
| 614 | } | 614 | } |
| 615 | 615 | ||
| 616 | /// Reference types, where the funcref references to a function regardless of its type | 616 | /// Reference types, where the funcref references to a function regardless of its type |
| ... | @@ -622,7 +622,7 @@ pub const RefType = enum(u8) { | ... | @@ -622,7 +622,7 @@ pub const RefType = enum(u8) { |
| 622 | 622 | ||
| 623 | /// Returns the integer value of a `Reftype` | 623 | /// Returns the integer value of a `Reftype` |
| 624 | pub fn reftype(value: RefType) u8 { | 624 | pub fn reftype(value: RefType) u8 { |
| 625 | return @enumToInt(value); | 625 | return @intFromEnum(value); |
| 626 | } | 626 | } |
| 627 | 627 | ||
| 628 | test "Wasm - valtypes" { | 628 | test "Wasm - valtypes" { |
| ... | @@ -649,11 +649,11 @@ pub const Limits = struct { | ... | @@ -649,11 +649,11 @@ pub const Limits = struct { |
| 649 | }; | 649 | }; |
| 650 | 650 | ||
| 651 | pub fn hasFlag(limits: Limits, flag: Flags) bool { | 651 | pub fn hasFlag(limits: Limits, flag: Flags) bool { |
| 652 | return limits.flags & @enumToInt(flag) != 0; | 652 | return limits.flags & @intFromEnum(flag) != 0; |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | pub fn setFlag(limits: *Limits, flag: Flags) void { | 655 | pub fn setFlag(limits: *Limits, flag: Flags) void { |
| 656 | limits.flags |= @enumToInt(flag); | 656 | limits.flags |= @intFromEnum(flag); |
| 657 | } | 657 | } |
| 658 | }; | 658 | }; |
| 659 | 659 | ||
| ... | @@ -790,7 +790,7 @@ pub const Section = enum(u8) { | ... | @@ -790,7 +790,7 @@ pub const Section = enum(u8) { |
| 790 | 790 | ||
| 791 | /// Returns the integer value of a given `Section` | 791 | /// Returns the integer value of a given `Section` |
| 792 | pub fn section(val: Section) u8 { | 792 | pub fn section(val: Section) u8 { |
| 793 | return @enumToInt(val); | 793 | return @intFromEnum(val); |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | /// The kind of the type when importing or exporting to/from the host environment | 796 | /// The kind of the type when importing or exporting to/from the host environment |
| ... | @@ -804,7 +804,7 @@ pub const ExternalKind = enum(u8) { | ... | @@ -804,7 +804,7 @@ pub const ExternalKind = enum(u8) { |
| 804 | 804 | ||
| 805 | /// Returns the integer value of a given `ExternalKind` | 805 | /// Returns the integer value of a given `ExternalKind` |
| 806 | pub fn externalKind(val: ExternalKind) u8 { | 806 | pub fn externalKind(val: ExternalKind) u8 { |
| 807 | return @enumToInt(val); | 807 | return @intFromEnum(val); |
| 808 | } | 808 | } |
| 809 | 809 | ||
| 810 | /// Defines the enum values for each subsection id for the "Names" custom section | 810 | /// Defines the enum values for each subsection id for the "Names" custom section |
lib/std/zig/Ast.zig+22-22| ... | @@ -208,22 +208,22 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { | ... | @@ -208,22 +208,22 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 208 | }, | 208 | }, |
| 209 | .expected_block => { | 209 | .expected_block => { |
| 210 | return stream.print("expected block, found '{s}'", .{ | 210 | return stream.print("expected block, found '{s}'", .{ |
| 211 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 211 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 212 | }); | 212 | }); |
| 213 | }, | 213 | }, |
| 214 | .expected_block_or_assignment => { | 214 | .expected_block_or_assignment => { |
| 215 | return stream.print("expected block or assignment, found '{s}'", .{ | 215 | return stream.print("expected block or assignment, found '{s}'", .{ |
| 216 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 216 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 217 | }); | 217 | }); |
| 218 | }, | 218 | }, |
| 219 | .expected_block_or_expr => { | 219 | .expected_block_or_expr => { |
| 220 | return stream.print("expected block or expression, found '{s}'", .{ | 220 | return stream.print("expected block or expression, found '{s}'", .{ |
| 221 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 221 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 222 | }); | 222 | }); |
| 223 | }, | 223 | }, |
| 224 | .expected_block_or_field => { | 224 | .expected_block_or_field => { |
| 225 | return stream.print("expected block or field, found '{s}'", .{ | 225 | return stream.print("expected block or field, found '{s}'", .{ |
| 226 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 226 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 227 | }); | 227 | }); |
| 228 | }, | 228 | }, |
| 229 | .expected_container_members => { | 229 | .expected_container_members => { |
| ... | @@ -233,42 +233,42 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { | ... | @@ -233,42 +233,42 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 233 | }, | 233 | }, |
| 234 | .expected_expr => { | 234 | .expected_expr => { |
| 235 | return stream.print("expected expression, found '{s}'", .{ | 235 | return stream.print("expected expression, found '{s}'", .{ |
| 236 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 236 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 237 | }); | 237 | }); |
| 238 | }, | 238 | }, |
| 239 | .expected_expr_or_assignment => { | 239 | .expected_expr_or_assignment => { |
| 240 | return stream.print("expected expression or assignment, found '{s}'", .{ | 240 | return stream.print("expected expression or assignment, found '{s}'", .{ |
| 241 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 241 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 242 | }); | 242 | }); |
| 243 | }, | 243 | }, |
| 244 | .expected_fn => { | 244 | .expected_fn => { |
| 245 | return stream.print("expected function, found '{s}'", .{ | 245 | return stream.print("expected function, found '{s}'", .{ |
| 246 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 246 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 247 | }); | 247 | }); |
| 248 | }, | 248 | }, |
| 249 | .expected_inlinable => { | 249 | .expected_inlinable => { |
| 250 | return stream.print("expected 'while' or 'for', found '{s}'", .{ | 250 | return stream.print("expected 'while' or 'for', found '{s}'", .{ |
| 251 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 251 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 252 | }); | 252 | }); |
| 253 | }, | 253 | }, |
| 254 | .expected_labelable => { | 254 | .expected_labelable => { |
| 255 | return stream.print("expected 'while', 'for', 'inline', or '{{', found '{s}'", .{ | 255 | return stream.print("expected 'while', 'for', 'inline', or '{{', found '{s}'", .{ |
| 256 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 256 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 257 | }); | 257 | }); |
| 258 | }, | 258 | }, |
| 259 | .expected_param_list => { | 259 | .expected_param_list => { |
| 260 | return stream.print("expected parameter list, found '{s}'", .{ | 260 | return stream.print("expected parameter list, found '{s}'", .{ |
| 261 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 261 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 262 | }); | 262 | }); |
| 263 | }, | 263 | }, |
| 264 | .expected_prefix_expr => { | 264 | .expected_prefix_expr => { |
| 265 | return stream.print("expected prefix expression, found '{s}'", .{ | 265 | return stream.print("expected prefix expression, found '{s}'", .{ |
| 266 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 266 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 267 | }); | 267 | }); |
| 268 | }, | 268 | }, |
| 269 | .expected_primary_type_expr => { | 269 | .expected_primary_type_expr => { |
| 270 | return stream.print("expected primary type expression, found '{s}'", .{ | 270 | return stream.print("expected primary type expression, found '{s}'", .{ |
| 271 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 271 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 272 | }); | 272 | }); |
| 273 | }, | 273 | }, |
| 274 | .expected_pub_item => { | 274 | .expected_pub_item => { |
| ... | @@ -276,7 +276,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { | ... | @@ -276,7 +276,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 276 | }, | 276 | }, |
| 277 | .expected_return_type => { | 277 | .expected_return_type => { |
| 278 | return stream.print("expected return type expression, found '{s}'", .{ | 278 | return stream.print("expected return type expression, found '{s}'", .{ |
| 279 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 279 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 280 | }); | 280 | }); |
| 281 | }, | 281 | }, |
| 282 | .expected_semi_or_else => { | 282 | .expected_semi_or_else => { |
| ... | @@ -292,32 +292,32 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { | ... | @@ -292,32 +292,32 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 292 | }, | 292 | }, |
| 293 | .expected_suffix_op => { | 293 | .expected_suffix_op => { |
| 294 | return stream.print("expected pointer dereference, optional unwrap, or field access, found '{s}'", .{ | 294 | return stream.print("expected pointer dereference, optional unwrap, or field access, found '{s}'", .{ |
| 295 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 295 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 296 | }); | 296 | }); |
| 297 | }, | 297 | }, |
| 298 | .expected_type_expr => { | 298 | .expected_type_expr => { |
| 299 | return stream.print("expected type expression, found '{s}'", .{ | 299 | return stream.print("expected type expression, found '{s}'", .{ |
| 300 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 300 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 301 | }); | 301 | }); |
| 302 | }, | 302 | }, |
| 303 | .expected_var_decl => { | 303 | .expected_var_decl => { |
| 304 | return stream.print("expected variable declaration, found '{s}'", .{ | 304 | return stream.print("expected variable declaration, found '{s}'", .{ |
| 305 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 305 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 306 | }); | 306 | }); |
| 307 | }, | 307 | }, |
| 308 | .expected_var_decl_or_fn => { | 308 | .expected_var_decl_or_fn => { |
| 309 | return stream.print("expected variable declaration or function, found '{s}'", .{ | 309 | return stream.print("expected variable declaration or function, found '{s}'", .{ |
| 310 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 310 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 311 | }); | 311 | }); |
| 312 | }, | 312 | }, |
| 313 | .expected_loop_payload => { | 313 | .expected_loop_payload => { |
| 314 | return stream.print("expected loop payload, found '{s}'", .{ | 314 | return stream.print("expected loop payload, found '{s}'", .{ |
| 315 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 315 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 316 | }); | 316 | }); |
| 317 | }, | 317 | }, |
| 318 | .expected_container => { | 318 | .expected_container => { |
| 319 | return stream.print("expected a struct, enum or union, found '{s}'", .{ | 319 | return stream.print("expected a struct, enum or union, found '{s}'", .{ |
| 320 | token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)].symbol(), | 320 | token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)].symbol(), |
| 321 | }); | 321 | }); |
| 322 | }, | 322 | }, |
| 323 | .extern_fn_body => { | 323 | .extern_fn_body => { |
| ... | @@ -434,7 +434,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { | ... | @@ -434,7 +434,7 @@ pub fn renderError(tree: Ast, parse_error: Error, stream: anytype) !void { |
| 434 | }, | 434 | }, |
| 435 | 435 | ||
| 436 | .expected_token => { | 436 | .expected_token => { |
| 437 | const found_tag = token_tags[parse_error.token + @boolToInt(parse_error.token_is_prev)]; | 437 | const found_tag = token_tags[parse_error.token + @intFromBool(parse_error.token_is_prev)]; |
| 438 | const expected_symbol = parse_error.extra.expected_tag.symbol(); | 438 | const expected_symbol = parse_error.extra.expected_tag.symbol(); |
| 439 | switch (found_tag) { | 439 | switch (found_tag) { |
| 440 | .invalid => return stream.print("expected '{s}', found invalid bytes", .{ | 440 | .invalid => return stream.print("expected '{s}', found invalid bytes", .{ |
| ... | @@ -1289,7 +1289,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { | ... | @@ -1289,7 +1289,7 @@ pub fn lastToken(tree: Ast, node: Node.Index) TokenIndex { |
| 1289 | }, | 1289 | }, |
| 1290 | .@"for" => { | 1290 | .@"for" => { |
| 1291 | const extra = @bitCast(Node.For, datas[n].rhs); | 1291 | const extra = @bitCast(Node.For, datas[n].rhs); |
| 1292 | n = tree.extra_data[datas[n].lhs + extra.inputs + @boolToInt(extra.has_else)]; | 1292 | n = tree.extra_data[datas[n].lhs + extra.inputs + @intFromBool(extra.has_else)]; |
| 1293 | }, | 1293 | }, |
| 1294 | .@"suspend" => { | 1294 | .@"suspend" => { |
| 1295 | if (datas[n].lhs != 0) { | 1295 | if (datas[n].lhs != 0) { |
| ... | @@ -2291,7 +2291,7 @@ fn fullForComponents(tree: Ast, info: full.For.Components) full.For { | ... | @@ -2291,7 +2291,7 @@ fn fullForComponents(tree: Ast, info: full.For.Components) full.For { |
| 2291 | result.label_token = tok_i - 1; | 2291 | result.label_token = tok_i - 1; |
| 2292 | } | 2292 | } |
| 2293 | const last_cond_token = tree.lastToken(info.inputs[info.inputs.len - 1]); | 2293 | const last_cond_token = tree.lastToken(info.inputs[info.inputs.len - 1]); |
| 2294 | result.payload_token = last_cond_token + 3 + @boolToInt(token_tags[last_cond_token + 1] == .comma); | 2294 | result.payload_token = last_cond_token + 3 + @intFromBool(token_tags[last_cond_token + 1] == .comma); |
| 2295 | if (info.else_expr != 0) { | 2295 | if (info.else_expr != 0) { |
| 2296 | result.else_token = tree.lastToken(info.then_expr) + 1; | 2296 | result.else_token = tree.lastToken(info.then_expr) + 1; |
| 2297 | } | 2297 | } |
lib/std/zig/ErrorBundle.zig+13-13| ... | @@ -98,17 +98,17 @@ pub fn getMessages(eb: ErrorBundle) []const MessageIndex { | ... | @@ -98,17 +98,17 @@ pub fn getMessages(eb: ErrorBundle) []const MessageIndex { |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | pub fn getErrorMessage(eb: ErrorBundle, index: MessageIndex) ErrorMessage { | 100 | pub fn getErrorMessage(eb: ErrorBundle, index: MessageIndex) ErrorMessage { |
| 101 | return eb.extraData(ErrorMessage, @enumToInt(index)).data; | 101 | return eb.extraData(ErrorMessage, @intFromEnum(index)).data; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLocation { | 104 | pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLocation { |
| 105 | assert(index != .none); | 105 | assert(index != .none); |
| 106 | return eb.extraData(SourceLocation, @enumToInt(index)).data; | 106 | return eb.extraData(SourceLocation, @intFromEnum(index)).data; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex { | 109 | pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex { |
| 110 | const notes_len = eb.getErrorMessage(index).notes_len; | 110 | const notes_len = eb.getErrorMessage(index).notes_len; |
| 111 | const start = @enumToInt(index) + @typeInfo(ErrorMessage).Struct.fields.len; | 111 | const start = @intFromEnum(index) + @typeInfo(ErrorMessage).Struct.fields.len; |
| 112 | return @ptrCast([]const MessageIndex, eb.extra[start..][0..notes_len]); | 112 | return @ptrCast([]const MessageIndex, eb.extra[start..][0..notes_len]); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| ... | @@ -125,8 +125,8 @@ fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, | ... | @@ -125,8 +125,8 @@ fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, |
| 125 | inline for (fields) |field| { | 125 | inline for (fields) |field| { |
| 126 | @field(result, field.name) = switch (field.type) { | 126 | @field(result, field.name) = switch (field.type) { |
| 127 | u32 => eb.extra[i], | 127 | u32 => eb.extra[i], |
| 128 | MessageIndex => @intToEnum(MessageIndex, eb.extra[i]), | 128 | MessageIndex => @enumFromInt(MessageIndex, eb.extra[i]), |
| 129 | SourceLocationIndex => @intToEnum(SourceLocationIndex, eb.extra[i]), | 129 | SourceLocationIndex => @enumFromInt(SourceLocationIndex, eb.extra[i]), |
| 130 | else => @compileError("bad field type"), | 130 | else => @compileError("bad field type"), |
| 131 | }; | 131 | }; |
| 132 | i += 1; | 132 | i += 1; |
| ... | @@ -189,7 +189,7 @@ fn renderErrorMessageToWriter( | ... | @@ -189,7 +189,7 @@ fn renderErrorMessageToWriter( |
| 189 | const counting_stderr = counting_writer.writer(); | 189 | const counting_stderr = counting_writer.writer(); |
| 190 | const err_msg = eb.getErrorMessage(err_msg_index); | 190 | const err_msg = eb.getErrorMessage(err_msg_index); |
| 191 | if (err_msg.src_loc != .none) { | 191 | if (err_msg.src_loc != .none) { |
| 192 | const src = eb.extraData(SourceLocation, @enumToInt(err_msg.src_loc)); | 192 | const src = eb.extraData(SourceLocation, @intFromEnum(err_msg.src_loc)); |
| 193 | try counting_stderr.writeByteNTimes(' ', indent); | 193 | try counting_stderr.writeByteNTimes(' ', indent); |
| 194 | try ttyconf.setColor(stderr, .bold); | 194 | try ttyconf.setColor(stderr, .bold); |
| 195 | try counting_stderr.print("{s}:{d}:{d}: ", .{ | 195 | try counting_stderr.print("{s}:{d}:{d}: ", .{ |
| ... | @@ -407,15 +407,15 @@ pub const Wip = struct { | ... | @@ -407,15 +407,15 @@ pub const Wip = struct { |
| 407 | } | 407 | } |
| 408 | 408 | ||
| 409 | pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) !MessageIndex { | 409 | pub fn addErrorMessage(wip: *Wip, em: ErrorMessage) !MessageIndex { |
| 410 | return @intToEnum(MessageIndex, try addExtra(wip, em)); | 410 | return @enumFromInt(MessageIndex, try addExtra(wip, em)); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | pub fn addErrorMessageAssumeCapacity(wip: *Wip, em: ErrorMessage) MessageIndex { | 413 | pub fn addErrorMessageAssumeCapacity(wip: *Wip, em: ErrorMessage) MessageIndex { |
| 414 | return @intToEnum(MessageIndex, addExtraAssumeCapacity(wip, em)); | 414 | return @enumFromInt(MessageIndex, addExtraAssumeCapacity(wip, em)); |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) !SourceLocationIndex { | 417 | pub fn addSourceLocation(wip: *Wip, sl: SourceLocation) !SourceLocationIndex { |
| 418 | return @intToEnum(SourceLocationIndex, try addExtra(wip, sl)); | 418 | return @enumFromInt(SourceLocationIndex, try addExtra(wip, sl)); |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) !void { | 421 | pub fn addReferenceTrace(wip: *Wip, rt: ReferenceTrace) !void { |
| ... | @@ -433,7 +433,7 @@ pub const Wip = struct { | ... | @@ -433,7 +433,7 @@ pub const Wip = struct { |
| 433 | // The ensureUnusedCapacity call above guarantees this. | 433 | // The ensureUnusedCapacity call above guarantees this. |
| 434 | const notes_start = wip.reserveNotes(@intCast(u32, other_list.len)) catch unreachable; | 434 | const notes_start = wip.reserveNotes(@intCast(u32, other_list.len)) catch unreachable; |
| 435 | for (notes_start.., other_list) |note, message| { | 435 | for (notes_start.., other_list) |note, message| { |
| 436 | wip.extra.items[note] = @enumToInt(wip.addOtherMessage(other, message) catch unreachable); | 436 | wip.extra.items[note] = @intFromEnum(wip.addOtherMessage(other, message) catch unreachable); |
| 437 | } | 437 | } |
| 438 | } | 438 | } |
| 439 | 439 | ||
| ... | @@ -455,7 +455,7 @@ pub const Wip = struct { | ... | @@ -455,7 +455,7 @@ pub const Wip = struct { |
| 455 | }); | 455 | }); |
| 456 | const notes_start = try wip.reserveNotes(other_msg.notes_len); | 456 | const notes_start = try wip.reserveNotes(other_msg.notes_len); |
| 457 | for (notes_start.., other.getNotes(msg_index)) |note, other_note| { | 457 | for (notes_start.., other.getNotes(msg_index)) |note, other_note| { |
| 458 | wip.extra.items[note] = @enumToInt(try wip.addOtherMessage(other, other_note)); | 458 | wip.extra.items[note] = @intFromEnum(try wip.addOtherMessage(other, other_note)); |
| 459 | } | 459 | } |
| 460 | return msg; | 460 | return msg; |
| 461 | } | 461 | } |
| ... | @@ -505,8 +505,8 @@ pub const Wip = struct { | ... | @@ -505,8 +505,8 @@ pub const Wip = struct { |
| 505 | inline for (fields) |field| { | 505 | inline for (fields) |field| { |
| 506 | wip.extra.items[i] = switch (field.type) { | 506 | wip.extra.items[i] = switch (field.type) { |
| 507 | u32 => @field(extra, field.name), | 507 | u32 => @field(extra, field.name), |
| 508 | MessageIndex => @enumToInt(@field(extra, field.name)), | 508 | MessageIndex => @intFromEnum(@field(extra, field.name)), |
| 509 | SourceLocationIndex => @enumToInt(@field(extra, field.name)), | 509 | SourceLocationIndex => @intFromEnum(@field(extra, field.name)), |
| 510 | else => @compileError("bad field type"), | 510 | else => @compileError("bad field type"), |
| 511 | }; | 511 | }; |
| 512 | i += 1; | 512 | i += 1; |
lib/std/zig/Parse.zig+1-1| ... | @@ -1486,7 +1486,7 @@ fn parseExprPrecedence(p: *Parse, min_prec: i32) Error!Node.Index { | ... | @@ -1486,7 +1486,7 @@ fn parseExprPrecedence(p: *Parse, min_prec: i32) Error!Node.Index { |
| 1486 | 1486 | ||
| 1487 | while (true) { | 1487 | while (true) { |
| 1488 | const tok_tag = p.token_tags[p.tok_i]; | 1488 | const tok_tag = p.token_tags[p.tok_i]; |
| 1489 | const info = operTable[@intCast(usize, @enumToInt(tok_tag))]; | 1489 | const info = operTable[@intCast(usize, @intFromEnum(tok_tag))]; |
| 1490 | if (info.prec < min_prec) { | 1490 | if (info.prec < min_prec) { |
| 1491 | break; | 1491 | break; |
| 1492 | } | 1492 | } |
lib/std/zig/Server.zig+2-2| ... | @@ -253,7 +253,7 @@ fn bswap(x: anytype) @TypeOf(x) { | ... | @@ -253,7 +253,7 @@ fn bswap(x: anytype) @TypeOf(x) { |
| 253 | 253 | ||
| 254 | const T = @TypeOf(x); | 254 | const T = @TypeOf(x); |
| 255 | switch (@typeInfo(T)) { | 255 | switch (@typeInfo(T)) { |
| 256 | .Enum => return @intToEnum(T, @byteSwap(@enumToInt(x))), | 256 | .Enum => return @enumFromInt(T, @byteSwap(@intFromEnum(x))), |
| 257 | .Int => return @byteSwap(x), | 257 | .Int => return @byteSwap(x), |
| 258 | .Struct => |info| switch (info.layout) { | 258 | .Struct => |info| switch (info.layout) { |
| 259 | .Extern => { | 259 | .Extern => { |
| ... | @@ -286,7 +286,7 @@ fn bswap_and_workaround_u32(bytes_ptr: *const [4]u8) u32 { | ... | @@ -286,7 +286,7 @@ fn bswap_and_workaround_u32(bytes_ptr: *const [4]u8) u32 { |
| 286 | /// workaround for https://github.com/ziglang/zig/issues/14904 | 286 | /// workaround for https://github.com/ziglang/zig/issues/14904 |
| 287 | fn bswap_and_workaround_tag(bytes_ptr: *const [4]u8) InMessage.Tag { | 287 | fn bswap_and_workaround_tag(bytes_ptr: *const [4]u8) InMessage.Tag { |
| 288 | const int = std.mem.readIntLittle(u32, bytes_ptr); | 288 | const int = std.mem.readIntLittle(u32, bytes_ptr); |
| 289 | return @intToEnum(InMessage.Tag, int); | 289 | return @enumFromInt(InMessage.Tag, int); |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | const OutMessage = std.zig.Server.Message; | 292 | const OutMessage = std.zig.Server.Message; |
lib/std/zig/c_builtins.zig+6-6| ... | @@ -11,10 +11,10 @@ pub inline fn __builtin_bswap64(val: u64) u64 { | ... | @@ -11,10 +11,10 @@ pub inline fn __builtin_bswap64(val: u64) u64 { |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | pub inline fn __builtin_signbit(val: f64) c_int { | 13 | pub inline fn __builtin_signbit(val: f64) c_int { |
| 14 | return @boolToInt(std.math.signbit(val)); | 14 | return @intFromBool(std.math.signbit(val)); |
| 15 | } | 15 | } |
| 16 | pub inline fn __builtin_signbitf(val: f32) c_int { | 16 | pub inline fn __builtin_signbitf(val: f32) c_int { |
| 17 | return @boolToInt(std.math.signbit(val)); | 17 | return @intFromBool(std.math.signbit(val)); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | pub inline fn __builtin_popcount(val: c_uint) c_int { | 20 | pub inline fn __builtin_popcount(val: c_uint) c_int { |
| ... | @@ -215,11 +215,11 @@ pub inline fn __builtin_inff() f32 { | ... | @@ -215,11 +215,11 @@ pub inline fn __builtin_inff() f32 { |
| 215 | } | 215 | } |
| 216 | 216 | ||
| 217 | pub inline fn __builtin_isnan(x: anytype) c_int { | 217 | pub inline fn __builtin_isnan(x: anytype) c_int { |
| 218 | return @boolToInt(std.math.isNan(x)); | 218 | return @intFromBool(std.math.isNan(x)); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | pub inline fn __builtin_isinf(x: anytype) c_int { | 221 | pub inline fn __builtin_isinf(x: anytype) c_int { |
| 222 | return @boolToInt(std.math.isInf(x)); | 222 | return @intFromBool(std.math.isInf(x)); |
| 223 | } | 223 | } |
| 224 | 224 | ||
| 225 | /// Similar to isinf, except the return value is -1 for an argument of -Inf and 1 for an argument of +Inf. | 225 | /// Similar to isinf, except the return value is -1 for an argument of -Inf and 1 for an argument of +Inf. |
| ... | @@ -230,7 +230,7 @@ pub inline fn __builtin_isinf_sign(x: anytype) c_int { | ... | @@ -230,7 +230,7 @@ pub inline fn __builtin_isinf_sign(x: anytype) c_int { |
| 230 | 230 | ||
| 231 | pub inline fn __has_builtin(func: anytype) c_int { | 231 | pub inline fn __has_builtin(func: anytype) c_int { |
| 232 | _ = func; | 232 | _ = func; |
| 233 | return @boolToInt(true); | 233 | return @intFromBool(true); |
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | pub inline fn __builtin_assume(cond: bool) void { | 236 | pub inline fn __builtin_assume(cond: bool) void { |
| ... | @@ -243,7 +243,7 @@ pub inline fn __builtin_unreachable() noreturn { | ... | @@ -243,7 +243,7 @@ pub inline fn __builtin_unreachable() noreturn { |
| 243 | 243 | ||
| 244 | pub inline fn __builtin_constant_p(expr: anytype) c_int { | 244 | pub inline fn __builtin_constant_p(expr: anytype) c_int { |
| 245 | _ = expr; | 245 | _ = expr; |
| 246 | return @boolToInt(false); | 246 | return @intFromBool(false); |
| 247 | } | 247 | } |
| 248 | pub fn __builtin_mul_overflow(a: anytype, b: anytype, result: *@TypeOf(a, b)) c_int { | 248 | pub fn __builtin_mul_overflow(a: anytype, b: anytype, result: *@TypeOf(a, b)) c_int { |
| 249 | const res = @mulWithOverflow(a, b); | 249 | const res = @mulWithOverflow(a, b); |
lib/std/zig/c_translation.zig+22-22| ... | @@ -21,30 +21,30 @@ pub fn cast(comptime DestType: type, target: anytype) DestType { | ... | @@ -21,30 +21,30 @@ pub fn cast(comptime DestType: type, target: anytype) DestType { |
| 21 | .Int => { | 21 | .Int => { |
| 22 | switch (@typeInfo(SourceType)) { | 22 | switch (@typeInfo(SourceType)) { |
| 23 | .Pointer => { | 23 | .Pointer => { |
| 24 | return castInt(DestType, @ptrToInt(target)); | 24 | return castInt(DestType, @intFromPtr(target)); |
| 25 | }, | 25 | }, |
| 26 | .Optional => |opt| { | 26 | .Optional => |opt| { |
| 27 | if (@typeInfo(opt.child) == .Pointer) { | 27 | if (@typeInfo(opt.child) == .Pointer) { |
| 28 | return castInt(DestType, @ptrToInt(target)); | 28 | return castInt(DestType, @intFromPtr(target)); |
| 29 | } | 29 | } |
| 30 | }, | 30 | }, |
| 31 | .Int => { | 31 | .Int => { |
| 32 | return castInt(DestType, target); | 32 | return castInt(DestType, target); |
| 33 | }, | 33 | }, |
| 34 | .Fn => { | 34 | .Fn => { |
| 35 | return castInt(DestType, @ptrToInt(&target)); | 35 | return castInt(DestType, @intFromPtr(&target)); |
| 36 | }, | 36 | }, |
| 37 | .Bool => { | 37 | .Bool => { |
| 38 | return @boolToInt(target); | 38 | return @intFromBool(target); |
| 39 | }, | 39 | }, |
| 40 | else => {}, | 40 | else => {}, |
| 41 | } | 41 | } |
| 42 | }, | 42 | }, |
| 43 | .Float => { | 43 | .Float => { |
| 44 | switch (@typeInfo(SourceType)) { | 44 | switch (@typeInfo(SourceType)) { |
| 45 | .Int => return @intToFloat(DestType, target), | 45 | .Int => return @floatFromInt(DestType, target), |
| 46 | .Float => return @floatCast(DestType, target), | 46 | .Float => return @floatCast(DestType, target), |
| 47 | .Bool => return @intToFloat(DestType, @boolToInt(target)), | 47 | .Bool => return @floatFromInt(DestType, @intFromBool(target)), |
| 48 | else => {}, | 48 | else => {}, |
| 49 | } | 49 | } |
| 50 | }, | 50 | }, |
| ... | @@ -88,13 +88,13 @@ fn castPtr(comptime DestType: type, target: anytype) DestType { | ... | @@ -88,13 +88,13 @@ fn castPtr(comptime DestType: type, target: anytype) DestType { |
| 88 | fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype) DestType { | 88 | fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype) DestType { |
| 89 | switch (@typeInfo(SourceType)) { | 89 | switch (@typeInfo(SourceType)) { |
| 90 | .Int => { | 90 | .Int => { |
| 91 | return @intToPtr(DestType, castInt(usize, target)); | 91 | return @ptrFromInt(DestType, castInt(usize, target)); |
| 92 | }, | 92 | }, |
| 93 | .ComptimeInt => { | 93 | .ComptimeInt => { |
| 94 | if (target < 0) | 94 | if (target < 0) |
| 95 | return @intToPtr(DestType, @bitCast(usize, @intCast(isize, target))) | 95 | return @ptrFromInt(DestType, @bitCast(usize, @intCast(isize, target))) |
| 96 | else | 96 | else |
| 97 | return @intToPtr(DestType, @intCast(usize, target)); | 97 | return @ptrFromInt(DestType, @intCast(usize, target)); |
| 98 | }, | 98 | }, |
| 99 | .Pointer => { | 99 | .Pointer => { |
| 100 | return castPtr(DestType, target); | 100 | return castPtr(DestType, target); |
| ... | @@ -120,34 +120,34 @@ fn ptrInfo(comptime PtrType: type) std.builtin.Type.Pointer { | ... | @@ -120,34 +120,34 @@ fn ptrInfo(comptime PtrType: type) std.builtin.Type.Pointer { |
| 120 | test "cast" { | 120 | test "cast" { |
| 121 | var i = @as(i64, 10); | 121 | var i = @as(i64, 10); |
| 122 | 122 | ||
| 123 | try testing.expect(cast(*u8, 16) == @intToPtr(*u8, 16)); | 123 | try testing.expect(cast(*u8, 16) == @ptrFromInt(*u8, 16)); |
| 124 | try testing.expect(cast(*u64, &i).* == @as(u64, 10)); | 124 | try testing.expect(cast(*u64, &i).* == @as(u64, 10)); |
| 125 | try testing.expect(cast(*i64, @as(?*align(1) i64, &i)) == &i); | 125 | try testing.expect(cast(*i64, @as(?*align(1) i64, &i)) == &i); |
| 126 | 126 | ||
| 127 | try testing.expect(cast(?*u8, 2) == @intToPtr(*u8, 2)); | 127 | try testing.expect(cast(?*u8, 2) == @ptrFromInt(*u8, 2)); |
| 128 | try testing.expect(cast(?*i64, @as(*align(1) i64, &i)) == &i); | 128 | try testing.expect(cast(?*i64, @as(*align(1) i64, &i)) == &i); |
| 129 | try testing.expect(cast(?*i64, @as(?*align(1) i64, &i)) == &i); | 129 | try testing.expect(cast(?*i64, @as(?*align(1) i64, &i)) == &i); |
| 130 | 130 | ||
| 131 | try testing.expectEqual(@as(u32, 4), cast(u32, @intToPtr(*u32, 4))); | 131 | try testing.expectEqual(@as(u32, 4), cast(u32, @ptrFromInt(*u32, 4))); |
| 132 | try testing.expectEqual(@as(u32, 4), cast(u32, @intToPtr(?*u32, 4))); | 132 | try testing.expectEqual(@as(u32, 4), cast(u32, @ptrFromInt(?*u32, 4))); |
| 133 | try testing.expectEqual(@as(u32, 10), cast(u32, @as(u64, 10))); | 133 | try testing.expectEqual(@as(u32, 10), cast(u32, @as(u64, 10))); |
| 134 | 134 | ||
| 135 | try testing.expectEqual(@bitCast(i32, @as(u32, 0x8000_0000)), cast(i32, @as(u32, 0x8000_0000))); | 135 | try testing.expectEqual(@bitCast(i32, @as(u32, 0x8000_0000)), cast(i32, @as(u32, 0x8000_0000))); |
| 136 | 136 | ||
| 137 | try testing.expectEqual(@intToPtr(*u8, 2), cast(*u8, @intToPtr(*const u8, 2))); | 137 | try testing.expectEqual(@ptrFromInt(*u8, 2), cast(*u8, @ptrFromInt(*const u8, 2))); |
| 138 | try testing.expectEqual(@intToPtr(*u8, 2), cast(*u8, @intToPtr(*volatile u8, 2))); | 138 | try testing.expectEqual(@ptrFromInt(*u8, 2), cast(*u8, @ptrFromInt(*volatile u8, 2))); |
| 139 | 139 | ||
| 140 | try testing.expectEqual(@intToPtr(?*anyopaque, 2), cast(?*anyopaque, @intToPtr(*u8, 2))); | 140 | try testing.expectEqual(@ptrFromInt(?*anyopaque, 2), cast(?*anyopaque, @ptrFromInt(*u8, 2))); |
| 141 | 141 | ||
| 142 | var foo: c_int = -1; | 142 | var foo: c_int = -1; |
| 143 | try testing.expect(cast(*anyopaque, -1) == @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1)))); | 143 | try testing.expect(cast(*anyopaque, -1) == @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1)))); |
| 144 | try testing.expect(cast(*anyopaque, foo) == @intToPtr(*anyopaque, @bitCast(usize, @as(isize, -1)))); | 144 | try testing.expect(cast(*anyopaque, foo) == @ptrFromInt(*anyopaque, @bitCast(usize, @as(isize, -1)))); |
| 145 | try testing.expect(cast(?*anyopaque, -1) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1)))); | 145 | try testing.expect(cast(?*anyopaque, -1) == @ptrFromInt(?*anyopaque, @bitCast(usize, @as(isize, -1)))); |
| 146 | try testing.expect(cast(?*anyopaque, foo) == @intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1)))); | 146 | try testing.expect(cast(?*anyopaque, foo) == @ptrFromInt(?*anyopaque, @bitCast(usize, @as(isize, -1)))); |
| 147 | 147 | ||
| 148 | const FnPtr = ?*align(1) const fn (*anyopaque) void; | 148 | const FnPtr = ?*align(1) const fn (*anyopaque) void; |
| 149 | try testing.expect(cast(FnPtr, 0) == @intToPtr(FnPtr, @as(usize, 0))); | 149 | try testing.expect(cast(FnPtr, 0) == @ptrFromInt(FnPtr, @as(usize, 0))); |
| 150 | try testing.expect(cast(FnPtr, foo) == @intToPtr(FnPtr, @bitCast(usize, @as(isize, -1)))); | 150 | try testing.expect(cast(FnPtr, foo) == @ptrFromInt(FnPtr, @bitCast(usize, @as(isize, -1)))); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | /// Given a value returns its size as C's sizeof operator would. | 153 | /// Given a value returns its size as C's sizeof operator would. |
lib/std/zig/number_literal.zig+3-3| ... | @@ -141,7 +141,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { | ... | @@ -141,7 +141,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 141 | 'a'...'z' => c - 'a' + 10, | 141 | 'a'...'z' => c - 'a' + 10, |
| 142 | else => return .{ .failure = .{ .invalid_character = i } }, | 142 | else => return .{ .failure = .{ .invalid_character = i } }, |
| 143 | }; | 143 | }; |
| 144 | if (digit >= base) return .{ .failure = .{ .invalid_digit = .{ .i = i, .base = @intToEnum(Base, base) } } }; | 144 | if (digit >= base) return .{ .failure = .{ .invalid_digit = .{ .i = i, .base = @enumFromInt(Base, base) } } }; |
| 145 | if (exponent and digit >= 10) return .{ .failure = .{ .invalid_digit_exponent = i } }; | 145 | if (exponent and digit >= 10) return .{ .failure = .{ .invalid_digit_exponent = i } }; |
| 146 | underscore = false; | 146 | underscore = false; |
| 147 | special = 0; | 147 | special = 0; |
| ... | @@ -159,7 +159,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { | ... | @@ -159,7 +159,7 @@ pub fn parseNumberLiteral(bytes: []const u8) Result { |
| 159 | if (underscore) return .{ .failure = .{ .trailing_underscore = bytes.len - 1 } }; | 159 | if (underscore) return .{ .failure = .{ .trailing_underscore = bytes.len - 1 } }; |
| 160 | if (special != 0) return .{ .failure = .{ .trailing_special = bytes.len - 1 } }; | 160 | if (special != 0) return .{ .failure = .{ .trailing_special = bytes.len - 1 } }; |
| 161 | 161 | ||
| 162 | if (float) return .{ .float = @intToEnum(FloatBase, base) }; | 162 | if (float) return .{ .float = @enumFromInt(FloatBase, base) }; |
| 163 | if (overflow) return .{ .big_int = @intToEnum(Base, base) }; | 163 | if (overflow) return .{ .big_int = @enumFromInt(Base, base) }; |
| 164 | return .{ .int = x }; | 164 | return .{ .int = x }; |
| 165 | } | 165 | } |
lib/std/zig/parser_test.zig+2-2| ... | @@ -628,7 +628,7 @@ test "zig fmt: builtin call with trailing comma" { | ... | @@ -628,7 +628,7 @@ test "zig fmt: builtin call with trailing comma" { |
| 628 | try testCanonical( | 628 | try testCanonical( |
| 629 | \\pub fn main() void { | 629 | \\pub fn main() void { |
| 630 | \\ @breakpoint(); | 630 | \\ @breakpoint(); |
| 631 | \\ _ = @boolToInt(a); | 631 | \\ _ = @intFromBool(a); |
| 632 | \\ _ = @call( | 632 | \\ _ = @call( |
| 633 | \\ a, | 633 | \\ a, |
| 634 | \\ b, | 634 | \\ b, |
| ... | @@ -4815,7 +4815,7 @@ test "zig fmt: use of comments and multiline string literals may force the param | ... | @@ -4815,7 +4815,7 @@ test "zig fmt: use of comments and multiline string literals may force the param |
| 4815 | \\ \\ Consider providing your own hash function. | 4815 | \\ \\ Consider providing your own hash function. |
| 4816 | \\ ); | 4816 | \\ ); |
| 4817 | \\ return @intCast(i1, doMemCheckClientRequestExpr(0, // default return | 4817 | \\ return @intCast(i1, doMemCheckClientRequestExpr(0, // default return |
| 4818 | \\ .MakeMemUndefined, @ptrToInt(qzz.ptr), qzz.len, 0, 0, 0)); | 4818 | \\ .MakeMemUndefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0)); |
| 4819 | \\} | 4819 | \\} |
| 4820 | \\ | 4820 | \\ |
| 4821 | \\// This looks like garbage don't do this | 4821 | \\// This looks like garbage don't do this |
lib/std/zig/perf_test.zig+3-3| ... | @@ -18,9 +18,9 @@ pub fn main() !void { | ... | @@ -18,9 +18,9 @@ pub fn main() !void { |
| 18 | } | 18 | } |
| 19 | const end = timer.read(); | 19 | const end = timer.read(); |
| 20 | memory_used /= iterations; | 20 | memory_used /= iterations; |
| 21 | const elapsed_s = @intToFloat(f64, end - start) / std.time.ns_per_s; | 21 | const elapsed_s = @floatFromInt(f64, end - start) / std.time.ns_per_s; |
| 22 | const bytes_per_sec_float = @intToFloat(f64, source.len * iterations) / elapsed_s; | 22 | const bytes_per_sec_float = @floatFromInt(f64, source.len * iterations) / elapsed_s; |
| 23 | const bytes_per_sec = @floatToInt(u64, @floor(bytes_per_sec_float)); | 23 | const bytes_per_sec = @intFromFloat(u64, @floor(bytes_per_sec_float)); |
| 24 | 24 | ||
| 25 | var stdout_file = std.io.getStdOut(); | 25 | var stdout_file = std.io.getStdOut(); |
| 26 | const stdout = stdout_file.writer(); | 26 | const stdout = stdout_file.writer(); |
lib/std/zig/render.zig+1-1| ... | @@ -1723,7 +1723,7 @@ fn renderSwitchCase( | ... | @@ -1723,7 +1723,7 @@ fn renderSwitchCase( |
| 1723 | 1723 | ||
| 1724 | if (switch_case.payload_token) |payload_token| { | 1724 | if (switch_case.payload_token) |payload_token| { |
| 1725 | try renderToken(ais, tree, payload_token - 1, .none); // pipe | 1725 | try renderToken(ais, tree, payload_token - 1, .none); // pipe |
| 1726 | const ident = payload_token + @boolToInt(token_tags[payload_token] == .asterisk); | 1726 | const ident = payload_token + @intFromBool(token_tags[payload_token] == .asterisk); |
| 1727 | if (token_tags[payload_token] == .asterisk) { | 1727 | if (token_tags[payload_token] == .asterisk) { |
| 1728 | try renderToken(ais, tree, payload_token, .none); // asterisk | 1728 | try renderToken(ais, tree, payload_token, .none); // asterisk |
| 1729 | } | 1729 | } |
lib/std/zig/system/NativeTargetInfo.zig+4-4| ... | @@ -207,10 +207,10 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { | ... | @@ -207,10 +207,10 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { |
| 207 | })) { | 207 | })) { |
| 208 | switch (result.target.abi) { | 208 | switch (result.target.abi) { |
| 209 | .code16 => result.target.cpu.features.addFeature( | 209 | .code16 => result.target.cpu.features.addFeature( |
| 210 | @enumToInt(std.Target.x86.Feature.@"16bit_mode"), | 210 | @intFromEnum(std.Target.x86.Feature.@"16bit_mode"), |
| 211 | ), | 211 | ), |
| 212 | else => result.target.cpu.features.addFeature( | 212 | else => result.target.cpu.features.addFeature( |
| 213 | @enumToInt(std.Target.x86.Feature.@"32bit_mode"), | 213 | @intFromEnum(std.Target.x86.Feature.@"32bit_mode"), |
| 214 | ), | 214 | ), |
| 215 | } | 215 | } |
| 216 | } | 216 | } |
| ... | @@ -221,7 +221,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { | ... | @@ -221,7 +221,7 @@ pub fn detect(cross_target: CrossTarget) DetectError!NativeTargetInfo { |
| 221 | }, | 221 | }, |
| 222 | .thumb, .thumbeb => { | 222 | .thumb, .thumbeb => { |
| 223 | result.target.cpu.features.addFeature( | 223 | result.target.cpu.features.addFeature( |
| 224 | @enumToInt(std.Target.arm.Feature.thumb_mode), | 224 | @intFromEnum(std.Target.arm.Feature.thumb_mode), |
| 225 | ); | 225 | ); |
| 226 | }, | 226 | }, |
| 227 | else => {}, | 227 | else => {}, |
| ... | @@ -268,7 +268,7 @@ fn detectAbiAndDynamicLinker( | ... | @@ -268,7 +268,7 @@ fn detectAbiAndDynamicLinker( |
| 268 | // and supported by Zig. But that means that we must detect the system ABI here rather than | 268 | // and supported by Zig. But that means that we must detect the system ABI here rather than |
| 269 | // relying on `builtin.target`. | 269 | // relying on `builtin.target`. |
| 270 | const all_abis = comptime blk: { | 270 | const all_abis = comptime blk: { |
| 271 | assert(@enumToInt(Target.Abi.none) == 0); | 271 | assert(@intFromEnum(Target.Abi.none) == 0); |
| 272 | const fields = std.meta.fields(Target.Abi)[1..]; | 272 | const fields = std.meta.fields(Target.Abi)[1..]; |
| 273 | var array: [fields.len]Target.Abi = undefined; | 273 | var array: [fields.len]Target.Abi = undefined; |
| 274 | inline for (fields, 0..) |field, i| { | 274 | inline for (fields, 0..) |field, i| { |
lib/std/zig/system/arm.zig+1-1| ... | @@ -135,7 +135,7 @@ pub const cpu_models = struct { | ... | @@ -135,7 +135,7 @@ pub const cpu_models = struct { |
| 135 | 135 | ||
| 136 | pub const aarch64 = struct { | 136 | pub const aarch64 = struct { |
| 137 | fn setFeature(cpu: *Target.Cpu, feature: Target.aarch64.Feature, enabled: bool) void { | 137 | fn setFeature(cpu: *Target.Cpu, feature: Target.aarch64.Feature, enabled: bool) void { |
| 138 | const idx = @as(Target.Cpu.Feature.Set.Index, @enumToInt(feature)); | 138 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); |
| 139 | 139 | ||
| 140 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 140 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 141 | } | 141 | } |
lib/std/zig/system/windows.zig+2-2| ... | @@ -43,7 +43,7 @@ pub fn detectRuntimeVersion() WindowsVersion { | ... | @@ -43,7 +43,7 @@ pub fn detectRuntimeVersion() WindowsVersion { |
| 43 | 43 | ||
| 44 | const version: u32 = @as(u32, os_ver) << 16 | @as(u16, sp_ver) << 8 | sub_ver; | 44 | const version: u32 = @as(u32, os_ver) << 16 | @as(u16, sp_ver) << 8 | sub_ver; |
| 45 | 45 | ||
| 46 | return @intToEnum(WindowsVersion, version); | 46 | return @enumFromInt(WindowsVersion, version); |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | // Technically, a registry value can be as long as 1MB. However, MS recommends storing | 49 | // Technically, a registry value can be as long as 1MB. However, MS recommends storing |
| ... | @@ -188,7 +188,7 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void { | ... | @@ -188,7 +188,7 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void { |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | fn setFeature(comptime Feature: type, cpu: *Target.Cpu, feature: Feature, enabled: bool) void { | 190 | fn setFeature(comptime Feature: type, cpu: *Target.Cpu, feature: Feature, enabled: bool) void { |
| 191 | const idx = @as(Target.Cpu.Feature.Set.Index, @enumToInt(feature)); | 191 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); |
| 192 | 192 | ||
| 193 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 193 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 194 | } | 194 | } |
lib/std/zig/system/x86.zig+1-1| ... | @@ -10,7 +10,7 @@ const XCR0_ZMM0_15 = 0x40; | ... | @@ -10,7 +10,7 @@ const XCR0_ZMM0_15 = 0x40; |
| 10 | const XCR0_ZMM16_31 = 0x80; | 10 | const XCR0_ZMM16_31 = 0x80; |
| 11 | 11 | ||
| 12 | fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void { | 12 | fn setFeature(cpu: *Target.Cpu, feature: Target.x86.Feature, enabled: bool) void { |
| 13 | const idx = @as(Target.Cpu.Feature.Set.Index, @enumToInt(feature)); | 13 | const idx = @as(Target.Cpu.Feature.Set.Index, @intFromEnum(feature)); |
| 14 | 14 | ||
| 15 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); | 15 | if (enabled) cpu.features.addFeature(idx) else cpu.features.removeFeature(idx); |
| 16 | } | 16 | } |
lib/test_runner.zig+3-3| ... | @@ -117,7 +117,7 @@ fn mainServer() !void { | ... | @@ -117,7 +117,7 @@ fn mainServer() !void { |
| 117 | }, | 117 | }, |
| 118 | 118 | ||
| 119 | else => { | 119 | else => { |
| 120 | std.debug.print("unsupported message: {x}", .{@enumToInt(hdr.tag)}); | 120 | std.debug.print("unsupported message: {x}", .{@intFromEnum(hdr.tag)}); |
| 121 | std.process.exit(1); | 121 | std.process.exit(1); |
| 122 | }, | 122 | }, |
| 123 | } | 123 | } |
| ... | @@ -216,10 +216,10 @@ pub fn log( | ... | @@ -216,10 +216,10 @@ pub fn log( |
| 216 | comptime format: []const u8, | 216 | comptime format: []const u8, |
| 217 | args: anytype, | 217 | args: anytype, |
| 218 | ) void { | 218 | ) void { |
| 219 | if (@enumToInt(message_level) <= @enumToInt(std.log.Level.err)) { | 219 | if (@intFromEnum(message_level) <= @intFromEnum(std.log.Level.err)) { |
| 220 | log_err_count += 1; | 220 | log_err_count += 1; |
| 221 | } | 221 | } |
| 222 | if (@enumToInt(message_level) <= @enumToInt(std.testing.log_level)) { | 222 | if (@intFromEnum(message_level) <= @intFromEnum(std.testing.log_level)) { |
| 223 | std.debug.print( | 223 | std.debug.print( |
| 224 | "[" ++ @tagName(scope) ++ "] (" ++ @tagName(message_level) ++ "): " ++ format ++ "\n", | 224 | "[" ++ @tagName(scope) ++ "] (" ++ @tagName(message_level) ++ "): " ++ format ++ "\n", |
| 225 | args, | 225 | args, |
src/Air.zig+98-98| ... | @@ -850,93 +850,93 @@ pub const Inst = struct { | ... | @@ -850,93 +850,93 @@ pub const Inst = struct { |
| 850 | pub const Index = u32; | 850 | pub const Index = u32; |
| 851 | 851 | ||
| 852 | pub const Ref = enum(u32) { | 852 | pub const Ref = enum(u32) { |
| 853 | u1_type = @enumToInt(InternPool.Index.u1_type), | 853 | u1_type = @intFromEnum(InternPool.Index.u1_type), |
| 854 | u8_type = @enumToInt(InternPool.Index.u8_type), | 854 | u8_type = @intFromEnum(InternPool.Index.u8_type), |
| 855 | i8_type = @enumToInt(InternPool.Index.i8_type), | 855 | i8_type = @intFromEnum(InternPool.Index.i8_type), |
| 856 | u16_type = @enumToInt(InternPool.Index.u16_type), | 856 | u16_type = @intFromEnum(InternPool.Index.u16_type), |
| 857 | i16_type = @enumToInt(InternPool.Index.i16_type), | 857 | i16_type = @intFromEnum(InternPool.Index.i16_type), |
| 858 | u29_type = @enumToInt(InternPool.Index.u29_type), | 858 | u29_type = @intFromEnum(InternPool.Index.u29_type), |
| 859 | u32_type = @enumToInt(InternPool.Index.u32_type), | 859 | u32_type = @intFromEnum(InternPool.Index.u32_type), |
| 860 | i32_type = @enumToInt(InternPool.Index.i32_type), | 860 | i32_type = @intFromEnum(InternPool.Index.i32_type), |
| 861 | u64_type = @enumToInt(InternPool.Index.u64_type), | 861 | u64_type = @intFromEnum(InternPool.Index.u64_type), |
| 862 | i64_type = @enumToInt(InternPool.Index.i64_type), | 862 | i64_type = @intFromEnum(InternPool.Index.i64_type), |
| 863 | u80_type = @enumToInt(InternPool.Index.u80_type), | 863 | u80_type = @intFromEnum(InternPool.Index.u80_type), |
| 864 | u128_type = @enumToInt(InternPool.Index.u128_type), | 864 | u128_type = @intFromEnum(InternPool.Index.u128_type), |
| 865 | i128_type = @enumToInt(InternPool.Index.i128_type), | 865 | i128_type = @intFromEnum(InternPool.Index.i128_type), |
| 866 | usize_type = @enumToInt(InternPool.Index.usize_type), | 866 | usize_type = @intFromEnum(InternPool.Index.usize_type), |
| 867 | isize_type = @enumToInt(InternPool.Index.isize_type), | 867 | isize_type = @intFromEnum(InternPool.Index.isize_type), |
| 868 | c_char_type = @enumToInt(InternPool.Index.c_char_type), | 868 | c_char_type = @intFromEnum(InternPool.Index.c_char_type), |
| 869 | c_short_type = @enumToInt(InternPool.Index.c_short_type), | 869 | c_short_type = @intFromEnum(InternPool.Index.c_short_type), |
| 870 | c_ushort_type = @enumToInt(InternPool.Index.c_ushort_type), | 870 | c_ushort_type = @intFromEnum(InternPool.Index.c_ushort_type), |
| 871 | c_int_type = @enumToInt(InternPool.Index.c_int_type), | 871 | c_int_type = @intFromEnum(InternPool.Index.c_int_type), |
| 872 | c_uint_type = @enumToInt(InternPool.Index.c_uint_type), | 872 | c_uint_type = @intFromEnum(InternPool.Index.c_uint_type), |
| 873 | c_long_type = @enumToInt(InternPool.Index.c_long_type), | 873 | c_long_type = @intFromEnum(InternPool.Index.c_long_type), |
| 874 | c_ulong_type = @enumToInt(InternPool.Index.c_ulong_type), | 874 | c_ulong_type = @intFromEnum(InternPool.Index.c_ulong_type), |
| 875 | c_longlong_type = @enumToInt(InternPool.Index.c_longlong_type), | 875 | c_longlong_type = @intFromEnum(InternPool.Index.c_longlong_type), |
| 876 | c_ulonglong_type = @enumToInt(InternPool.Index.c_ulonglong_type), | 876 | c_ulonglong_type = @intFromEnum(InternPool.Index.c_ulonglong_type), |
| 877 | c_longdouble_type = @enumToInt(InternPool.Index.c_longdouble_type), | 877 | c_longdouble_type = @intFromEnum(InternPool.Index.c_longdouble_type), |
| 878 | f16_type = @enumToInt(InternPool.Index.f16_type), | 878 | f16_type = @intFromEnum(InternPool.Index.f16_type), |
| 879 | f32_type = @enumToInt(InternPool.Index.f32_type), | 879 | f32_type = @intFromEnum(InternPool.Index.f32_type), |
| 880 | f64_type = @enumToInt(InternPool.Index.f64_type), | 880 | f64_type = @intFromEnum(InternPool.Index.f64_type), |
| 881 | f80_type = @enumToInt(InternPool.Index.f80_type), | 881 | f80_type = @intFromEnum(InternPool.Index.f80_type), |
| 882 | f128_type = @enumToInt(InternPool.Index.f128_type), | 882 | f128_type = @intFromEnum(InternPool.Index.f128_type), |
| 883 | anyopaque_type = @enumToInt(InternPool.Index.anyopaque_type), | 883 | anyopaque_type = @intFromEnum(InternPool.Index.anyopaque_type), |
| 884 | bool_type = @enumToInt(InternPool.Index.bool_type), | 884 | bool_type = @intFromEnum(InternPool.Index.bool_type), |
| 885 | void_type = @enumToInt(InternPool.Index.void_type), | 885 | void_type = @intFromEnum(InternPool.Index.void_type), |
| 886 | type_type = @enumToInt(InternPool.Index.type_type), | 886 | type_type = @intFromEnum(InternPool.Index.type_type), |
| 887 | anyerror_type = @enumToInt(InternPool.Index.anyerror_type), | 887 | anyerror_type = @intFromEnum(InternPool.Index.anyerror_type), |
| 888 | comptime_int_type = @enumToInt(InternPool.Index.comptime_int_type), | 888 | comptime_int_type = @intFromEnum(InternPool.Index.comptime_int_type), |
| 889 | comptime_float_type = @enumToInt(InternPool.Index.comptime_float_type), | 889 | comptime_float_type = @intFromEnum(InternPool.Index.comptime_float_type), |
| 890 | noreturn_type = @enumToInt(InternPool.Index.noreturn_type), | 890 | noreturn_type = @intFromEnum(InternPool.Index.noreturn_type), |
| 891 | anyframe_type = @enumToInt(InternPool.Index.anyframe_type), | 891 | anyframe_type = @intFromEnum(InternPool.Index.anyframe_type), |
| 892 | null_type = @enumToInt(InternPool.Index.null_type), | 892 | null_type = @intFromEnum(InternPool.Index.null_type), |
| 893 | undefined_type = @enumToInt(InternPool.Index.undefined_type), | 893 | undefined_type = @intFromEnum(InternPool.Index.undefined_type), |
| 894 | enum_literal_type = @enumToInt(InternPool.Index.enum_literal_type), | 894 | enum_literal_type = @intFromEnum(InternPool.Index.enum_literal_type), |
| 895 | atomic_order_type = @enumToInt(InternPool.Index.atomic_order_type), | 895 | atomic_order_type = @intFromEnum(InternPool.Index.atomic_order_type), |
| 896 | atomic_rmw_op_type = @enumToInt(InternPool.Index.atomic_rmw_op_type), | 896 | atomic_rmw_op_type = @intFromEnum(InternPool.Index.atomic_rmw_op_type), |
| 897 | calling_convention_type = @enumToInt(InternPool.Index.calling_convention_type), | 897 | calling_convention_type = @intFromEnum(InternPool.Index.calling_convention_type), |
| 898 | address_space_type = @enumToInt(InternPool.Index.address_space_type), | 898 | address_space_type = @intFromEnum(InternPool.Index.address_space_type), |
| 899 | float_mode_type = @enumToInt(InternPool.Index.float_mode_type), | 899 | float_mode_type = @intFromEnum(InternPool.Index.float_mode_type), |
| 900 | reduce_op_type = @enumToInt(InternPool.Index.reduce_op_type), | 900 | reduce_op_type = @intFromEnum(InternPool.Index.reduce_op_type), |
| 901 | call_modifier_type = @enumToInt(InternPool.Index.call_modifier_type), | 901 | call_modifier_type = @intFromEnum(InternPool.Index.call_modifier_type), |
| 902 | prefetch_options_type = @enumToInt(InternPool.Index.prefetch_options_type), | 902 | prefetch_options_type = @intFromEnum(InternPool.Index.prefetch_options_type), |
| 903 | export_options_type = @enumToInt(InternPool.Index.export_options_type), | 903 | export_options_type = @intFromEnum(InternPool.Index.export_options_type), |
| 904 | extern_options_type = @enumToInt(InternPool.Index.extern_options_type), | 904 | extern_options_type = @intFromEnum(InternPool.Index.extern_options_type), |
| 905 | type_info_type = @enumToInt(InternPool.Index.type_info_type), | 905 | type_info_type = @intFromEnum(InternPool.Index.type_info_type), |
| 906 | manyptr_u8_type = @enumToInt(InternPool.Index.manyptr_u8_type), | 906 | manyptr_u8_type = @intFromEnum(InternPool.Index.manyptr_u8_type), |
| 907 | manyptr_const_u8_type = @enumToInt(InternPool.Index.manyptr_const_u8_type), | 907 | manyptr_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_u8_type), |
| 908 | manyptr_const_u8_sentinel_0_type = @enumToInt(InternPool.Index.manyptr_const_u8_sentinel_0_type), | 908 | manyptr_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.manyptr_const_u8_sentinel_0_type), |
| 909 | single_const_pointer_to_comptime_int_type = @enumToInt(InternPool.Index.single_const_pointer_to_comptime_int_type), | 909 | single_const_pointer_to_comptime_int_type = @intFromEnum(InternPool.Index.single_const_pointer_to_comptime_int_type), |
| 910 | slice_const_u8_type = @enumToInt(InternPool.Index.slice_const_u8_type), | 910 | slice_const_u8_type = @intFromEnum(InternPool.Index.slice_const_u8_type), |
| 911 | slice_const_u8_sentinel_0_type = @enumToInt(InternPool.Index.slice_const_u8_sentinel_0_type), | 911 | slice_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.slice_const_u8_sentinel_0_type), |
| 912 | anyerror_void_error_union_type = @enumToInt(InternPool.Index.anyerror_void_error_union_type), | 912 | anyerror_void_error_union_type = @intFromEnum(InternPool.Index.anyerror_void_error_union_type), |
| 913 | generic_poison_type = @enumToInt(InternPool.Index.generic_poison_type), | 913 | generic_poison_type = @intFromEnum(InternPool.Index.generic_poison_type), |
| 914 | empty_struct_type = @enumToInt(InternPool.Index.empty_struct_type), | 914 | empty_struct_type = @intFromEnum(InternPool.Index.empty_struct_type), |
| 915 | undef = @enumToInt(InternPool.Index.undef), | 915 | undef = @intFromEnum(InternPool.Index.undef), |
| 916 | zero = @enumToInt(InternPool.Index.zero), | 916 | zero = @intFromEnum(InternPool.Index.zero), |
| 917 | zero_usize = @enumToInt(InternPool.Index.zero_usize), | 917 | zero_usize = @intFromEnum(InternPool.Index.zero_usize), |
| 918 | zero_u8 = @enumToInt(InternPool.Index.zero_u8), | 918 | zero_u8 = @intFromEnum(InternPool.Index.zero_u8), |
| 919 | one = @enumToInt(InternPool.Index.one), | 919 | one = @intFromEnum(InternPool.Index.one), |
| 920 | one_usize = @enumToInt(InternPool.Index.one_usize), | 920 | one_usize = @intFromEnum(InternPool.Index.one_usize), |
| 921 | one_u8 = @enumToInt(InternPool.Index.one_u8), | 921 | one_u8 = @intFromEnum(InternPool.Index.one_u8), |
| 922 | four_u8 = @enumToInt(InternPool.Index.four_u8), | 922 | four_u8 = @intFromEnum(InternPool.Index.four_u8), |
| 923 | negative_one = @enumToInt(InternPool.Index.negative_one), | 923 | negative_one = @intFromEnum(InternPool.Index.negative_one), |
| 924 | calling_convention_c = @enumToInt(InternPool.Index.calling_convention_c), | 924 | calling_convention_c = @intFromEnum(InternPool.Index.calling_convention_c), |
| 925 | calling_convention_inline = @enumToInt(InternPool.Index.calling_convention_inline), | 925 | calling_convention_inline = @intFromEnum(InternPool.Index.calling_convention_inline), |
| 926 | void_value = @enumToInt(InternPool.Index.void_value), | 926 | void_value = @intFromEnum(InternPool.Index.void_value), |
| 927 | unreachable_value = @enumToInt(InternPool.Index.unreachable_value), | 927 | unreachable_value = @intFromEnum(InternPool.Index.unreachable_value), |
| 928 | null_value = @enumToInt(InternPool.Index.null_value), | 928 | null_value = @intFromEnum(InternPool.Index.null_value), |
| 929 | bool_true = @enumToInt(InternPool.Index.bool_true), | 929 | bool_true = @intFromEnum(InternPool.Index.bool_true), |
| 930 | bool_false = @enumToInt(InternPool.Index.bool_false), | 930 | bool_false = @intFromEnum(InternPool.Index.bool_false), |
| 931 | empty_struct = @enumToInt(InternPool.Index.empty_struct), | 931 | empty_struct = @intFromEnum(InternPool.Index.empty_struct), |
| 932 | generic_poison = @enumToInt(InternPool.Index.generic_poison), | 932 | generic_poison = @intFromEnum(InternPool.Index.generic_poison), |
| 933 | 933 | ||
| 934 | /// This Ref does not correspond to any AIR instruction or constant | 934 | /// This Ref does not correspond to any AIR instruction or constant |
| 935 | /// value. It is used to handle argument types of var args functions. | 935 | /// value. It is used to handle argument types of var args functions. |
| 936 | var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type), | 936 | var_args_param_type = @intFromEnum(InternPool.Index.var_args_param_type), |
| 937 | /// This Ref does not correspond to any AIR instruction or constant | 937 | /// This Ref does not correspond to any AIR instruction or constant |
| 938 | /// value and may instead be used as a sentinel to indicate null. | 938 | /// value and may instead be used as a sentinel to indicate null. |
| 939 | none = @enumToInt(InternPool.Index.none), | 939 | none = @intFromEnum(InternPool.Index.none), |
| 940 | _, | 940 | _, |
| 941 | }; | 941 | }; |
| 942 | 942 | ||
| ... | @@ -1103,11 +1103,11 @@ pub const VectorCmp = struct { | ... | @@ -1103,11 +1103,11 @@ pub const VectorCmp = struct { |
| 1103 | op: u32, | 1103 | op: u32, |
| 1104 | 1104 | ||
| 1105 | pub fn compareOperator(self: VectorCmp) std.math.CompareOperator { | 1105 | pub fn compareOperator(self: VectorCmp) std.math.CompareOperator { |
| 1106 | return @intToEnum(std.math.CompareOperator, @truncate(u3, self.op)); | 1106 | return @enumFromInt(std.math.CompareOperator, @truncate(u3, self.op)); |
| 1107 | } | 1107 | } |
| 1108 | 1108 | ||
| 1109 | pub fn encodeOp(compare_operator: std.math.CompareOperator) u32 { | 1109 | pub fn encodeOp(compare_operator: std.math.CompareOperator) u32 { |
| 1110 | return @enumToInt(compare_operator); | 1110 | return @intFromEnum(compare_operator); |
| 1111 | } | 1111 | } |
| 1112 | }; | 1112 | }; |
| 1113 | 1113 | ||
| ... | @@ -1148,11 +1148,11 @@ pub const Cmpxchg = struct { | ... | @@ -1148,11 +1148,11 @@ pub const Cmpxchg = struct { |
| 1148 | flags: u32, | 1148 | flags: u32, |
| 1149 | 1149 | ||
| 1150 | pub fn successOrder(self: Cmpxchg) std.builtin.AtomicOrder { | 1150 | pub fn successOrder(self: Cmpxchg) std.builtin.AtomicOrder { |
| 1151 | return @intToEnum(std.builtin.AtomicOrder, @truncate(u3, self.flags)); | 1151 | return @enumFromInt(std.builtin.AtomicOrder, @truncate(u3, self.flags)); |
| 1152 | } | 1152 | } |
| 1153 | 1153 | ||
| 1154 | pub fn failureOrder(self: Cmpxchg) std.builtin.AtomicOrder { | 1154 | pub fn failureOrder(self: Cmpxchg) std.builtin.AtomicOrder { |
| 1155 | return @intToEnum(std.builtin.AtomicOrder, @truncate(u3, self.flags >> 3)); | 1155 | return @enumFromInt(std.builtin.AtomicOrder, @truncate(u3, self.flags >> 3)); |
| 1156 | } | 1156 | } |
| 1157 | }; | 1157 | }; |
| 1158 | 1158 | ||
| ... | @@ -1163,11 +1163,11 @@ pub const AtomicRmw = struct { | ... | @@ -1163,11 +1163,11 @@ pub const AtomicRmw = struct { |
| 1163 | flags: u32, | 1163 | flags: u32, |
| 1164 | 1164 | ||
| 1165 | pub fn ordering(self: AtomicRmw) std.builtin.AtomicOrder { | 1165 | pub fn ordering(self: AtomicRmw) std.builtin.AtomicOrder { |
| 1166 | return @intToEnum(std.builtin.AtomicOrder, @truncate(u3, self.flags)); | 1166 | return @enumFromInt(std.builtin.AtomicOrder, @truncate(u3, self.flags)); |
| 1167 | } | 1167 | } |
| 1168 | 1168 | ||
| 1169 | pub fn op(self: AtomicRmw) std.builtin.AtomicRmwOp { | 1169 | pub fn op(self: AtomicRmw) std.builtin.AtomicRmwOp { |
| 1170 | return @intToEnum(std.builtin.AtomicRmwOp, @truncate(u4, self.flags >> 3)); | 1170 | return @enumFromInt(std.builtin.AtomicRmwOp, @truncate(u4, self.flags >> 3)); |
| 1171 | } | 1171 | } |
| 1172 | }; | 1172 | }; |
| 1173 | 1173 | ||
| ... | @@ -1177,13 +1177,13 @@ pub const UnionInit = struct { | ... | @@ -1177,13 +1177,13 @@ pub const UnionInit = struct { |
| 1177 | }; | 1177 | }; |
| 1178 | 1178 | ||
| 1179 | pub fn getMainBody(air: Air) []const Air.Inst.Index { | 1179 | pub fn getMainBody(air: Air) []const Air.Inst.Index { |
| 1180 | const body_index = air.extra[@enumToInt(ExtraIndex.main_block)]; | 1180 | const body_index = air.extra[@intFromEnum(ExtraIndex.main_block)]; |
| 1181 | const extra = air.extraData(Block, body_index); | 1181 | const extra = air.extraData(Block, body_index); |
| 1182 | return air.extra[extra.end..][0..extra.data.body_len]; | 1182 | return air.extra[extra.end..][0..extra.data.body_len]; |
| 1183 | } | 1183 | } |
| 1184 | 1184 | ||
| 1185 | pub fn typeOf(air: Air, inst: Air.Inst.Ref, ip: *const InternPool) Type { | 1185 | pub fn typeOf(air: Air, inst: Air.Inst.Ref, ip: *const InternPool) Type { |
| 1186 | const ref_int = @enumToInt(inst); | 1186 | const ref_int = @intFromEnum(inst); |
| 1187 | if (ref_int < InternPool.static_keys.len) { | 1187 | if (ref_int < InternPool.static_keys.len) { |
| 1188 | return InternPool.static_keys[ref_int].typeOf().toType(); | 1188 | return InternPool.static_keys[ref_int].typeOf().toType(); |
| 1189 | } | 1189 | } |
| ... | @@ -1446,9 +1446,9 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index, ip: *const InternPool) Type { | ... | @@ -1446,9 +1446,9 @@ pub fn typeOfIndex(air: Air, inst: Air.Inst.Index, ip: *const InternPool) Type { |
| 1446 | } | 1446 | } |
| 1447 | 1447 | ||
| 1448 | pub fn getRefType(air: Air, ref: Air.Inst.Ref) Type { | 1448 | pub fn getRefType(air: Air, ref: Air.Inst.Ref) Type { |
| 1449 | const ref_int = @enumToInt(ref); | 1449 | const ref_int = @intFromEnum(ref); |
| 1450 | if (ref_int < ref_start_index) { | 1450 | if (ref_int < ref_start_index) { |
| 1451 | const ip_index = @intToEnum(InternPool.Index, ref_int); | 1451 | const ip_index = @enumFromInt(InternPool.Index, ref_int); |
| 1452 | return ip_index.toType(); | 1452 | return ip_index.toType(); |
| 1453 | } | 1453 | } |
| 1454 | const inst_index = ref_int - ref_start_index; | 1454 | const inst_index = ref_int - ref_start_index; |
| ... | @@ -1469,9 +1469,9 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end | ... | @@ -1469,9 +1469,9 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end |
| 1469 | inline for (fields) |field| { | 1469 | inline for (fields) |field| { |
| 1470 | @field(result, field.name) = switch (field.type) { | 1470 | @field(result, field.name) = switch (field.type) { |
| 1471 | u32 => air.extra[i], | 1471 | u32 => air.extra[i], |
| 1472 | Inst.Ref => @intToEnum(Inst.Ref, air.extra[i]), | 1472 | Inst.Ref => @enumFromInt(Inst.Ref, air.extra[i]), |
| 1473 | i32 => @bitCast(i32, air.extra[i]), | 1473 | i32 => @bitCast(i32, air.extra[i]), |
| 1474 | InternPool.Index => @intToEnum(InternPool.Index, air.extra[i]), | 1474 | InternPool.Index => @enumFromInt(InternPool.Index, air.extra[i]), |
| 1475 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 1475 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 1476 | }; | 1476 | }; |
| 1477 | i += 1; | 1477 | i += 1; |
| ... | @@ -1491,12 +1491,12 @@ pub fn deinit(air: *Air, gpa: std.mem.Allocator) void { | ... | @@ -1491,12 +1491,12 @@ pub fn deinit(air: *Air, gpa: std.mem.Allocator) void { |
| 1491 | pub const ref_start_index: u32 = InternPool.static_len; | 1491 | pub const ref_start_index: u32 = InternPool.static_len; |
| 1492 | 1492 | ||
| 1493 | pub fn indexToRef(inst: Inst.Index) Inst.Ref { | 1493 | pub fn indexToRef(inst: Inst.Index) Inst.Ref { |
| 1494 | return @intToEnum(Inst.Ref, ref_start_index + inst); | 1494 | return @enumFromInt(Inst.Ref, ref_start_index + inst); |
| 1495 | } | 1495 | } |
| 1496 | 1496 | ||
| 1497 | pub fn refToIndex(inst: Inst.Ref) ?Inst.Index { | 1497 | pub fn refToIndex(inst: Inst.Ref) ?Inst.Index { |
| 1498 | assert(inst != .none); | 1498 | assert(inst != .none); |
| 1499 | const ref_int = @enumToInt(inst); | 1499 | const ref_int = @intFromEnum(inst); |
| 1500 | if (ref_int >= ref_start_index) { | 1500 | if (ref_int >= ref_start_index) { |
| 1501 | return ref_int - ref_start_index; | 1501 | return ref_int - ref_start_index; |
| 1502 | } else { | 1502 | } else { |
| ... | @@ -1511,9 +1511,9 @@ pub fn refToIndexAllowNone(inst: Inst.Ref) ?Inst.Index { | ... | @@ -1511,9 +1511,9 @@ pub fn refToIndexAllowNone(inst: Inst.Ref) ?Inst.Index { |
| 1511 | 1511 | ||
| 1512 | /// Returns `null` if runtime-known. | 1512 | /// Returns `null` if runtime-known. |
| 1513 | pub fn value(air: Air, inst: Inst.Ref, mod: *Module) !?Value { | 1513 | pub fn value(air: Air, inst: Inst.Ref, mod: *Module) !?Value { |
| 1514 | const ref_int = @enumToInt(inst); | 1514 | const ref_int = @intFromEnum(inst); |
| 1515 | if (ref_int < ref_start_index) { | 1515 | if (ref_int < ref_start_index) { |
| 1516 | const ip_index = @intToEnum(InternPool.Index, ref_int); | 1516 | const ip_index = @enumFromInt(InternPool.Index, ref_int); |
| 1517 | return ip_index.toValue(); | 1517 | return ip_index.toValue(); |
| 1518 | } | 1518 | } |
| 1519 | const inst_index = @intCast(Air.Inst.Index, ref_int - ref_start_index); | 1519 | const inst_index = @intCast(Air.Inst.Index, ref_int - ref_start_index); |
src/AstGen.zig+155-155| ... | @@ -82,7 +82,7 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { | ... | @@ -82,7 +82,7 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void { |
| 82 | inline for (fields) |field| { | 82 | inline for (fields) |field| { |
| 83 | astgen.extra.items[i] = switch (field.type) { | 83 | astgen.extra.items[i] = switch (field.type) { |
| 84 | u32 => @field(extra, field.name), | 84 | u32 => @field(extra, field.name), |
| 85 | Zir.Inst.Ref => @enumToInt(@field(extra, field.name)), | 85 | Zir.Inst.Ref => @intFromEnum(@field(extra, field.name)), |
| 86 | i32 => @bitCast(u32, @field(extra, field.name)), | 86 | i32 => @bitCast(u32, @field(extra, field.name)), |
| 87 | Zir.Inst.Call.Flags => @bitCast(u32, @field(extra, field.name)), | 87 | Zir.Inst.Call.Flags => @bitCast(u32, @field(extra, field.name)), |
| 88 | Zir.Inst.BuiltinCall.Flags => @bitCast(u32, @field(extra, field.name)), | 88 | Zir.Inst.BuiltinCall.Flags => @bitCast(u32, @field(extra, field.name)), |
| ... | @@ -168,7 +168,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -168,7 +168,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 168 | try lowerAstErrors(&astgen); | 168 | try lowerAstErrors(&astgen); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | const err_index = @enumToInt(Zir.ExtraIndex.compile_errors); | 171 | const err_index = @intFromEnum(Zir.ExtraIndex.compile_errors); |
| 172 | if (astgen.compile_errors.items.len == 0) { | 172 | if (astgen.compile_errors.items.len == 0) { |
| 173 | astgen.extra.items[err_index] = 0; | 173 | astgen.extra.items[err_index] = 0; |
| 174 | } else { | 174 | } else { |
| ... | @@ -184,7 +184,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -184,7 +184,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 184 | } | 184 | } |
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | const imports_index = @enumToInt(Zir.ExtraIndex.imports); | 187 | const imports_index = @intFromEnum(Zir.ExtraIndex.imports); |
| 188 | if (astgen.imports.count() == 0) { | 188 | if (astgen.imports.count() == 0) { |
| 189 | astgen.extra.items[imports_index] = 0; | 189 | astgen.extra.items[imports_index] = 0; |
| 190 | } else { | 190 | } else { |
| ... | @@ -1513,7 +1513,7 @@ fn arrayInitExprRlNone( | ... | @@ -1513,7 +1513,7 @@ fn arrayInitExprRlNone( |
| 1513 | 1513 | ||
| 1514 | for (elements) |elem_init| { | 1514 | for (elements) |elem_init| { |
| 1515 | const elem_ref = try expr(gz, scope, .{ .rl = .none }, elem_init); | 1515 | const elem_ref = try expr(gz, scope, .{ .rl = .none }, elem_init); |
| 1516 | astgen.extra.items[extra_index] = @enumToInt(elem_ref); | 1516 | astgen.extra.items[extra_index] = @intFromEnum(elem_ref); |
| 1517 | extra_index += 1; | 1517 | extra_index += 1; |
| 1518 | } | 1518 | } |
| 1519 | return try gz.addPlNodePayloadIndex(tag, node, payload_index); | 1519 | return try gz.addPlNodePayloadIndex(tag, node, payload_index); |
| ... | @@ -1530,13 +1530,13 @@ fn arrayInitExprInner( | ... | @@ -1530,13 +1530,13 @@ fn arrayInitExprInner( |
| 1530 | ) InnerError!Zir.Inst.Ref { | 1530 | ) InnerError!Zir.Inst.Ref { |
| 1531 | const astgen = gz.astgen; | 1531 | const astgen = gz.astgen; |
| 1532 | 1532 | ||
| 1533 | const len = elements.len + @boolToInt(array_ty_inst != .none); | 1533 | const len = elements.len + @intFromBool(array_ty_inst != .none); |
| 1534 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ | 1534 | const payload_index = try addExtra(astgen, Zir.Inst.MultiOp{ |
| 1535 | .operands_len = @intCast(u32, len), | 1535 | .operands_len = @intCast(u32, len), |
| 1536 | }); | 1536 | }); |
| 1537 | var extra_index = try reserveExtra(astgen, len); | 1537 | var extra_index = try reserveExtra(astgen, len); |
| 1538 | if (array_ty_inst != .none) { | 1538 | if (array_ty_inst != .none) { |
| 1539 | astgen.extra.items[extra_index] = @enumToInt(array_ty_inst); | 1539 | astgen.extra.items[extra_index] = @intFromEnum(array_ty_inst); |
| 1540 | extra_index += 1; | 1540 | extra_index += 1; |
| 1541 | } | 1541 | } |
| 1542 | 1542 | ||
| ... | @@ -1548,14 +1548,14 @@ fn arrayInitExprInner( | ... | @@ -1548,14 +1548,14 @@ fn arrayInitExprInner( |
| 1548 | .tag = .elem_type_index, | 1548 | .tag = .elem_type_index, |
| 1549 | .data = .{ .bin = .{ | 1549 | .data = .{ .bin = .{ |
| 1550 | .lhs = array_ty_inst, | 1550 | .lhs = array_ty_inst, |
| 1551 | .rhs = @intToEnum(Zir.Inst.Ref, i), | 1551 | .rhs = @enumFromInt(Zir.Inst.Ref, i), |
| 1552 | } }, | 1552 | } }, |
| 1553 | }); | 1553 | }); |
| 1554 | break :ri ResultInfo{ .rl = .{ .coerced_ty = ty_expr } }; | 1554 | break :ri ResultInfo{ .rl = .{ .coerced_ty = ty_expr } }; |
| 1555 | } else ResultInfo{ .rl = .{ .none = {} } }; | 1555 | } else ResultInfo{ .rl = .{ .none = {} } }; |
| 1556 | 1556 | ||
| 1557 | const elem_ref = try expr(gz, scope, ri, elem_init); | 1557 | const elem_ref = try expr(gz, scope, ri, elem_init); |
| 1558 | astgen.extra.items[extra_index] = @enumToInt(elem_ref); | 1558 | astgen.extra.items[extra_index] = @intFromEnum(elem_ref); |
| 1559 | extra_index += 1; | 1559 | extra_index += 1; |
| 1560 | } | 1560 | } |
| 1561 | 1561 | ||
| ... | @@ -3515,17 +3515,17 @@ fn ptrType( | ... | @@ -3515,17 +3515,17 @@ fn ptrType( |
| 3515 | .src_node = gz.nodeIndexToRelative(node), | 3515 | .src_node = gz.nodeIndexToRelative(node), |
| 3516 | }); | 3516 | }); |
| 3517 | if (sentinel_ref != .none) { | 3517 | if (sentinel_ref != .none) { |
| 3518 | gz.astgen.extra.appendAssumeCapacity(@enumToInt(sentinel_ref)); | 3518 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(sentinel_ref)); |
| 3519 | } | 3519 | } |
| 3520 | if (align_ref != .none) { | 3520 | if (align_ref != .none) { |
| 3521 | gz.astgen.extra.appendAssumeCapacity(@enumToInt(align_ref)); | 3521 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(align_ref)); |
| 3522 | } | 3522 | } |
| 3523 | if (addrspace_ref != .none) { | 3523 | if (addrspace_ref != .none) { |
| 3524 | gz.astgen.extra.appendAssumeCapacity(@enumToInt(addrspace_ref)); | 3524 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(addrspace_ref)); |
| 3525 | } | 3525 | } |
| 3526 | if (bit_start_ref != .none) { | 3526 | if (bit_start_ref != .none) { |
| 3527 | gz.astgen.extra.appendAssumeCapacity(@enumToInt(bit_start_ref)); | 3527 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_start_ref)); |
| 3528 | gz.astgen.extra.appendAssumeCapacity(@enumToInt(bit_end_ref)); | 3528 | gz.astgen.extra.appendAssumeCapacity(@intFromEnum(bit_end_ref)); |
| 3529 | } | 3529 | } |
| 3530 | 3530 | ||
| 3531 | const new_index = @intCast(Zir.Inst.Index, gz.astgen.instructions.len); | 3531 | const new_index = @intCast(Zir.Inst.Index, gz.astgen.instructions.len); |
| ... | @@ -3644,10 +3644,10 @@ const WipMembers = struct { | ... | @@ -3644,10 +3644,10 @@ const WipMembers = struct { |
| 3644 | assert(index < self.decls_start); | 3644 | assert(index < self.decls_start); |
| 3645 | const bit_bag: u32 = if (self.decl_index % decls_per_u32 == 0) 0 else self.payload.items[index]; | 3645 | const bit_bag: u32 = if (self.decl_index % decls_per_u32 == 0) 0 else self.payload.items[index]; |
| 3646 | self.payload.items[index] = (bit_bag >> bits_per_decl) | | 3646 | self.payload.items[index] = (bit_bag >> bits_per_decl) | |
| 3647 | (@as(u32, @boolToInt(is_pub)) << 28) | | 3647 | (@as(u32, @intFromBool(is_pub)) << 28) | |
| 3648 | (@as(u32, @boolToInt(is_export)) << 29) | | 3648 | (@as(u32, @intFromBool(is_export)) << 29) | |
| 3649 | (@as(u32, @boolToInt(has_align)) << 30) | | 3649 | (@as(u32, @intFromBool(has_align)) << 30) | |
| 3650 | (@as(u32, @boolToInt(has_section_or_addrspace)) << 31); | 3650 | (@as(u32, @intFromBool(has_section_or_addrspace)) << 31); |
| 3651 | self.decl_index += 1; | 3651 | self.decl_index += 1; |
| 3652 | } | 3652 | } |
| 3653 | 3653 | ||
| ... | @@ -3659,7 +3659,7 @@ const WipMembers = struct { | ... | @@ -3659,7 +3659,7 @@ const WipMembers = struct { |
| 3659 | bit_bag >>= bits_per_field; | 3659 | bit_bag >>= bits_per_field; |
| 3660 | comptime var i = 0; | 3660 | comptime var i = 0; |
| 3661 | inline while (i < bits_per_field) : (i += 1) { | 3661 | inline while (i < bits_per_field) : (i += 1) { |
| 3662 | bit_bag |= @as(u32, @boolToInt(bits[i])) << (32 - bits_per_field + i); | 3662 | bit_bag |= @as(u32, @intFromBool(bits[i])) << (32 - bits_per_field + i); |
| 3663 | } | 3663 | } |
| 3664 | self.payload.items[index] = bit_bag; | 3664 | self.payload.items[index] = bit_bag; |
| 3665 | self.field_index += 1; | 3665 | self.field_index += 1; |
| ... | @@ -4233,11 +4233,11 @@ fn globalVarDecl( | ... | @@ -4233,11 +4233,11 @@ fn globalVarDecl( |
| 4233 | wip_members.appendToDecl(block_inst); | 4233 | wip_members.appendToDecl(block_inst); |
| 4234 | wip_members.appendToDecl(doc_comment_index); // doc_comment wip | 4234 | wip_members.appendToDecl(doc_comment_index); // doc_comment wip |
| 4235 | if (align_inst != .none) { | 4235 | if (align_inst != .none) { |
| 4236 | wip_members.appendToDecl(@enumToInt(align_inst)); | 4236 | wip_members.appendToDecl(@intFromEnum(align_inst)); |
| 4237 | } | 4237 | } |
| 4238 | if (has_section_or_addrspace) { | 4238 | if (has_section_or_addrspace) { |
| 4239 | wip_members.appendToDecl(@enumToInt(section_inst)); | 4239 | wip_members.appendToDecl(@intFromEnum(section_inst)); |
| 4240 | wip_members.appendToDecl(@enumToInt(addrspace_inst)); | 4240 | wip_members.appendToDecl(@intFromEnum(addrspace_inst)); |
| 4241 | } | 4241 | } |
| 4242 | } | 4242 | } |
| 4243 | 4243 | ||
| ... | @@ -4727,7 +4727,7 @@ fn structDeclInner( | ... | @@ -4727,7 +4727,7 @@ fn structDeclInner( |
| 4727 | wip_members.appendToField(@intCast(u32, astgen.scratch.items.len - old_scratch_len)); | 4727 | wip_members.appendToField(@intCast(u32, astgen.scratch.items.len - old_scratch_len)); |
| 4728 | block_scope.instructions.items.len = block_scope.instructions_top; | 4728 | block_scope.instructions.items.len = block_scope.instructions_top; |
| 4729 | } else { | 4729 | } else { |
| 4730 | wip_members.appendToField(@enumToInt(field_type)); | 4730 | wip_members.appendToField(@intFromEnum(field_type)); |
| 4731 | } | 4731 | } |
| 4732 | 4732 | ||
| 4733 | if (have_align) { | 4733 | if (have_align) { |
| ... | @@ -4878,13 +4878,13 @@ fn unionDeclInner( | ... | @@ -4878,13 +4878,13 @@ fn unionDeclInner( |
| 4878 | 4878 | ||
| 4879 | if (have_type) { | 4879 | if (have_type) { |
| 4880 | const field_type = try typeExpr(&block_scope, &namespace.base, member.ast.type_expr); | 4880 | const field_type = try typeExpr(&block_scope, &namespace.base, member.ast.type_expr); |
| 4881 | wip_members.appendToField(@enumToInt(field_type)); | 4881 | wip_members.appendToField(@intFromEnum(field_type)); |
| 4882 | } else if (arg_inst == .none and auto_enum_tok == null) { | 4882 | } else if (arg_inst == .none and auto_enum_tok == null) { |
| 4883 | return astgen.failNode(member_node, "union field missing type", .{}); | 4883 | return astgen.failNode(member_node, "union field missing type", .{}); |
| 4884 | } | 4884 | } |
| 4885 | if (have_align) { | 4885 | if (have_align) { |
| 4886 | const align_inst = try expr(&block_scope, &block_scope.base, .{ .rl = .{ .ty = .u32_type } }, member.ast.align_expr); | 4886 | const align_inst = try expr(&block_scope, &block_scope.base, .{ .rl = .{ .ty = .u32_type } }, member.ast.align_expr); |
| 4887 | wip_members.appendToField(@enumToInt(align_inst)); | 4887 | wip_members.appendToField(@intFromEnum(align_inst)); |
| 4888 | } | 4888 | } |
| 4889 | if (have_value) { | 4889 | if (have_value) { |
| 4890 | if (arg_inst == .none) { | 4890 | if (arg_inst == .none) { |
| ... | @@ -4916,7 +4916,7 @@ fn unionDeclInner( | ... | @@ -4916,7 +4916,7 @@ fn unionDeclInner( |
| 4916 | ); | 4916 | ); |
| 4917 | } | 4917 | } |
| 4918 | const tag_value = try expr(&block_scope, &block_scope.base, .{ .rl = .{ .ty = arg_inst } }, member.ast.value_expr); | 4918 | const tag_value = try expr(&block_scope, &block_scope.base, .{ .rl = .{ .ty = arg_inst } }, member.ast.value_expr); |
| 4919 | wip_members.appendToField(@enumToInt(tag_value)); | 4919 | wip_members.appendToField(@intFromEnum(tag_value)); |
| 4920 | } | 4920 | } |
| 4921 | } | 4921 | } |
| 4922 | 4922 | ||
| ... | @@ -5167,7 +5167,7 @@ fn containerDecl( | ... | @@ -5167,7 +5167,7 @@ fn containerDecl( |
| 5167 | } | 5167 | } |
| 5168 | namespace.base.tag = .enum_namespace; | 5168 | namespace.base.tag = .enum_namespace; |
| 5169 | const tag_value_inst = try expr(&block_scope, &namespace.base, .{ .rl = .{ .ty = arg_inst } }, member.ast.value_expr); | 5169 | const tag_value_inst = try expr(&block_scope, &namespace.base, .{ .rl = .{ .ty = arg_inst } }, member.ast.value_expr); |
| 5170 | wip_members.appendToField(@enumToInt(tag_value_inst)); | 5170 | wip_members.appendToField(@intFromEnum(tag_value_inst)); |
| 5171 | } | 5171 | } |
| 5172 | } | 5172 | } |
| 5173 | 5173 | ||
| ... | @@ -5846,7 +5846,7 @@ fn ifExpr( | ... | @@ -5846,7 +5846,7 @@ fn ifExpr( |
| 5846 | else | 5846 | else |
| 5847 | .err_union_payload_unsafe; | 5847 | .err_union_payload_unsafe; |
| 5848 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, then_node); | 5848 | const payload_inst = try then_scope.addUnNode(tag, cond.inst, then_node); |
| 5849 | const token_name_index = payload_token + @boolToInt(payload_is_ref); | 5849 | const token_name_index = payload_token + @intFromBool(payload_is_ref); |
| 5850 | const ident_name = try astgen.identAsString(token_name_index); | 5850 | const ident_name = try astgen.identAsString(token_name_index); |
| 5851 | const token_name_str = tree.tokenSlice(token_name_index); | 5851 | const token_name_str = tree.tokenSlice(token_name_index); |
| 5852 | if (mem.eql(u8, "_", token_name_str)) | 5852 | if (mem.eql(u8, "_", token_name_str)) |
| ... | @@ -6000,8 +6000,8 @@ fn setCondBrPayload( | ... | @@ -6000,8 +6000,8 @@ fn setCondBrPayload( |
| 6000 | const astgen = then_scope.astgen; | 6000 | const astgen = then_scope.astgen; |
| 6001 | const then_body = then_scope.instructionsSliceUpto(else_scope); | 6001 | const then_body = then_scope.instructionsSliceUpto(else_scope); |
| 6002 | const else_body = else_scope.instructionsSlice(); | 6002 | const else_body = else_scope.instructionsSlice(); |
| 6003 | const then_body_len = astgen.countBodyLenAfterFixups(then_body) + @boolToInt(then_break != 0); | 6003 | const then_body_len = astgen.countBodyLenAfterFixups(then_body) + @intFromBool(then_break != 0); |
| 6004 | const else_body_len = astgen.countBodyLenAfterFixups(else_body) + @boolToInt(else_break != 0); | 6004 | const else_body_len = astgen.countBodyLenAfterFixups(else_body) + @intFromBool(else_break != 0); |
| 6005 | try astgen.extra.ensureUnusedCapacity( | 6005 | try astgen.extra.ensureUnusedCapacity( |
| 6006 | astgen.gpa, | 6006 | astgen.gpa, |
| 6007 | @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len, | 6007 | @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len, |
| ... | @@ -6036,8 +6036,8 @@ fn setCondBrPayloadElideBlockStorePtr( | ... | @@ -6036,8 +6036,8 @@ fn setCondBrPayloadElideBlockStorePtr( |
| 6036 | const else_body = else_scope.instructionsSlice(); | 6036 | const else_body = else_scope.instructionsSlice(); |
| 6037 | const has_then_break = then_break != 0; | 6037 | const has_then_break = then_break != 0; |
| 6038 | const has_else_break = else_break != 0; | 6038 | const has_else_break = else_break != 0; |
| 6039 | const then_body_len = astgen.countBodyLenAfterFixups(then_body) + @boolToInt(has_then_break); | 6039 | const then_body_len = astgen.countBodyLenAfterFixups(then_body) + @intFromBool(has_then_break); |
| 6040 | const else_body_len = astgen.countBodyLenAfterFixups(else_body) + @boolToInt(has_else_break); | 6040 | const else_body_len = astgen.countBodyLenAfterFixups(else_body) + @intFromBool(has_else_break); |
| 6041 | try astgen.extra.ensureUnusedCapacity( | 6041 | try astgen.extra.ensureUnusedCapacity( |
| 6042 | astgen.gpa, | 6042 | astgen.gpa, |
| 6043 | @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len, | 6043 | @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len, |
| ... | @@ -6197,7 +6197,7 @@ fn whileExpr( | ... | @@ -6197,7 +6197,7 @@ fn whileExpr( |
| 6197 | const ident_bytes = tree.tokenSlice(ident_token); | 6197 | const ident_bytes = tree.tokenSlice(ident_token); |
| 6198 | if (mem.eql(u8, "_", ident_bytes)) | 6198 | if (mem.eql(u8, "_", ident_bytes)) |
| 6199 | break :s &then_scope.base; | 6199 | break :s &then_scope.base; |
| 6200 | const payload_name_loc = payload_token + @boolToInt(payload_is_ref); | 6200 | const payload_name_loc = payload_token + @intFromBool(payload_is_ref); |
| 6201 | const ident_name = try astgen.identAsString(payload_name_loc); | 6201 | const ident_name = try astgen.identAsString(payload_name_loc); |
| 6202 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .capture); | 6202 | try astgen.detectLocalShadowing(&then_scope.base, ident_name, payload_name_loc, ident_bytes, .capture); |
| 6203 | payload_val_scope = .{ | 6203 | payload_val_scope = .{ |
| ... | @@ -6439,7 +6439,7 @@ fn forExpr( | ... | @@ -6439,7 +6439,7 @@ fn forExpr( |
| 6439 | for (for_full.ast.inputs, 0..) |input, i_usize| { | 6439 | for (for_full.ast.inputs, 0..) |input, i_usize| { |
| 6440 | const i = @intCast(u32, i_usize); | 6440 | const i = @intCast(u32, i_usize); |
| 6441 | const capture_is_ref = token_tags[capture_token] == .asterisk; | 6441 | const capture_is_ref = token_tags[capture_token] == .asterisk; |
| 6442 | const ident_tok = capture_token + @boolToInt(capture_is_ref); | 6442 | const ident_tok = capture_token + @intFromBool(capture_is_ref); |
| 6443 | const is_discard = mem.eql(u8, tree.tokenSlice(ident_tok), "_"); | 6443 | const is_discard = mem.eql(u8, tree.tokenSlice(ident_tok), "_"); |
| 6444 | 6444 | ||
| 6445 | if (is_discard and capture_is_ref) { | 6445 | if (is_discard and capture_is_ref) { |
| ... | @@ -6567,7 +6567,7 @@ fn forExpr( | ... | @@ -6567,7 +6567,7 @@ fn forExpr( |
| 6567 | for (for_full.ast.inputs, 0..) |input, i_usize| { | 6567 | for (for_full.ast.inputs, 0..) |input, i_usize| { |
| 6568 | const i = @intCast(u32, i_usize); | 6568 | const i = @intCast(u32, i_usize); |
| 6569 | const capture_is_ref = token_tags[capture_token] == .asterisk; | 6569 | const capture_is_ref = token_tags[capture_token] == .asterisk; |
| 6570 | const ident_tok = capture_token + @boolToInt(capture_is_ref); | 6570 | const ident_tok = capture_token + @intFromBool(capture_is_ref); |
| 6571 | const capture_name = tree.tokenSlice(ident_tok); | 6571 | const capture_name = tree.tokenSlice(ident_tok); |
| 6572 | // Skip over the comma, and on to the next capture (or the ending pipe character). | 6572 | // Skip over the comma, and on to the next capture (or the ending pipe character). |
| 6573 | capture_token = ident_tok + 2; | 6573 | capture_token = ident_tok + 2; |
| ... | @@ -6591,7 +6591,7 @@ fn forExpr( | ... | @@ -6591,7 +6591,7 @@ fn forExpr( |
| 6591 | // indexables, we use it as an element index. This is so similar | 6591 | // indexables, we use it as an element index. This is so similar |
| 6592 | // that they can share the same code paths, branching only on the | 6592 | // that they can share the same code paths, branching only on the |
| 6593 | // ZIR tag. | 6593 | // ZIR tag. |
| 6594 | const switch_cond = (@as(u2, @boolToInt(capture_is_ref)) << 1) | @boolToInt(is_counter); | 6594 | const switch_cond = (@as(u2, @intFromBool(capture_is_ref)) << 1) | @intFromBool(is_counter); |
| 6595 | const tag: Zir.Inst.Tag = switch (switch_cond) { | 6595 | const tag: Zir.Inst.Tag = switch (switch_cond) { |
| 6596 | 0b00 => .elem_val, | 6596 | 0b00 => .elem_val, |
| 6597 | 0b01 => .add, | 6597 | 0b01 => .add, |
| ... | @@ -6842,7 +6842,7 @@ fn switchExpr( | ... | @@ -6842,7 +6842,7 @@ fn switchExpr( |
| 6842 | const payloads = &astgen.scratch; | 6842 | const payloads = &astgen.scratch; |
| 6843 | const scratch_top = astgen.scratch.items.len; | 6843 | const scratch_top = astgen.scratch.items.len; |
| 6844 | const case_table_start = scratch_top; | 6844 | const case_table_start = scratch_top; |
| 6845 | const scalar_case_table = case_table_start + @boolToInt(special_prong != .none); | 6845 | const scalar_case_table = case_table_start + @intFromBool(special_prong != .none); |
| 6846 | const multi_case_table = scalar_case_table + scalar_cases_len; | 6846 | const multi_case_table = scalar_case_table + scalar_cases_len; |
| 6847 | const case_table_end = multi_case_table + multi_cases_len; | 6847 | const case_table_end = multi_case_table + multi_cases_len; |
| 6848 | try astgen.scratch.resize(gpa, case_table_end); | 6848 | try astgen.scratch.resize(gpa, case_table_end); |
| ... | @@ -6971,7 +6971,7 @@ fn switchExpr( | ... | @@ -6971,7 +6971,7 @@ fn switchExpr( |
| 6971 | items_len += 1; | 6971 | items_len += 1; |
| 6972 | 6972 | ||
| 6973 | const item_inst = try comptimeExpr(parent_gz, scope, item_ri, item_node); | 6973 | const item_inst = try comptimeExpr(parent_gz, scope, item_ri, item_node); |
| 6974 | try payloads.append(gpa, @enumToInt(item_inst)); | 6974 | try payloads.append(gpa, @intFromEnum(item_inst)); |
| 6975 | } | 6975 | } |
| 6976 | 6976 | ||
| 6977 | // ranges | 6977 | // ranges |
| ... | @@ -6983,7 +6983,7 @@ fn switchExpr( | ... | @@ -6983,7 +6983,7 @@ fn switchExpr( |
| 6983 | const first = try comptimeExpr(parent_gz, scope, item_ri, node_datas[range].lhs); | 6983 | const first = try comptimeExpr(parent_gz, scope, item_ri, node_datas[range].lhs); |
| 6984 | const last = try comptimeExpr(parent_gz, scope, item_ri, node_datas[range].rhs); | 6984 | const last = try comptimeExpr(parent_gz, scope, item_ri, node_datas[range].rhs); |
| 6985 | try payloads.appendSlice(gpa, &[_]u32{ | 6985 | try payloads.appendSlice(gpa, &[_]u32{ |
| 6986 | @enumToInt(first), @enumToInt(last), | 6986 | @intFromEnum(first), @intFromEnum(last), |
| 6987 | }); | 6987 | }); |
| 6988 | } | 6988 | } |
| 6989 | 6989 | ||
| ... | @@ -7000,7 +7000,7 @@ fn switchExpr( | ... | @@ -7000,7 +7000,7 @@ fn switchExpr( |
| 7000 | try payloads.resize(gpa, header_index + 2); // item, body_len | 7000 | try payloads.resize(gpa, header_index + 2); // item, body_len |
| 7001 | const item_node = case.ast.values[0]; | 7001 | const item_node = case.ast.values[0]; |
| 7002 | const item_inst = try comptimeExpr(parent_gz, scope, item_ri, item_node); | 7002 | const item_inst = try comptimeExpr(parent_gz, scope, item_ri, item_node); |
| 7003 | payloads.items[header_index] = @enumToInt(item_inst); | 7003 | payloads.items[header_index] = @intFromEnum(item_inst); |
| 7004 | break :blk header_index + 1; | 7004 | break :blk header_index + 1; |
| 7005 | }; | 7005 | }; |
| 7006 | 7006 | ||
| ... | @@ -7069,8 +7069,8 @@ fn switchExpr( | ... | @@ -7069,8 +7069,8 @@ fn switchExpr( |
| 7069 | try parent_gz.instructions.append(gpa, switch_block); | 7069 | try parent_gz.instructions.append(gpa, switch_block); |
| 7070 | 7070 | ||
| 7071 | try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).Struct.fields.len + | 7071 | try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).Struct.fields.len + |
| 7072 | @boolToInt(multi_cases_len != 0) + | 7072 | @intFromBool(multi_cases_len != 0) + |
| 7073 | @boolToInt(any_has_tag_capture) + | 7073 | @intFromBool(any_has_tag_capture) + |
| 7074 | payloads.items.len - case_table_end); | 7074 | payloads.items.len - case_table_end); |
| 7075 | 7075 | ||
| 7076 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlock{ | 7076 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlock{ |
| ... | @@ -7633,8 +7633,8 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: | ... | @@ -7633,8 +7633,8 @@ fn numberLiteral(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index, source_node: |
| 7633 | const gpa = astgen.gpa; | 7633 | const gpa = astgen.gpa; |
| 7634 | var big_int = try std.math.big.int.Managed.init(gpa); | 7634 | var big_int = try std.math.big.int.Managed.init(gpa); |
| 7635 | defer big_int.deinit(); | 7635 | defer big_int.deinit(); |
| 7636 | const prefix_offset = @as(u8, 2) * @boolToInt(base != .decimal); | 7636 | const prefix_offset = @as(u8, 2) * @intFromBool(base != .decimal); |
| 7637 | big_int.setString(@enumToInt(base), bytes[prefix_offset..]) catch |err| switch (err) { | 7637 | big_int.setString(@intFromEnum(base), bytes[prefix_offset..]) catch |err| switch (err) { |
| 7638 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` | 7638 | error.InvalidCharacter => unreachable, // caught in `parseNumberLiteral` |
| 7639 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above | 7639 | error.InvalidBase => unreachable, // we only pass 16, 8, 2, see above |
| 7640 | error.OutOfMemory => return error.OutOfMemory, | 7640 | error.OutOfMemory => return error.OutOfMemory, |
| ... | @@ -7739,7 +7739,7 @@ fn asmExpr( | ... | @@ -7739,7 +7739,7 @@ fn asmExpr( |
| 7739 | }, | 7739 | }, |
| 7740 | else => .{ | 7740 | else => .{ |
| 7741 | .tag = .asm_expr, | 7741 | .tag = .asm_expr, |
| 7742 | .tmpl = @enumToInt(try comptimeExpr(gz, scope, .{ .rl = .none }, full.ast.template)), | 7742 | .tmpl = @intFromEnum(try comptimeExpr(gz, scope, .{ .rl = .none }, full.ast.template)), |
| 7743 | }, | 7743 | }, |
| 7744 | }; | 7744 | }; |
| 7745 | 7745 | ||
| ... | @@ -7977,7 +7977,7 @@ fn typeOf( | ... | @@ -7977,7 +7977,7 @@ fn typeOf( |
| 7977 | 7977 | ||
| 7978 | for (args, 0..) |arg, i| { | 7978 | for (args, 0..) |arg, i| { |
| 7979 | const param_ref = try reachableExpr(&typeof_scope, &typeof_scope.base, .{ .rl = .none }, arg, node); | 7979 | const param_ref = try reachableExpr(&typeof_scope, &typeof_scope.base, .{ .rl = .none }, arg, node); |
| 7980 | astgen.extra.items[args_index + i] = @enumToInt(param_ref); | 7980 | astgen.extra.items[args_index + i] = @intFromEnum(param_ref); |
| 7981 | } | 7981 | } |
| 7982 | _ = try typeof_scope.addBreak(.break_inline, refToIndex(typeof_inst).?, .void_value); | 7982 | _ = try typeof_scope.addBreak(.break_inline, refToIndex(typeof_inst).?, .void_value); |
| 7983 | 7983 | ||
| ... | @@ -8026,7 +8026,7 @@ fn minMax( | ... | @@ -8026,7 +8026,7 @@ fn minMax( |
| 8026 | var extra_index = try reserveExtra(gz.astgen, args.len); | 8026 | var extra_index = try reserveExtra(gz.astgen, args.len); |
| 8027 | for (args) |arg| { | 8027 | for (args) |arg| { |
| 8028 | const arg_ref = try expr(gz, scope, .{ .rl = .none }, arg); | 8028 | const arg_ref = try expr(gz, scope, .{ .rl = .none }, arg); |
| 8029 | astgen.extra.items[extra_index] = @enumToInt(arg_ref); | 8029 | astgen.extra.items[extra_index] = @intFromEnum(arg_ref); |
| 8030 | extra_index += 1; | 8030 | extra_index += 1; |
| 8031 | } | 8031 | } |
| 8032 | const tag: Zir.Inst.Extended = switch (op) { | 8032 | const tag: Zir.Inst.Extended = switch (op) { |
| ... | @@ -8101,7 +8101,7 @@ fn builtinCall( | ... | @@ -8101,7 +8101,7 @@ fn builtinCall( |
| 8101 | var extra_index = try reserveExtra(gz.astgen, params.len); | 8101 | var extra_index = try reserveExtra(gz.astgen, params.len); |
| 8102 | for (params) |param| { | 8102 | for (params) |param| { |
| 8103 | const param_ref = try expr(gz, scope, .{ .rl = .none }, param); | 8103 | const param_ref = try expr(gz, scope, .{ .rl = .none }, param); |
| 8104 | astgen.extra.items[extra_index] = @enumToInt(param_ref); | 8104 | astgen.extra.items[extra_index] = @intFromEnum(param_ref); |
| 8105 | extra_index += 1; | 8105 | extra_index += 1; |
| 8106 | } | 8106 | } |
| 8107 | const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len); | 8107 | const result = try gz.addExtendedMultiOpPayloadIndex(.compile_log, payload_index, params.len); |
| ... | @@ -8335,7 +8335,7 @@ fn builtinCall( | ... | @@ -8335,7 +8335,7 @@ fn builtinCall( |
| 8335 | .tag = .extended, | 8335 | .tag = .extended, |
| 8336 | .data = .{ .extended = .{ | 8336 | .data = .{ .extended = .{ |
| 8337 | .opcode = .reify, | 8337 | .opcode = .reify, |
| 8338 | .small = @enumToInt(gz.anon_name_strategy), | 8338 | .small = @intFromEnum(gz.anon_name_strategy), |
| 8339 | .operand = payload_index, | 8339 | .operand = payload_index, |
| 8340 | } }, | 8340 | } }, |
| 8341 | }); | 8341 | }); |
| ... | @@ -9050,7 +9050,7 @@ fn callExpr( | ... | @@ -9050,7 +9050,7 @@ fn callExpr( |
| 9050 | .callee = callee_obj, | 9050 | .callee = callee_obj, |
| 9051 | .flags = .{ | 9051 | .flags = .{ |
| 9052 | .pop_error_return_trace = !propagate_error_trace, | 9052 | .pop_error_return_trace = !propagate_error_trace, |
| 9053 | .packed_modifier = @intCast(Zir.Inst.Call.Flags.PackedModifier, @enumToInt(modifier)), | 9053 | .packed_modifier = @intCast(Zir.Inst.Call.Flags.PackedModifier, @intFromEnum(modifier)), |
| 9054 | .args_len = @intCast(Zir.Inst.Call.Flags.PackedArgsLen, call.ast.params.len), | 9054 | .args_len = @intCast(Zir.Inst.Call.Flags.PackedArgsLen, call.ast.params.len), |
| 9055 | }, | 9055 | }, |
| 9056 | }); | 9056 | }); |
| ... | @@ -9071,7 +9071,7 @@ fn callExpr( | ... | @@ -9071,7 +9071,7 @@ fn callExpr( |
| 9071 | .field_name_start = callee_field.field_name_start, | 9071 | .field_name_start = callee_field.field_name_start, |
| 9072 | .flags = .{ | 9072 | .flags = .{ |
| 9073 | .pop_error_return_trace = !propagate_error_trace, | 9073 | .pop_error_return_trace = !propagate_error_trace, |
| 9074 | .packed_modifier = @intCast(Zir.Inst.Call.Flags.PackedModifier, @enumToInt(modifier)), | 9074 | .packed_modifier = @intCast(Zir.Inst.Call.Flags.PackedModifier, @intFromEnum(modifier)), |
| 9075 | .args_len = @intCast(Zir.Inst.Call.Flags.PackedArgsLen, call.ast.params.len), | 9075 | .args_len = @intCast(Zir.Inst.Call.Flags.PackedArgsLen, call.ast.params.len), |
| 9076 | }, | 9076 | }, |
| 9077 | }); | 9077 | }); |
| ... | @@ -10266,80 +10266,80 @@ fn rvalue( | ... | @@ -10266,80 +10266,80 @@ fn rvalue( |
| 10266 | }, | 10266 | }, |
| 10267 | .ty => |ty_inst| { | 10267 | .ty => |ty_inst| { |
| 10268 | // Quickly eliminate some common, unnecessary type coercion. | 10268 | // Quickly eliminate some common, unnecessary type coercion. |
| 10269 | const as_ty = @as(u64, @enumToInt(Zir.Inst.Ref.type_type)) << 32; | 10269 | const as_ty = @as(u64, @intFromEnum(Zir.Inst.Ref.type_type)) << 32; |
| 10270 | const as_comptime_int = @as(u64, @enumToInt(Zir.Inst.Ref.comptime_int_type)) << 32; | 10270 | const as_comptime_int = @as(u64, @intFromEnum(Zir.Inst.Ref.comptime_int_type)) << 32; |
| 10271 | const as_bool = @as(u64, @enumToInt(Zir.Inst.Ref.bool_type)) << 32; | 10271 | const as_bool = @as(u64, @intFromEnum(Zir.Inst.Ref.bool_type)) << 32; |
| 10272 | const as_usize = @as(u64, @enumToInt(Zir.Inst.Ref.usize_type)) << 32; | 10272 | const as_usize = @as(u64, @intFromEnum(Zir.Inst.Ref.usize_type)) << 32; |
| 10273 | const as_void = @as(u64, @enumToInt(Zir.Inst.Ref.void_type)) << 32; | 10273 | const as_void = @as(u64, @intFromEnum(Zir.Inst.Ref.void_type)) << 32; |
| 10274 | switch ((@as(u64, @enumToInt(ty_inst)) << 32) | @as(u64, @enumToInt(result))) { | 10274 | switch ((@as(u64, @intFromEnum(ty_inst)) << 32) | @as(u64, @intFromEnum(result))) { |
| 10275 | as_ty | @enumToInt(Zir.Inst.Ref.u1_type), | 10275 | as_ty | @intFromEnum(Zir.Inst.Ref.u1_type), |
| 10276 | as_ty | @enumToInt(Zir.Inst.Ref.u8_type), | 10276 | as_ty | @intFromEnum(Zir.Inst.Ref.u8_type), |
| 10277 | as_ty | @enumToInt(Zir.Inst.Ref.i8_type), | 10277 | as_ty | @intFromEnum(Zir.Inst.Ref.i8_type), |
| 10278 | as_ty | @enumToInt(Zir.Inst.Ref.u16_type), | 10278 | as_ty | @intFromEnum(Zir.Inst.Ref.u16_type), |
| 10279 | as_ty | @enumToInt(Zir.Inst.Ref.u29_type), | 10279 | as_ty | @intFromEnum(Zir.Inst.Ref.u29_type), |
| 10280 | as_ty | @enumToInt(Zir.Inst.Ref.i16_type), | 10280 | as_ty | @intFromEnum(Zir.Inst.Ref.i16_type), |
| 10281 | as_ty | @enumToInt(Zir.Inst.Ref.u32_type), | 10281 | as_ty | @intFromEnum(Zir.Inst.Ref.u32_type), |
| 10282 | as_ty | @enumToInt(Zir.Inst.Ref.i32_type), | 10282 | as_ty | @intFromEnum(Zir.Inst.Ref.i32_type), |
| 10283 | as_ty | @enumToInt(Zir.Inst.Ref.u64_type), | 10283 | as_ty | @intFromEnum(Zir.Inst.Ref.u64_type), |
| 10284 | as_ty | @enumToInt(Zir.Inst.Ref.i64_type), | 10284 | as_ty | @intFromEnum(Zir.Inst.Ref.i64_type), |
| 10285 | as_ty | @enumToInt(Zir.Inst.Ref.u128_type), | 10285 | as_ty | @intFromEnum(Zir.Inst.Ref.u128_type), |
| 10286 | as_ty | @enumToInt(Zir.Inst.Ref.i128_type), | 10286 | as_ty | @intFromEnum(Zir.Inst.Ref.i128_type), |
| 10287 | as_ty | @enumToInt(Zir.Inst.Ref.usize_type), | 10287 | as_ty | @intFromEnum(Zir.Inst.Ref.usize_type), |
| 10288 | as_ty | @enumToInt(Zir.Inst.Ref.isize_type), | 10288 | as_ty | @intFromEnum(Zir.Inst.Ref.isize_type), |
| 10289 | as_ty | @enumToInt(Zir.Inst.Ref.c_char_type), | 10289 | as_ty | @intFromEnum(Zir.Inst.Ref.c_char_type), |
| 10290 | as_ty | @enumToInt(Zir.Inst.Ref.c_short_type), | 10290 | as_ty | @intFromEnum(Zir.Inst.Ref.c_short_type), |
| 10291 | as_ty | @enumToInt(Zir.Inst.Ref.c_ushort_type), | 10291 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ushort_type), |
| 10292 | as_ty | @enumToInt(Zir.Inst.Ref.c_int_type), | 10292 | as_ty | @intFromEnum(Zir.Inst.Ref.c_int_type), |
| 10293 | as_ty | @enumToInt(Zir.Inst.Ref.c_uint_type), | 10293 | as_ty | @intFromEnum(Zir.Inst.Ref.c_uint_type), |
| 10294 | as_ty | @enumToInt(Zir.Inst.Ref.c_long_type), | 10294 | as_ty | @intFromEnum(Zir.Inst.Ref.c_long_type), |
| 10295 | as_ty | @enumToInt(Zir.Inst.Ref.c_ulong_type), | 10295 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulong_type), |
| 10296 | as_ty | @enumToInt(Zir.Inst.Ref.c_longlong_type), | 10296 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longlong_type), |
| 10297 | as_ty | @enumToInt(Zir.Inst.Ref.c_ulonglong_type), | 10297 | as_ty | @intFromEnum(Zir.Inst.Ref.c_ulonglong_type), |
| 10298 | as_ty | @enumToInt(Zir.Inst.Ref.c_longdouble_type), | 10298 | as_ty | @intFromEnum(Zir.Inst.Ref.c_longdouble_type), |
| 10299 | as_ty | @enumToInt(Zir.Inst.Ref.f16_type), | 10299 | as_ty | @intFromEnum(Zir.Inst.Ref.f16_type), |
| 10300 | as_ty | @enumToInt(Zir.Inst.Ref.f32_type), | 10300 | as_ty | @intFromEnum(Zir.Inst.Ref.f32_type), |
| 10301 | as_ty | @enumToInt(Zir.Inst.Ref.f64_type), | 10301 | as_ty | @intFromEnum(Zir.Inst.Ref.f64_type), |
| 10302 | as_ty | @enumToInt(Zir.Inst.Ref.f80_type), | 10302 | as_ty | @intFromEnum(Zir.Inst.Ref.f80_type), |
| 10303 | as_ty | @enumToInt(Zir.Inst.Ref.f128_type), | 10303 | as_ty | @intFromEnum(Zir.Inst.Ref.f128_type), |
| 10304 | as_ty | @enumToInt(Zir.Inst.Ref.anyopaque_type), | 10304 | as_ty | @intFromEnum(Zir.Inst.Ref.anyopaque_type), |
| 10305 | as_ty | @enumToInt(Zir.Inst.Ref.bool_type), | 10305 | as_ty | @intFromEnum(Zir.Inst.Ref.bool_type), |
| 10306 | as_ty | @enumToInt(Zir.Inst.Ref.void_type), | 10306 | as_ty | @intFromEnum(Zir.Inst.Ref.void_type), |
| 10307 | as_ty | @enumToInt(Zir.Inst.Ref.type_type), | 10307 | as_ty | @intFromEnum(Zir.Inst.Ref.type_type), |
| 10308 | as_ty | @enumToInt(Zir.Inst.Ref.anyerror_type), | 10308 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_type), |
| 10309 | as_ty | @enumToInt(Zir.Inst.Ref.comptime_int_type), | 10309 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_int_type), |
| 10310 | as_ty | @enumToInt(Zir.Inst.Ref.comptime_float_type), | 10310 | as_ty | @intFromEnum(Zir.Inst.Ref.comptime_float_type), |
| 10311 | as_ty | @enumToInt(Zir.Inst.Ref.noreturn_type), | 10311 | as_ty | @intFromEnum(Zir.Inst.Ref.noreturn_type), |
| 10312 | as_ty | @enumToInt(Zir.Inst.Ref.anyframe_type), | 10312 | as_ty | @intFromEnum(Zir.Inst.Ref.anyframe_type), |
| 10313 | as_ty | @enumToInt(Zir.Inst.Ref.null_type), | 10313 | as_ty | @intFromEnum(Zir.Inst.Ref.null_type), |
| 10314 | as_ty | @enumToInt(Zir.Inst.Ref.undefined_type), | 10314 | as_ty | @intFromEnum(Zir.Inst.Ref.undefined_type), |
| 10315 | as_ty | @enumToInt(Zir.Inst.Ref.enum_literal_type), | 10315 | as_ty | @intFromEnum(Zir.Inst.Ref.enum_literal_type), |
| 10316 | as_ty | @enumToInt(Zir.Inst.Ref.atomic_order_type), | 10316 | as_ty | @intFromEnum(Zir.Inst.Ref.atomic_order_type), |
| 10317 | as_ty | @enumToInt(Zir.Inst.Ref.atomic_rmw_op_type), | 10317 | as_ty | @intFromEnum(Zir.Inst.Ref.atomic_rmw_op_type), |
| 10318 | as_ty | @enumToInt(Zir.Inst.Ref.calling_convention_type), | 10318 | as_ty | @intFromEnum(Zir.Inst.Ref.calling_convention_type), |
| 10319 | as_ty | @enumToInt(Zir.Inst.Ref.address_space_type), | 10319 | as_ty | @intFromEnum(Zir.Inst.Ref.address_space_type), |
| 10320 | as_ty | @enumToInt(Zir.Inst.Ref.float_mode_type), | 10320 | as_ty | @intFromEnum(Zir.Inst.Ref.float_mode_type), |
| 10321 | as_ty | @enumToInt(Zir.Inst.Ref.reduce_op_type), | 10321 | as_ty | @intFromEnum(Zir.Inst.Ref.reduce_op_type), |
| 10322 | as_ty | @enumToInt(Zir.Inst.Ref.call_modifier_type), | 10322 | as_ty | @intFromEnum(Zir.Inst.Ref.call_modifier_type), |
| 10323 | as_ty | @enumToInt(Zir.Inst.Ref.prefetch_options_type), | 10323 | as_ty | @intFromEnum(Zir.Inst.Ref.prefetch_options_type), |
| 10324 | as_ty | @enumToInt(Zir.Inst.Ref.export_options_type), | 10324 | as_ty | @intFromEnum(Zir.Inst.Ref.export_options_type), |
| 10325 | as_ty | @enumToInt(Zir.Inst.Ref.extern_options_type), | 10325 | as_ty | @intFromEnum(Zir.Inst.Ref.extern_options_type), |
| 10326 | as_ty | @enumToInt(Zir.Inst.Ref.type_info_type), | 10326 | as_ty | @intFromEnum(Zir.Inst.Ref.type_info_type), |
| 10327 | as_ty | @enumToInt(Zir.Inst.Ref.manyptr_u8_type), | 10327 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_u8_type), |
| 10328 | as_ty | @enumToInt(Zir.Inst.Ref.manyptr_const_u8_type), | 10328 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_type), |
| 10329 | as_ty | @enumToInt(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), | 10329 | as_ty | @intFromEnum(Zir.Inst.Ref.manyptr_const_u8_sentinel_0_type), |
| 10330 | as_ty | @enumToInt(Zir.Inst.Ref.single_const_pointer_to_comptime_int_type), | 10330 | as_ty | @intFromEnum(Zir.Inst.Ref.single_const_pointer_to_comptime_int_type), |
| 10331 | as_ty | @enumToInt(Zir.Inst.Ref.slice_const_u8_type), | 10331 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_type), |
| 10332 | as_ty | @enumToInt(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), | 10332 | as_ty | @intFromEnum(Zir.Inst.Ref.slice_const_u8_sentinel_0_type), |
| 10333 | as_ty | @enumToInt(Zir.Inst.Ref.anyerror_void_error_union_type), | 10333 | as_ty | @intFromEnum(Zir.Inst.Ref.anyerror_void_error_union_type), |
| 10334 | as_ty | @enumToInt(Zir.Inst.Ref.generic_poison_type), | 10334 | as_ty | @intFromEnum(Zir.Inst.Ref.generic_poison_type), |
| 10335 | as_ty | @enumToInt(Zir.Inst.Ref.empty_struct_type), | 10335 | as_ty | @intFromEnum(Zir.Inst.Ref.empty_struct_type), |
| 10336 | as_comptime_int | @enumToInt(Zir.Inst.Ref.zero), | 10336 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.zero), |
| 10337 | as_comptime_int | @enumToInt(Zir.Inst.Ref.one), | 10337 | as_comptime_int | @intFromEnum(Zir.Inst.Ref.one), |
| 10338 | as_bool | @enumToInt(Zir.Inst.Ref.bool_true), | 10338 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_true), |
| 10339 | as_bool | @enumToInt(Zir.Inst.Ref.bool_false), | 10339 | as_bool | @intFromEnum(Zir.Inst.Ref.bool_false), |
| 10340 | as_usize | @enumToInt(Zir.Inst.Ref.zero_usize), | 10340 | as_usize | @intFromEnum(Zir.Inst.Ref.zero_usize), |
| 10341 | as_usize | @enumToInt(Zir.Inst.Ref.one_usize), | 10341 | as_usize | @intFromEnum(Zir.Inst.Ref.one_usize), |
| 10342 | as_void | @enumToInt(Zir.Inst.Ref.void_value), | 10342 | as_void | @intFromEnum(Zir.Inst.Ref.void_value), |
| 10343 | => return result, // type of result is already correct | 10343 | => return result, // type of result is already correct |
| 10344 | 10344 | ||
| 10345 | // Need an explicit type coercion instruction. | 10345 | // Need an explicit type coercion instruction. |
| ... | @@ -11429,8 +11429,8 @@ const GenZir = struct { | ... | @@ -11429,8 +11429,8 @@ const GenZir = struct { |
| 11429 | fancyFnExprExtraLen(astgen, cc_body, args.cc_ref) + | 11429 | fancyFnExprExtraLen(astgen, cc_body, args.cc_ref) + |
| 11430 | fancyFnExprExtraLen(astgen, ret_body, ret_ref) + | 11430 | fancyFnExprExtraLen(astgen, ret_body, ret_ref) + |
| 11431 | body_len + src_locs.len + | 11431 | body_len + src_locs.len + |
| 11432 | @boolToInt(args.lib_name != 0) + | 11432 | @intFromBool(args.lib_name != 0) + |
| 11433 | @boolToInt(args.noalias_bits != 0), | 11433 | @intFromBool(args.noalias_bits != 0), |
| 11434 | ); | 11434 | ); |
| 11435 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.FuncFancy{ | 11435 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.FuncFancy{ |
| 11436 | .param_block = args.param_block, | 11436 | .param_block = args.param_block, |
| ... | @@ -11468,7 +11468,7 @@ const GenZir = struct { | ... | @@ -11468,7 +11468,7 @@ const GenZir = struct { |
| 11468 | const inst_data = zir_datas[align_body[align_body.len - 1]].@"break"; | 11468 | const inst_data = zir_datas[align_body[align_body.len - 1]].@"break"; |
| 11469 | astgen.extra.items[inst_data.payload_index] = new_index; | 11469 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11470 | } else if (args.align_ref != .none) { | 11470 | } else if (args.align_ref != .none) { |
| 11471 | astgen.extra.appendAssumeCapacity(@enumToInt(args.align_ref)); | 11471 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.align_ref)); |
| 11472 | } | 11472 | } |
| 11473 | if (addrspace_body.len != 0) { | 11473 | if (addrspace_body.len != 0) { |
| 11474 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, addrspace_body)); | 11474 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, addrspace_body)); |
| ... | @@ -11476,7 +11476,7 @@ const GenZir = struct { | ... | @@ -11476,7 +11476,7 @@ const GenZir = struct { |
| 11476 | const inst_data = zir_datas[addrspace_body[addrspace_body.len - 1]].@"break"; | 11476 | const inst_data = zir_datas[addrspace_body[addrspace_body.len - 1]].@"break"; |
| 11477 | astgen.extra.items[inst_data.payload_index] = new_index; | 11477 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11478 | } else if (args.addrspace_ref != .none) { | 11478 | } else if (args.addrspace_ref != .none) { |
| 11479 | astgen.extra.appendAssumeCapacity(@enumToInt(args.addrspace_ref)); | 11479 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.addrspace_ref)); |
| 11480 | } | 11480 | } |
| 11481 | if (section_body.len != 0) { | 11481 | if (section_body.len != 0) { |
| 11482 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, section_body)); | 11482 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, section_body)); |
| ... | @@ -11484,7 +11484,7 @@ const GenZir = struct { | ... | @@ -11484,7 +11484,7 @@ const GenZir = struct { |
| 11484 | const inst_data = zir_datas[section_body[section_body.len - 1]].@"break"; | 11484 | const inst_data = zir_datas[section_body[section_body.len - 1]].@"break"; |
| 11485 | astgen.extra.items[inst_data.payload_index] = new_index; | 11485 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11486 | } else if (args.section_ref != .none) { | 11486 | } else if (args.section_ref != .none) { |
| 11487 | astgen.extra.appendAssumeCapacity(@enumToInt(args.section_ref)); | 11487 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.section_ref)); |
| 11488 | } | 11488 | } |
| 11489 | if (cc_body.len != 0) { | 11489 | if (cc_body.len != 0) { |
| 11490 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, cc_body)); | 11490 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, cc_body)); |
| ... | @@ -11492,7 +11492,7 @@ const GenZir = struct { | ... | @@ -11492,7 +11492,7 @@ const GenZir = struct { |
| 11492 | const inst_data = zir_datas[cc_body[cc_body.len - 1]].@"break"; | 11492 | const inst_data = zir_datas[cc_body[cc_body.len - 1]].@"break"; |
| 11493 | astgen.extra.items[inst_data.payload_index] = new_index; | 11493 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11494 | } else if (args.cc_ref != .none) { | 11494 | } else if (args.cc_ref != .none) { |
| 11495 | astgen.extra.appendAssumeCapacity(@enumToInt(args.cc_ref)); | 11495 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.cc_ref)); |
| 11496 | } | 11496 | } |
| 11497 | if (ret_body.len != 0) { | 11497 | if (ret_body.len != 0) { |
| 11498 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, ret_body)); | 11498 | astgen.extra.appendAssumeCapacity(countBodyLenAfterFixups(astgen, ret_body)); |
| ... | @@ -11500,7 +11500,7 @@ const GenZir = struct { | ... | @@ -11500,7 +11500,7 @@ const GenZir = struct { |
| 11500 | const inst_data = zir_datas[ret_body[ret_body.len - 1]].@"break"; | 11500 | const inst_data = zir_datas[ret_body[ret_body.len - 1]].@"break"; |
| 11501 | astgen.extra.items[inst_data.payload_index] = new_index; | 11501 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11502 | } else if (ret_ref != .none) { | 11502 | } else if (ret_ref != .none) { |
| 11503 | astgen.extra.appendAssumeCapacity(@enumToInt(ret_ref)); | 11503 | astgen.extra.appendAssumeCapacity(@intFromEnum(ret_ref)); |
| 11504 | } | 11504 | } |
| 11505 | 11505 | ||
| 11506 | if (args.noalias_bits != 0) { | 11506 | if (args.noalias_bits != 0) { |
| ... | @@ -11542,7 +11542,7 @@ const GenZir = struct { | ... | @@ -11542,7 +11542,7 @@ const GenZir = struct { |
| 11542 | const ret_body_len = if (ret_body.len != 0) | 11542 | const ret_body_len = if (ret_body.len != 0) |
| 11543 | countBodyLenAfterFixups(astgen, ret_body) | 11543 | countBodyLenAfterFixups(astgen, ret_body) |
| 11544 | else | 11544 | else |
| 11545 | @boolToInt(ret_ref != .none); | 11545 | @intFromBool(ret_ref != .none); |
| 11546 | 11546 | ||
| 11547 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.Func{ | 11547 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.Func{ |
| 11548 | .param_block = args.param_block, | 11548 | .param_block = args.param_block, |
| ... | @@ -11556,7 +11556,7 @@ const GenZir = struct { | ... | @@ -11556,7 +11556,7 @@ const GenZir = struct { |
| 11556 | const inst_data = zir_datas[ret_body[ret_body.len - 1]].@"break"; | 11556 | const inst_data = zir_datas[ret_body[ret_body.len - 1]].@"break"; |
| 11557 | astgen.extra.items[inst_data.payload_index] = new_index; | 11557 | astgen.extra.items[inst_data.payload_index] = new_index; |
| 11558 | } else if (ret_ref != .none) { | 11558 | } else if (ret_ref != .none) { |
| 11559 | astgen.extra.appendAssumeCapacity(@enumToInt(ret_ref)); | 11559 | astgen.extra.appendAssumeCapacity(@intFromEnum(ret_ref)); |
| 11560 | } | 11560 | } |
| 11561 | astgen.appendBodyWithFixups(body); | 11561 | astgen.appendBodyWithFixups(body); |
| 11562 | astgen.extra.appendSliceAssumeCapacity(src_locs); | 11562 | astgen.extra.appendSliceAssumeCapacity(src_locs); |
| ... | @@ -11587,7 +11587,7 @@ const GenZir = struct { | ... | @@ -11587,7 +11587,7 @@ const GenZir = struct { |
| 11587 | fn fancyFnExprExtraLen(astgen: *AstGen, body: []Zir.Inst.Index, ref: Zir.Inst.Ref) u32 { | 11587 | fn fancyFnExprExtraLen(astgen: *AstGen, body: []Zir.Inst.Index, ref: Zir.Inst.Ref) u32 { |
| 11588 | // In the case of non-empty body, there is one for the body length, | 11588 | // In the case of non-empty body, there is one for the body length, |
| 11589 | // and then one for each instruction. | 11589 | // and then one for each instruction. |
| 11590 | return countBodyLenAfterFixups(astgen, body) + @boolToInt(ref != .none); | 11590 | return countBodyLenAfterFixups(astgen, body) + @intFromBool(ref != .none); |
| 11591 | } | 11591 | } |
| 11592 | 11592 | ||
| 11593 | fn addVar(gz: *GenZir, args: struct { | 11593 | fn addVar(gz: *GenZir, args: struct { |
| ... | @@ -11607,9 +11607,9 @@ const GenZir = struct { | ... | @@ -11607,9 +11607,9 @@ const GenZir = struct { |
| 11607 | try astgen.extra.ensureUnusedCapacity( | 11607 | try astgen.extra.ensureUnusedCapacity( |
| 11608 | gpa, | 11608 | gpa, |
| 11609 | @typeInfo(Zir.Inst.ExtendedVar).Struct.fields.len + | 11609 | @typeInfo(Zir.Inst.ExtendedVar).Struct.fields.len + |
| 11610 | @boolToInt(args.lib_name != 0) + | 11610 | @intFromBool(args.lib_name != 0) + |
| 11611 | @boolToInt(args.align_inst != .none) + | 11611 | @intFromBool(args.align_inst != .none) + |
| 11612 | @boolToInt(args.init != .none), | 11612 | @intFromBool(args.init != .none), |
| 11613 | ); | 11613 | ); |
| 11614 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.ExtendedVar{ | 11614 | const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.ExtendedVar{ |
| 11615 | .var_type = args.var_type, | 11615 | .var_type = args.var_type, |
| ... | @@ -11618,10 +11618,10 @@ const GenZir = struct { | ... | @@ -11618,10 +11618,10 @@ const GenZir = struct { |
| 11618 | astgen.extra.appendAssumeCapacity(args.lib_name); | 11618 | astgen.extra.appendAssumeCapacity(args.lib_name); |
| 11619 | } | 11619 | } |
| 11620 | if (args.align_inst != .none) { | 11620 | if (args.align_inst != .none) { |
| 11621 | astgen.extra.appendAssumeCapacity(@enumToInt(args.align_inst)); | 11621 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.align_inst)); |
| 11622 | } | 11622 | } |
| 11623 | if (args.init != .none) { | 11623 | if (args.init != .none) { |
| 11624 | astgen.extra.appendAssumeCapacity(@enumToInt(args.init)); | 11624 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.init)); |
| 11625 | } | 11625 | } |
| 11626 | 11626 | ||
| 11627 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); | 11627 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); |
| ... | @@ -12208,23 +12208,23 @@ const GenZir = struct { | ... | @@ -12208,23 +12208,23 @@ const GenZir = struct { |
| 12208 | try astgen.extra.ensureUnusedCapacity( | 12208 | try astgen.extra.ensureUnusedCapacity( |
| 12209 | gpa, | 12209 | gpa, |
| 12210 | @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len + | 12210 | @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len + |
| 12211 | @as(usize, @boolToInt(args.type_inst != .none)) + | 12211 | @as(usize, @intFromBool(args.type_inst != .none)) + |
| 12212 | @as(usize, @boolToInt(args.align_inst != .none)), | 12212 | @as(usize, @intFromBool(args.align_inst != .none)), |
| 12213 | ); | 12213 | ); |
| 12214 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.AllocExtended{ | 12214 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.AllocExtended{ |
| 12215 | .src_node = gz.nodeIndexToRelative(args.node), | 12215 | .src_node = gz.nodeIndexToRelative(args.node), |
| 12216 | }); | 12216 | }); |
| 12217 | if (args.type_inst != .none) { | 12217 | if (args.type_inst != .none) { |
| 12218 | astgen.extra.appendAssumeCapacity(@enumToInt(args.type_inst)); | 12218 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.type_inst)); |
| 12219 | } | 12219 | } |
| 12220 | if (args.align_inst != .none) { | 12220 | if (args.align_inst != .none) { |
| 12221 | astgen.extra.appendAssumeCapacity(@enumToInt(args.align_inst)); | 12221 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.align_inst)); |
| 12222 | } | 12222 | } |
| 12223 | 12223 | ||
| 12224 | const has_type: u4 = @boolToInt(args.type_inst != .none); | 12224 | const has_type: u4 = @intFromBool(args.type_inst != .none); |
| 12225 | const has_align: u4 = @boolToInt(args.align_inst != .none); | 12225 | const has_align: u4 = @intFromBool(args.align_inst != .none); |
| 12226 | const is_const: u4 = @boolToInt(args.is_const); | 12226 | const is_const: u4 = @intFromBool(args.is_const); |
| 12227 | const is_comptime: u4 = @boolToInt(args.is_comptime); | 12227 | const is_comptime: u4 = @intFromBool(args.is_comptime); |
| 12228 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); | 12228 | const small: u16 = has_type | (has_align << 1) | (is_const << 2) | (is_comptime << 3); |
| 12229 | 12229 | ||
| 12230 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); | 12230 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); |
| ... | @@ -12284,7 +12284,7 @@ const GenZir = struct { | ... | @@ -12284,7 +12284,7 @@ const GenZir = struct { |
| 12284 | const small: u16 = @intCast(u16, args.outputs.len) | | 12284 | const small: u16 = @intCast(u16, args.outputs.len) | |
| 12285 | @intCast(u16, args.inputs.len << 5) | | 12285 | @intCast(u16, args.inputs.len << 5) | |
| 12286 | @intCast(u16, args.clobbers.len << 10) | | 12286 | @intCast(u16, args.clobbers.len << 10) | |
| 12287 | (@as(u16, @boolToInt(args.is_volatile)) << 15); | 12287 | (@as(u16, @intFromBool(args.is_volatile)) << 15); |
| 12288 | 12288 | ||
| 12289 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); | 12289 | const new_index = @intCast(Zir.Inst.Index, astgen.instructions.len); |
| 12290 | astgen.instructions.appendAssumeCapacity(.{ | 12290 | astgen.instructions.appendAssumeCapacity(.{ |
| ... | @@ -12362,7 +12362,7 @@ const GenZir = struct { | ... | @@ -12362,7 +12362,7 @@ const GenZir = struct { |
| 12362 | if (args.backing_int_ref != .none) { | 12362 | if (args.backing_int_ref != .none) { |
| 12363 | astgen.extra.appendAssumeCapacity(args.backing_int_body_len); | 12363 | astgen.extra.appendAssumeCapacity(args.backing_int_body_len); |
| 12364 | if (args.backing_int_body_len == 0) { | 12364 | if (args.backing_int_body_len == 0) { |
| 12365 | astgen.extra.appendAssumeCapacity(@enumToInt(args.backing_int_ref)); | 12365 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.backing_int_ref)); |
| 12366 | } | 12366 | } |
| 12367 | } | 12367 | } |
| 12368 | astgen.instructions.set(inst, .{ | 12368 | astgen.instructions.set(inst, .{ |
| ... | @@ -12405,7 +12405,7 @@ const GenZir = struct { | ... | @@ -12405,7 +12405,7 @@ const GenZir = struct { |
| 12405 | astgen.extra.appendAssumeCapacity(@bitCast(u32, node_offset)); | 12405 | astgen.extra.appendAssumeCapacity(@bitCast(u32, node_offset)); |
| 12406 | } | 12406 | } |
| 12407 | if (args.tag_type != .none) { | 12407 | if (args.tag_type != .none) { |
| 12408 | astgen.extra.appendAssumeCapacity(@enumToInt(args.tag_type)); | 12408 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); |
| 12409 | } | 12409 | } |
| 12410 | if (args.body_len != 0) { | 12410 | if (args.body_len != 0) { |
| 12411 | astgen.extra.appendAssumeCapacity(args.body_len); | 12411 | astgen.extra.appendAssumeCapacity(args.body_len); |
| ... | @@ -12454,7 +12454,7 @@ const GenZir = struct { | ... | @@ -12454,7 +12454,7 @@ const GenZir = struct { |
| 12454 | astgen.extra.appendAssumeCapacity(@bitCast(u32, node_offset)); | 12454 | astgen.extra.appendAssumeCapacity(@bitCast(u32, node_offset)); |
| 12455 | } | 12455 | } |
| 12456 | if (args.tag_type != .none) { | 12456 | if (args.tag_type != .none) { |
| 12457 | astgen.extra.appendAssumeCapacity(@enumToInt(args.tag_type)); | 12457 | astgen.extra.appendAssumeCapacity(@intFromEnum(args.tag_type)); |
| 12458 | } | 12458 | } |
| 12459 | if (args.body_len != 0) { | 12459 | if (args.body_len != 0) { |
| 12460 | astgen.extra.appendAssumeCapacity(args.body_len); | 12460 | astgen.extra.appendAssumeCapacity(args.body_len); |
| ... | @@ -12948,10 +12948,10 @@ fn lowerAstErrors(astgen: *AstGen) !void { | ... | @@ -12948,10 +12948,10 @@ fn lowerAstErrors(astgen: *AstGen) !void { |
| 12948 | var notes: std.ArrayListUnmanaged(u32) = .{}; | 12948 | var notes: std.ArrayListUnmanaged(u32) = .{}; |
| 12949 | defer notes.deinit(gpa); | 12949 | defer notes.deinit(gpa); |
| 12950 | 12950 | ||
| 12951 | if (token_tags[parse_err.token + @boolToInt(parse_err.token_is_prev)] == .invalid) { | 12951 | if (token_tags[parse_err.token + @intFromBool(parse_err.token_is_prev)] == .invalid) { |
| 12952 | const tok = parse_err.token + @boolToInt(parse_err.token_is_prev); | 12952 | const tok = parse_err.token + @intFromBool(parse_err.token_is_prev); |
| 12953 | const bad_off = @intCast(u32, tree.tokenSlice(parse_err.token + @boolToInt(parse_err.token_is_prev)).len); | 12953 | const bad_off = @intCast(u32, tree.tokenSlice(parse_err.token + @intFromBool(parse_err.token_is_prev)).len); |
| 12954 | const byte_abs = token_starts[parse_err.token + @boolToInt(parse_err.token_is_prev)] + bad_off; | 12954 | const byte_abs = token_starts[parse_err.token + @intFromBool(parse_err.token_is_prev)] + bad_off; |
| 12955 | try notes.append(gpa, try astgen.errNoteTokOff(tok, bad_off, "invalid byte: '{'}'", .{ | 12955 | try notes.append(gpa, try astgen.errNoteTokOff(tok, bad_off, "invalid byte: '{'}'", .{ |
| 12956 | std.zig.fmtEscapes(tree.source[byte_abs..][0..1]), | 12956 | std.zig.fmtEscapes(tree.source[byte_abs..][0..1]), |
| 12957 | })); | 12957 | })); |
src/Autodoc.zig+80-80| ... | @@ -107,10 +107,10 @@ pub fn generateZirData(self: *Autodoc) !void { | ... | @@ -107,10 +107,10 @@ pub fn generateZirData(self: *Autodoc) !void { |
| 107 | const file = self.comp_module.import_table.get(abs_root_src_path).?; // file is expected to be present in the import table | 107 | const file = self.comp_module.import_table.get(abs_root_src_path).?; // file is expected to be present in the import table |
| 108 | // Append all the types in Zir.Inst.Ref. | 108 | // Append all the types in Zir.Inst.Ref. |
| 109 | { | 109 | { |
| 110 | comptime std.debug.assert(@enumToInt(InternPool.Index.first_type) == 0); | 110 | comptime std.debug.assert(@intFromEnum(InternPool.Index.first_type) == 0); |
| 111 | var i: u32 = 0; | 111 | var i: u32 = 0; |
| 112 | while (i <= @enumToInt(InternPool.Index.last_type)) : (i += 1) { | 112 | while (i <= @intFromEnum(InternPool.Index.last_type)) : (i += 1) { |
| 113 | const ip_index = @intToEnum(InternPool.Index, i); | 113 | const ip_index = @enumFromInt(InternPool.Index, i); |
| 114 | var tmpbuf = std.ArrayList(u8).init(self.arena); | 114 | var tmpbuf = std.ArrayList(u8).init(self.arena); |
| 115 | if (ip_index == .generic_poison_type) { | 115 | if (ip_index == .generic_poison_type) { |
| 116 | // Not a real type, doesn't have a normal name | 116 | // Not a real type, doesn't have a normal name |
| ... | @@ -696,14 +696,14 @@ const DocData = struct { | ... | @@ -696,14 +696,14 @@ const DocData = struct { |
| 696 | jsw.whitespace = opts.whitespace; | 696 | jsw.whitespace = opts.whitespace; |
| 697 | try jsw.beginArray(); | 697 | try jsw.beginArray(); |
| 698 | try jsw.arrayElem(); | 698 | try jsw.arrayElem(); |
| 699 | try jsw.emitNumber(@enumToInt(active_tag)); | 699 | try jsw.emitNumber(@intFromEnum(active_tag)); |
| 700 | inline for (comptime std.meta.fields(Type)) |case| { | 700 | inline for (comptime std.meta.fields(Type)) |case| { |
| 701 | if (@field(Type, case.name) == active_tag) { | 701 | if (@field(Type, case.name) == active_tag) { |
| 702 | const current_value = @field(self, case.name); | 702 | const current_value = @field(self, case.name); |
| 703 | inline for (comptime std.meta.fields(case.type)) |f| { | 703 | inline for (comptime std.meta.fields(case.type)) |f| { |
| 704 | try jsw.arrayElem(); | 704 | try jsw.arrayElem(); |
| 705 | if (f.type == std.builtin.Type.Pointer.Size) { | 705 | if (f.type == std.builtin.Type.Pointer.Size) { |
| 706 | try jsw.emitNumber(@enumToInt(@field(current_value, f.name))); | 706 | try jsw.emitNumber(@intFromEnum(@field(current_value, f.name))); |
| 707 | } else { | 707 | } else { |
| 708 | try std.json.stringify(@field(current_value, f.name), opts, w); | 708 | try std.json.stringify(@field(current_value, f.name), opts, w); |
| 709 | jsw.state_index -= 1; | 709 | jsw.state_index -= 1; |
| ... | @@ -756,7 +756,7 @@ const DocData = struct { | ... | @@ -756,7 +756,7 @@ const DocData = struct { |
| 756 | as: As, | 756 | as: As, |
| 757 | sizeOf: usize, // index in `exprs` | 757 | sizeOf: usize, // index in `exprs` |
| 758 | bitSizeOf: usize, // index in `exprs` | 758 | bitSizeOf: usize, // index in `exprs` |
| 759 | enumToInt: usize, // index in `exprs` | 759 | intFromEnum: usize, // index in `exprs` |
| 760 | compileError: usize, //index in `exprs` | 760 | compileError: usize, //index in `exprs` |
| 761 | errorSets: usize, | 761 | errorSets: usize, |
| 762 | string: []const u8, // direct value | 762 | string: []const u8, // direct value |
| ... | @@ -956,7 +956,7 @@ fn walkInstruction( | ... | @@ -956,7 +956,7 @@ fn walkInstruction( |
| 956 | 956 | ||
| 957 | if (result.found_existing) { | 957 | if (result.found_existing) { |
| 958 | return DocData.WalkResult{ | 958 | return DocData.WalkResult{ |
| 959 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 959 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 960 | .expr = .{ .type = result.value_ptr.main }, | 960 | .expr = .{ .type = result.value_ptr.main }, |
| 961 | }; | 961 | }; |
| 962 | } | 962 | } |
| ... | @@ -1005,7 +1005,7 @@ fn walkInstruction( | ... | @@ -1005,7 +1005,7 @@ fn walkInstruction( |
| 1005 | const result = try self.files.getOrPut(self.arena, new_file.file); | 1005 | const result = try self.files.getOrPut(self.arena, new_file.file); |
| 1006 | if (result.found_existing) { | 1006 | if (result.found_existing) { |
| 1007 | return DocData.WalkResult{ | 1007 | return DocData.WalkResult{ |
| 1008 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1008 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1009 | .expr = .{ .type = result.value_ptr.* }, | 1009 | .expr = .{ .type = result.value_ptr.* }, |
| 1010 | }; | 1010 | }; |
| 1011 | } | 1011 | } |
| ... | @@ -1033,8 +1033,8 @@ fn walkInstruction( | ... | @@ -1033,8 +1033,8 @@ fn walkInstruction( |
| 1033 | }, | 1033 | }, |
| 1034 | .ret_type => { | 1034 | .ret_type => { |
| 1035 | return DocData.WalkResult{ | 1035 | return DocData.WalkResult{ |
| 1036 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1036 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1037 | .expr = .{ .type = @enumToInt(Ref.type_type) }, | 1037 | .expr = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1038 | }; | 1038 | }; |
| 1039 | }, | 1039 | }, |
| 1040 | .ret_node => { | 1040 | .ret_node => { |
| ... | @@ -1093,7 +1093,7 @@ fn walkInstruction( | ... | @@ -1093,7 +1093,7 @@ fn walkInstruction( |
| 1093 | try self.types.append(self.arena, .{ | 1093 | try self.types.append(self.arena, .{ |
| 1094 | .Array = .{ | 1094 | .Array = .{ |
| 1095 | .len = .{ .int = .{ .value = str.len } }, | 1095 | .len = .{ .int = .{ .value = str.len } }, |
| 1096 | .child = .{ .type = @enumToInt(Ref.u8_type) }, | 1096 | .child = .{ .type = @intFromEnum(Ref.u8_type) }, |
| 1097 | .sentinel = .{ .int = .{ | 1097 | .sentinel = .{ .int = .{ |
| 1098 | .value = 0, | 1098 | .value = 0, |
| 1099 | .negated = false, | 1099 | .negated = false, |
| ... | @@ -1155,7 +1155,7 @@ fn walkInstruction( | ... | @@ -1155,7 +1155,7 @@ fn walkInstruction( |
| 1155 | .int => { | 1155 | .int => { |
| 1156 | const int = data[inst_index].int; | 1156 | const int = data[inst_index].int; |
| 1157 | return DocData.WalkResult{ | 1157 | return DocData.WalkResult{ |
| 1158 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 1158 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 1159 | .expr = .{ .int = .{ .value = int } }, | 1159 | .expr = .{ .int = .{ .value = int } }, |
| 1160 | }; | 1160 | }; |
| 1161 | }, | 1161 | }, |
| ... | @@ -1176,7 +1176,7 @@ fn walkInstruction( | ... | @@ -1176,7 +1176,7 @@ fn walkInstruction( |
| 1176 | const as_string = try big_int.toStringAlloc(self.arena, 10, .lower); | 1176 | const as_string = try big_int.toStringAlloc(self.arena, 10, .lower); |
| 1177 | 1177 | ||
| 1178 | return DocData.WalkResult{ | 1178 | return DocData.WalkResult{ |
| 1179 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 1179 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 1180 | .expr = .{ .int_big = .{ .value = as_string } }, | 1180 | .expr = .{ .int_big = .{ .value = as_string } }, |
| 1181 | }; | 1181 | }; |
| 1182 | }, | 1182 | }, |
| ... | @@ -1422,7 +1422,7 @@ fn walkInstruction( | ... | @@ -1422,7 +1422,7 @@ fn walkInstruction( |
| 1422 | } }; | 1422 | } }; |
| 1423 | 1423 | ||
| 1424 | return DocData.WalkResult{ | 1424 | return DocData.WalkResult{ |
| 1425 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1425 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1426 | .expr = .{ .binOpIndex = binop_index }, | 1426 | .expr = .{ .binOpIndex = binop_index }, |
| 1427 | }; | 1427 | }; |
| 1428 | }, | 1428 | }, |
| ... | @@ -1466,7 +1466,7 @@ fn walkInstruction( | ... | @@ -1466,7 +1466,7 @@ fn walkInstruction( |
| 1466 | } }; | 1466 | } }; |
| 1467 | 1467 | ||
| 1468 | return DocData.WalkResult{ | 1468 | return DocData.WalkResult{ |
| 1469 | .typeRef = .{ .type = @enumToInt(Ref.bool_type) }, | 1469 | .typeRef = .{ .type = @intFromEnum(Ref.bool_type) }, |
| 1470 | .expr = .{ .binOpIndex = binop_index }, | 1470 | .expr = .{ .binOpIndex = binop_index }, |
| 1471 | }; | 1471 | }; |
| 1472 | }, | 1472 | }, |
| ... | @@ -1516,7 +1516,7 @@ fn walkInstruction( | ... | @@ -1516,7 +1516,7 @@ fn walkInstruction( |
| 1516 | self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(tags[inst_index]), .param = param_index } }; | 1516 | self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(tags[inst_index]), .param = param_index } }; |
| 1517 | 1517 | ||
| 1518 | return DocData.WalkResult{ | 1518 | return DocData.WalkResult{ |
| 1519 | .typeRef = param.typeRef orelse .{ .type = @enumToInt(Ref.type_type) }, | 1519 | .typeRef = param.typeRef orelse .{ .type = @intFromEnum(Ref.type_type) }, |
| 1520 | .expr = .{ .builtinIndex = bin_index }, | 1520 | .expr = .{ .builtinIndex = bin_index }, |
| 1521 | }; | 1521 | }; |
| 1522 | }, | 1522 | }, |
| ... | @@ -1578,7 +1578,7 @@ fn walkInstruction( | ... | @@ -1578,7 +1578,7 @@ fn walkInstruction( |
| 1578 | self.exprs.items[binop_index] = .{ .builtinBin = .{ .name = @tagName(tags[inst_index]), .lhs = lhs_index, .rhs = rhs_index } }; | 1578 | self.exprs.items[binop_index] = .{ .builtinBin = .{ .name = @tagName(tags[inst_index]), .lhs = lhs_index, .rhs = rhs_index } }; |
| 1579 | 1579 | ||
| 1580 | return DocData.WalkResult{ | 1580 | return DocData.WalkResult{ |
| 1581 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1581 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1582 | .expr = .{ .builtinBinIndex = binop_index }, | 1582 | .expr = .{ .builtinBinIndex = binop_index }, |
| 1583 | }; | 1583 | }; |
| 1584 | }, | 1584 | }, |
| ... | @@ -1608,7 +1608,7 @@ fn walkInstruction( | ... | @@ -1608,7 +1608,7 @@ fn walkInstruction( |
| 1608 | } }); | 1608 | } }); |
| 1609 | 1609 | ||
| 1610 | return DocData.WalkResult{ | 1610 | return DocData.WalkResult{ |
| 1611 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1611 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1612 | .expr = .{ .errorUnion = type_slot_index }, | 1612 | .expr = .{ .errorUnion = type_slot_index }, |
| 1613 | }; | 1613 | }; |
| 1614 | }, | 1614 | }, |
| ... | @@ -1637,7 +1637,7 @@ fn walkInstruction( | ... | @@ -1637,7 +1637,7 @@ fn walkInstruction( |
| 1637 | } }); | 1637 | } }); |
| 1638 | 1638 | ||
| 1639 | return DocData.WalkResult{ | 1639 | return DocData.WalkResult{ |
| 1640 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1640 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1641 | .expr = .{ .errorSets = type_slot_index }, | 1641 | .expr = .{ .errorSets = type_slot_index }, |
| 1642 | }; | 1642 | }; |
| 1643 | }, | 1643 | }, |
| ... | @@ -1670,7 +1670,7 @@ fn walkInstruction( | ... | @@ -1670,7 +1670,7 @@ fn walkInstruction( |
| 1670 | // present in json | 1670 | // present in json |
| 1671 | var sentinel: ?DocData.Expr = null; | 1671 | var sentinel: ?DocData.Expr = null; |
| 1672 | if (ptr.flags.has_sentinel) { | 1672 | if (ptr.flags.has_sentinel) { |
| 1673 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 1673 | const ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1674 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); | 1674 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1675 | sentinel = ref_result.expr; | 1675 | sentinel = ref_result.expr; |
| 1676 | extra_index += 1; | 1676 | extra_index += 1; |
| ... | @@ -1678,21 +1678,21 @@ fn walkInstruction( | ... | @@ -1678,21 +1678,21 @@ fn walkInstruction( |
| 1678 | 1678 | ||
| 1679 | var @"align": ?DocData.Expr = null; | 1679 | var @"align": ?DocData.Expr = null; |
| 1680 | if (ptr.flags.has_align) { | 1680 | if (ptr.flags.has_align) { |
| 1681 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 1681 | const ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1682 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); | 1682 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1683 | @"align" = ref_result.expr; | 1683 | @"align" = ref_result.expr; |
| 1684 | extra_index += 1; | 1684 | extra_index += 1; |
| 1685 | } | 1685 | } |
| 1686 | var address_space: ?DocData.Expr = null; | 1686 | var address_space: ?DocData.Expr = null; |
| 1687 | if (ptr.flags.has_addrspace) { | 1687 | if (ptr.flags.has_addrspace) { |
| 1688 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 1688 | const ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1689 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); | 1689 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1690 | address_space = ref_result.expr; | 1690 | address_space = ref_result.expr; |
| 1691 | extra_index += 1; | 1691 | extra_index += 1; |
| 1692 | } | 1692 | } |
| 1693 | var bit_start: ?DocData.Expr = null; | 1693 | var bit_start: ?DocData.Expr = null; |
| 1694 | if (ptr.flags.has_bit_range) { | 1694 | if (ptr.flags.has_bit_range) { |
| 1695 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 1695 | const ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1696 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); | 1696 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1697 | address_space = ref_result.expr; | 1697 | address_space = ref_result.expr; |
| 1698 | extra_index += 1; | 1698 | extra_index += 1; |
| ... | @@ -1700,7 +1700,7 @@ fn walkInstruction( | ... | @@ -1700,7 +1700,7 @@ fn walkInstruction( |
| 1700 | 1700 | ||
| 1701 | var host_size: ?DocData.Expr = null; | 1701 | var host_size: ?DocData.Expr = null; |
| 1702 | if (ptr.flags.has_bit_range) { | 1702 | if (ptr.flags.has_bit_range) { |
| 1703 | const ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 1703 | const ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 1704 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); | 1704 | const ref_result = try self.walkRef(file, parent_scope, parent_src, ref, false); |
| 1705 | host_size = ref_result.expr; | 1705 | host_size = ref_result.expr; |
| 1706 | } | 1706 | } |
| ... | @@ -1724,7 +1724,7 @@ fn walkInstruction( | ... | @@ -1724,7 +1724,7 @@ fn walkInstruction( |
| 1724 | }, | 1724 | }, |
| 1725 | }); | 1725 | }); |
| 1726 | return DocData.WalkResult{ | 1726 | return DocData.WalkResult{ |
| 1727 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1727 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1728 | .expr = .{ .type = type_slot_index }, | 1728 | .expr = .{ .type = type_slot_index }, |
| 1729 | }; | 1729 | }; |
| 1730 | }, | 1730 | }, |
| ... | @@ -1744,7 +1744,7 @@ fn walkInstruction( | ... | @@ -1744,7 +1744,7 @@ fn walkInstruction( |
| 1744 | }); | 1744 | }); |
| 1745 | 1745 | ||
| 1746 | return DocData.WalkResult{ | 1746 | return DocData.WalkResult{ |
| 1747 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1747 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1748 | .expr = .{ .type = type_slot_index }, | 1748 | .expr = .{ .type = type_slot_index }, |
| 1749 | }; | 1749 | }; |
| 1750 | }, | 1750 | }, |
| ... | @@ -1764,7 +1764,7 @@ fn walkInstruction( | ... | @@ -1764,7 +1764,7 @@ fn walkInstruction( |
| 1764 | }, | 1764 | }, |
| 1765 | }); | 1765 | }); |
| 1766 | return DocData.WalkResult{ | 1766 | return DocData.WalkResult{ |
| 1767 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1767 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1768 | .expr = .{ .type = type_slot_index }, | 1768 | .expr = .{ .type = type_slot_index }, |
| 1769 | }; | 1769 | }; |
| 1770 | }, | 1770 | }, |
| ... | @@ -1863,7 +1863,7 @@ fn walkInstruction( | ... | @@ -1863,7 +1863,7 @@ fn walkInstruction( |
| 1863 | .float => { | 1863 | .float => { |
| 1864 | const float = data[inst_index].float; | 1864 | const float = data[inst_index].float; |
| 1865 | return DocData.WalkResult{ | 1865 | return DocData.WalkResult{ |
| 1866 | .typeRef = .{ .type = @enumToInt(Ref.comptime_float_type) }, | 1866 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_float_type) }, |
| 1867 | .expr = .{ .float = float }, | 1867 | .expr = .{ .float = float }, |
| 1868 | }; | 1868 | }; |
| 1869 | }, | 1869 | }, |
| ... | @@ -1872,7 +1872,7 @@ fn walkInstruction( | ... | @@ -1872,7 +1872,7 @@ fn walkInstruction( |
| 1872 | const pl_node = data[inst_index].pl_node; | 1872 | const pl_node = data[inst_index].pl_node; |
| 1873 | const extra = file.zir.extraData(Zir.Inst.Float128, pl_node.payload_index); | 1873 | const extra = file.zir.extraData(Zir.Inst.Float128, pl_node.payload_index); |
| 1874 | return DocData.WalkResult{ | 1874 | return DocData.WalkResult{ |
| 1875 | .typeRef = .{ .type = @enumToInt(Ref.comptime_float_type) }, | 1875 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_float_type) }, |
| 1876 | .expr = .{ .float128 = extra.data.get() }, | 1876 | .expr = .{ .float128 = extra.data.get() }, |
| 1877 | }; | 1877 | }; |
| 1878 | }, | 1878 | }, |
| ... | @@ -1913,7 +1913,7 @@ fn walkInstruction( | ... | @@ -1913,7 +1913,7 @@ fn walkInstruction( |
| 1913 | const operand_index = self.exprs.items.len; | 1913 | const operand_index = self.exprs.items.len; |
| 1914 | try self.exprs.append(self.arena, operand.expr); | 1914 | try self.exprs.append(self.arena, operand.expr); |
| 1915 | return DocData.WalkResult{ | 1915 | return DocData.WalkResult{ |
| 1916 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 1916 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 1917 | .expr = .{ .sizeOf = operand_index }, | 1917 | .expr = .{ .sizeOf = operand_index }, |
| 1918 | }; | 1918 | }; |
| 1919 | }, | 1919 | }, |
| ... | @@ -1950,8 +1950,8 @@ fn walkInstruction( | ... | @@ -1950,8 +1950,8 @@ fn walkInstruction( |
| 1950 | try self.exprs.append(self.arena, operand.expr); | 1950 | try self.exprs.append(self.arena, operand.expr); |
| 1951 | 1951 | ||
| 1952 | return DocData.WalkResult{ | 1952 | return DocData.WalkResult{ |
| 1953 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 1953 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 1954 | .expr = .{ .enumToInt = operand_index }, | 1954 | .expr = .{ .intFromEnum = operand_index }, |
| 1955 | }; | 1955 | }; |
| 1956 | }, | 1956 | }, |
| 1957 | .switch_block => { | 1957 | .switch_block => { |
| ... | @@ -1992,7 +1992,7 @@ fn walkInstruction( | ... | @@ -1992,7 +1992,7 @@ fn walkInstruction( |
| 1992 | // } }); | 1992 | // } }); |
| 1993 | 1993 | ||
| 1994 | return DocData.WalkResult{ | 1994 | return DocData.WalkResult{ |
| 1995 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 1995 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 1996 | .expr = .{ .switchIndex = switch_index }, | 1996 | .expr = .{ .switchIndex = switch_index }, |
| 1997 | }; | 1997 | }; |
| 1998 | }, | 1998 | }, |
| ... | @@ -2109,7 +2109,7 @@ fn walkInstruction( | ... | @@ -2109,7 +2109,7 @@ fn walkInstruction( |
| 2109 | }); | 2109 | }); |
| 2110 | 2110 | ||
| 2111 | return DocData.WalkResult{ | 2111 | return DocData.WalkResult{ |
| 2112 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2112 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2113 | .expr = .{ .type = operand_idx }, | 2113 | .expr = .{ .type = operand_idx }, |
| 2114 | }; | 2114 | }; |
| 2115 | }, | 2115 | }, |
| ... | @@ -2210,13 +2210,13 @@ fn walkInstruction( | ... | @@ -2210,13 +2210,13 @@ fn walkInstruction( |
| 2210 | }); | 2210 | }); |
| 2211 | 2211 | ||
| 2212 | return DocData.WalkResult{ | 2212 | return DocData.WalkResult{ |
| 2213 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2213 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2214 | .expr = .{ .type = self.types.items.len - 1 }, | 2214 | .expr = .{ .type = self.types.items.len - 1 }, |
| 2215 | }; | 2215 | }; |
| 2216 | }, | 2216 | }, |
| 2217 | .block => { | 2217 | .block => { |
| 2218 | const res = DocData.WalkResult{ | 2218 | const res = DocData.WalkResult{ |
| 2219 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2219 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2220 | .expr = .{ .comptimeExpr = self.comptime_exprs.items.len }, | 2220 | .expr = .{ .comptimeExpr = self.comptime_exprs.items.len }, |
| 2221 | }; | 2221 | }; |
| 2222 | const pl_node = data[inst_index].pl_node; | 2222 | const pl_node = data[inst_index].pl_node; |
| ... | @@ -2233,7 +2233,7 @@ fn walkInstruction( | ... | @@ -2233,7 +2233,7 @@ fn walkInstruction( |
| 2233 | parent_src, | 2233 | parent_src, |
| 2234 | getBlockInlineBreak(file.zir, inst_index) orelse { | 2234 | getBlockInlineBreak(file.zir, inst_index) orelse { |
| 2235 | const res = DocData.WalkResult{ | 2235 | const res = DocData.WalkResult{ |
| 2236 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2236 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2237 | .expr = .{ .comptimeExpr = self.comptime_exprs.items.len }, | 2237 | .expr = .{ .comptimeExpr = self.comptime_exprs.items.len }, |
| 2238 | }; | 2238 | }; |
| 2239 | const pl_node = data[inst_index].pl_node; | 2239 | const pl_node = data[inst_index].pl_node; |
| ... | @@ -2376,7 +2376,7 @@ fn walkInstruction( | ... | @@ -2376,7 +2376,7 @@ fn walkInstruction( |
| 2376 | }); | 2376 | }); |
| 2377 | 2377 | ||
| 2378 | return DocData.WalkResult{ | 2378 | return DocData.WalkResult{ |
| 2379 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2379 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2380 | .expr = .{ .type = type_slot_index }, | 2380 | .expr = .{ .type = type_slot_index }, |
| 2381 | }; | 2381 | }; |
| 2382 | }, | 2382 | }, |
| ... | @@ -2600,7 +2600,7 @@ fn walkInstruction( | ... | @@ -2600,7 +2600,7 @@ fn walkInstruction( |
| 2600 | // anyway, but maybe we should put it elsewhere. | 2600 | // anyway, but maybe we should put it elsewhere. |
| 2601 | } | 2601 | } |
| 2602 | return DocData.WalkResult{ | 2602 | return DocData.WalkResult{ |
| 2603 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2603 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2604 | .expr = .{ .type = type_slot_index }, | 2604 | .expr = .{ .type = type_slot_index }, |
| 2605 | }; | 2605 | }; |
| 2606 | }, | 2606 | }, |
| ... | @@ -2620,7 +2620,7 @@ fn walkInstruction( | ... | @@ -2620,7 +2620,7 @@ fn walkInstruction( |
| 2620 | }; | 2620 | }; |
| 2621 | 2621 | ||
| 2622 | if (small.has_init) { | 2622 | if (small.has_init) { |
| 2623 | const var_init_ref = @intToEnum(Ref, file.zir.extra[extra_index]); | 2623 | const var_init_ref = @enumFromInt(Ref, file.zir.extra[extra_index]); |
| 2624 | const var_init = try self.walkRef(file, parent_scope, parent_src, var_init_ref, need_type); | 2624 | const var_init = try self.walkRef(file, parent_scope, parent_src, var_init_ref, need_type); |
| 2625 | value.expr = var_init.expr; | 2625 | value.expr = var_init.expr; |
| 2626 | value.typeRef = var_init.typeRef; | 2626 | value.typeRef = var_init.typeRef; |
| ... | @@ -2656,7 +2656,7 @@ fn walkInstruction( | ... | @@ -2656,7 +2656,7 @@ fn walkInstruction( |
| 2656 | const tag_type_ref: ?Ref = if (small.has_tag_type) blk: { | 2656 | const tag_type_ref: ?Ref = if (small.has_tag_type) blk: { |
| 2657 | const tag_type = file.zir.extra[extra_index]; | 2657 | const tag_type = file.zir.extra[extra_index]; |
| 2658 | extra_index += 1; | 2658 | extra_index += 1; |
| 2659 | const tag_ref = @intToEnum(Ref, tag_type); | 2659 | const tag_ref = @enumFromInt(Ref, tag_type); |
| 2660 | break :blk tag_ref; | 2660 | break :blk tag_ref; |
| 2661 | } else null; | 2661 | } else null; |
| 2662 | 2662 | ||
| ... | @@ -2751,7 +2751,7 @@ fn walkInstruction( | ... | @@ -2751,7 +2751,7 @@ fn walkInstruction( |
| 2751 | } | 2751 | } |
| 2752 | 2752 | ||
| 2753 | return DocData.WalkResult{ | 2753 | return DocData.WalkResult{ |
| 2754 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2754 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2755 | .expr = .{ .type = type_slot_index }, | 2755 | .expr = .{ .type = type_slot_index }, |
| 2756 | }; | 2756 | }; |
| 2757 | }, | 2757 | }, |
| ... | @@ -2781,7 +2781,7 @@ fn walkInstruction( | ... | @@ -2781,7 +2781,7 @@ fn walkInstruction( |
| 2781 | const tag_type: ?DocData.Expr = if (small.has_tag_type) blk: { | 2781 | const tag_type: ?DocData.Expr = if (small.has_tag_type) blk: { |
| 2782 | const tag_type = file.zir.extra[extra_index]; | 2782 | const tag_type = file.zir.extra[extra_index]; |
| 2783 | extra_index += 1; | 2783 | extra_index += 1; |
| 2784 | const tag_ref = @intToEnum(Ref, tag_type); | 2784 | const tag_ref = @enumFromInt(Ref, tag_type); |
| 2785 | const wr = try self.walkRef(file, parent_scope, parent_src, tag_ref, false); | 2785 | const wr = try self.walkRef(file, parent_scope, parent_src, tag_ref, false); |
| 2786 | break :blk wr.expr; | 2786 | break :blk wr.expr; |
| 2787 | } else null; | 2787 | } else null; |
| ... | @@ -2839,7 +2839,7 @@ fn walkInstruction( | ... | @@ -2839,7 +2839,7 @@ fn walkInstruction( |
| 2839 | const value_expr: ?DocData.Expr = if (has_value) blk: { | 2839 | const value_expr: ?DocData.Expr = if (has_value) blk: { |
| 2840 | const value_ref = file.zir.extra[extra_index]; | 2840 | const value_ref = file.zir.extra[extra_index]; |
| 2841 | extra_index += 1; | 2841 | extra_index += 1; |
| 2842 | const value = try self.walkRef(file, &scope, src_info, @intToEnum(Ref, value_ref), false); | 2842 | const value = try self.walkRef(file, &scope, src_info, @enumFromInt(Ref, value_ref), false); |
| 2843 | break :blk value.expr; | 2843 | break :blk value.expr; |
| 2844 | } else null; | 2844 | } else null; |
| 2845 | try field_values.append(self.arena, value_expr); | 2845 | try field_values.append(self.arena, value_expr); |
| ... | @@ -2887,7 +2887,7 @@ fn walkInstruction( | ... | @@ -2887,7 +2887,7 @@ fn walkInstruction( |
| 2887 | // anyway, but maybe we should put it elsewhere. | 2887 | // anyway, but maybe we should put it elsewhere. |
| 2888 | } | 2888 | } |
| 2889 | return DocData.WalkResult{ | 2889 | return DocData.WalkResult{ |
| 2890 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 2890 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 2891 | .expr = .{ .type = type_slot_index }, | 2891 | .expr = .{ .type = type_slot_index }, |
| 2892 | }; | 2892 | }; |
| 2893 | }, | 2893 | }, |
| ... | @@ -2928,7 +2928,7 @@ fn walkInstruction( | ... | @@ -2928,7 +2928,7 @@ fn walkInstruction( |
| 2928 | const backing_int_body_len = file.zir.extra[extra_index]; | 2928 | const backing_int_body_len = file.zir.extra[extra_index]; |
| 2929 | extra_index += 1; // backing_int_body_len | 2929 | extra_index += 1; // backing_int_body_len |
| 2930 | if (backing_int_body_len == 0) { | 2930 | if (backing_int_body_len == 0) { |
| 2931 | const backing_int_ref = @intToEnum(Ref, file.zir.extra[extra_index]); | 2931 | const backing_int_ref = @enumFromInt(Ref, file.zir.extra[extra_index]); |
| 2932 | const backing_int_res = try self.walkRef(file, &scope, src_info, backing_int_ref, true); | 2932 | const backing_int_res = try self.walkRef(file, &scope, src_info, backing_int_ref, true); |
| 2933 | backing_int = backing_int_res.expr; | 2933 | backing_int = backing_int_res.expr; |
| 2934 | extra_index += 1; // backing_int_ref | 2934 | extra_index += 1; // backing_int_ref |
| ... | @@ -3006,13 +3006,13 @@ fn walkInstruction( | ... | @@ -3006,13 +3006,13 @@ fn walkInstruction( |
| 3006 | // anyway, but maybe we should put it elsewhere. | 3006 | // anyway, but maybe we should put it elsewhere. |
| 3007 | } | 3007 | } |
| 3008 | return DocData.WalkResult{ | 3008 | return DocData.WalkResult{ |
| 3009 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 3009 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 3010 | .expr = .{ .type = type_slot_index }, | 3010 | .expr = .{ .type = type_slot_index }, |
| 3011 | }; | 3011 | }; |
| 3012 | }, | 3012 | }, |
| 3013 | .this => { | 3013 | .this => { |
| 3014 | return DocData.WalkResult{ | 3014 | return DocData.WalkResult{ |
| 3015 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 3015 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 3016 | .expr = .{ | 3016 | .expr = .{ |
| 3017 | .this = parent_scope.enclosing_type.?, | 3017 | .this = parent_scope.enclosing_type.?, |
| 3018 | // We know enclosing_type is always present | 3018 | // We know enclosing_type is always present |
| ... | @@ -3038,7 +3038,7 @@ fn walkInstruction( | ... | @@ -3038,7 +3038,7 @@ fn walkInstruction( |
| 3038 | self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(extended.opcode), .param = param_index } }; | 3038 | self.exprs.items[bin_index] = .{ .builtin = .{ .name = @tagName(extended.opcode), .param = param_index } }; |
| 3039 | 3039 | ||
| 3040 | return DocData.WalkResult{ | 3040 | return DocData.WalkResult{ |
| 3041 | .typeRef = param.typeRef orelse .{ .type = @enumToInt(Ref.type_type) }, | 3041 | .typeRef = param.typeRef orelse .{ .type = @intFromEnum(Ref.type_type) }, |
| 3042 | .expr = .{ .builtinIndex = bin_index }, | 3042 | .expr = .{ .builtinIndex = bin_index }, |
| 3043 | }; | 3043 | }; |
| 3044 | }, | 3044 | }, |
| ... | @@ -3058,7 +3058,7 @@ fn walkInstruction( | ... | @@ -3058,7 +3058,7 @@ fn walkInstruction( |
| 3058 | 3058 | ||
| 3059 | return DocData.WalkResult{ | 3059 | return DocData.WalkResult{ |
| 3060 | // from docs we know they return u32 | 3060 | // from docs we know they return u32 |
| 3061 | .typeRef = .{ .type = @enumToInt(Ref.u32_type) }, | 3061 | .typeRef = .{ .type = @intFromEnum(Ref.u32_type) }, |
| 3062 | .expr = .{ .builtinIndex = bin_index }, | 3062 | .expr = .{ .builtinIndex = bin_index }, |
| 3063 | }; | 3063 | }; |
| 3064 | }, | 3064 | }, |
| ... | @@ -3131,7 +3131,7 @@ fn walkInstruction( | ... | @@ -3131,7 +3131,7 @@ fn walkInstruction( |
| 3131 | .failure_order = failure_order_index, | 3131 | .failure_order = failure_order_index, |
| 3132 | } }); | 3132 | } }); |
| 3133 | return DocData.WalkResult{ | 3133 | return DocData.WalkResult{ |
| 3134 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 3134 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 3135 | .expr = .{ .cmpxchgIndex = cmpxchg_index }, | 3135 | .expr = .{ .cmpxchgIndex = cmpxchg_index }, |
| 3136 | }; | 3136 | }; |
| 3137 | }, | 3137 | }, |
| ... | @@ -3280,21 +3280,21 @@ fn analyzeDecl( | ... | @@ -3280,21 +3280,21 @@ fn analyzeDecl( |
| 3280 | 3280 | ||
| 3281 | extra_index += 1; | 3281 | extra_index += 1; |
| 3282 | const align_inst: Zir.Inst.Ref = if (!has_align) .none else inst: { | 3282 | const align_inst: Zir.Inst.Ref = if (!has_align) .none else inst: { |
| 3283 | const inst = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 3283 | const inst = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3284 | extra_index += 1; | 3284 | extra_index += 1; |
| 3285 | break :inst inst; | 3285 | break :inst inst; |
| 3286 | }; | 3286 | }; |
| 3287 | _ = align_inst; | 3287 | _ = align_inst; |
| 3288 | 3288 | ||
| 3289 | const section_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { | 3289 | const section_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { |
| 3290 | const inst = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 3290 | const inst = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3291 | extra_index += 1; | 3291 | extra_index += 1; |
| 3292 | break :inst inst; | 3292 | break :inst inst; |
| 3293 | }; | 3293 | }; |
| 3294 | _ = section_inst; | 3294 | _ = section_inst; |
| 3295 | 3295 | ||
| 3296 | const addrspace_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { | 3296 | const addrspace_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { |
| 3297 | const inst = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 3297 | const inst = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 3298 | extra_index += 1; | 3298 | extra_index += 1; |
| 3299 | break :inst inst; | 3299 | break :inst inst; |
| 3300 | }; | 3300 | }; |
| ... | @@ -4111,7 +4111,7 @@ fn analyzeFancyFunction( | ... | @@ -4111,7 +4111,7 @@ fn analyzeFancyFunction( |
| 4111 | 4111 | ||
| 4112 | var align_index: ?usize = null; | 4112 | var align_index: ?usize = null; |
| 4113 | if (extra.data.bits.has_align_ref) { | 4113 | if (extra.data.bits.has_align_ref) { |
| 4114 | const align_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 4114 | const align_ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 4115 | align_index = self.exprs.items.len; | 4115 | align_index = self.exprs.items.len; |
| 4116 | _ = try self.walkRef(file, scope, parent_src, align_ref, false); | 4116 | _ = try self.walkRef(file, scope, parent_src, align_ref, false); |
| 4117 | extra_index += 1; | 4117 | extra_index += 1; |
| ... | @@ -4128,7 +4128,7 @@ fn analyzeFancyFunction( | ... | @@ -4128,7 +4128,7 @@ fn analyzeFancyFunction( |
| 4128 | 4128 | ||
| 4129 | var addrspace_index: ?usize = null; | 4129 | var addrspace_index: ?usize = null; |
| 4130 | if (extra.data.bits.has_addrspace_ref) { | 4130 | if (extra.data.bits.has_addrspace_ref) { |
| 4131 | const addrspace_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 4131 | const addrspace_ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 4132 | addrspace_index = self.exprs.items.len; | 4132 | addrspace_index = self.exprs.items.len; |
| 4133 | _ = try self.walkRef(file, scope, parent_src, addrspace_ref, false); | 4133 | _ = try self.walkRef(file, scope, parent_src, addrspace_ref, false); |
| 4134 | extra_index += 1; | 4134 | extra_index += 1; |
| ... | @@ -4145,7 +4145,7 @@ fn analyzeFancyFunction( | ... | @@ -4145,7 +4145,7 @@ fn analyzeFancyFunction( |
| 4145 | 4145 | ||
| 4146 | var section_index: ?usize = null; | 4146 | var section_index: ?usize = null; |
| 4147 | if (extra.data.bits.has_section_ref) { | 4147 | if (extra.data.bits.has_section_ref) { |
| 4148 | const section_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 4148 | const section_ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 4149 | section_index = self.exprs.items.len; | 4149 | section_index = self.exprs.items.len; |
| 4150 | _ = try self.walkRef(file, scope, parent_src, section_ref, false); | 4150 | _ = try self.walkRef(file, scope, parent_src, section_ref, false); |
| 4151 | extra_index += 1; | 4151 | extra_index += 1; |
| ... | @@ -4162,7 +4162,7 @@ fn analyzeFancyFunction( | ... | @@ -4162,7 +4162,7 @@ fn analyzeFancyFunction( |
| 4162 | 4162 | ||
| 4163 | var cc_index: ?usize = null; | 4163 | var cc_index: ?usize = null; |
| 4164 | if (extra.data.bits.has_cc_ref and !extra.data.bits.has_cc_body) { | 4164 | if (extra.data.bits.has_cc_ref and !extra.data.bits.has_cc_body) { |
| 4165 | const cc_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 4165 | const cc_ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 4166 | const cc_expr = try self.walkRef(file, scope, parent_src, cc_ref, false); | 4166 | const cc_expr = try self.walkRef(file, scope, parent_src, cc_ref, false); |
| 4167 | 4167 | ||
| 4168 | cc_index = self.exprs.items.len; | 4168 | cc_index = self.exprs.items.len; |
| ... | @@ -4211,7 +4211,7 @@ fn analyzeFancyFunction( | ... | @@ -4211,7 +4211,7 @@ fn analyzeFancyFunction( |
| 4211 | const generic_ret: ?DocData.Expr = switch (ret_type_ref) { | 4211 | const generic_ret: ?DocData.Expr = switch (ret_type_ref) { |
| 4212 | .type => |t| blk: { | 4212 | .type => |t| blk: { |
| 4213 | if (fn_info.body.len == 0) break :blk null; | 4213 | if (fn_info.body.len == 0) break :blk null; |
| 4214 | if (t == @enumToInt(Ref.type_type)) { | 4214 | if (t == @intFromEnum(Ref.type_type)) { |
| 4215 | break :blk try self.getGenericReturnType( | 4215 | break :blk try self.getGenericReturnType( |
| 4216 | file, | 4216 | file, |
| 4217 | scope, | 4217 | scope, |
| ... | @@ -4249,7 +4249,7 @@ fn analyzeFancyFunction( | ... | @@ -4249,7 +4249,7 @@ fn analyzeFancyFunction( |
| 4249 | }; | 4249 | }; |
| 4250 | 4250 | ||
| 4251 | return DocData.WalkResult{ | 4251 | return DocData.WalkResult{ |
| 4252 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 4252 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 4253 | .expr = .{ .type = type_slot_index }, | 4253 | .expr = .{ .type = type_slot_index }, |
| 4254 | }; | 4254 | }; |
| 4255 | } | 4255 | } |
| ... | @@ -4354,7 +4354,7 @@ fn analyzeFunction( | ... | @@ -4354,7 +4354,7 @@ fn analyzeFunction( |
| 4354 | const generic_ret: ?DocData.Expr = switch (ret_type_ref) { | 4354 | const generic_ret: ?DocData.Expr = switch (ret_type_ref) { |
| 4355 | .type => |t| blk: { | 4355 | .type => |t| blk: { |
| 4356 | if (fn_info.body.len == 0) break :blk null; | 4356 | if (fn_info.body.len == 0) break :blk null; |
| 4357 | if (t == @enumToInt(Ref.type_type)) { | 4357 | if (t == @intFromEnum(Ref.type_type)) { |
| 4358 | break :blk try self.getGenericReturnType( | 4358 | break :blk try self.getGenericReturnType( |
| 4359 | file, | 4359 | file, |
| 4360 | scope, | 4360 | scope, |
| ... | @@ -4395,7 +4395,7 @@ fn analyzeFunction( | ... | @@ -4395,7 +4395,7 @@ fn analyzeFunction( |
| 4395 | }; | 4395 | }; |
| 4396 | 4396 | ||
| 4397 | return DocData.WalkResult{ | 4397 | return DocData.WalkResult{ |
| 4398 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 4398 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 4399 | .expr = .{ .type = type_slot_index }, | 4399 | .expr = .{ .type = type_slot_index }, |
| 4400 | }; | 4400 | }; |
| 4401 | } | 4401 | } |
| ... | @@ -4467,7 +4467,7 @@ fn collectUnionFieldInfo( | ... | @@ -4467,7 +4467,7 @@ fn collectUnionFieldInfo( |
| 4467 | const doc_comment_index = file.zir.extra[extra_index]; | 4467 | const doc_comment_index = file.zir.extra[extra_index]; |
| 4468 | extra_index += 1; | 4468 | extra_index += 1; |
| 4469 | const field_type = if (has_type) | 4469 | const field_type = if (has_type) |
| 4470 | @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]) | 4470 | @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]) |
| 4471 | else | 4471 | else |
| 4472 | .void_type; | 4472 | .void_type; |
| 4473 | if (has_type) extra_index += 1; | 4473 | if (has_type) extra_index += 1; |
| ... | @@ -4561,7 +4561,7 @@ fn collectStructFieldInfo( | ... | @@ -4561,7 +4561,7 @@ fn collectStructFieldInfo( |
| 4561 | if (has_type_body) { | 4561 | if (has_type_body) { |
| 4562 | fields[field_i].type_body_len = file.zir.extra[extra_index]; | 4562 | fields[field_i].type_body_len = file.zir.extra[extra_index]; |
| 4563 | } else { | 4563 | } else { |
| 4564 | fields[field_i].type_ref = @intToEnum(Zir.Inst.Ref, file.zir.extra[extra_index]); | 4564 | fields[field_i].type_ref = @enumFromInt(Zir.Inst.Ref, file.zir.extra[extra_index]); |
| 4565 | } | 4565 | } |
| 4566 | extra_index += 1; | 4566 | extra_index += 1; |
| 4567 | 4567 | ||
| ... | @@ -4651,13 +4651,13 @@ fn walkRef( | ... | @@ -4651,13 +4651,13 @@ fn walkRef( |
| 4651 | ) AutodocErrors!DocData.WalkResult { | 4651 | ) AutodocErrors!DocData.WalkResult { |
| 4652 | if (ref == .none) { | 4652 | if (ref == .none) { |
| 4653 | return .{ .expr = .{ .comptimeExpr = 0 } }; | 4653 | return .{ .expr = .{ .comptimeExpr = 0 } }; |
| 4654 | } else if (@enumToInt(ref) <= @enumToInt(InternPool.Index.last_type)) { | 4654 | } else if (@intFromEnum(ref) <= @intFromEnum(InternPool.Index.last_type)) { |
| 4655 | // We can just return a type that indexes into `types` with the | 4655 | // We can just return a type that indexes into `types` with the |
| 4656 | // enum value because in the beginning we pre-filled `types` with | 4656 | // enum value because in the beginning we pre-filled `types` with |
| 4657 | // the types that are listed in `Ref`. | 4657 | // the types that are listed in `Ref`. |
| 4658 | return DocData.WalkResult{ | 4658 | return DocData.WalkResult{ |
| 4659 | .typeRef = .{ .type = @enumToInt(std.builtin.TypeId.Type) }, | 4659 | .typeRef = .{ .type = @intFromEnum(std.builtin.TypeId.Type) }, |
| 4660 | .expr = .{ .type = @enumToInt(ref) }, | 4660 | .expr = .{ .type = @intFromEnum(ref) }, |
| 4661 | }; | 4661 | }; |
| 4662 | } else if (Zir.refToIndex(ref)) |zir_index| { | 4662 | } else if (Zir.refToIndex(ref)) |zir_index| { |
| 4663 | return self.walkInstruction(file, parent_scope, parent_src, zir_index, need_type); | 4663 | return self.walkInstruction(file, parent_scope, parent_src, zir_index, need_type); |
| ... | @@ -4676,26 +4676,26 @@ fn walkRef( | ... | @@ -4676,26 +4676,26 @@ fn walkRef( |
| 4676 | }, | 4676 | }, |
| 4677 | .zero => { | 4677 | .zero => { |
| 4678 | return DocData.WalkResult{ | 4678 | return DocData.WalkResult{ |
| 4679 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 4679 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 4680 | .expr = .{ .int = .{ .value = 0 } }, | 4680 | .expr = .{ .int = .{ .value = 0 } }, |
| 4681 | }; | 4681 | }; |
| 4682 | }, | 4682 | }, |
| 4683 | .one => { | 4683 | .one => { |
| 4684 | return DocData.WalkResult{ | 4684 | return DocData.WalkResult{ |
| 4685 | .typeRef = .{ .type = @enumToInt(Ref.comptime_int_type) }, | 4685 | .typeRef = .{ .type = @intFromEnum(Ref.comptime_int_type) }, |
| 4686 | .expr = .{ .int = .{ .value = 1 } }, | 4686 | .expr = .{ .int = .{ .value = 1 } }, |
| 4687 | }; | 4687 | }; |
| 4688 | }, | 4688 | }, |
| 4689 | 4689 | ||
| 4690 | .void_value => { | 4690 | .void_value => { |
| 4691 | return DocData.WalkResult{ | 4691 | return DocData.WalkResult{ |
| 4692 | .typeRef = .{ .type = @enumToInt(Ref.void_type) }, | 4692 | .typeRef = .{ .type = @intFromEnum(Ref.void_type) }, |
| 4693 | .expr = .{ .void = .{} }, | 4693 | .expr = .{ .void = .{} }, |
| 4694 | }; | 4694 | }; |
| 4695 | }, | 4695 | }, |
| 4696 | .unreachable_value => { | 4696 | .unreachable_value => { |
| 4697 | return DocData.WalkResult{ | 4697 | return DocData.WalkResult{ |
| 4698 | .typeRef = .{ .type = @enumToInt(Ref.noreturn_type) }, | 4698 | .typeRef = .{ .type = @intFromEnum(Ref.noreturn_type) }, |
| 4699 | .expr = .{ .@"unreachable" = .{} }, | 4699 | .expr = .{ .@"unreachable" = .{} }, |
| 4700 | }; | 4700 | }; |
| 4701 | }, | 4701 | }, |
| ... | @@ -4704,13 +4704,13 @@ fn walkRef( | ... | @@ -4704,13 +4704,13 @@ fn walkRef( |
| 4704 | }, | 4704 | }, |
| 4705 | .bool_true => { | 4705 | .bool_true => { |
| 4706 | return DocData.WalkResult{ | 4706 | return DocData.WalkResult{ |
| 4707 | .typeRef = .{ .type = @enumToInt(Ref.bool_type) }, | 4707 | .typeRef = .{ .type = @intFromEnum(Ref.bool_type) }, |
| 4708 | .expr = .{ .bool = true }, | 4708 | .expr = .{ .bool = true }, |
| 4709 | }; | 4709 | }; |
| 4710 | }, | 4710 | }, |
| 4711 | .bool_false => { | 4711 | .bool_false => { |
| 4712 | return DocData.WalkResult{ | 4712 | return DocData.WalkResult{ |
| 4713 | .typeRef = .{ .type = @enumToInt(Ref.bool_type) }, | 4713 | .typeRef = .{ .type = @intFromEnum(Ref.bool_type) }, |
| 4714 | .expr = .{ .bool = false }, | 4714 | .expr = .{ .bool = false }, |
| 4715 | }; | 4715 | }; |
| 4716 | }, | 4716 | }, |
| ... | @@ -4719,37 +4719,37 @@ fn walkRef( | ... | @@ -4719,37 +4719,37 @@ fn walkRef( |
| 4719 | }, | 4719 | }, |
| 4720 | .zero_usize => { | 4720 | .zero_usize => { |
| 4721 | return DocData.WalkResult{ | 4721 | return DocData.WalkResult{ |
| 4722 | .typeRef = .{ .type = @enumToInt(Ref.usize_type) }, | 4722 | .typeRef = .{ .type = @intFromEnum(Ref.usize_type) }, |
| 4723 | .expr = .{ .int = .{ .value = 0 } }, | 4723 | .expr = .{ .int = .{ .value = 0 } }, |
| 4724 | }; | 4724 | }; |
| 4725 | }, | 4725 | }, |
| 4726 | .one_usize => { | 4726 | .one_usize => { |
| 4727 | return DocData.WalkResult{ | 4727 | return DocData.WalkResult{ |
| 4728 | .typeRef = .{ .type = @enumToInt(Ref.usize_type) }, | 4728 | .typeRef = .{ .type = @intFromEnum(Ref.usize_type) }, |
| 4729 | .expr = .{ .int = .{ .value = 1 } }, | 4729 | .expr = .{ .int = .{ .value = 1 } }, |
| 4730 | }; | 4730 | }; |
| 4731 | }, | 4731 | }, |
| 4732 | .calling_convention_type => { | 4732 | .calling_convention_type => { |
| 4733 | return DocData.WalkResult{ | 4733 | return DocData.WalkResult{ |
| 4734 | .typeRef = .{ .type = @enumToInt(Ref.type_type) }, | 4734 | .typeRef = .{ .type = @intFromEnum(Ref.type_type) }, |
| 4735 | .expr = .{ .type = @enumToInt(Ref.calling_convention_type) }, | 4735 | .expr = .{ .type = @intFromEnum(Ref.calling_convention_type) }, |
| 4736 | }; | 4736 | }; |
| 4737 | }, | 4737 | }, |
| 4738 | .calling_convention_c => { | 4738 | .calling_convention_c => { |
| 4739 | return DocData.WalkResult{ | 4739 | return DocData.WalkResult{ |
| 4740 | .typeRef = .{ .type = @enumToInt(Ref.calling_convention_type) }, | 4740 | .typeRef = .{ .type = @intFromEnum(Ref.calling_convention_type) }, |
| 4741 | .expr = .{ .enumLiteral = "C" }, | 4741 | .expr = .{ .enumLiteral = "C" }, |
| 4742 | }; | 4742 | }; |
| 4743 | }, | 4743 | }, |
| 4744 | .calling_convention_inline => { | 4744 | .calling_convention_inline => { |
| 4745 | return DocData.WalkResult{ | 4745 | return DocData.WalkResult{ |
| 4746 | .typeRef = .{ .type = @enumToInt(Ref.calling_convention_type) }, | 4746 | .typeRef = .{ .type = @intFromEnum(Ref.calling_convention_type) }, |
| 4747 | .expr = .{ .enumLiteral = "Inline" }, | 4747 | .expr = .{ .enumLiteral = "Inline" }, |
| 4748 | }; | 4748 | }; |
| 4749 | }, | 4749 | }, |
| 4750 | // .generic_poison => { | 4750 | // .generic_poison => { |
| 4751 | // return DocData.WalkResult{ .int = .{ | 4751 | // return DocData.WalkResult{ .int = .{ |
| 4752 | // .type = @enumToInt(Ref.comptime_int_type), | 4752 | // .type = @intFromEnum(Ref.comptime_int_type), |
| 4753 | // .value = 1, | 4753 | // .value = 1, |
| 4754 | // } }; | 4754 | // } }; |
| 4755 | // }, | 4755 | // }, |
src/Compilation.zig+16-16| ... | @@ -1050,7 +1050,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { | ... | @@ -1050,7 +1050,7 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 1050 | const is_enabled = options.target.cpu.features.isEnabled(index); | 1050 | const is_enabled = options.target.cpu.features.isEnabled(index); |
| 1051 | 1051 | ||
| 1052 | if (feature.llvm_name) |llvm_name| { | 1052 | if (feature.llvm_name) |llvm_name| { |
| 1053 | const plus_or_minus = "-+"[@boolToInt(is_enabled)]; | 1053 | const plus_or_minus = "-+"[@intFromBool(is_enabled)]; |
| 1054 | try buf.ensureUnusedCapacity(2 + llvm_name.len); | 1054 | try buf.ensureUnusedCapacity(2 + llvm_name.len); |
| 1055 | buf.appendAssumeCapacity(plus_or_minus); | 1055 | buf.appendAssumeCapacity(plus_or_minus); |
| 1056 | buf.appendSliceAssumeCapacity(llvm_name); | 1056 | buf.appendSliceAssumeCapacity(llvm_name); |
| ... | @@ -2506,7 +2506,7 @@ pub fn makeBinFileWritable(self: *Compilation) !void { | ... | @@ -2506,7 +2506,7 @@ pub fn makeBinFileWritable(self: *Compilation) !void { |
| 2506 | /// This function is temporally single-threaded. | 2506 | /// This function is temporally single-threaded. |
| 2507 | pub fn totalErrorCount(self: *Compilation) u32 { | 2507 | pub fn totalErrorCount(self: *Compilation) u32 { |
| 2508 | var total: usize = self.failed_c_objects.count() + self.misc_failures.count() + | 2508 | var total: usize = self.failed_c_objects.count() + self.misc_failures.count() + |
| 2509 | @boolToInt(self.alloc_failure_occurred) + self.lld_errors.items.len; | 2509 | @intFromBool(self.alloc_failure_occurred) + self.lld_errors.items.len; |
| 2510 | 2510 | ||
| 2511 | if (self.bin_file.options.module) |module| { | 2511 | if (self.bin_file.options.module) |module| { |
| 2512 | total += module.failed_exports.count(); | 2512 | total += module.failed_exports.count(); |
| ... | @@ -2520,7 +2520,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { | ... | @@ -2520,7 +2520,7 @@ pub fn totalErrorCount(self: *Compilation) u32 { |
| 2520 | } else { | 2520 | } else { |
| 2521 | const file = entry.key_ptr.*; | 2521 | const file = entry.key_ptr.*; |
| 2522 | assert(file.zir_loaded); | 2522 | assert(file.zir_loaded); |
| 2523 | const payload_index = file.zir.extra[@enumToInt(Zir.ExtraIndex.compile_errors)]; | 2523 | const payload_index = file.zir.extra[@intFromEnum(Zir.ExtraIndex.compile_errors)]; |
| 2524 | assert(payload_index != 0); | 2524 | assert(payload_index != 0); |
| 2525 | const header = file.zir.extraData(Zir.Inst.CompileErrors, payload_index); | 2525 | const header = file.zir.extraData(Zir.Inst.CompileErrors, payload_index); |
| 2526 | total += header.data.items_len; | 2526 | total += header.data.items_len; |
| ... | @@ -2551,14 +2551,14 @@ pub fn totalErrorCount(self: *Compilation) u32 { | ... | @@ -2551,14 +2551,14 @@ pub fn totalErrorCount(self: *Compilation) u32 { |
| 2551 | 2551 | ||
| 2552 | // The "no entry point found" error only counts if there are no semantic analysis errors. | 2552 | // The "no entry point found" error only counts if there are no semantic analysis errors. |
| 2553 | if (total == 0) { | 2553 | if (total == 0) { |
| 2554 | total += @boolToInt(self.link_error_flags.no_entry_point_found); | 2554 | total += @intFromBool(self.link_error_flags.no_entry_point_found); |
| 2555 | } | 2555 | } |
| 2556 | total += @boolToInt(self.link_error_flags.missing_libc); | 2556 | total += @intFromBool(self.link_error_flags.missing_libc); |
| 2557 | 2557 | ||
| 2558 | // Compile log errors only count if there are no other errors. | 2558 | // Compile log errors only count if there are no other errors. |
| 2559 | if (total == 0) { | 2559 | if (total == 0) { |
| 2560 | if (self.bin_file.options.module) |module| { | 2560 | if (self.bin_file.options.module) |module| { |
| 2561 | total += @boolToInt(module.compile_log_decls.count() != 0); | 2561 | total += @intFromBool(module.compile_log_decls.count() != 0); |
| 2562 | } | 2562 | } |
| 2563 | } | 2563 | } |
| 2564 | 2564 | ||
| ... | @@ -2604,7 +2604,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { | ... | @@ -2604,7 +2604,7 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { |
| 2604 | }); | 2604 | }); |
| 2605 | const notes_start = try bundle.reserveNotes(notes_len); | 2605 | const notes_start = try bundle.reserveNotes(notes_len); |
| 2606 | for (notes_start.., lld_error.context_lines) |note, context_line| { | 2606 | for (notes_start.., lld_error.context_lines) |note, context_line| { |
| 2607 | bundle.extra.items[note] = @enumToInt(bundle.addErrorMessageAssumeCapacity(.{ | 2607 | bundle.extra.items[note] = @intFromEnum(bundle.addErrorMessageAssumeCapacity(.{ |
| 2608 | .msg = try bundle.addString(context_line), | 2608 | .msg = try bundle.addString(context_line), |
| 2609 | })); | 2609 | })); |
| 2610 | } | 2610 | } |
| ... | @@ -2697,10 +2697,10 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { | ... | @@ -2697,10 +2697,10 @@ pub fn getAllErrorsAlloc(self: *Compilation) !ErrorBundle { |
| 2697 | .notes_len = 2, | 2697 | .notes_len = 2, |
| 2698 | }); | 2698 | }); |
| 2699 | const notes_start = try bundle.reserveNotes(2); | 2699 | const notes_start = try bundle.reserveNotes(2); |
| 2700 | bundle.extra.items[notes_start + 0] = @enumToInt(try bundle.addErrorMessage(.{ | 2700 | bundle.extra.items[notes_start + 0] = @intFromEnum(try bundle.addErrorMessage(.{ |
| 2701 | .msg = try bundle.addString("run 'zig libc -h' to learn about libc installations"), | 2701 | .msg = try bundle.addString("run 'zig libc -h' to learn about libc installations"), |
| 2702 | })); | 2702 | })); |
| 2703 | bundle.extra.items[notes_start + 1] = @enumToInt(try bundle.addErrorMessage(.{ | 2703 | bundle.extra.items[notes_start + 1] = @intFromEnum(try bundle.addErrorMessage(.{ |
| 2704 | .msg = try bundle.addString("run 'zig targets' to see the targets for which zig can always provide libc"), | 2704 | .msg = try bundle.addString("run 'zig targets' to see the targets for which zig can always provide libc"), |
| 2705 | })); | 2705 | })); |
| 2706 | } | 2706 | } |
| ... | @@ -2895,7 +2895,7 @@ pub fn addModuleErrorMsg(mod: *Module, eb: *ErrorBundle.Wip, module_err_msg: Mod | ... | @@ -2895,7 +2895,7 @@ pub fn addModuleErrorMsg(mod: *Module, eb: *ErrorBundle.Wip, module_err_msg: Mod |
| 2895 | const notes_start = try eb.reserveNotes(notes_len); | 2895 | const notes_start = try eb.reserveNotes(notes_len); |
| 2896 | 2896 | ||
| 2897 | for (notes_start.., notes.keys()) |i, note| { | 2897 | for (notes_start.., notes.keys()) |i, note| { |
| 2898 | eb.extra.items[i] = @enumToInt(try eb.addErrorMessage(note)); | 2898 | eb.extra.items[i] = @intFromEnum(try eb.addErrorMessage(note)); |
| 2899 | } | 2899 | } |
| 2900 | } | 2900 | } |
| 2901 | 2901 | ||
| ... | @@ -2903,7 +2903,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { | ... | @@ -2903,7 +2903,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { |
| 2903 | assert(file.zir_loaded); | 2903 | assert(file.zir_loaded); |
| 2904 | assert(file.tree_loaded); | 2904 | assert(file.tree_loaded); |
| 2905 | assert(file.source_loaded); | 2905 | assert(file.source_loaded); |
| 2906 | const payload_index = file.zir.extra[@enumToInt(Zir.ExtraIndex.compile_errors)]; | 2906 | const payload_index = file.zir.extra[@intFromEnum(Zir.ExtraIndex.compile_errors)]; |
| 2907 | assert(payload_index != 0); | 2907 | assert(payload_index != 0); |
| 2908 | const gpa = eb.gpa; | 2908 | const gpa = eb.gpa; |
| 2909 | 2909 | ||
| ... | @@ -2963,7 +2963,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { | ... | @@ -2963,7 +2963,7 @@ pub fn addZirErrorMessages(eb: *ErrorBundle.Wip, file: *Module.File) !void { |
| 2963 | const src_path = try file.fullPath(gpa); | 2963 | const src_path = try file.fullPath(gpa); |
| 2964 | defer gpa.free(src_path); | 2964 | defer gpa.free(src_path); |
| 2965 | 2965 | ||
| 2966 | eb.extra.items[note_i] = @enumToInt(try eb.addErrorMessage(.{ | 2966 | eb.extra.items[note_i] = @intFromEnum(try eb.addErrorMessage(.{ |
| 2967 | .msg = try eb.addString(msg), | 2967 | .msg = try eb.addString(msg), |
| 2968 | .src_loc = try eb.addSourceLocation(.{ | 2968 | .src_loc = try eb.addSourceLocation(.{ |
| 2969 | .src_path = try eb.addString(src_path), | 2969 | .src_path = try eb.addString(src_path), |
| ... | @@ -3466,7 +3466,7 @@ fn workerAstGenFile( | ... | @@ -3466,7 +3466,7 @@ fn workerAstGenFile( |
| 3466 | // If we experience an error preemptively fetching the | 3466 | // If we experience an error preemptively fetching the |
| 3467 | // file, just ignore it and let it happen again later during Sema. | 3467 | // file, just ignore it and let it happen again later during Sema. |
| 3468 | assert(file.zir_loaded); | 3468 | assert(file.zir_loaded); |
| 3469 | const imports_index = file.zir.extra[@enumToInt(Zir.ExtraIndex.imports)]; | 3469 | const imports_index = file.zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; |
| 3470 | if (imports_index != 0) { | 3470 | if (imports_index != 0) { |
| 3471 | const extra = file.zir.extraData(Zir.Inst.Imports, imports_index); | 3471 | const extra = file.zir.extraData(Zir.Inst.Imports, imports_index); |
| 3472 | var import_i: u32 = 0; | 3472 | var import_i: u32 = 0; |
| ... | @@ -4239,10 +4239,10 @@ pub fn addCCArgs( | ... | @@ -4239,10 +4239,10 @@ pub fn addCCArgs( |
| 4239 | } | 4239 | } |
| 4240 | 4240 | ||
| 4241 | try argv.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ | 4241 | try argv.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ |
| 4242 | @enumToInt(comp.libcxx_abi_version), | 4242 | @intFromEnum(comp.libcxx_abi_version), |
| 4243 | })); | 4243 | })); |
| 4244 | try argv.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ | 4244 | try argv.append(try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 4245 | @enumToInt(comp.libcxx_abi_version), | 4245 | @intFromEnum(comp.libcxx_abi_version), |
| 4246 | })); | 4246 | })); |
| 4247 | } | 4247 | } |
| 4248 | 4248 | ||
| ... | @@ -4307,7 +4307,7 @@ pub fn addCCArgs( | ... | @@ -4307,7 +4307,7 @@ pub fn addCCArgs( |
| 4307 | 4307 | ||
| 4308 | if (feature.llvm_name) |llvm_name| { | 4308 | if (feature.llvm_name) |llvm_name| { |
| 4309 | argv.appendSliceAssumeCapacity(&[_][]const u8{ "-Xclang", "-target-feature", "-Xclang" }); | 4309 | argv.appendSliceAssumeCapacity(&[_][]const u8{ "-Xclang", "-target-feature", "-Xclang" }); |
| 4310 | const plus_or_minus = "-+"[@boolToInt(is_enabled)]; | 4310 | const plus_or_minus = "-+"[@intFromBool(is_enabled)]; |
| 4311 | const arg = try std.fmt.allocPrint(arena, "{c}{s}", .{ plus_or_minus, llvm_name }); | 4311 | const arg = try std.fmt.allocPrint(arena, "{c}{s}", .{ plus_or_minus, llvm_name }); |
| 4312 | argv.appendAssumeCapacity(arg); | 4312 | argv.appendAssumeCapacity(arg); |
| 4313 | } | 4313 | } |
src/InternPool.zig+170-170| ... | @@ -80,7 +80,7 @@ const KeyAdapter = struct { | ... | @@ -80,7 +80,7 @@ const KeyAdapter = struct { |
| 80 | 80 | ||
| 81 | pub fn eql(ctx: @This(), a: Key, b_void: void, b_map_index: usize) bool { | 81 | pub fn eql(ctx: @This(), a: Key, b_void: void, b_map_index: usize) bool { |
| 82 | _ = b_void; | 82 | _ = b_void; |
| 83 | return ctx.intern_pool.indexToKey(@intToEnum(Index, b_map_index)).eql(a, ctx.intern_pool); | 83 | return ctx.intern_pool.indexToKey(@enumFromInt(Index, b_map_index)).eql(a, ctx.intern_pool); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | pub fn hash(ctx: @This(), a: Key) u32 { | 86 | pub fn hash(ctx: @This(), a: Key) u32 { |
| ... | @@ -95,7 +95,7 @@ pub const OptionalMapIndex = enum(u32) { | ... | @@ -95,7 +95,7 @@ pub const OptionalMapIndex = enum(u32) { |
| 95 | 95 | ||
| 96 | pub fn unwrap(oi: OptionalMapIndex) ?MapIndex { | 96 | pub fn unwrap(oi: OptionalMapIndex) ?MapIndex { |
| 97 | if (oi == .none) return null; | 97 | if (oi == .none) return null; |
| 98 | return @intToEnum(MapIndex, @enumToInt(oi)); | 98 | return @enumFromInt(MapIndex, @intFromEnum(oi)); |
| 99 | } | 99 | } |
| 100 | }; | 100 | }; |
| 101 | 101 | ||
| ... | @@ -104,7 +104,7 @@ pub const MapIndex = enum(u32) { | ... | @@ -104,7 +104,7 @@ pub const MapIndex = enum(u32) { |
| 104 | _, | 104 | _, |
| 105 | 105 | ||
| 106 | pub fn toOptional(i: MapIndex) OptionalMapIndex { | 106 | pub fn toOptional(i: MapIndex) OptionalMapIndex { |
| 107 | return @intToEnum(OptionalMapIndex, @enumToInt(i)); | 107 | return @enumFromInt(OptionalMapIndex, @intFromEnum(i)); |
| 108 | } | 108 | } |
| 109 | }; | 109 | }; |
| 110 | 110 | ||
| ... | @@ -114,7 +114,7 @@ pub const RuntimeIndex = enum(u32) { | ... | @@ -114,7 +114,7 @@ pub const RuntimeIndex = enum(u32) { |
| 114 | _, | 114 | _, |
| 115 | 115 | ||
| 116 | pub fn increment(ri: *RuntimeIndex) void { | 116 | pub fn increment(ri: *RuntimeIndex) void { |
| 117 | ri.* = @intToEnum(RuntimeIndex, @enumToInt(ri.*) + 1); | 117 | ri.* = @enumFromInt(RuntimeIndex, @intFromEnum(ri.*) + 1); |
| 118 | } | 118 | } |
| 119 | }; | 119 | }; |
| 120 | 120 | ||
| ... | @@ -130,11 +130,11 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -130,11 +130,11 @@ pub const NullTerminatedString = enum(u32) { |
| 130 | _, | 130 | _, |
| 131 | 131 | ||
| 132 | pub fn toString(self: NullTerminatedString) String { | 132 | pub fn toString(self: NullTerminatedString) String { |
| 133 | return @intToEnum(String, @enumToInt(self)); | 133 | return @enumFromInt(String, @intFromEnum(self)); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | pub fn toOptional(self: NullTerminatedString) OptionalNullTerminatedString { | 136 | pub fn toOptional(self: NullTerminatedString) OptionalNullTerminatedString { |
| 137 | return @intToEnum(OptionalNullTerminatedString, @enumToInt(self)); | 137 | return @enumFromInt(OptionalNullTerminatedString, @intFromEnum(self)); |
| 138 | } | 138 | } |
| 139 | 139 | ||
| 140 | const Adapter = struct { | 140 | const Adapter = struct { |
| ... | @@ -147,14 +147,14 @@ pub const NullTerminatedString = enum(u32) { | ... | @@ -147,14 +147,14 @@ pub const NullTerminatedString = enum(u32) { |
| 147 | 147 | ||
| 148 | pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { | 148 | pub fn hash(ctx: @This(), a: NullTerminatedString) u32 { |
| 149 | _ = ctx; | 149 | _ = ctx; |
| 150 | return std.hash.uint32(@enumToInt(a)); | 150 | return std.hash.uint32(@intFromEnum(a)); |
| 151 | } | 151 | } |
| 152 | }; | 152 | }; |
| 153 | 153 | ||
| 154 | /// Compare based on integer value alone, ignoring the string contents. | 154 | /// Compare based on integer value alone, ignoring the string contents. |
| 155 | pub fn indexLessThan(ctx: void, a: NullTerminatedString, b: NullTerminatedString) bool { | 155 | pub fn indexLessThan(ctx: void, a: NullTerminatedString, b: NullTerminatedString) bool { |
| 156 | _ = ctx; | 156 | _ = ctx; |
| 157 | return @enumToInt(a) < @enumToInt(b); | 157 | return @intFromEnum(a) < @intFromEnum(b); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | pub fn toUnsigned(self: NullTerminatedString, ip: *const InternPool) ?u32 { | 160 | pub fn toUnsigned(self: NullTerminatedString, ip: *const InternPool) ?u32 { |
| ... | @@ -196,7 +196,7 @@ pub const OptionalNullTerminatedString = enum(u32) { | ... | @@ -196,7 +196,7 @@ pub const OptionalNullTerminatedString = enum(u32) { |
| 196 | 196 | ||
| 197 | pub fn unwrap(oi: OptionalNullTerminatedString) ?NullTerminatedString { | 197 | pub fn unwrap(oi: OptionalNullTerminatedString) ?NullTerminatedString { |
| 198 | if (oi == .none) return null; | 198 | if (oi == .none) return null; |
| 199 | return @intToEnum(NullTerminatedString, @enumToInt(oi)); | 199 | return @enumFromInt(NullTerminatedString, @intFromEnum(oi)); |
| 200 | } | 200 | } |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| ... | @@ -279,7 +279,7 @@ pub const Key = union(enum) { | ... | @@ -279,7 +279,7 @@ pub const Key = union(enum) { |
| 279 | 279 | ||
| 280 | /// Look up field index based on field name. | 280 | /// Look up field index based on field name. |
| 281 | pub fn nameIndex(self: ErrorSetType, ip: *const InternPool, name: NullTerminatedString) ?u32 { | 281 | pub fn nameIndex(self: ErrorSetType, ip: *const InternPool, name: NullTerminatedString) ?u32 { |
| 282 | const map = &ip.maps.items[@enumToInt(self.names_map.unwrap().?)]; | 282 | const map = &ip.maps.items[@intFromEnum(self.names_map.unwrap().?)]; |
| 283 | const adapter: NullTerminatedString.Adapter = .{ .strings = self.names }; | 283 | const adapter: NullTerminatedString.Adapter = .{ .strings = self.names }; |
| 284 | const field_index = map.getIndexAdapted(name, adapter) orelse return null; | 284 | const field_index = map.getIndexAdapted(name, adapter) orelse return null; |
| 285 | return @intCast(u32, field_index); | 285 | return @intCast(u32, field_index); |
| ... | @@ -417,7 +417,7 @@ pub const Key = union(enum) { | ... | @@ -417,7 +417,7 @@ pub const Key = union(enum) { |
| 417 | 417 | ||
| 418 | /// Look up field index based on field name. | 418 | /// Look up field index based on field name. |
| 419 | pub fn nameIndex(self: EnumType, ip: *const InternPool, name: NullTerminatedString) ?u32 { | 419 | pub fn nameIndex(self: EnumType, ip: *const InternPool, name: NullTerminatedString) ?u32 { |
| 420 | const map = &ip.maps.items[@enumToInt(self.names_map.unwrap().?)]; | 420 | const map = &ip.maps.items[@intFromEnum(self.names_map.unwrap().?)]; |
| 421 | const adapter: NullTerminatedString.Adapter = .{ .strings = self.names }; | 421 | const adapter: NullTerminatedString.Adapter = .{ .strings = self.names }; |
| 422 | const field_index = map.getIndexAdapted(name, adapter) orelse return null; | 422 | const field_index = map.getIndexAdapted(name, adapter) orelse return null; |
| 423 | return @intCast(u32, field_index); | 423 | return @intCast(u32, field_index); |
| ... | @@ -437,7 +437,7 @@ pub const Key = union(enum) { | ... | @@ -437,7 +437,7 @@ pub const Key = union(enum) { |
| 437 | else => unreachable, | 437 | else => unreachable, |
| 438 | }; | 438 | }; |
| 439 | if (self.values_map.unwrap()) |values_map| { | 439 | if (self.values_map.unwrap()) |values_map| { |
| 440 | const map = &ip.maps.items[@enumToInt(values_map)]; | 440 | const map = &ip.maps.items[@intFromEnum(values_map)]; |
| 441 | const adapter: Index.Adapter = .{ .indexes = self.values }; | 441 | const adapter: Index.Adapter = .{ .indexes = self.values }; |
| 442 | const field_index = map.getIndexAdapted(int_tag_val, adapter) orelse return null; | 442 | const field_index = map.getIndexAdapted(int_tag_val, adapter) orelse return null; |
| 443 | return @intCast(u32, field_index); | 443 | return @intCast(u32, field_index); |
| ... | @@ -691,7 +691,7 @@ pub const Key = union(enum) { | ... | @@ -691,7 +691,7 @@ pub const Key = union(enum) { |
| 691 | pub fn hash64(key: Key, ip: *const InternPool) u64 { | 691 | pub fn hash64(key: Key, ip: *const InternPool) u64 { |
| 692 | const asBytes = std.mem.asBytes; | 692 | const asBytes = std.mem.asBytes; |
| 693 | const KeyTag = @typeInfo(Key).Union.tag_type.?; | 693 | const KeyTag = @typeInfo(Key).Union.tag_type.?; |
| 694 | const seed = @enumToInt(@as(KeyTag, key)); | 694 | const seed = @intFromEnum(@as(KeyTag, key)); |
| 695 | return switch (key) { | 695 | return switch (key) { |
| 696 | // TODO: assert no padding in these types | 696 | // TODO: assert no padding in these types |
| 697 | inline .ptr_type, | 697 | inline .ptr_type, |
| ... | @@ -714,8 +714,8 @@ pub const Key = union(enum) { | ... | @@ -714,8 +714,8 @@ pub const Key = union(enum) { |
| 714 | .un, | 714 | .un, |
| 715 | => |x| Hash.hash(seed, asBytes(&x)), | 715 | => |x| Hash.hash(seed, asBytes(&x)), |
| 716 | 716 | ||
| 717 | .int_type => |x| Hash.hash(seed + @enumToInt(x.signedness), asBytes(&x.bits)), | 717 | .int_type => |x| Hash.hash(seed + @intFromEnum(x.signedness), asBytes(&x.bits)), |
| 718 | .union_type => |x| Hash.hash(seed + @enumToInt(x.runtime_tag), asBytes(&x.index)), | 718 | .union_type => |x| Hash.hash(seed + @intFromEnum(x.runtime_tag), asBytes(&x.index)), |
| 719 | 719 | ||
| 720 | .error_union => |x| switch (x.val) { | 720 | .error_union => |x| switch (x.val) { |
| 721 | .err_name => |y| Hash.hash(seed + 0, asBytes(&x.ty) ++ asBytes(&y)), | 721 | .err_name => |y| Hash.hash(seed + 0, asBytes(&x.ty) ++ asBytes(&y)), |
| ... | @@ -777,7 +777,7 @@ pub const Key = union(enum) { | ... | @@ -777,7 +777,7 @@ pub const Key = union(enum) { |
| 777 | // Int-to-ptr pointers are hashed separately than decl-referencing pointers. | 777 | // Int-to-ptr pointers are hashed separately than decl-referencing pointers. |
| 778 | // This is sound due to pointer provenance rules. | 778 | // This is sound due to pointer provenance rules. |
| 779 | const addr: @typeInfo(Key.Ptr.Addr).Union.tag_type.? = ptr.addr; | 779 | const addr: @typeInfo(Key.Ptr.Addr).Union.tag_type.? = ptr.addr; |
| 780 | const seed2 = seed + @enumToInt(addr); | 780 | const seed2 = seed + @intFromEnum(addr); |
| 781 | const common = asBytes(&ptr.ty) ++ asBytes(&ptr.len); | 781 | const common = asBytes(&ptr.ty) ++ asBytes(&ptr.len); |
| 782 | return switch (ptr.addr) { | 782 | return switch (ptr.addr) { |
| 783 | .decl => |x| Hash.hash(seed2, common ++ asBytes(&x)), | 783 | .decl => |x| Hash.hash(seed2, common ++ asBytes(&x)), |
| ... | @@ -1381,7 +1381,7 @@ pub const Index = enum(u32) { | ... | @@ -1381,7 +1381,7 @@ pub const Index = enum(u32) { |
| 1381 | 1381 | ||
| 1382 | pub fn hash(ctx: @This(), a: Index) u32 { | 1382 | pub fn hash(ctx: @This(), a: Index) u32 { |
| 1383 | _ = ctx; | 1383 | _ = ctx; |
| 1384 | return std.hash.uint32(@enumToInt(a)); | 1384 | return std.hash.uint32(@intFromEnum(a)); |
| 1385 | } | 1385 | } |
| 1386 | }; | 1386 | }; |
| 1387 | 1387 | ||
| ... | @@ -2259,21 +2259,21 @@ pub const Alignment = enum(u6) { | ... | @@ -2259,21 +2259,21 @@ pub const Alignment = enum(u6) { |
| 2259 | pub fn toByteUnitsOptional(a: Alignment) ?u64 { | 2259 | pub fn toByteUnitsOptional(a: Alignment) ?u64 { |
| 2260 | return switch (a) { | 2260 | return switch (a) { |
| 2261 | .none => null, | 2261 | .none => null, |
| 2262 | _ => @as(u64, 1) << @enumToInt(a), | 2262 | _ => @as(u64, 1) << @intFromEnum(a), |
| 2263 | }; | 2263 | }; |
| 2264 | } | 2264 | } |
| 2265 | 2265 | ||
| 2266 | pub fn toByteUnits(a: Alignment, default: u64) u64 { | 2266 | pub fn toByteUnits(a: Alignment, default: u64) u64 { |
| 2267 | return switch (a) { | 2267 | return switch (a) { |
| 2268 | .none => default, | 2268 | .none => default, |
| 2269 | _ => @as(u64, 1) << @enumToInt(a), | 2269 | _ => @as(u64, 1) << @intFromEnum(a), |
| 2270 | }; | 2270 | }; |
| 2271 | } | 2271 | } |
| 2272 | 2272 | ||
| 2273 | pub fn fromByteUnits(n: u64) Alignment { | 2273 | pub fn fromByteUnits(n: u64) Alignment { |
| 2274 | if (n == 0) return .none; | 2274 | if (n == 0) return .none; |
| 2275 | assert(std.math.isPowerOfTwo(n)); | 2275 | assert(std.math.isPowerOfTwo(n)); |
| 2276 | return @intToEnum(Alignment, @ctz(n)); | 2276 | return @enumFromInt(Alignment, @ctz(n)); |
| 2277 | } | 2277 | } |
| 2278 | 2278 | ||
| 2279 | pub fn fromNonzeroByteUnits(n: u64) Alignment { | 2279 | pub fn fromNonzeroByteUnits(n: u64) Alignment { |
| ... | @@ -2282,7 +2282,7 @@ pub const Alignment = enum(u6) { | ... | @@ -2282,7 +2282,7 @@ pub const Alignment = enum(u6) { |
| 2282 | } | 2282 | } |
| 2283 | 2283 | ||
| 2284 | pub fn min(a: Alignment, b: Alignment) Alignment { | 2284 | pub fn min(a: Alignment, b: Alignment) Alignment { |
| 2285 | return @intToEnum(Alignment, @min(@enumToInt(a), @enumToInt(b))); | 2285 | return @enumFromInt(Alignment, @min(@intFromEnum(a), @intFromEnum(b))); |
| 2286 | } | 2286 | } |
| 2287 | }; | 2287 | }; |
| 2288 | 2288 | ||
| ... | @@ -2509,10 +2509,10 @@ pub fn init(ip: *InternPool, gpa: Allocator) !void { | ... | @@ -2509,10 +2509,10 @@ pub fn init(ip: *InternPool, gpa: Allocator) !void { |
| 2509 | const cc_c = ip.indexToKey(.calling_convention_c).enum_tag.int; | 2509 | const cc_c = ip.indexToKey(.calling_convention_c).enum_tag.int; |
| 2510 | 2510 | ||
| 2511 | assert(ip.indexToKey(cc_inline).int.storage.u64 == | 2511 | assert(ip.indexToKey(cc_inline).int.storage.u64 == |
| 2512 | @enumToInt(std.builtin.CallingConvention.Inline)); | 2512 | @intFromEnum(std.builtin.CallingConvention.Inline)); |
| 2513 | 2513 | ||
| 2514 | assert(ip.indexToKey(cc_c).int.storage.u64 == | 2514 | assert(ip.indexToKey(cc_c).int.storage.u64 == |
| 2515 | @enumToInt(std.builtin.CallingConvention.C)); | 2515 | @intFromEnum(std.builtin.CallingConvention.C)); |
| 2516 | 2516 | ||
| 2517 | assert(ip.indexToKey(ip.typeOf(cc_inline)).int_type.bits == | 2517 | assert(ip.indexToKey(ip.typeOf(cc_inline)).int_type.bits == |
| 2518 | @typeInfo(@typeInfo(std.builtin.CallingConvention).Enum.tag_type).Int.bits); | 2518 | @typeInfo(@typeInfo(std.builtin.CallingConvention).Enum.tag_type).Int.bits); |
| ... | @@ -2550,7 +2550,7 @@ pub fn deinit(ip: *InternPool, gpa: Allocator) void { | ... | @@ -2550,7 +2550,7 @@ pub fn deinit(ip: *InternPool, gpa: Allocator) void { |
| 2550 | 2550 | ||
| 2551 | pub fn indexToKey(ip: *const InternPool, index: Index) Key { | 2551 | pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2552 | assert(index != .none); | 2552 | assert(index != .none); |
| 2553 | const item = ip.items.get(@enumToInt(index)); | 2553 | const item = ip.items.get(@intFromEnum(index)); |
| 2554 | const data = item.data; | 2554 | const data = item.data; |
| 2555 | return switch (item.tag) { | 2555 | return switch (item.tag) { |
| 2556 | .type_int_signed => .{ | 2556 | .type_int_signed => .{ |
| ... | @@ -2581,8 +2581,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2581,8 +2581,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2581 | .sentinel = .none, | 2581 | .sentinel = .none, |
| 2582 | } }; | 2582 | } }; |
| 2583 | }, | 2583 | }, |
| 2584 | .simple_type => .{ .simple_type = @intToEnum(SimpleType, data) }, | 2584 | .simple_type => .{ .simple_type = @enumFromInt(SimpleType, data) }, |
| 2585 | .simple_value => .{ .simple_value = @intToEnum(SimpleValue, data) }, | 2585 | .simple_value => .{ .simple_value = @enumFromInt(SimpleValue, data) }, |
| 2586 | 2586 | ||
| 2587 | .type_vector => { | 2587 | .type_vector => { |
| 2588 | const vector_info = ip.extraData(Vector, data); | 2588 | const vector_info = ip.extraData(Vector, data); |
| ... | @@ -2601,8 +2601,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2601,8 +2601,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2601 | return .{ .ptr_type = ptr_info }; | 2601 | return .{ .ptr_type = ptr_info }; |
| 2602 | }, | 2602 | }, |
| 2603 | 2603 | ||
| 2604 | .type_optional => .{ .opt_type = @intToEnum(Index, data) }, | 2604 | .type_optional => .{ .opt_type = @enumFromInt(Index, data) }, |
| 2605 | .type_anyframe => .{ .anyframe_type = @intToEnum(Index, data) }, | 2605 | .type_anyframe => .{ .anyframe_type = @enumFromInt(Index, data) }, |
| 2606 | 2606 | ||
| 2607 | .type_error_union => .{ .error_union_type = ip.extraData(Key.ErrorUnionType, data) }, | 2607 | .type_error_union => .{ .error_union_type = ip.extraData(Key.ErrorUnionType, data) }, |
| 2608 | .type_error_set => { | 2608 | .type_error_set => { |
| ... | @@ -2615,12 +2615,12 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2615,12 +2615,12 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2615 | } }; | 2615 | } }; |
| 2616 | }, | 2616 | }, |
| 2617 | .type_inferred_error_set => .{ | 2617 | .type_inferred_error_set => .{ |
| 2618 | .inferred_error_set_type = @intToEnum(Module.Fn.InferredErrorSet.Index, data), | 2618 | .inferred_error_set_type = @enumFromInt(Module.Fn.InferredErrorSet.Index, data), |
| 2619 | }, | 2619 | }, |
| 2620 | 2620 | ||
| 2621 | .type_opaque => .{ .opaque_type = ip.extraData(Key.OpaqueType, data) }, | 2621 | .type_opaque => .{ .opaque_type = ip.extraData(Key.OpaqueType, data) }, |
| 2622 | .type_struct => { | 2622 | .type_struct => { |
| 2623 | const struct_index = @intToEnum(Module.Struct.OptionalIndex, data); | 2623 | const struct_index = @enumFromInt(Module.Struct.OptionalIndex, data); |
| 2624 | const namespace = if (struct_index.unwrap()) |i| | 2624 | const namespace = if (struct_index.unwrap()) |i| |
| 2625 | ip.structPtrConst(i).namespace.toOptional() | 2625 | ip.structPtrConst(i).namespace.toOptional() |
| 2626 | else | 2626 | else |
| ... | @@ -2632,7 +2632,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2632,7 +2632,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2632 | }, | 2632 | }, |
| 2633 | .type_struct_ns => .{ .struct_type = .{ | 2633 | .type_struct_ns => .{ .struct_type = .{ |
| 2634 | .index = .none, | 2634 | .index = .none, |
| 2635 | .namespace = @intToEnum(Module.Namespace.Index, data).toOptional(), | 2635 | .namespace = @enumFromInt(Module.Namespace.Index, data).toOptional(), |
| 2636 | } }, | 2636 | } }, |
| 2637 | 2637 | ||
| 2638 | .type_struct_anon => { | 2638 | .type_struct_anon => { |
| ... | @@ -2660,15 +2660,15 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2660,15 +2660,15 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2660 | }, | 2660 | }, |
| 2661 | 2661 | ||
| 2662 | .type_union_untagged => .{ .union_type = .{ | 2662 | .type_union_untagged => .{ .union_type = .{ |
| 2663 | .index = @intToEnum(Module.Union.Index, data), | 2663 | .index = @enumFromInt(Module.Union.Index, data), |
| 2664 | .runtime_tag = .none, | 2664 | .runtime_tag = .none, |
| 2665 | } }, | 2665 | } }, |
| 2666 | .type_union_tagged => .{ .union_type = .{ | 2666 | .type_union_tagged => .{ .union_type = .{ |
| 2667 | .index = @intToEnum(Module.Union.Index, data), | 2667 | .index = @enumFromInt(Module.Union.Index, data), |
| 2668 | .runtime_tag = .tagged, | 2668 | .runtime_tag = .tagged, |
| 2669 | } }, | 2669 | } }, |
| 2670 | .type_union_safety => .{ .union_type = .{ | 2670 | .type_union_safety => .{ .union_type = .{ |
| 2671 | .index = @intToEnum(Module.Union.Index, data), | 2671 | .index = @enumFromInt(Module.Union.Index, data), |
| 2672 | .runtime_tag = .safety, | 2672 | .runtime_tag = .safety, |
| 2673 | } }, | 2673 | } }, |
| 2674 | 2674 | ||
| ... | @@ -2693,10 +2693,10 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2693,10 +2693,10 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2693 | .type_enum_nonexhaustive => ip.indexToKeyEnum(data, .nonexhaustive), | 2693 | .type_enum_nonexhaustive => ip.indexToKeyEnum(data, .nonexhaustive), |
| 2694 | .type_function => .{ .func_type = ip.indexToKeyFuncType(data) }, | 2694 | .type_function => .{ .func_type = ip.indexToKeyFuncType(data) }, |
| 2695 | 2695 | ||
| 2696 | .undef => .{ .undef = @intToEnum(Index, data) }, | 2696 | .undef => .{ .undef = @enumFromInt(Index, data) }, |
| 2697 | .runtime_value => .{ .runtime_value = ip.extraData(Tag.TypeValue, data) }, | 2697 | .runtime_value => .{ .runtime_value = ip.extraData(Tag.TypeValue, data) }, |
| 2698 | .opt_null => .{ .opt = .{ | 2698 | .opt_null => .{ .opt = .{ |
| 2699 | .ty = @intToEnum(Index, data), | 2699 | .ty = @enumFromInt(Index, data), |
| 2700 | .val = .none, | 2700 | .val = .none, |
| 2701 | } }, | 2701 | } }, |
| 2702 | .opt_payload => { | 2702 | .opt_payload => { |
| ... | @@ -2754,7 +2754,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2754,7 +2754,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2754 | .ptr_elem => { | 2754 | .ptr_elem => { |
| 2755 | // Avoid `indexToKey` recursion by asserting the tag encoding. | 2755 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2756 | const info = ip.extraData(PtrBaseIndex, data); | 2756 | const info = ip.extraData(PtrBaseIndex, data); |
| 2757 | const index_item = ip.items.get(@enumToInt(info.index)); | 2757 | const index_item = ip.items.get(@intFromEnum(info.index)); |
| 2758 | return switch (index_item.tag) { | 2758 | return switch (index_item.tag) { |
| 2759 | .int_usize => .{ .ptr = .{ | 2759 | .int_usize => .{ .ptr = .{ |
| 2760 | .ty = info.ty, | 2760 | .ty = info.ty, |
| ... | @@ -2770,7 +2770,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2770,7 +2770,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2770 | .ptr_field => { | 2770 | .ptr_field => { |
| 2771 | // Avoid `indexToKey` recursion by asserting the tag encoding. | 2771 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2772 | const info = ip.extraData(PtrBaseIndex, data); | 2772 | const info = ip.extraData(PtrBaseIndex, data); |
| 2773 | const index_item = ip.items.get(@enumToInt(info.index)); | 2773 | const index_item = ip.items.get(@intFromEnum(info.index)); |
| 2774 | return switch (index_item.tag) { | 2774 | return switch (index_item.tag) { |
| 2775 | .int_usize => .{ .ptr = .{ | 2775 | .int_usize => .{ .ptr = .{ |
| 2776 | .ty = info.ty, | 2776 | .ty = info.ty, |
| ... | @@ -2785,7 +2785,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2785,7 +2785,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2785 | }, | 2785 | }, |
| 2786 | .ptr_slice => { | 2786 | .ptr_slice => { |
| 2787 | const info = ip.extraData(PtrSlice, data); | 2787 | const info = ip.extraData(PtrSlice, data); |
| 2788 | const ptr_item = ip.items.get(@enumToInt(info.ptr)); | 2788 | const ptr_item = ip.items.get(@intFromEnum(info.ptr)); |
| 2789 | return .{ | 2789 | return .{ |
| 2790 | .ptr = .{ | 2790 | .ptr = .{ |
| 2791 | .ty = info.ty, | 2791 | .ty = info.ty, |
| ... | @@ -2815,7 +2815,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2815,7 +2815,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2815 | .ptr_elem => b: { | 2815 | .ptr_elem => b: { |
| 2816 | // Avoid `indexToKey` recursion by asserting the tag encoding. | 2816 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2817 | const sub_info = ip.extraData(PtrBaseIndex, ptr_item.data); | 2817 | const sub_info = ip.extraData(PtrBaseIndex, ptr_item.data); |
| 2818 | const index_item = ip.items.get(@enumToInt(sub_info.index)); | 2818 | const index_item = ip.items.get(@intFromEnum(sub_info.index)); |
| 2819 | break :b switch (index_item.tag) { | 2819 | break :b switch (index_item.tag) { |
| 2820 | .int_usize => .{ .elem = .{ | 2820 | .int_usize => .{ .elem = .{ |
| 2821 | .base = sub_info.base, | 2821 | .base = sub_info.base, |
| ... | @@ -2828,7 +2828,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2828,7 +2828,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2828 | .ptr_field => b: { | 2828 | .ptr_field => b: { |
| 2829 | // Avoid `indexToKey` recursion by asserting the tag encoding. | 2829 | // Avoid `indexToKey` recursion by asserting the tag encoding. |
| 2830 | const sub_info = ip.extraData(PtrBaseIndex, ptr_item.data); | 2830 | const sub_info = ip.extraData(PtrBaseIndex, ptr_item.data); |
| 2831 | const index_item = ip.items.get(@enumToInt(sub_info.index)); | 2831 | const index_item = ip.items.get(@intFromEnum(sub_info.index)); |
| 2832 | break :b switch (index_item.tag) { | 2832 | break :b switch (index_item.tag) { |
| 2833 | .int_usize => .{ .field = .{ | 2833 | .int_usize => .{ .field = .{ |
| 2834 | .base = sub_info.base, | 2834 | .base = sub_info.base, |
| ... | @@ -2940,8 +2940,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2940,8 +2940,8 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2940 | .extern_func => .{ .extern_func = ip.extraData(Tag.ExternFunc, data) }, | 2940 | .extern_func => .{ .extern_func = ip.extraData(Tag.ExternFunc, data) }, |
| 2941 | .func => .{ .func = ip.extraData(Tag.Func, data) }, | 2941 | .func => .{ .func = ip.extraData(Tag.Func, data) }, |
| 2942 | .only_possible_value => { | 2942 | .only_possible_value => { |
| 2943 | const ty = @intToEnum(Index, data); | 2943 | const ty = @enumFromInt(Index, data); |
| 2944 | const ty_item = ip.items.get(@enumToInt(ty)); | 2944 | const ty_item = ip.items.get(@intFromEnum(ty)); |
| 2945 | return switch (ty_item.tag) { | 2945 | return switch (ty_item.tag) { |
| 2946 | .type_array_big => { | 2946 | .type_array_big => { |
| 2947 | const sentinel = @ptrCast( | 2947 | const sentinel = @ptrCast( |
| ... | @@ -2950,7 +2950,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2950,7 +2950,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2950 | ); | 2950 | ); |
| 2951 | return .{ .aggregate = .{ | 2951 | return .{ .aggregate = .{ |
| 2952 | .ty = ty, | 2952 | .ty = ty, |
| 2953 | .storage = .{ .elems = sentinel[0..@boolToInt(sentinel[0] != .none)] }, | 2953 | .storage = .{ .elems = sentinel[0..@intFromBool(sentinel[0] != .none)] }, |
| 2954 | } }; | 2954 | } }; |
| 2955 | }, | 2955 | }, |
| 2956 | .type_array_small, .type_vector => .{ .aggregate = .{ | 2956 | .type_array_small, .type_vector => .{ .aggregate = .{ |
| ... | @@ -2994,7 +2994,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -2994,7 +2994,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 2994 | const len = @intCast(u32, ip.aggregateTypeLenIncludingSentinel(extra.ty)); | 2994 | const len = @intCast(u32, ip.aggregateTypeLenIncludingSentinel(extra.ty)); |
| 2995 | return .{ .aggregate = .{ | 2995 | return .{ .aggregate = .{ |
| 2996 | .ty = extra.ty, | 2996 | .ty = extra.ty, |
| 2997 | .storage = .{ .bytes = ip.string_bytes.items[@enumToInt(extra.bytes)..][0..len] }, | 2997 | .storage = .{ .bytes = ip.string_bytes.items[@intFromEnum(extra.bytes)..][0..len] }, |
| 2998 | } }; | 2998 | } }; |
| 2999 | }, | 2999 | }, |
| 3000 | .aggregate => { | 3000 | .aggregate => { |
| ... | @@ -3029,7 +3029,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { | ... | @@ -3029,7 +3029,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key { |
| 3029 | .val = .{ .payload = extra.val }, | 3029 | .val = .{ .payload = extra.val }, |
| 3030 | } }; | 3030 | } }; |
| 3031 | }, | 3031 | }, |
| 3032 | .enum_literal => .{ .enum_literal = @intToEnum(NullTerminatedString, data) }, | 3032 | .enum_literal => .{ .enum_literal = @enumFromInt(NullTerminatedString, data) }, |
| 3033 | .enum_tag => .{ .enum_tag = ip.extraData(Tag.EnumTag, data) }, | 3033 | .enum_tag => .{ .enum_tag = ip.extraData(Tag.EnumTag, data) }, |
| 3034 | 3034 | ||
| 3035 | .memoized_call => { | 3035 | .memoized_call => { |
| ... | @@ -3103,7 +3103,7 @@ fn indexToKeyBigInt(ip: *const InternPool, limb_index: u32, positive: bool) Key | ... | @@ -3103,7 +3103,7 @@ fn indexToKeyBigInt(ip: *const InternPool, limb_index: u32, positive: bool) Key |
| 3103 | pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | 3103 | pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3104 | const adapter: KeyAdapter = .{ .intern_pool = ip }; | 3104 | const adapter: KeyAdapter = .{ .intern_pool = ip }; |
| 3105 | const gop = try ip.map.getOrPutAdapted(gpa, key, adapter); | 3105 | const gop = try ip.map.getOrPutAdapted(gpa, key, adapter); |
| 3106 | if (gop.found_existing) return @intToEnum(Index, gop.index); | 3106 | if (gop.found_existing) return @enumFromInt(Index, gop.index); |
| 3107 | try ip.items.ensureUnusedCapacity(gpa, 1); | 3107 | try ip.items.ensureUnusedCapacity(gpa, 1); |
| 3108 | switch (key) { | 3108 | switch (key) { |
| 3109 | .int_type => |int_type| { | 3109 | .int_type => |int_type| { |
| ... | @@ -3129,9 +3129,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3129,9 +3129,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3129 | try ip.items.ensureUnusedCapacity(gpa, 1); | 3129 | try ip.items.ensureUnusedCapacity(gpa, 1); |
| 3130 | ip.items.appendAssumeCapacity(.{ | 3130 | ip.items.appendAssumeCapacity(.{ |
| 3131 | .tag = .type_slice, | 3131 | .tag = .type_slice, |
| 3132 | .data = @enumToInt(ptr_type_index), | 3132 | .data = @intFromEnum(ptr_type_index), |
| 3133 | }); | 3133 | }); |
| 3134 | return @intToEnum(Index, ip.items.len - 1); | 3134 | return @enumFromInt(Index, ip.items.len - 1); |
| 3135 | } | 3135 | } |
| 3136 | 3136 | ||
| 3137 | var ptr_type_adjusted = ptr_type; | 3137 | var ptr_type_adjusted = ptr_type; |
| ... | @@ -3155,7 +3155,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3155,7 +3155,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3155 | .child = array_type.child, | 3155 | .child = array_type.child, |
| 3156 | }), | 3156 | }), |
| 3157 | }); | 3157 | }); |
| 3158 | return @intToEnum(Index, ip.items.len - 1); | 3158 | return @enumFromInt(Index, ip.items.len - 1); |
| 3159 | } | 3159 | } |
| 3160 | } | 3160 | } |
| 3161 | 3161 | ||
| ... | @@ -3183,14 +3183,14 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3183,14 +3183,14 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3183 | assert(payload_type != .none); | 3183 | assert(payload_type != .none); |
| 3184 | ip.items.appendAssumeCapacity(.{ | 3184 | ip.items.appendAssumeCapacity(.{ |
| 3185 | .tag = .type_optional, | 3185 | .tag = .type_optional, |
| 3186 | .data = @enumToInt(payload_type), | 3186 | .data = @intFromEnum(payload_type), |
| 3187 | }); | 3187 | }); |
| 3188 | }, | 3188 | }, |
| 3189 | .anyframe_type => |payload_type| { | 3189 | .anyframe_type => |payload_type| { |
| 3190 | // payload_type might be none, indicating the type is `anyframe`. | 3190 | // payload_type might be none, indicating the type is `anyframe`. |
| 3191 | ip.items.appendAssumeCapacity(.{ | 3191 | ip.items.appendAssumeCapacity(.{ |
| 3192 | .tag = .type_anyframe, | 3192 | .tag = .type_anyframe, |
| 3193 | .data = @enumToInt(payload_type), | 3193 | .data = @intFromEnum(payload_type), |
| 3194 | }); | 3194 | }); |
| 3195 | }, | 3195 | }, |
| 3196 | .error_union_type => |error_union_type| { | 3196 | .error_union_type => |error_union_type| { |
| ... | @@ -3218,26 +3218,26 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3218,26 +3218,26 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3218 | .inferred_error_set_type => |ies_index| { | 3218 | .inferred_error_set_type => |ies_index| { |
| 3219 | ip.items.appendAssumeCapacity(.{ | 3219 | ip.items.appendAssumeCapacity(.{ |
| 3220 | .tag = .type_inferred_error_set, | 3220 | .tag = .type_inferred_error_set, |
| 3221 | .data = @enumToInt(ies_index), | 3221 | .data = @intFromEnum(ies_index), |
| 3222 | }); | 3222 | }); |
| 3223 | }, | 3223 | }, |
| 3224 | .simple_type => |simple_type| { | 3224 | .simple_type => |simple_type| { |
| 3225 | ip.items.appendAssumeCapacity(.{ | 3225 | ip.items.appendAssumeCapacity(.{ |
| 3226 | .tag = .simple_type, | 3226 | .tag = .simple_type, |
| 3227 | .data = @enumToInt(simple_type), | 3227 | .data = @intFromEnum(simple_type), |
| 3228 | }); | 3228 | }); |
| 3229 | }, | 3229 | }, |
| 3230 | .simple_value => |simple_value| { | 3230 | .simple_value => |simple_value| { |
| 3231 | ip.items.appendAssumeCapacity(.{ | 3231 | ip.items.appendAssumeCapacity(.{ |
| 3232 | .tag = .simple_value, | 3232 | .tag = .simple_value, |
| 3233 | .data = @enumToInt(simple_value), | 3233 | .data = @intFromEnum(simple_value), |
| 3234 | }); | 3234 | }); |
| 3235 | }, | 3235 | }, |
| 3236 | .undef => |ty| { | 3236 | .undef => |ty| { |
| 3237 | assert(ty != .none); | 3237 | assert(ty != .none); |
| 3238 | ip.items.appendAssumeCapacity(.{ | 3238 | ip.items.appendAssumeCapacity(.{ |
| 3239 | .tag = .undef, | 3239 | .tag = .undef, |
| 3240 | .data = @enumToInt(ty), | 3240 | .data = @intFromEnum(ty), |
| 3241 | }); | 3241 | }); |
| 3242 | }, | 3242 | }, |
| 3243 | .runtime_value => |runtime_value| { | 3243 | .runtime_value => |runtime_value| { |
| ... | @@ -3251,13 +3251,13 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3251,13 +3251,13 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3251 | .struct_type => |struct_type| { | 3251 | .struct_type => |struct_type| { |
| 3252 | ip.items.appendAssumeCapacity(if (struct_type.index.unwrap()) |i| .{ | 3252 | ip.items.appendAssumeCapacity(if (struct_type.index.unwrap()) |i| .{ |
| 3253 | .tag = .type_struct, | 3253 | .tag = .type_struct, |
| 3254 | .data = @enumToInt(i), | 3254 | .data = @intFromEnum(i), |
| 3255 | } else if (struct_type.namespace.unwrap()) |i| .{ | 3255 | } else if (struct_type.namespace.unwrap()) |i| .{ |
| 3256 | .tag = .type_struct_ns, | 3256 | .tag = .type_struct_ns, |
| 3257 | .data = @enumToInt(i), | 3257 | .data = @intFromEnum(i), |
| 3258 | } else .{ | 3258 | } else .{ |
| 3259 | .tag = .type_struct, | 3259 | .tag = .type_struct, |
| 3260 | .data = @enumToInt(Module.Struct.OptionalIndex.none), | 3260 | .data = @intFromEnum(Module.Struct.OptionalIndex.none), |
| 3261 | }); | 3261 | }); |
| 3262 | }, | 3262 | }, |
| 3263 | 3263 | ||
| ... | @@ -3279,7 +3279,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3279,7 +3279,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3279 | }); | 3279 | }); |
| 3280 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.types)); | 3280 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.types)); |
| 3281 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.values)); | 3281 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.values)); |
| 3282 | return @intToEnum(Index, ip.items.len - 1); | 3282 | return @enumFromInt(Index, ip.items.len - 1); |
| 3283 | } | 3283 | } |
| 3284 | 3284 | ||
| 3285 | assert(anon_struct_type.names.len == anon_struct_type.types.len); | 3285 | assert(anon_struct_type.names.len == anon_struct_type.types.len); |
| ... | @@ -3297,7 +3297,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3297,7 +3297,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3297 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.types)); | 3297 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.types)); |
| 3298 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.values)); | 3298 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.values)); |
| 3299 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.names)); | 3299 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, anon_struct_type.names)); |
| 3300 | return @intToEnum(Index, ip.items.len - 1); | 3300 | return @enumFromInt(Index, ip.items.len - 1); |
| 3301 | }, | 3301 | }, |
| 3302 | 3302 | ||
| 3303 | .union_type => |union_type| { | 3303 | .union_type => |union_type| { |
| ... | @@ -3307,7 +3307,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3307,7 +3307,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3307 | .safety => .type_union_safety, | 3307 | .safety => .type_union_safety, |
| 3308 | .tagged => .type_union_tagged, | 3308 | .tagged => .type_union_tagged, |
| 3309 | }, | 3309 | }, |
| 3310 | .data = @enumToInt(union_type.index), | 3310 | .data = @intFromEnum(union_type.index), |
| 3311 | }); | 3311 | }); |
| 3312 | }, | 3312 | }, |
| 3313 | 3313 | ||
| ... | @@ -3343,7 +3343,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3343,7 +3343,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3343 | }), | 3343 | }), |
| 3344 | }); | 3344 | }); |
| 3345 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.names)); | 3345 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.names)); |
| 3346 | return @intToEnum(Index, ip.items.len - 1); | 3346 | return @enumFromInt(Index, ip.items.len - 1); |
| 3347 | }, | 3347 | }, |
| 3348 | .explicit => return finishGetEnum(ip, gpa, enum_type, .type_enum_explicit), | 3348 | .explicit => return finishGetEnum(ip, gpa, enum_type, .type_enum_explicit), |
| 3349 | .nonexhaustive => return finishGetEnum(ip, gpa, enum_type, .type_enum_nonexhaustive), | 3349 | .nonexhaustive => return finishGetEnum(ip, gpa, enum_type, .type_enum_nonexhaustive), |
| ... | @@ -3540,7 +3540,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3540,7 +3540,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3540 | }); | 3540 | }); |
| 3541 | }, | 3541 | }, |
| 3542 | } | 3542 | } |
| 3543 | assert(ptr.ty == ip.indexToKey(@intToEnum(Index, ip.items.len - 1)).ptr.ty); | 3543 | assert(ptr.ty == ip.indexToKey(@enumFromInt(Index, ip.items.len - 1)).ptr.ty); |
| 3544 | }, | 3544 | }, |
| 3545 | 3545 | ||
| 3546 | .opt => |opt| { | 3546 | .opt => |opt| { |
| ... | @@ -3548,7 +3548,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3548,7 +3548,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3548 | assert(opt.val == .none or ip.indexToKey(opt.ty).opt_type == ip.typeOf(opt.val)); | 3548 | assert(opt.val == .none or ip.indexToKey(opt.ty).opt_type == ip.typeOf(opt.val)); |
| 3549 | ip.items.appendAssumeCapacity(if (opt.val == .none) .{ | 3549 | ip.items.appendAssumeCapacity(if (opt.val == .none) .{ |
| 3550 | .tag = .opt_null, | 3550 | .tag = .opt_null, |
| 3551 | .data = @enumToInt(opt.ty), | 3551 | .data = @intFromEnum(opt.ty), |
| 3552 | } else .{ | 3552 | } else .{ |
| 3553 | .tag = .opt_payload, | 3553 | .tag = .opt_payload, |
| 3554 | .data = try ip.addExtra(gpa, Tag.TypeValue{ | 3554 | .data = try ip.addExtra(gpa, Tag.TypeValue{ |
| ... | @@ -3574,7 +3574,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3574,7 +3574,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3574 | .lazy_ty = lazy_ty, | 3574 | .lazy_ty = lazy_ty, |
| 3575 | }), | 3575 | }), |
| 3576 | }); | 3576 | }); |
| 3577 | return @intToEnum(Index, ip.items.len - 1); | 3577 | return @enumFromInt(Index, ip.items.len - 1); |
| 3578 | }, | 3578 | }, |
| 3579 | } | 3579 | } |
| 3580 | switch (int.ty) { | 3580 | switch (int.ty) { |
| ... | @@ -3715,7 +3715,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3715,7 +3715,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3715 | .value = casted, | 3715 | .value = casted, |
| 3716 | }), | 3716 | }), |
| 3717 | }); | 3717 | }); |
| 3718 | return @intToEnum(Index, ip.items.len - 1); | 3718 | return @enumFromInt(Index, ip.items.len - 1); |
| 3719 | } else |_| {} | 3719 | } else |_| {} |
| 3720 | 3720 | ||
| 3721 | const tag: Tag = if (big_int.positive) .int_positive else .int_negative; | 3721 | const tag: Tag = if (big_int.positive) .int_positive else .int_negative; |
| ... | @@ -3730,7 +3730,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3730,7 +3730,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3730 | .value = casted, | 3730 | .value = casted, |
| 3731 | }), | 3731 | }), |
| 3732 | }); | 3732 | }); |
| 3733 | return @intToEnum(Index, ip.items.len - 1); | 3733 | return @enumFromInt(Index, ip.items.len - 1); |
| 3734 | } | 3734 | } |
| 3735 | 3735 | ||
| 3736 | var buf: [2]Limb = undefined; | 3736 | var buf: [2]Limb = undefined; |
| ... | @@ -3772,7 +3772,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3772,7 +3772,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3772 | 3772 | ||
| 3773 | .enum_literal => |enum_literal| ip.items.appendAssumeCapacity(.{ | 3773 | .enum_literal => |enum_literal| ip.items.appendAssumeCapacity(.{ |
| 3774 | .tag = .enum_literal, | 3774 | .tag = .enum_literal, |
| 3775 | .data = @enumToInt(enum_literal), | 3775 | .data = @intFromEnum(enum_literal), |
| 3776 | }), | 3776 | }), |
| 3777 | 3777 | ||
| 3778 | .enum_tag => |enum_tag| { | 3778 | .enum_tag => |enum_tag| { |
| ... | @@ -3790,7 +3790,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3790,7 +3790,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3790 | 3790 | ||
| 3791 | .empty_enum_value => |enum_or_union_ty| ip.items.appendAssumeCapacity(.{ | 3791 | .empty_enum_value => |enum_or_union_ty| ip.items.appendAssumeCapacity(.{ |
| 3792 | .tag = .only_possible_value, | 3792 | .tag = .only_possible_value, |
| 3793 | .data = @enumToInt(enum_or_union_ty), | 3793 | .data = @intFromEnum(enum_or_union_ty), |
| 3794 | }), | 3794 | }), |
| 3795 | 3795 | ||
| 3796 | .float => |float| { | 3796 | .float => |float| { |
| ... | @@ -3847,7 +3847,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3847,7 +3847,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3847 | .vector_type, .anon_struct_type, .struct_type => .none, | 3847 | .vector_type, .anon_struct_type, .struct_type => .none, |
| 3848 | else => unreachable, | 3848 | else => unreachable, |
| 3849 | }; | 3849 | }; |
| 3850 | const len_including_sentinel = len + @boolToInt(sentinel != .none); | 3850 | const len_including_sentinel = len + @intFromBool(sentinel != .none); |
| 3851 | switch (aggregate.storage) { | 3851 | switch (aggregate.storage) { |
| 3852 | .bytes => |bytes| { | 3852 | .bytes => |bytes| { |
| 3853 | assert(child == .u8_type); | 3853 | assert(child == .u8_type); |
| ... | @@ -3891,9 +3891,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3891,9 +3891,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3891 | if (len == 0) { | 3891 | if (len == 0) { |
| 3892 | ip.items.appendAssumeCapacity(.{ | 3892 | ip.items.appendAssumeCapacity(.{ |
| 3893 | .tag = .only_possible_value, | 3893 | .tag = .only_possible_value, |
| 3894 | .data = @enumToInt(aggregate.ty), | 3894 | .data = @intFromEnum(aggregate.ty), |
| 3895 | }); | 3895 | }); |
| 3896 | return @intToEnum(Index, ip.items.len - 1); | 3896 | return @enumFromInt(Index, ip.items.len - 1); |
| 3897 | } | 3897 | } |
| 3898 | 3898 | ||
| 3899 | switch (ty_key) { | 3899 | switch (ty_key) { |
| ... | @@ -3919,9 +3919,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3919,9 +3919,9 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3919 | // in the aggregate fields. | 3919 | // in the aggregate fields. |
| 3920 | ip.items.appendAssumeCapacity(.{ | 3920 | ip.items.appendAssumeCapacity(.{ |
| 3921 | .tag = .only_possible_value, | 3921 | .tag = .only_possible_value, |
| 3922 | .data = @enumToInt(aggregate.ty), | 3922 | .data = @intFromEnum(aggregate.ty), |
| 3923 | }); | 3923 | }); |
| 3924 | return @intToEnum(Index, ip.items.len - 1); | 3924 | return @enumFromInt(Index, ip.items.len - 1); |
| 3925 | }, | 3925 | }, |
| 3926 | else => {}, | 3926 | else => {}, |
| 3927 | } | 3927 | } |
| ... | @@ -3960,7 +3960,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3960,7 +3960,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3960 | .elem_val = elem, | 3960 | .elem_val = elem, |
| 3961 | }), | 3961 | }), |
| 3962 | }); | 3962 | }); |
| 3963 | return @intToEnum(Index, ip.items.len - 1); | 3963 | return @enumFromInt(Index, ip.items.len - 1); |
| 3964 | } | 3964 | } |
| 3965 | 3965 | ||
| 3966 | if (child == .u8_type) bytes: { | 3966 | if (child == .u8_type) bytes: { |
| ... | @@ -3994,7 +3994,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -3994,7 +3994,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 3994 | @intCast(u8, ip.indexToKey(sentinel).int.storage.u64), | 3994 | @intCast(u8, ip.indexToKey(sentinel).int.storage.u64), |
| 3995 | ); | 3995 | ); |
| 3996 | const string = if (has_internal_null) | 3996 | const string = if (has_internal_null) |
| 3997 | @intToEnum(String, string_bytes_index) | 3997 | @enumFromInt(String, string_bytes_index) |
| 3998 | else | 3998 | else |
| 3999 | (try ip.getOrPutTrailingString(gpa, @intCast(usize, len_including_sentinel))).toString(); | 3999 | (try ip.getOrPutTrailingString(gpa, @intCast(usize, len_including_sentinel))).toString(); |
| 4000 | ip.items.appendAssumeCapacity(.{ | 4000 | ip.items.appendAssumeCapacity(.{ |
| ... | @@ -4004,7 +4004,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -4004,7 +4004,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 4004 | .bytes = string, | 4004 | .bytes = string, |
| 4005 | }), | 4005 | }), |
| 4006 | }); | 4006 | }); |
| 4007 | return @intToEnum(Index, ip.items.len - 1); | 4007 | return @enumFromInt(Index, ip.items.len - 1); |
| 4008 | } | 4008 | } |
| 4009 | 4009 | ||
| 4010 | try ip.extra.ensureUnusedCapacity( | 4010 | try ip.extra.ensureUnusedCapacity( |
| ... | @@ -4018,7 +4018,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -4018,7 +4018,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 4018 | }), | 4018 | }), |
| 4019 | }); | 4019 | }); |
| 4020 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, aggregate.storage.elems)); | 4020 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, aggregate.storage.elems)); |
| 4021 | if (sentinel != .none) ip.extra.appendAssumeCapacity(@enumToInt(sentinel)); | 4021 | if (sentinel != .none) ip.extra.appendAssumeCapacity(@intFromEnum(sentinel)); |
| 4022 | }, | 4022 | }, |
| 4023 | 4023 | ||
| 4024 | .un => |un| { | 4024 | .un => |un| { |
| ... | @@ -4046,7 +4046,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { | ... | @@ -4046,7 +4046,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, key: Key) Allocator.Error!Index { |
| 4046 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, memoized_call.arg_values)); | 4046 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, memoized_call.arg_values)); |
| 4047 | }, | 4047 | }, |
| 4048 | } | 4048 | } |
| 4049 | return @intToEnum(Index, ip.items.len - 1); | 4049 | return @enumFromInt(Index, ip.items.len - 1); |
| 4050 | } | 4050 | } |
| 4051 | 4051 | ||
| 4052 | /// Provides API for completing an enum type after calling `getIncompleteEnum`. | 4052 | /// Provides API for completing an enum type after calling `getIncompleteEnum`. |
| ... | @@ -4060,7 +4060,7 @@ pub const IncompleteEnumType = struct { | ... | @@ -4060,7 +4060,7 @@ pub const IncompleteEnumType = struct { |
| 4060 | 4060 | ||
| 4061 | pub fn setTagType(self: @This(), ip: *InternPool, tag_ty: Index) void { | 4061 | pub fn setTagType(self: @This(), ip: *InternPool, tag_ty: Index) void { |
| 4062 | assert(tag_ty == .noreturn_type or ip.isIntegerType(tag_ty)); | 4062 | assert(tag_ty == .noreturn_type or ip.isIntegerType(tag_ty)); |
| 4063 | ip.extra.items[self.tag_ty_index] = @enumToInt(tag_ty); | 4063 | ip.extra.items[self.tag_ty_index] = @intFromEnum(tag_ty); |
| 4064 | } | 4064 | } |
| 4065 | 4065 | ||
| 4066 | /// Returns the already-existing field with the same name, if any. | 4066 | /// Returns the already-existing field with the same name, if any. |
| ... | @@ -4070,7 +4070,7 @@ pub const IncompleteEnumType = struct { | ... | @@ -4070,7 +4070,7 @@ pub const IncompleteEnumType = struct { |
| 4070 | gpa: Allocator, | 4070 | gpa: Allocator, |
| 4071 | name: NullTerminatedString, | 4071 | name: NullTerminatedString, |
| 4072 | ) Allocator.Error!?u32 { | 4072 | ) Allocator.Error!?u32 { |
| 4073 | const map = &ip.maps.items[@enumToInt(self.names_map)]; | 4073 | const map = &ip.maps.items[@intFromEnum(self.names_map)]; |
| 4074 | const field_index = map.count(); | 4074 | const field_index = map.count(); |
| 4075 | const strings = ip.extra.items[self.names_start..][0..field_index]; | 4075 | const strings = ip.extra.items[self.names_start..][0..field_index]; |
| 4076 | const adapter: NullTerminatedString.Adapter = .{ | 4076 | const adapter: NullTerminatedString.Adapter = .{ |
| ... | @@ -4078,7 +4078,7 @@ pub const IncompleteEnumType = struct { | ... | @@ -4078,7 +4078,7 @@ pub const IncompleteEnumType = struct { |
| 4078 | }; | 4078 | }; |
| 4079 | const gop = try map.getOrPutAdapted(gpa, name, adapter); | 4079 | const gop = try map.getOrPutAdapted(gpa, name, adapter); |
| 4080 | if (gop.found_existing) return @intCast(u32, gop.index); | 4080 | if (gop.found_existing) return @intCast(u32, gop.index); |
| 4081 | ip.extra.items[self.names_start + field_index] = @enumToInt(name); | 4081 | ip.extra.items[self.names_start + field_index] = @intFromEnum(name); |
| 4082 | return null; | 4082 | return null; |
| 4083 | } | 4083 | } |
| 4084 | 4084 | ||
| ... | @@ -4090,8 +4090,8 @@ pub const IncompleteEnumType = struct { | ... | @@ -4090,8 +4090,8 @@ pub const IncompleteEnumType = struct { |
| 4090 | gpa: Allocator, | 4090 | gpa: Allocator, |
| 4091 | value: Index, | 4091 | value: Index, |
| 4092 | ) Allocator.Error!?u32 { | 4092 | ) Allocator.Error!?u32 { |
| 4093 | assert(ip.typeOf(value) == @intToEnum(Index, ip.extra.items[self.tag_ty_index])); | 4093 | assert(ip.typeOf(value) == @enumFromInt(Index, ip.extra.items[self.tag_ty_index])); |
| 4094 | const map = &ip.maps.items[@enumToInt(self.values_map.unwrap().?)]; | 4094 | const map = &ip.maps.items[@intFromEnum(self.values_map.unwrap().?)]; |
| 4095 | const field_index = map.count(); | 4095 | const field_index = map.count(); |
| 4096 | const indexes = ip.extra.items[self.values_start..][0..field_index]; | 4096 | const indexes = ip.extra.items[self.values_start..][0..field_index]; |
| 4097 | const adapter: Index.Adapter = .{ | 4097 | const adapter: Index.Adapter = .{ |
| ... | @@ -4099,7 +4099,7 @@ pub const IncompleteEnumType = struct { | ... | @@ -4099,7 +4099,7 @@ pub const IncompleteEnumType = struct { |
| 4099 | }; | 4099 | }; |
| 4100 | const gop = try map.getOrPutAdapted(gpa, value, adapter); | 4100 | const gop = try map.getOrPutAdapted(gpa, value, adapter); |
| 4101 | if (gop.found_existing) return @intCast(u32, gop.index); | 4101 | if (gop.found_existing) return @intCast(u32, gop.index); |
| 4102 | ip.extra.items[self.values_start + field_index] = @enumToInt(value); | 4102 | ip.extra.items[self.values_start + field_index] = @intFromEnum(value); |
| 4103 | return null; | 4103 | return null; |
| 4104 | } | 4104 | } |
| 4105 | }; | 4105 | }; |
| ... | @@ -4156,9 +4156,9 @@ fn getIncompleteEnumAuto( | ... | @@ -4156,9 +4156,9 @@ fn getIncompleteEnumAuto( |
| 4156 | .tag = .type_enum_auto, | 4156 | .tag = .type_enum_auto, |
| 4157 | .data = extra_index, | 4157 | .data = extra_index, |
| 4158 | }); | 4158 | }); |
| 4159 | ip.extra.appendNTimesAssumeCapacity(@enumToInt(Index.none), enum_type.fields_len); | 4159 | ip.extra.appendNTimesAssumeCapacity(@intFromEnum(Index.none), enum_type.fields_len); |
| 4160 | return .{ | 4160 | return .{ |
| 4161 | .index = @intToEnum(Index, ip.items.len - 1), | 4161 | .index = @enumFromInt(Index, ip.items.len - 1), |
| 4162 | .tag_ty_index = extra_index + std.meta.fieldIndex(EnumAuto, "int_tag_type").?, | 4162 | .tag_ty_index = extra_index + std.meta.fieldIndex(EnumAuto, "int_tag_type").?, |
| 4163 | .names_map = names_map, | 4163 | .names_map = names_map, |
| 4164 | .names_start = extra_index + extra_fields_len, | 4164 | .names_start = extra_index + extra_fields_len, |
| ... | @@ -4207,9 +4207,9 @@ fn getIncompleteEnumExplicit( | ... | @@ -4207,9 +4207,9 @@ fn getIncompleteEnumExplicit( |
| 4207 | .data = extra_index, | 4207 | .data = extra_index, |
| 4208 | }); | 4208 | }); |
| 4209 | // This is both fields and values (if present). | 4209 | // This is both fields and values (if present). |
| 4210 | ip.extra.appendNTimesAssumeCapacity(@enumToInt(Index.none), reserved_len); | 4210 | ip.extra.appendNTimesAssumeCapacity(@intFromEnum(Index.none), reserved_len); |
| 4211 | return .{ | 4211 | return .{ |
| 4212 | .index = @intToEnum(Index, ip.items.len - 1), | 4212 | .index = @enumFromInt(Index, ip.items.len - 1), |
| 4213 | .tag_ty_index = extra_index + std.meta.fieldIndex(EnumExplicit, "int_tag_type").?, | 4213 | .tag_ty_index = extra_index + std.meta.fieldIndex(EnumExplicit, "int_tag_type").?, |
| 4214 | .names_map = names_map, | 4214 | .names_map = names_map, |
| 4215 | .names_start = extra_index + extra_fields_len, | 4215 | .names_start = extra_index + extra_fields_len, |
| ... | @@ -4248,13 +4248,13 @@ pub fn finishGetEnum( | ... | @@ -4248,13 +4248,13 @@ pub fn finishGetEnum( |
| 4248 | }); | 4248 | }); |
| 4249 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.names)); | 4249 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.names)); |
| 4250 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.values)); | 4250 | ip.extra.appendSliceAssumeCapacity(@ptrCast([]const u32, enum_type.values)); |
| 4251 | return @intToEnum(Index, ip.items.len - 1); | 4251 | return @enumFromInt(Index, ip.items.len - 1); |
| 4252 | } | 4252 | } |
| 4253 | 4253 | ||
| 4254 | pub fn getIfExists(ip: *const InternPool, key: Key) ?Index { | 4254 | pub fn getIfExists(ip: *const InternPool, key: Key) ?Index { |
| 4255 | const adapter: KeyAdapter = .{ .intern_pool = ip }; | 4255 | const adapter: KeyAdapter = .{ .intern_pool = ip }; |
| 4256 | const index = ip.map.getIndexAdapted(key, adapter) orelse return null; | 4256 | const index = ip.map.getIndexAdapted(key, adapter) orelse return null; |
| 4257 | return @intToEnum(Index, index); | 4257 | return @enumFromInt(Index, index); |
| 4258 | } | 4258 | } |
| 4259 | 4259 | ||
| 4260 | pub fn getAssumeExists(ip: *const InternPool, key: Key) Index { | 4260 | pub fn getAssumeExists(ip: *const InternPool, key: Key) Index { |
| ... | @@ -4267,7 +4267,7 @@ fn addStringsToMap( | ... | @@ -4267,7 +4267,7 @@ fn addStringsToMap( |
| 4267 | map_index: MapIndex, | 4267 | map_index: MapIndex, |
| 4268 | strings: []const NullTerminatedString, | 4268 | strings: []const NullTerminatedString, |
| 4269 | ) Allocator.Error!void { | 4269 | ) Allocator.Error!void { |
| 4270 | const map = &ip.maps.items[@enumToInt(map_index)]; | 4270 | const map = &ip.maps.items[@intFromEnum(map_index)]; |
| 4271 | const adapter: NullTerminatedString.Adapter = .{ .strings = strings }; | 4271 | const adapter: NullTerminatedString.Adapter = .{ .strings = strings }; |
| 4272 | for (strings) |string| { | 4272 | for (strings) |string| { |
| 4273 | const gop = try map.getOrPutAdapted(gpa, string, adapter); | 4273 | const gop = try map.getOrPutAdapted(gpa, string, adapter); |
| ... | @@ -4281,7 +4281,7 @@ fn addIndexesToMap( | ... | @@ -4281,7 +4281,7 @@ fn addIndexesToMap( |
| 4281 | map_index: MapIndex, | 4281 | map_index: MapIndex, |
| 4282 | indexes: []const Index, | 4282 | indexes: []const Index, |
| 4283 | ) Allocator.Error!void { | 4283 | ) Allocator.Error!void { |
| 4284 | const map = &ip.maps.items[@enumToInt(map_index)]; | 4284 | const map = &ip.maps.items[@intFromEnum(map_index)]; |
| 4285 | const adapter: Index.Adapter = .{ .indexes = indexes }; | 4285 | const adapter: Index.Adapter = .{ .indexes = indexes }; |
| 4286 | for (indexes) |index| { | 4286 | for (indexes) |index| { |
| 4287 | const gop = try map.getOrPutAdapted(gpa, index, adapter); | 4287 | const gop = try map.getOrPutAdapted(gpa, index, adapter); |
| ... | @@ -4292,7 +4292,7 @@ fn addIndexesToMap( | ... | @@ -4292,7 +4292,7 @@ fn addIndexesToMap( |
| 4292 | fn addMap(ip: *InternPool, gpa: Allocator) Allocator.Error!MapIndex { | 4292 | fn addMap(ip: *InternPool, gpa: Allocator) Allocator.Error!MapIndex { |
| 4293 | const ptr = try ip.maps.addOne(gpa); | 4293 | const ptr = try ip.maps.addOne(gpa); |
| 4294 | ptr.* = .{}; | 4294 | ptr.* = .{}; |
| 4295 | return @intToEnum(MapIndex, ip.maps.items.len - 1); | 4295 | return @enumFromInt(MapIndex, ip.maps.items.len - 1); |
| 4296 | } | 4296 | } |
| 4297 | 4297 | ||
| 4298 | /// This operation only happens under compile error conditions. | 4298 | /// This operation only happens under compile error conditions. |
| ... | @@ -4324,22 +4324,22 @@ fn addExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { | ... | @@ -4324,22 +4324,22 @@ fn addExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { |
| 4324 | inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| { | 4324 | inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| { |
| 4325 | ip.extra.appendAssumeCapacity(switch (field.type) { | 4325 | ip.extra.appendAssumeCapacity(switch (field.type) { |
| 4326 | u32 => @field(extra, field.name), | 4326 | u32 => @field(extra, field.name), |
| 4327 | Index => @enumToInt(@field(extra, field.name)), | 4327 | Index => @intFromEnum(@field(extra, field.name)), |
| 4328 | Module.Decl.Index => @enumToInt(@field(extra, field.name)), | 4328 | Module.Decl.Index => @intFromEnum(@field(extra, field.name)), |
| 4329 | Module.Namespace.Index => @enumToInt(@field(extra, field.name)), | 4329 | Module.Namespace.Index => @intFromEnum(@field(extra, field.name)), |
| 4330 | Module.Namespace.OptionalIndex => @enumToInt(@field(extra, field.name)), | 4330 | Module.Namespace.OptionalIndex => @intFromEnum(@field(extra, field.name)), |
| 4331 | Module.Fn.Index => @enumToInt(@field(extra, field.name)), | 4331 | Module.Fn.Index => @intFromEnum(@field(extra, field.name)), |
| 4332 | MapIndex => @enumToInt(@field(extra, field.name)), | 4332 | MapIndex => @intFromEnum(@field(extra, field.name)), |
| 4333 | OptionalMapIndex => @enumToInt(@field(extra, field.name)), | 4333 | OptionalMapIndex => @intFromEnum(@field(extra, field.name)), |
| 4334 | RuntimeIndex => @enumToInt(@field(extra, field.name)), | 4334 | RuntimeIndex => @intFromEnum(@field(extra, field.name)), |
| 4335 | String => @enumToInt(@field(extra, field.name)), | 4335 | String => @intFromEnum(@field(extra, field.name)), |
| 4336 | NullTerminatedString => @enumToInt(@field(extra, field.name)), | 4336 | NullTerminatedString => @intFromEnum(@field(extra, field.name)), |
| 4337 | OptionalNullTerminatedString => @enumToInt(@field(extra, field.name)), | 4337 | OptionalNullTerminatedString => @intFromEnum(@field(extra, field.name)), |
| 4338 | i32 => @bitCast(u32, @field(extra, field.name)), | 4338 | i32 => @bitCast(u32, @field(extra, field.name)), |
| 4339 | Tag.TypePointer.Flags => @bitCast(u32, @field(extra, field.name)), | 4339 | Tag.TypePointer.Flags => @bitCast(u32, @field(extra, field.name)), |
| 4340 | TypeFunction.Flags => @bitCast(u32, @field(extra, field.name)), | 4340 | TypeFunction.Flags => @bitCast(u32, @field(extra, field.name)), |
| 4341 | Tag.TypePointer.PackedOffset => @bitCast(u32, @field(extra, field.name)), | 4341 | Tag.TypePointer.PackedOffset => @bitCast(u32, @field(extra, field.name)), |
| 4342 | Tag.TypePointer.VectorIndex => @enumToInt(@field(extra, field.name)), | 4342 | Tag.TypePointer.VectorIndex => @intFromEnum(@field(extra, field.name)), |
| 4343 | Tag.Variable.Flags => @bitCast(u32, @field(extra, field.name)), | 4343 | Tag.Variable.Flags => @bitCast(u32, @field(extra, field.name)), |
| 4344 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 4344 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 4345 | }); | 4345 | }); |
| ... | @@ -4365,7 +4365,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { | ... | @@ -4365,7 +4365,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 { |
| 4365 | inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| { | 4365 | inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| { |
| 4366 | const new: u32 = switch (field.type) { | 4366 | const new: u32 = switch (field.type) { |
| 4367 | u32 => @field(extra, field.name), | 4367 | u32 => @field(extra, field.name), |
| 4368 | Index => @enumToInt(@field(extra, field.name)), | 4368 | Index => @intFromEnum(@field(extra, field.name)), |
| 4369 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 4369 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 4370 | }; | 4370 | }; |
| 4371 | if (i % 2 == 0) { | 4371 | if (i % 2 == 0) { |
| ... | @@ -4392,22 +4392,22 @@ fn extraDataTrail(ip: *const InternPool, comptime T: type, index: usize) struct | ... | @@ -4392,22 +4392,22 @@ fn extraDataTrail(ip: *const InternPool, comptime T: type, index: usize) struct |
| 4392 | const int32 = ip.extra.items[i + index]; | 4392 | const int32 = ip.extra.items[i + index]; |
| 4393 | @field(result, field.name) = switch (field.type) { | 4393 | @field(result, field.name) = switch (field.type) { |
| 4394 | u32 => int32, | 4394 | u32 => int32, |
| 4395 | Index => @intToEnum(Index, int32), | 4395 | Index => @enumFromInt(Index, int32), |
| 4396 | Module.Decl.Index => @intToEnum(Module.Decl.Index, int32), | 4396 | Module.Decl.Index => @enumFromInt(Module.Decl.Index, int32), |
| 4397 | Module.Namespace.Index => @intToEnum(Module.Namespace.Index, int32), | 4397 | Module.Namespace.Index => @enumFromInt(Module.Namespace.Index, int32), |
| 4398 | Module.Namespace.OptionalIndex => @intToEnum(Module.Namespace.OptionalIndex, int32), | 4398 | Module.Namespace.OptionalIndex => @enumFromInt(Module.Namespace.OptionalIndex, int32), |
| 4399 | Module.Fn.Index => @intToEnum(Module.Fn.Index, int32), | 4399 | Module.Fn.Index => @enumFromInt(Module.Fn.Index, int32), |
| 4400 | MapIndex => @intToEnum(MapIndex, int32), | 4400 | MapIndex => @enumFromInt(MapIndex, int32), |
| 4401 | OptionalMapIndex => @intToEnum(OptionalMapIndex, int32), | 4401 | OptionalMapIndex => @enumFromInt(OptionalMapIndex, int32), |
| 4402 | RuntimeIndex => @intToEnum(RuntimeIndex, int32), | 4402 | RuntimeIndex => @enumFromInt(RuntimeIndex, int32), |
| 4403 | String => @intToEnum(String, int32), | 4403 | String => @enumFromInt(String, int32), |
| 4404 | NullTerminatedString => @intToEnum(NullTerminatedString, int32), | 4404 | NullTerminatedString => @enumFromInt(NullTerminatedString, int32), |
| 4405 | OptionalNullTerminatedString => @intToEnum(OptionalNullTerminatedString, int32), | 4405 | OptionalNullTerminatedString => @enumFromInt(OptionalNullTerminatedString, int32), |
| 4406 | i32 => @bitCast(i32, int32), | 4406 | i32 => @bitCast(i32, int32), |
| 4407 | Tag.TypePointer.Flags => @bitCast(Tag.TypePointer.Flags, int32), | 4407 | Tag.TypePointer.Flags => @bitCast(Tag.TypePointer.Flags, int32), |
| 4408 | TypeFunction.Flags => @bitCast(TypeFunction.Flags, int32), | 4408 | TypeFunction.Flags => @bitCast(TypeFunction.Flags, int32), |
| 4409 | Tag.TypePointer.PackedOffset => @bitCast(Tag.TypePointer.PackedOffset, int32), | 4409 | Tag.TypePointer.PackedOffset => @bitCast(Tag.TypePointer.PackedOffset, int32), |
| 4410 | Tag.TypePointer.VectorIndex => @intToEnum(Tag.TypePointer.VectorIndex, int32), | 4410 | Tag.TypePointer.VectorIndex => @enumFromInt(Tag.TypePointer.VectorIndex, int32), |
| 4411 | Tag.Variable.Flags => @bitCast(Tag.Variable.Flags, int32), | 4411 | Tag.Variable.Flags => @bitCast(Tag.Variable.Flags, int32), |
| 4412 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 4412 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 4413 | }; | 4413 | }; |
| ... | @@ -4439,7 +4439,7 @@ fn limbData(ip: *const InternPool, comptime T: type, index: usize) T { | ... | @@ -4439,7 +4439,7 @@ fn limbData(ip: *const InternPool, comptime T: type, index: usize) T { |
| 4439 | 4439 | ||
| 4440 | @field(result, field.name) = switch (field.type) { | 4440 | @field(result, field.name) = switch (field.type) { |
| 4441 | u32 => int32, | 4441 | u32 => int32, |
| 4442 | Index => @intToEnum(Index, int32), | 4442 | Index => @enumFromInt(Index, int32), |
| 4443 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 4443 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 4444 | }; | 4444 | }; |
| 4445 | } | 4445 | } |
| ... | @@ -4475,7 +4475,7 @@ fn limbsSliceToIndex(ip: *const InternPool, limbs: []const Limb) LimbsAsIndexes | ... | @@ -4475,7 +4475,7 @@ fn limbsSliceToIndex(ip: *const InternPool, limbs: []const Limb) LimbsAsIndexes |
| 4475 | }; | 4475 | }; |
| 4476 | // TODO: https://github.com/ziglang/zig/issues/1738 | 4476 | // TODO: https://github.com/ziglang/zig/issues/1738 |
| 4477 | return .{ | 4477 | return .{ |
| 4478 | .start = @intCast(u32, @divExact(@ptrToInt(limbs.ptr) - @ptrToInt(host_slice.ptr), @sizeOf(Limb))), | 4478 | .start = @intCast(u32, @divExact(@intFromPtr(limbs.ptr) - @intFromPtr(host_slice.ptr), @sizeOf(Limb))), |
| 4479 | .len = @intCast(u32, limbs.len), | 4479 | .len = @intCast(u32, limbs.len), |
| 4480 | }; | 4480 | }; |
| 4481 | } | 4481 | } |
| ... | @@ -4536,16 +4536,16 @@ pub fn slicePtrType(ip: *const InternPool, i: Index) Index { | ... | @@ -4536,16 +4536,16 @@ pub fn slicePtrType(ip: *const InternPool, i: Index) Index { |
| 4536 | .slice_const_u8_sentinel_0_type => return .manyptr_const_u8_sentinel_0_type, | 4536 | .slice_const_u8_sentinel_0_type => return .manyptr_const_u8_sentinel_0_type, |
| 4537 | else => {}, | 4537 | else => {}, |
| 4538 | } | 4538 | } |
| 4539 | const item = ip.items.get(@enumToInt(i)); | 4539 | const item = ip.items.get(@intFromEnum(i)); |
| 4540 | switch (item.tag) { | 4540 | switch (item.tag) { |
| 4541 | .type_slice => return @intToEnum(Index, item.data), | 4541 | .type_slice => return @enumFromInt(Index, item.data), |
| 4542 | else => unreachable, // not a slice type | 4542 | else => unreachable, // not a slice type |
| 4543 | } | 4543 | } |
| 4544 | } | 4544 | } |
| 4545 | 4545 | ||
| 4546 | /// Given a slice value, returns the value of the ptr field. | 4546 | /// Given a slice value, returns the value of the ptr field. |
| 4547 | pub fn slicePtr(ip: *const InternPool, i: Index) Index { | 4547 | pub fn slicePtr(ip: *const InternPool, i: Index) Index { |
| 4548 | const item = ip.items.get(@enumToInt(i)); | 4548 | const item = ip.items.get(@intFromEnum(i)); |
| 4549 | switch (item.tag) { | 4549 | switch (item.tag) { |
| 4550 | .ptr_slice => return ip.extraData(PtrSlice, item.data).ptr, | 4550 | .ptr_slice => return ip.extraData(PtrSlice, item.data).ptr, |
| 4551 | else => unreachable, // not a slice value | 4551 | else => unreachable, // not a slice value |
| ... | @@ -4554,7 +4554,7 @@ pub fn slicePtr(ip: *const InternPool, i: Index) Index { | ... | @@ -4554,7 +4554,7 @@ pub fn slicePtr(ip: *const InternPool, i: Index) Index { |
| 4554 | 4554 | ||
| 4555 | /// Given a slice value, returns the value of the len field. | 4555 | /// Given a slice value, returns the value of the len field. |
| 4556 | pub fn sliceLen(ip: *const InternPool, i: Index) Index { | 4556 | pub fn sliceLen(ip: *const InternPool, i: Index) Index { |
| 4557 | const item = ip.items.get(@enumToInt(i)); | 4557 | const item = ip.items.get(@intFromEnum(i)); |
| 4558 | switch (item.tag) { | 4558 | switch (item.tag) { |
| 4559 | .ptr_slice => return ip.extraData(PtrSlice, item.data).len, | 4559 | .ptr_slice => return ip.extraData(PtrSlice, item.data).len, |
| 4560 | else => unreachable, // not a slice value | 4560 | else => unreachable, // not a slice value |
| ... | @@ -4841,28 +4841,28 @@ pub fn getCoercedInts(ip: *InternPool, gpa: Allocator, int: Key.Int, new_ty: Ind | ... | @@ -4841,28 +4841,28 @@ pub fn getCoercedInts(ip: *InternPool, gpa: Allocator, int: Key.Int, new_ty: Ind |
| 4841 | pub fn indexToStructType(ip: *const InternPool, val: Index) Module.Struct.OptionalIndex { | 4841 | pub fn indexToStructType(ip: *const InternPool, val: Index) Module.Struct.OptionalIndex { |
| 4842 | assert(val != .none); | 4842 | assert(val != .none); |
| 4843 | const tags = ip.items.items(.tag); | 4843 | const tags = ip.items.items(.tag); |
| 4844 | if (tags[@enumToInt(val)] != .type_struct) return .none; | 4844 | if (tags[@intFromEnum(val)] != .type_struct) return .none; |
| 4845 | const datas = ip.items.items(.data); | 4845 | const datas = ip.items.items(.data); |
| 4846 | return @intToEnum(Module.Struct.Index, datas[@enumToInt(val)]).toOptional(); | 4846 | return @enumFromInt(Module.Struct.Index, datas[@intFromEnum(val)]).toOptional(); |
| 4847 | } | 4847 | } |
| 4848 | 4848 | ||
| 4849 | pub fn indexToUnionType(ip: *const InternPool, val: Index) Module.Union.OptionalIndex { | 4849 | pub fn indexToUnionType(ip: *const InternPool, val: Index) Module.Union.OptionalIndex { |
| 4850 | assert(val != .none); | 4850 | assert(val != .none); |
| 4851 | const tags = ip.items.items(.tag); | 4851 | const tags = ip.items.items(.tag); |
| 4852 | switch (tags[@enumToInt(val)]) { | 4852 | switch (tags[@intFromEnum(val)]) { |
| 4853 | .type_union_tagged, .type_union_untagged, .type_union_safety => {}, | 4853 | .type_union_tagged, .type_union_untagged, .type_union_safety => {}, |
| 4854 | else => return .none, | 4854 | else => return .none, |
| 4855 | } | 4855 | } |
| 4856 | const datas = ip.items.items(.data); | 4856 | const datas = ip.items.items(.data); |
| 4857 | return @intToEnum(Module.Union.Index, datas[@enumToInt(val)]).toOptional(); | 4857 | return @enumFromInt(Module.Union.Index, datas[@intFromEnum(val)]).toOptional(); |
| 4858 | } | 4858 | } |
| 4859 | 4859 | ||
| 4860 | pub fn indexToFuncType(ip: *const InternPool, val: Index) ?Key.FuncType { | 4860 | pub fn indexToFuncType(ip: *const InternPool, val: Index) ?Key.FuncType { |
| 4861 | assert(val != .none); | 4861 | assert(val != .none); |
| 4862 | const tags = ip.items.items(.tag); | 4862 | const tags = ip.items.items(.tag); |
| 4863 | const datas = ip.items.items(.data); | 4863 | const datas = ip.items.items(.data); |
| 4864 | switch (tags[@enumToInt(val)]) { | 4864 | switch (tags[@intFromEnum(val)]) { |
| 4865 | .type_function => return indexToKeyFuncType(ip, datas[@enumToInt(val)]), | 4865 | .type_function => return indexToKeyFuncType(ip, datas[@intFromEnum(val)]), |
| 4866 | else => return null, | 4866 | else => return null, |
| 4867 | } | 4867 | } |
| 4868 | } | 4868 | } |
| ... | @@ -4870,17 +4870,17 @@ pub fn indexToFuncType(ip: *const InternPool, val: Index) ?Key.FuncType { | ... | @@ -4870,17 +4870,17 @@ pub fn indexToFuncType(ip: *const InternPool, val: Index) ?Key.FuncType { |
| 4870 | pub fn indexToFunc(ip: *const InternPool, val: Index) Module.Fn.OptionalIndex { | 4870 | pub fn indexToFunc(ip: *const InternPool, val: Index) Module.Fn.OptionalIndex { |
| 4871 | assert(val != .none); | 4871 | assert(val != .none); |
| 4872 | const tags = ip.items.items(.tag); | 4872 | const tags = ip.items.items(.tag); |
| 4873 | if (tags[@enumToInt(val)] != .func) return .none; | 4873 | if (tags[@intFromEnum(val)] != .func) return .none; |
| 4874 | const datas = ip.items.items(.data); | 4874 | const datas = ip.items.items(.data); |
| 4875 | return ip.extraData(Tag.Func, datas[@enumToInt(val)]).index.toOptional(); | 4875 | return ip.extraData(Tag.Func, datas[@intFromEnum(val)]).index.toOptional(); |
| 4876 | } | 4876 | } |
| 4877 | 4877 | ||
| 4878 | pub fn indexToInferredErrorSetType(ip: *const InternPool, val: Index) Module.Fn.InferredErrorSet.OptionalIndex { | 4878 | pub fn indexToInferredErrorSetType(ip: *const InternPool, val: Index) Module.Fn.InferredErrorSet.OptionalIndex { |
| 4879 | assert(val != .none); | 4879 | assert(val != .none); |
| 4880 | const tags = ip.items.items(.tag); | 4880 | const tags = ip.items.items(.tag); |
| 4881 | if (tags[@enumToInt(val)] != .type_inferred_error_set) return .none; | 4881 | if (tags[@intFromEnum(val)] != .type_inferred_error_set) return .none; |
| 4882 | const datas = ip.items.items(.data); | 4882 | const datas = ip.items.items(.data); |
| 4883 | return @intToEnum(Module.Fn.InferredErrorSet.Index, datas[@enumToInt(val)]).toOptional(); | 4883 | return @enumFromInt(Module.Fn.InferredErrorSet.Index, datas[@intFromEnum(val)]).toOptional(); |
| 4884 | } | 4884 | } |
| 4885 | 4885 | ||
| 4886 | /// includes .comptime_int_type | 4886 | /// includes .comptime_int_type |
| ... | @@ -4956,9 +4956,9 @@ pub fn isAggregateType(ip: *const InternPool, ty: Index) bool { | ... | @@ -4956,9 +4956,9 @@ pub fn isAggregateType(ip: *const InternPool, ty: Index) bool { |
| 4956 | 4956 | ||
| 4957 | /// The is only legal because the initializer is not part of the hash. | 4957 | /// The is only legal because the initializer is not part of the hash. |
| 4958 | pub fn mutateVarInit(ip: *InternPool, index: Index, init_index: Index) void { | 4958 | pub fn mutateVarInit(ip: *InternPool, index: Index, init_index: Index) void { |
| 4959 | const item = ip.items.get(@enumToInt(index)); | 4959 | const item = ip.items.get(@intFromEnum(index)); |
| 4960 | assert(item.tag == .variable); | 4960 | assert(item.tag == .variable); |
| 4961 | ip.extra.items[item.data + std.meta.fieldIndex(Tag.Variable, "init").?] = @enumToInt(init_index); | 4961 | ip.extra.items[item.data + std.meta.fieldIndex(Tag.Variable, "init").?] = @intFromEnum(init_index); |
| 4962 | } | 4962 | } |
| 4963 | 4963 | ||
| 4964 | pub fn dump(ip: *const InternPool) void { | 4964 | pub fn dump(ip: *const InternPool) void { |
| ... | @@ -5038,7 +5038,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void { | ... | @@ -5038,7 +5038,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void { |
| 5038 | .type_enum_auto => @sizeOf(EnumAuto), | 5038 | .type_enum_auto => @sizeOf(EnumAuto), |
| 5039 | .type_opaque => @sizeOf(Key.OpaqueType), | 5039 | .type_opaque => @sizeOf(Key.OpaqueType), |
| 5040 | .type_struct => b: { | 5040 | .type_struct => b: { |
| 5041 | const struct_index = @intToEnum(Module.Struct.Index, data); | 5041 | const struct_index = @enumFromInt(Module.Struct.Index, data); |
| 5042 | const struct_obj = ip.structPtrConst(struct_index); | 5042 | const struct_obj = ip.structPtrConst(struct_index); |
| 5043 | break :b @sizeOf(Module.Struct) + | 5043 | break :b @sizeOf(Module.Struct) + |
| 5044 | @sizeOf(Module.Namespace) + | 5044 | @sizeOf(Module.Namespace) + |
| ... | @@ -5107,7 +5107,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void { | ... | @@ -5107,7 +5107,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void { |
| 5107 | const info = ip.extraData(Bytes, data); | 5107 | const info = ip.extraData(Bytes, data); |
| 5108 | const len = @intCast(u32, ip.aggregateTypeLenIncludingSentinel(info.ty)); | 5108 | const len = @intCast(u32, ip.aggregateTypeLenIncludingSentinel(info.ty)); |
| 5109 | break :b @sizeOf(Bytes) + len + | 5109 | break :b @sizeOf(Bytes) + len + |
| 5110 | @boolToInt(ip.string_bytes.items[@enumToInt(info.bytes) + len - 1] != 0); | 5110 | @intFromBool(ip.string_bytes.items[@intFromEnum(info.bytes) + len - 1] != 0); |
| 5111 | }, | 5111 | }, |
| 5112 | .aggregate => b: { | 5112 | .aggregate => b: { |
| 5113 | const info = ip.extraData(Tag.Aggregate, data); | 5113 | const info = ip.extraData(Tag.Aggregate, data); |
| ... | @@ -5162,8 +5162,8 @@ fn dumpAllFallible(ip: *const InternPool) anyerror!void { | ... | @@ -5162,8 +5162,8 @@ fn dumpAllFallible(ip: *const InternPool) anyerror!void { |
| 5162 | for (tags, datas, 0..) |tag, data, i| { | 5162 | for (tags, datas, 0..) |tag, data, i| { |
| 5163 | try w.print("${d} = {s}(", .{ i, @tagName(tag) }); | 5163 | try w.print("${d} = {s}(", .{ i, @tagName(tag) }); |
| 5164 | switch (tag) { | 5164 | switch (tag) { |
| 5165 | .simple_type => try w.print("{s}", .{@tagName(@intToEnum(SimpleType, data))}), | 5165 | .simple_type => try w.print("{s}", .{@tagName(@enumFromInt(SimpleType, data))}), |
| 5166 | .simple_value => try w.print("{s}", .{@tagName(@intToEnum(SimpleValue, data))}), | 5166 | .simple_value => try w.print("{s}", .{@tagName(@enumFromInt(SimpleValue, data))}), |
| 5167 | 5167 | ||
| 5168 | .type_int_signed, | 5168 | .type_int_signed, |
| 5169 | .type_int_unsigned, | 5169 | .type_int_unsigned, |
| ... | @@ -5246,11 +5246,11 @@ fn dumpAllFallible(ip: *const InternPool) anyerror!void { | ... | @@ -5246,11 +5246,11 @@ fn dumpAllFallible(ip: *const InternPool) anyerror!void { |
| 5246 | } | 5246 | } |
| 5247 | 5247 | ||
| 5248 | pub fn structPtr(ip: *InternPool, index: Module.Struct.Index) *Module.Struct { | 5248 | pub fn structPtr(ip: *InternPool, index: Module.Struct.Index) *Module.Struct { |
| 5249 | return ip.allocated_structs.at(@enumToInt(index)); | 5249 | return ip.allocated_structs.at(@intFromEnum(index)); |
| 5250 | } | 5250 | } |
| 5251 | 5251 | ||
| 5252 | pub fn structPtrConst(ip: *const InternPool, index: Module.Struct.Index) *const Module.Struct { | 5252 | pub fn structPtrConst(ip: *const InternPool, index: Module.Struct.Index) *const Module.Struct { |
| 5253 | return ip.allocated_structs.at(@enumToInt(index)); | 5253 | return ip.allocated_structs.at(@intFromEnum(index)); |
| 5254 | } | 5254 | } |
| 5255 | 5255 | ||
| 5256 | pub fn structPtrUnwrapConst(ip: *const InternPool, index: Module.Struct.OptionalIndex) ?*const Module.Struct { | 5256 | pub fn structPtrUnwrapConst(ip: *const InternPool, index: Module.Struct.OptionalIndex) ?*const Module.Struct { |
| ... | @@ -5258,27 +5258,27 @@ pub fn structPtrUnwrapConst(ip: *const InternPool, index: Module.Struct.Optional | ... | @@ -5258,27 +5258,27 @@ pub fn structPtrUnwrapConst(ip: *const InternPool, index: Module.Struct.Optional |
| 5258 | } | 5258 | } |
| 5259 | 5259 | ||
| 5260 | pub fn unionPtr(ip: *InternPool, index: Module.Union.Index) *Module.Union { | 5260 | pub fn unionPtr(ip: *InternPool, index: Module.Union.Index) *Module.Union { |
| 5261 | return ip.allocated_unions.at(@enumToInt(index)); | 5261 | return ip.allocated_unions.at(@intFromEnum(index)); |
| 5262 | } | 5262 | } |
| 5263 | 5263 | ||
| 5264 | pub fn unionPtrConst(ip: *const InternPool, index: Module.Union.Index) *const Module.Union { | 5264 | pub fn unionPtrConst(ip: *const InternPool, index: Module.Union.Index) *const Module.Union { |
| 5265 | return ip.allocated_unions.at(@enumToInt(index)); | 5265 | return ip.allocated_unions.at(@intFromEnum(index)); |
| 5266 | } | 5266 | } |
| 5267 | 5267 | ||
| 5268 | pub fn funcPtr(ip: *InternPool, index: Module.Fn.Index) *Module.Fn { | 5268 | pub fn funcPtr(ip: *InternPool, index: Module.Fn.Index) *Module.Fn { |
| 5269 | return ip.allocated_funcs.at(@enumToInt(index)); | 5269 | return ip.allocated_funcs.at(@intFromEnum(index)); |
| 5270 | } | 5270 | } |
| 5271 | 5271 | ||
| 5272 | pub fn funcPtrConst(ip: *const InternPool, index: Module.Fn.Index) *const Module.Fn { | 5272 | pub fn funcPtrConst(ip: *const InternPool, index: Module.Fn.Index) *const Module.Fn { |
| 5273 | return ip.allocated_funcs.at(@enumToInt(index)); | 5273 | return ip.allocated_funcs.at(@intFromEnum(index)); |
| 5274 | } | 5274 | } |
| 5275 | 5275 | ||
| 5276 | pub fn inferredErrorSetPtr(ip: *InternPool, index: Module.Fn.InferredErrorSet.Index) *Module.Fn.InferredErrorSet { | 5276 | pub fn inferredErrorSetPtr(ip: *InternPool, index: Module.Fn.InferredErrorSet.Index) *Module.Fn.InferredErrorSet { |
| 5277 | return ip.allocated_inferred_error_sets.at(@enumToInt(index)); | 5277 | return ip.allocated_inferred_error_sets.at(@intFromEnum(index)); |
| 5278 | } | 5278 | } |
| 5279 | 5279 | ||
| 5280 | pub fn inferredErrorSetPtrConst(ip: *const InternPool, index: Module.Fn.InferredErrorSet.Index) *const Module.Fn.InferredErrorSet { | 5280 | pub fn inferredErrorSetPtrConst(ip: *const InternPool, index: Module.Fn.InferredErrorSet.Index) *const Module.Fn.InferredErrorSet { |
| 5281 | return ip.allocated_inferred_error_sets.at(@enumToInt(index)); | 5281 | return ip.allocated_inferred_error_sets.at(@intFromEnum(index)); |
| 5282 | } | 5282 | } |
| 5283 | 5283 | ||
| 5284 | pub fn createStruct( | 5284 | pub fn createStruct( |
| ... | @@ -5287,12 +5287,12 @@ pub fn createStruct( | ... | @@ -5287,12 +5287,12 @@ pub fn createStruct( |
| 5287 | initialization: Module.Struct, | 5287 | initialization: Module.Struct, |
| 5288 | ) Allocator.Error!Module.Struct.Index { | 5288 | ) Allocator.Error!Module.Struct.Index { |
| 5289 | if (ip.structs_free_list.popOrNull()) |index| { | 5289 | if (ip.structs_free_list.popOrNull()) |index| { |
| 5290 | ip.allocated_structs.at(@enumToInt(index)).* = initialization; | 5290 | ip.allocated_structs.at(@intFromEnum(index)).* = initialization; |
| 5291 | return index; | 5291 | return index; |
| 5292 | } | 5292 | } |
| 5293 | const ptr = try ip.allocated_structs.addOne(gpa); | 5293 | const ptr = try ip.allocated_structs.addOne(gpa); |
| 5294 | ptr.* = initialization; | 5294 | ptr.* = initialization; |
| 5295 | return @intToEnum(Module.Struct.Index, ip.allocated_structs.len - 1); | 5295 | return @enumFromInt(Module.Struct.Index, ip.allocated_structs.len - 1); |
| 5296 | } | 5296 | } |
| 5297 | 5297 | ||
| 5298 | pub fn destroyStruct(ip: *InternPool, gpa: Allocator, index: Module.Struct.Index) void { | 5298 | pub fn destroyStruct(ip: *InternPool, gpa: Allocator, index: Module.Struct.Index) void { |
| ... | @@ -5309,12 +5309,12 @@ pub fn createUnion( | ... | @@ -5309,12 +5309,12 @@ pub fn createUnion( |
| 5309 | initialization: Module.Union, | 5309 | initialization: Module.Union, |
| 5310 | ) Allocator.Error!Module.Union.Index { | 5310 | ) Allocator.Error!Module.Union.Index { |
| 5311 | if (ip.unions_free_list.popOrNull()) |index| { | 5311 | if (ip.unions_free_list.popOrNull()) |index| { |
| 5312 | ip.allocated_unions.at(@enumToInt(index)).* = initialization; | 5312 | ip.allocated_unions.at(@intFromEnum(index)).* = initialization; |
| 5313 | return index; | 5313 | return index; |
| 5314 | } | 5314 | } |
| 5315 | const ptr = try ip.allocated_unions.addOne(gpa); | 5315 | const ptr = try ip.allocated_unions.addOne(gpa); |
| 5316 | ptr.* = initialization; | 5316 | ptr.* = initialization; |
| 5317 | return @intToEnum(Module.Union.Index, ip.allocated_unions.len - 1); | 5317 | return @enumFromInt(Module.Union.Index, ip.allocated_unions.len - 1); |
| 5318 | } | 5318 | } |
| 5319 | 5319 | ||
| 5320 | pub fn destroyUnion(ip: *InternPool, gpa: Allocator, index: Module.Union.Index) void { | 5320 | pub fn destroyUnion(ip: *InternPool, gpa: Allocator, index: Module.Union.Index) void { |
| ... | @@ -5331,12 +5331,12 @@ pub fn createFunc( | ... | @@ -5331,12 +5331,12 @@ pub fn createFunc( |
| 5331 | initialization: Module.Fn, | 5331 | initialization: Module.Fn, |
| 5332 | ) Allocator.Error!Module.Fn.Index { | 5332 | ) Allocator.Error!Module.Fn.Index { |
| 5333 | if (ip.funcs_free_list.popOrNull()) |index| { | 5333 | if (ip.funcs_free_list.popOrNull()) |index| { |
| 5334 | ip.allocated_funcs.at(@enumToInt(index)).* = initialization; | 5334 | ip.allocated_funcs.at(@intFromEnum(index)).* = initialization; |
| 5335 | return index; | 5335 | return index; |
| 5336 | } | 5336 | } |
| 5337 | const ptr = try ip.allocated_funcs.addOne(gpa); | 5337 | const ptr = try ip.allocated_funcs.addOne(gpa); |
| 5338 | ptr.* = initialization; | 5338 | ptr.* = initialization; |
| 5339 | return @intToEnum(Module.Fn.Index, ip.allocated_funcs.len - 1); | 5339 | return @enumFromInt(Module.Fn.Index, ip.allocated_funcs.len - 1); |
| 5340 | } | 5340 | } |
| 5341 | 5341 | ||
| 5342 | pub fn destroyFunc(ip: *InternPool, gpa: Allocator, index: Module.Fn.Index) void { | 5342 | pub fn destroyFunc(ip: *InternPool, gpa: Allocator, index: Module.Fn.Index) void { |
| ... | @@ -5353,12 +5353,12 @@ pub fn createInferredErrorSet( | ... | @@ -5353,12 +5353,12 @@ pub fn createInferredErrorSet( |
| 5353 | initialization: Module.Fn.InferredErrorSet, | 5353 | initialization: Module.Fn.InferredErrorSet, |
| 5354 | ) Allocator.Error!Module.Fn.InferredErrorSet.Index { | 5354 | ) Allocator.Error!Module.Fn.InferredErrorSet.Index { |
| 5355 | if (ip.inferred_error_sets_free_list.popOrNull()) |index| { | 5355 | if (ip.inferred_error_sets_free_list.popOrNull()) |index| { |
| 5356 | ip.allocated_inferred_error_sets.at(@enumToInt(index)).* = initialization; | 5356 | ip.allocated_inferred_error_sets.at(@intFromEnum(index)).* = initialization; |
| 5357 | return index; | 5357 | return index; |
| 5358 | } | 5358 | } |
| 5359 | const ptr = try ip.allocated_inferred_error_sets.addOne(gpa); | 5359 | const ptr = try ip.allocated_inferred_error_sets.addOne(gpa); |
| 5360 | ptr.* = initialization; | 5360 | ptr.* = initialization; |
| 5361 | return @intToEnum(Module.Fn.InferredErrorSet.Index, ip.allocated_inferred_error_sets.len - 1); | 5361 | return @enumFromInt(Module.Fn.InferredErrorSet.Index, ip.allocated_inferred_error_sets.len - 1); |
| 5362 | } | 5362 | } |
| 5363 | 5363 | ||
| 5364 | pub fn destroyInferredErrorSet(ip: *InternPool, gpa: Allocator, index: Module.Fn.InferredErrorSet.Index) void { | 5364 | pub fn destroyInferredErrorSet(ip: *InternPool, gpa: Allocator, index: Module.Fn.InferredErrorSet.Index) void { |
| ... | @@ -5425,11 +5425,11 @@ pub fn getOrPutTrailingString( | ... | @@ -5425,11 +5425,11 @@ pub fn getOrPutTrailingString( |
| 5425 | }); | 5425 | }); |
| 5426 | if (gop.found_existing) { | 5426 | if (gop.found_existing) { |
| 5427 | string_bytes.shrinkRetainingCapacity(str_index); | 5427 | string_bytes.shrinkRetainingCapacity(str_index); |
| 5428 | return @intToEnum(NullTerminatedString, gop.key_ptr.*); | 5428 | return @enumFromInt(NullTerminatedString, gop.key_ptr.*); |
| 5429 | } else { | 5429 | } else { |
| 5430 | gop.key_ptr.* = str_index; | 5430 | gop.key_ptr.* = str_index; |
| 5431 | string_bytes.appendAssumeCapacity(0); | 5431 | string_bytes.appendAssumeCapacity(0); |
| 5432 | return @intToEnum(NullTerminatedString, str_index); | 5432 | return @enumFromInt(NullTerminatedString, str_index); |
| 5433 | } | 5433 | } |
| 5434 | } | 5434 | } |
| 5435 | 5435 | ||
| ... | @@ -5437,7 +5437,7 @@ pub fn getString(ip: *InternPool, s: []const u8) OptionalNullTerminatedString { | ... | @@ -5437,7 +5437,7 @@ pub fn getString(ip: *InternPool, s: []const u8) OptionalNullTerminatedString { |
| 5437 | if (ip.string_table.getKeyAdapted(s, std.hash_map.StringIndexAdapter{ | 5437 | if (ip.string_table.getKeyAdapted(s, std.hash_map.StringIndexAdapter{ |
| 5438 | .bytes = &ip.string_bytes, | 5438 | .bytes = &ip.string_bytes, |
| 5439 | })) |index| { | 5439 | })) |index| { |
| 5440 | return @intToEnum(NullTerminatedString, index).toOptional(); | 5440 | return @enumFromInt(NullTerminatedString, index).toOptional(); |
| 5441 | } else { | 5441 | } else { |
| 5442 | return .none; | 5442 | return .none; |
| 5443 | } | 5443 | } |
| ... | @@ -5445,7 +5445,7 @@ pub fn getString(ip: *InternPool, s: []const u8) OptionalNullTerminatedString { | ... | @@ -5445,7 +5445,7 @@ pub fn getString(ip: *InternPool, s: []const u8) OptionalNullTerminatedString { |
| 5445 | 5445 | ||
| 5446 | pub fn stringToSlice(ip: *const InternPool, s: NullTerminatedString) [:0]const u8 { | 5446 | pub fn stringToSlice(ip: *const InternPool, s: NullTerminatedString) [:0]const u8 { |
| 5447 | const string_bytes = ip.string_bytes.items; | 5447 | const string_bytes = ip.string_bytes.items; |
| 5448 | const start = @enumToInt(s); | 5448 | const start = @intFromEnum(s); |
| 5449 | var end: usize = start; | 5449 | var end: usize = start; |
| 5450 | while (string_bytes[end] != 0) end += 1; | 5450 | while (string_bytes[end] != 0) end += 1; |
| 5451 | return string_bytes[start..end :0]; | 5451 | return string_bytes[start..end :0]; |
| ... | @@ -5543,7 +5543,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -5543,7 +5543,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 5543 | 5543 | ||
| 5544 | // This optimization on tags is needed so that indexToKey can call | 5544 | // This optimization on tags is needed so that indexToKey can call |
| 5545 | // typeOf without being recursive. | 5545 | // typeOf without being recursive. |
| 5546 | _ => switch (ip.items.items(.tag)[@enumToInt(index)]) { | 5546 | _ => switch (ip.items.items(.tag)[@intFromEnum(index)]) { |
| 5547 | .type_int_signed, | 5547 | .type_int_signed, |
| 5548 | .type_int_unsigned, | 5548 | .type_int_unsigned, |
| 5549 | .type_array_big, | 5549 | .type_array_big, |
| ... | @@ -5574,7 +5574,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -5574,7 +5574,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 5574 | .undef, | 5574 | .undef, |
| 5575 | .opt_null, | 5575 | .opt_null, |
| 5576 | .only_possible_value, | 5576 | .only_possible_value, |
| 5577 | => @intToEnum(Index, ip.items.items(.data)[@enumToInt(index)]), | 5577 | => @enumFromInt(Index, ip.items.items(.data)[@intFromEnum(index)]), |
| 5578 | 5578 | ||
| 5579 | .simple_value => unreachable, // handled via Index above | 5579 | .simple_value => unreachable, // handled via Index above |
| 5580 | 5580 | ||
| ... | @@ -5604,9 +5604,9 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -5604,9 +5604,9 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 5604 | .aggregate, | 5604 | .aggregate, |
| 5605 | .repeated, | 5605 | .repeated, |
| 5606 | => |t| { | 5606 | => |t| { |
| 5607 | const extra_index = ip.items.items(.data)[@enumToInt(index)]; | 5607 | const extra_index = ip.items.items(.data)[@intFromEnum(index)]; |
| 5608 | const field_index = std.meta.fieldIndex(t.Payload(), "ty").?; | 5608 | const field_index = std.meta.fieldIndex(t.Payload(), "ty").?; |
| 5609 | return @intToEnum(Index, ip.extra.items[extra_index + field_index]); | 5609 | return @enumFromInt(Index, ip.extra.items[extra_index + field_index]); |
| 5610 | }, | 5610 | }, |
| 5611 | 5611 | ||
| 5612 | .int_u8 => .u8_type, | 5612 | .int_u8 => .u8_type, |
| ... | @@ -5622,7 +5622,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -5622,7 +5622,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 5622 | // Note these are stored in limbs data, not extra data. | 5622 | // Note these are stored in limbs data, not extra data. |
| 5623 | .int_positive, | 5623 | .int_positive, |
| 5624 | .int_negative, | 5624 | .int_negative, |
| 5625 | => ip.limbData(Int, ip.items.items(.data)[@enumToInt(index)]).ty, | 5625 | => ip.limbData(Int, ip.items.items(.data)[@intFromEnum(index)]).ty, |
| 5626 | 5626 | ||
| 5627 | .enum_literal => .enum_literal_type, | 5627 | .enum_literal => .enum_literal_type, |
| 5628 | .float_f16 => .f16_type, | 5628 | .float_f16 => .f16_type, |
| ... | @@ -5648,7 +5648,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { | ... | @@ -5648,7 +5648,7 @@ pub fn typeOf(ip: *const InternPool, index: Index) Index { |
| 5648 | /// Assumes that the enum's field indexes equal its value tags. | 5648 | /// Assumes that the enum's field indexes equal its value tags. |
| 5649 | pub fn toEnum(ip: *const InternPool, comptime E: type, i: Index) E { | 5649 | pub fn toEnum(ip: *const InternPool, comptime E: type, i: Index) E { |
| 5650 | const int = ip.indexToKey(i).enum_tag.int; | 5650 | const int = ip.indexToKey(i).enum_tag.int; |
| 5651 | return @intToEnum(E, ip.indexToKey(int).int.storage.u64); | 5651 | return @enumFromInt(E, ip.indexToKey(int).int.storage.u64); |
| 5652 | } | 5652 | } |
| 5653 | 5653 | ||
| 5654 | pub fn aggregateTypeLen(ip: *const InternPool, ty: Index) u64 { | 5654 | pub fn aggregateTypeLen(ip: *const InternPool, ty: Index) u64 { |
| ... | @@ -5665,7 +5665,7 @@ pub fn aggregateTypeLenIncludingSentinel(ip: *const InternPool, ty: Index) u64 { | ... | @@ -5665,7 +5665,7 @@ pub fn aggregateTypeLenIncludingSentinel(ip: *const InternPool, ty: Index) u64 { |
| 5665 | return switch (ip.indexToKey(ty)) { | 5665 | return switch (ip.indexToKey(ty)) { |
| 5666 | .struct_type => |struct_type| ip.structPtrConst(struct_type.index.unwrap() orelse return 0).fields.count(), | 5666 | .struct_type => |struct_type| ip.structPtrConst(struct_type.index.unwrap() orelse return 0).fields.count(), |
| 5667 | .anon_struct_type => |anon_struct_type| anon_struct_type.types.len, | 5667 | .anon_struct_type => |anon_struct_type| anon_struct_type.types.len, |
| 5668 | .array_type => |array_type| array_type.len + @boolToInt(array_type.sentinel != .none), | 5668 | .array_type => |array_type| array_type.len + @intFromBool(array_type.sentinel != .none), |
| 5669 | .vector_type => |vector_type| vector_type.len, | 5669 | .vector_type => |vector_type| vector_type.len, |
| 5670 | else => unreachable, | 5670 | else => unreachable, |
| 5671 | }; | 5671 | }; |
| ... | @@ -5783,7 +5783,7 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois | ... | @@ -5783,7 +5783,7 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois |
| 5783 | 5783 | ||
| 5784 | .var_args_param_type => unreachable, // special tag | 5784 | .var_args_param_type => unreachable, // special tag |
| 5785 | 5785 | ||
| 5786 | _ => switch (ip.items.items(.tag)[@enumToInt(index)]) { | 5786 | _ => switch (ip.items.items(.tag)[@intFromEnum(index)]) { |
| 5787 | .type_int_signed, | 5787 | .type_int_signed, |
| 5788 | .type_int_unsigned, | 5788 | .type_int_unsigned, |
| 5789 | => .Int, | 5789 | => .Int, |
src/Liveness.zig+1-1| ... | @@ -1286,7 +1286,7 @@ fn analyzeOperands( | ... | @@ -1286,7 +1286,7 @@ fn analyzeOperands( |
| 1286 | break :blk true; | 1286 | break :blk true; |
| 1287 | }; | 1287 | }; |
| 1288 | 1288 | ||
| 1289 | var tomb_bits: Bpi = @as(Bpi, @boolToInt(immediate_death)) << (bpi - 1); | 1289 | var tomb_bits: Bpi = @as(Bpi, @intFromBool(immediate_death)) << (bpi - 1); |
| 1290 | 1290 | ||
| 1291 | // If our result is unused and the instruction doesn't need to be lowered, backends will | 1291 | // If our result is unused and the instruction doesn't need to be lowered, backends will |
| 1292 | // skip the lowering of this instruction, so we don't want to record uses of operands. | 1292 | // skip the lowering of this instruction, so we don't want to record uses of operands. |
src/Manifest.zig+4-4| ... | @@ -39,7 +39,7 @@ pub const multihash_function: MultihashFunction = switch (Hash) { | ... | @@ -39,7 +39,7 @@ pub const multihash_function: MultihashFunction = switch (Hash) { |
| 39 | comptime { | 39 | comptime { |
| 40 | // We avoid unnecessary uleb128 code in hexDigest by asserting here the | 40 | // We avoid unnecessary uleb128 code in hexDigest by asserting here the |
| 41 | // values are small enough to be contained in the one-byte encoding. | 41 | // values are small enough to be contained in the one-byte encoding. |
| 42 | assert(@enumToInt(multihash_function) < 127); | 42 | assert(@intFromEnum(multihash_function) < 127); |
| 43 | assert(Hash.digest_length < 127); | 43 | assert(Hash.digest_length < 127); |
| 44 | } | 44 | } |
| 45 | pub const multihash_len = 1 + 1 + Hash.digest_length; | 45 | pub const multihash_len = 1 + 1 + Hash.digest_length; |
| ... | @@ -117,8 +117,8 @@ test hex64 { | ... | @@ -117,8 +117,8 @@ test hex64 { |
| 117 | pub fn hexDigest(digest: [Hash.digest_length]u8) [multihash_len * 2]u8 { | 117 | pub fn hexDigest(digest: [Hash.digest_length]u8) [multihash_len * 2]u8 { |
| 118 | var result: [multihash_len * 2]u8 = undefined; | 118 | var result: [multihash_len * 2]u8 = undefined; |
| 119 | 119 | ||
| 120 | result[0] = hex_charset[@enumToInt(multihash_function) >> 4]; | 120 | result[0] = hex_charset[@intFromEnum(multihash_function) >> 4]; |
| 121 | result[1] = hex_charset[@enumToInt(multihash_function) & 15]; | 121 | result[1] = hex_charset[@intFromEnum(multihash_function) & 15]; |
| 122 | 122 | ||
| 123 | result[2] = hex_charset[Hash.digest_length >> 4]; | 123 | result[2] = hex_charset[Hash.digest_length >> 4]; |
| 124 | result[3] = hex_charset[Hash.digest_length & 15]; | 124 | result[3] = hex_charset[Hash.digest_length & 15]; |
| ... | @@ -284,7 +284,7 @@ const Parse = struct { | ... | @@ -284,7 +284,7 @@ const Parse = struct { |
| 284 | @errorName(err), | 284 | @errorName(err), |
| 285 | }); | 285 | }); |
| 286 | }; | 286 | }; |
| 287 | if (@intToEnum(MultihashFunction, their_multihash_func) != multihash_function) { | 287 | if (@enumFromInt(MultihashFunction, their_multihash_func) != multihash_function) { |
| 288 | return fail(p, tok, "unsupported hash function: only sha2-256 is supported", .{}); | 288 | return fail(p, tok, "unsupported hash function: only sha2-256 is supported", .{}); |
| 289 | } | 289 | } |
| 290 | } | 290 | } |
src/Module.zig+50-50| ... | @@ -223,7 +223,7 @@ pub const MonomorphedFuncsContext = struct { | ... | @@ -223,7 +223,7 @@ pub const MonomorphedFuncsContext = struct { |
| 223 | 223 | ||
| 224 | pub fn hash(ctx: @This(), key: MonomorphedFuncKey) u64 { | 224 | pub fn hash(ctx: @This(), key: MonomorphedFuncKey) u64 { |
| 225 | const key_args = ctx.mod.monomorphed_func_keys.items[key.args_index..][0..key.args_len]; | 225 | const key_args = ctx.mod.monomorphed_func_keys.items[key.args_index..][0..key.args_len]; |
| 226 | return std.hash.Wyhash.hash(@enumToInt(key.func), std.mem.sliceAsBytes(key_args)); | 226 | return std.hash.Wyhash.hash(@intFromEnum(key.func), std.mem.sliceAsBytes(key_args)); |
| 227 | } | 227 | } |
| 228 | }; | 228 | }; |
| 229 | 229 | ||
| ... | @@ -236,7 +236,7 @@ pub const MonomorphedFuncsAdaptedContext = struct { | ... | @@ -236,7 +236,7 @@ pub const MonomorphedFuncsAdaptedContext = struct { |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | pub fn hash(_: @This(), adapted_key: MonomorphedFuncAdaptedKey) u64 { | 238 | pub fn hash(_: @This(), adapted_key: MonomorphedFuncAdaptedKey) u64 { |
| 239 | return std.hash.Wyhash.hash(@enumToInt(adapted_key.func), std.mem.sliceAsBytes(adapted_key.args)); | 239 | return std.hash.Wyhash.hash(@intFromEnum(adapted_key.func), std.mem.sliceAsBytes(adapted_key.args)); |
| 240 | } | 240 | } |
| 241 | }; | 241 | }; |
| 242 | 242 | ||
| ... | @@ -263,7 +263,7 @@ pub const GlobalEmitH = struct { | ... | @@ -263,7 +263,7 @@ pub const GlobalEmitH = struct { |
| 263 | allocated_emit_h: std.SegmentedList(EmitH, 0) = .{}, | 263 | allocated_emit_h: std.SegmentedList(EmitH, 0) = .{}, |
| 264 | 264 | ||
| 265 | pub fn declPtr(global_emit_h: *GlobalEmitH, decl_index: Decl.Index) *EmitH { | 265 | pub fn declPtr(global_emit_h: *GlobalEmitH, decl_index: Decl.Index) *EmitH { |
| 266 | return global_emit_h.allocated_emit_h.at(@enumToInt(decl_index)); | 266 | return global_emit_h.allocated_emit_h.at(@intFromEnum(decl_index)); |
| 267 | } | 267 | } |
| 268 | }; | 268 | }; |
| 269 | 269 | ||
| ... | @@ -553,7 +553,7 @@ pub const Decl = struct { | ... | @@ -553,7 +553,7 @@ pub const Decl = struct { |
| 553 | _, | 553 | _, |
| 554 | 554 | ||
| 555 | pub fn toOptional(i: Index) OptionalIndex { | 555 | pub fn toOptional(i: Index) OptionalIndex { |
| 556 | return @intToEnum(OptionalIndex, @enumToInt(i)); | 556 | return @enumFromInt(OptionalIndex, @intFromEnum(i)); |
| 557 | } | 557 | } |
| 558 | }; | 558 | }; |
| 559 | 559 | ||
| ... | @@ -562,12 +562,12 @@ pub const Decl = struct { | ... | @@ -562,12 +562,12 @@ pub const Decl = struct { |
| 562 | _, | 562 | _, |
| 563 | 563 | ||
| 564 | pub fn init(oi: ?Index) OptionalIndex { | 564 | pub fn init(oi: ?Index) OptionalIndex { |
| 565 | return @intToEnum(OptionalIndex, @enumToInt(oi orelse return .none)); | 565 | return @enumFromInt(OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | pub fn unwrap(oi: OptionalIndex) ?Index { | 568 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 569 | if (oi == .none) return null; | 569 | if (oi == .none) return null; |
| 570 | return @intToEnum(Index, @enumToInt(oi)); | 570 | return @enumFromInt(Index, @intFromEnum(oi)); |
| 571 | } | 571 | } |
| 572 | }; | 572 | }; |
| 573 | 573 | ||
| ... | @@ -632,23 +632,23 @@ pub const Decl = struct { | ... | @@ -632,23 +632,23 @@ pub const Decl = struct { |
| 632 | if (!decl.has_align) return .none; | 632 | if (!decl.has_align) return .none; |
| 633 | assert(decl.zir_decl_index != 0); | 633 | assert(decl.zir_decl_index != 0); |
| 634 | const zir = decl.getFileScope(mod).zir; | 634 | const zir = decl.getFileScope(mod).zir; |
| 635 | return @intToEnum(Zir.Inst.Ref, zir.extra[decl.zir_decl_index + 8]); | 635 | return @enumFromInt(Zir.Inst.Ref, zir.extra[decl.zir_decl_index + 8]); |
| 636 | } | 636 | } |
| 637 | 637 | ||
| 638 | pub fn zirLinksectionRef(decl: Decl, mod: *Module) Zir.Inst.Ref { | 638 | pub fn zirLinksectionRef(decl: Decl, mod: *Module) Zir.Inst.Ref { |
| 639 | if (!decl.has_linksection_or_addrspace) return .none; | 639 | if (!decl.has_linksection_or_addrspace) return .none; |
| 640 | assert(decl.zir_decl_index != 0); | 640 | assert(decl.zir_decl_index != 0); |
| 641 | const zir = decl.getFileScope(mod).zir; | 641 | const zir = decl.getFileScope(mod).zir; |
| 642 | const extra_index = decl.zir_decl_index + 8 + @boolToInt(decl.has_align); | 642 | const extra_index = decl.zir_decl_index + 8 + @intFromBool(decl.has_align); |
| 643 | return @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 643 | return @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | pub fn zirAddrspaceRef(decl: Decl, mod: *Module) Zir.Inst.Ref { | 646 | pub fn zirAddrspaceRef(decl: Decl, mod: *Module) Zir.Inst.Ref { |
| 647 | if (!decl.has_linksection_or_addrspace) return .none; | 647 | if (!decl.has_linksection_or_addrspace) return .none; |
| 648 | assert(decl.zir_decl_index != 0); | 648 | assert(decl.zir_decl_index != 0); |
| 649 | const zir = decl.getFileScope(mod).zir; | 649 | const zir = decl.getFileScope(mod).zir; |
| 650 | const extra_index = decl.zir_decl_index + 8 + @boolToInt(decl.has_align) + 1; | 650 | const extra_index = decl.zir_decl_index + 8 + @intFromBool(decl.has_align) + 1; |
| 651 | return @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 651 | return @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 652 | } | 652 | } |
| 653 | 653 | ||
| 654 | pub fn relativeToLine(decl: Decl, offset: u32) u32 { | 654 | pub fn relativeToLine(decl: Decl, offset: u32) u32 { |
| ... | @@ -831,7 +831,7 @@ pub const Decl = struct { | ... | @@ -831,7 +831,7 @@ pub const Decl = struct { |
| 831 | decl.scope.sub_file_path, | 831 | decl.scope.sub_file_path, |
| 832 | loc.line + 1, | 832 | loc.line + 1, |
| 833 | loc.column + 1, | 833 | loc.column + 1, |
| 834 | @enumToInt(decl.name), | 834 | @intFromEnum(decl.name), |
| 835 | @tagName(decl.analysis), | 835 | @tagName(decl.analysis), |
| 836 | }); | 836 | }); |
| 837 | if (decl.has_tv) { | 837 | if (decl.has_tv) { |
| ... | @@ -927,7 +927,7 @@ pub const Struct = struct { | ... | @@ -927,7 +927,7 @@ pub const Struct = struct { |
| 927 | _, | 927 | _, |
| 928 | 928 | ||
| 929 | pub fn toOptional(i: Index) OptionalIndex { | 929 | pub fn toOptional(i: Index) OptionalIndex { |
| 930 | return @intToEnum(OptionalIndex, @enumToInt(i)); | 930 | return @enumFromInt(OptionalIndex, @intFromEnum(i)); |
| 931 | } | 931 | } |
| 932 | }; | 932 | }; |
| 933 | 933 | ||
| ... | @@ -936,12 +936,12 @@ pub const Struct = struct { | ... | @@ -936,12 +936,12 @@ pub const Struct = struct { |
| 936 | _, | 936 | _, |
| 937 | 937 | ||
| 938 | pub fn init(oi: ?Index) OptionalIndex { | 938 | pub fn init(oi: ?Index) OptionalIndex { |
| 939 | return @intToEnum(OptionalIndex, @enumToInt(oi orelse return .none)); | 939 | return @enumFromInt(OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | pub fn unwrap(oi: OptionalIndex) ?Index { | 942 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 943 | if (oi == .none) return null; | 943 | if (oi == .none) return null; |
| 944 | return @intToEnum(Index, @enumToInt(oi)); | 944 | return @enumFromInt(Index, @intFromEnum(oi)); |
| 945 | } | 945 | } |
| 946 | }; | 946 | }; |
| 947 | 947 | ||
| ... | @@ -1128,7 +1128,7 @@ pub const Union = struct { | ... | @@ -1128,7 +1128,7 @@ pub const Union = struct { |
| 1128 | _, | 1128 | _, |
| 1129 | 1129 | ||
| 1130 | pub fn toOptional(i: Index) OptionalIndex { | 1130 | pub fn toOptional(i: Index) OptionalIndex { |
| 1131 | return @intToEnum(OptionalIndex, @enumToInt(i)); | 1131 | return @enumFromInt(OptionalIndex, @intFromEnum(i)); |
| 1132 | } | 1132 | } |
| 1133 | }; | 1133 | }; |
| 1134 | 1134 | ||
| ... | @@ -1137,12 +1137,12 @@ pub const Union = struct { | ... | @@ -1137,12 +1137,12 @@ pub const Union = struct { |
| 1137 | _, | 1137 | _, |
| 1138 | 1138 | ||
| 1139 | pub fn init(oi: ?Index) OptionalIndex { | 1139 | pub fn init(oi: ?Index) OptionalIndex { |
| 1140 | return @intToEnum(OptionalIndex, @enumToInt(oi orelse return .none)); | 1140 | return @enumFromInt(OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 1141 | } | 1141 | } |
| 1142 | 1142 | ||
| 1143 | pub fn unwrap(oi: OptionalIndex) ?Index { | 1143 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 1144 | if (oi == .none) return null; | 1144 | if (oi == .none) return null; |
| 1145 | return @intToEnum(Index, @enumToInt(oi)); | 1145 | return @enumFromInt(Index, @intFromEnum(oi)); |
| 1146 | } | 1146 | } |
| 1147 | }; | 1147 | }; |
| 1148 | 1148 | ||
| ... | @@ -1424,7 +1424,7 @@ pub const Fn = struct { | ... | @@ -1424,7 +1424,7 @@ pub const Fn = struct { |
| 1424 | _, | 1424 | _, |
| 1425 | 1425 | ||
| 1426 | pub fn toOptional(i: Index) OptionalIndex { | 1426 | pub fn toOptional(i: Index) OptionalIndex { |
| 1427 | return @intToEnum(OptionalIndex, @enumToInt(i)); | 1427 | return @enumFromInt(OptionalIndex, @intFromEnum(i)); |
| 1428 | } | 1428 | } |
| 1429 | }; | 1429 | }; |
| 1430 | 1430 | ||
| ... | @@ -1433,12 +1433,12 @@ pub const Fn = struct { | ... | @@ -1433,12 +1433,12 @@ pub const Fn = struct { |
| 1433 | _, | 1433 | _, |
| 1434 | 1434 | ||
| 1435 | pub fn init(oi: ?Index) OptionalIndex { | 1435 | pub fn init(oi: ?Index) OptionalIndex { |
| 1436 | return @intToEnum(OptionalIndex, @enumToInt(oi orelse return .none)); | 1436 | return @enumFromInt(OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 1437 | } | 1437 | } |
| 1438 | 1438 | ||
| 1439 | pub fn unwrap(oi: OptionalIndex) ?Index { | 1439 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 1440 | if (oi == .none) return null; | 1440 | if (oi == .none) return null; |
| 1441 | return @intToEnum(Index, @enumToInt(oi)); | 1441 | return @enumFromInt(Index, @intFromEnum(oi)); |
| 1442 | } | 1442 | } |
| 1443 | }; | 1443 | }; |
| 1444 | 1444 | ||
| ... | @@ -1492,7 +1492,7 @@ pub const Fn = struct { | ... | @@ -1492,7 +1492,7 @@ pub const Fn = struct { |
| 1492 | _, | 1492 | _, |
| 1493 | 1493 | ||
| 1494 | pub fn toOptional(i: InferredErrorSet.Index) InferredErrorSet.OptionalIndex { | 1494 | pub fn toOptional(i: InferredErrorSet.Index) InferredErrorSet.OptionalIndex { |
| 1495 | return @intToEnum(InferredErrorSet.OptionalIndex, @enumToInt(i)); | 1495 | return @enumFromInt(InferredErrorSet.OptionalIndex, @intFromEnum(i)); |
| 1496 | } | 1496 | } |
| 1497 | }; | 1497 | }; |
| 1498 | 1498 | ||
| ... | @@ -1501,12 +1501,12 @@ pub const Fn = struct { | ... | @@ -1501,12 +1501,12 @@ pub const Fn = struct { |
| 1501 | _, | 1501 | _, |
| 1502 | 1502 | ||
| 1503 | pub fn init(oi: ?InferredErrorSet.Index) InferredErrorSet.OptionalIndex { | 1503 | pub fn init(oi: ?InferredErrorSet.Index) InferredErrorSet.OptionalIndex { |
| 1504 | return @intToEnum(InferredErrorSet.OptionalIndex, @enumToInt(oi orelse return .none)); | 1504 | return @enumFromInt(InferredErrorSet.OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 1505 | } | 1505 | } |
| 1506 | 1506 | ||
| 1507 | pub fn unwrap(oi: InferredErrorSet.OptionalIndex) ?InferredErrorSet.Index { | 1507 | pub fn unwrap(oi: InferredErrorSet.OptionalIndex) ?InferredErrorSet.Index { |
| 1508 | if (oi == .none) return null; | 1508 | if (oi == .none) return null; |
| 1509 | return @intToEnum(InferredErrorSet.Index, @enumToInt(oi)); | 1509 | return @enumFromInt(InferredErrorSet.Index, @intFromEnum(oi)); |
| 1510 | } | 1510 | } |
| 1511 | }; | 1511 | }; |
| 1512 | 1512 | ||
| ... | @@ -1594,7 +1594,7 @@ pub const DeclAdapter = struct { | ... | @@ -1594,7 +1594,7 @@ pub const DeclAdapter = struct { |
| 1594 | 1594 | ||
| 1595 | pub fn hash(self: @This(), s: InternPool.NullTerminatedString) u32 { | 1595 | pub fn hash(self: @This(), s: InternPool.NullTerminatedString) u32 { |
| 1596 | _ = self; | 1596 | _ = self; |
| 1597 | return std.hash.uint32(@enumToInt(s)); | 1597 | return std.hash.uint32(@intFromEnum(s)); |
| 1598 | } | 1598 | } |
| 1599 | 1599 | ||
| 1600 | pub fn eql(self: @This(), a: InternPool.NullTerminatedString, b_decl_index: Decl.Index, b_index: usize) bool { | 1600 | pub fn eql(self: @This(), a: InternPool.NullTerminatedString, b_decl_index: Decl.Index, b_index: usize) bool { |
| ... | @@ -1628,7 +1628,7 @@ pub const Namespace = struct { | ... | @@ -1628,7 +1628,7 @@ pub const Namespace = struct { |
| 1628 | _, | 1628 | _, |
| 1629 | 1629 | ||
| 1630 | pub fn toOptional(i: Index) OptionalIndex { | 1630 | pub fn toOptional(i: Index) OptionalIndex { |
| 1631 | return @intToEnum(OptionalIndex, @enumToInt(i)); | 1631 | return @enumFromInt(OptionalIndex, @intFromEnum(i)); |
| 1632 | } | 1632 | } |
| 1633 | }; | 1633 | }; |
| 1634 | 1634 | ||
| ... | @@ -1637,12 +1637,12 @@ pub const Namespace = struct { | ... | @@ -1637,12 +1637,12 @@ pub const Namespace = struct { |
| 1637 | _, | 1637 | _, |
| 1638 | 1638 | ||
| 1639 | pub fn init(oi: ?Index) OptionalIndex { | 1639 | pub fn init(oi: ?Index) OptionalIndex { |
| 1640 | return @intToEnum(OptionalIndex, @enumToInt(oi orelse return .none)); | 1640 | return @enumFromInt(OptionalIndex, @intFromEnum(oi orelse return .none)); |
| 1641 | } | 1641 | } |
| 1642 | 1642 | ||
| 1643 | pub fn unwrap(oi: OptionalIndex) ?Index { | 1643 | pub fn unwrap(oi: OptionalIndex) ?Index { |
| 1644 | if (oi == .none) return null; | 1644 | if (oi == .none) return null; |
| 1645 | return @intToEnum(Index, @enumToInt(oi)); | 1645 | return @enumFromInt(Index, @intFromEnum(oi)); |
| 1646 | } | 1646 | } |
| 1647 | }; | 1647 | }; |
| 1648 | 1648 | ||
| ... | @@ -1651,7 +1651,7 @@ pub const Namespace = struct { | ... | @@ -1651,7 +1651,7 @@ pub const Namespace = struct { |
| 1651 | 1651 | ||
| 1652 | pub fn hash(ctx: @This(), decl_index: Decl.Index) u32 { | 1652 | pub fn hash(ctx: @This(), decl_index: Decl.Index) u32 { |
| 1653 | const decl = ctx.module.declPtr(decl_index); | 1653 | const decl = ctx.module.declPtr(decl_index); |
| 1654 | return std.hash.uint32(@enumToInt(decl.name)); | 1654 | return std.hash.uint32(@intFromEnum(decl.name)); |
| 1655 | } | 1655 | } |
| 1656 | 1656 | ||
| 1657 | pub fn eql(ctx: @This(), a_decl_index: Decl.Index, b_decl_index: Decl.Index, b_index: usize) bool { | 1657 | pub fn eql(ctx: @This(), a_decl_index: Decl.Index, b_decl_index: Decl.Index, b_index: usize) bool { |
| ... | @@ -2006,7 +2006,7 @@ pub const File = struct { | ... | @@ -2006,7 +2006,7 @@ pub const File = struct { |
| 2006 | // be the case if there were other astgen failures in this file | 2006 | // be the case if there were other astgen failures in this file |
| 2007 | if (!file.zir_loaded) return; | 2007 | if (!file.zir_loaded) return; |
| 2008 | 2008 | ||
| 2009 | const imports_index = file.zir.extra[@enumToInt(Zir.ExtraIndex.imports)]; | 2009 | const imports_index = file.zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; |
| 2010 | if (imports_index == 0) return; | 2010 | if (imports_index == 0) return; |
| 2011 | const extra = file.zir.extraData(Zir.Inst.Imports, imports_index); | 2011 | const extra = file.zir.extraData(Zir.Inst.Imports, imports_index); |
| 2012 | 2012 | ||
| ... | @@ -3360,11 +3360,11 @@ pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void { | ... | @@ -3360,11 +3360,11 @@ pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void { |
| 3360 | } | 3360 | } |
| 3361 | 3361 | ||
| 3362 | pub fn declPtr(mod: *Module, index: Decl.Index) *Decl { | 3362 | pub fn declPtr(mod: *Module, index: Decl.Index) *Decl { |
| 3363 | return mod.allocated_decls.at(@enumToInt(index)); | 3363 | return mod.allocated_decls.at(@intFromEnum(index)); |
| 3364 | } | 3364 | } |
| 3365 | 3365 | ||
| 3366 | pub fn namespacePtr(mod: *Module, index: Namespace.Index) *Namespace { | 3366 | pub fn namespacePtr(mod: *Module, index: Namespace.Index) *Namespace { |
| 3367 | return mod.allocated_namespaces.at(@enumToInt(index)); | 3367 | return mod.allocated_namespaces.at(@intFromEnum(index)); |
| 3368 | } | 3368 | } |
| 3369 | 3369 | ||
| 3370 | pub fn unionPtr(mod: *Module, index: Union.Index) *Union { | 3370 | pub fn unionPtr(mod: *Module, index: Union.Index) *Union { |
| ... | @@ -3767,10 +3767,10 @@ fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_file: std.fs.File) | ... | @@ -3767,10 +3767,10 @@ fn loadZirCacheBody(gpa: Allocator, header: Zir.Header, cache_file: std.fs.File) |
| 3767 | if (data_has_safety_tag) { | 3767 | if (data_has_safety_tag) { |
| 3768 | const tags = zir.instructions.items(.tag); | 3768 | const tags = zir.instructions.items(.tag); |
| 3769 | for (zir.instructions.items(.data), 0..) |*data, i| { | 3769 | for (zir.instructions.items(.data), 0..) |*data, i| { |
| 3770 | const union_tag = Zir.Inst.Tag.data_tags[@enumToInt(tags[i])]; | 3770 | const union_tag = Zir.Inst.Tag.data_tags[@intFromEnum(tags[i])]; |
| 3771 | const as_struct = @ptrCast(*HackDataLayout, data); | 3771 | const as_struct = @ptrCast(*HackDataLayout, data); |
| 3772 | as_struct.* = .{ | 3772 | as_struct.* = .{ |
| 3773 | .safety_tag = @enumToInt(union_tag), | 3773 | .safety_tag = @intFromEnum(union_tag), |
| 3774 | .data = safety_buffer[i], | 3774 | .data = safety_buffer[i], |
| 3775 | }; | 3775 | }; |
| 3776 | } | 3776 | } |
| ... | @@ -4101,7 +4101,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void { | ... | @@ -4101,7 +4101,7 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void { |
| 4101 | const update_level: Decl.DepType = if (!type_changed and decl.ty.zigTypeTag(mod) == .Fn) .function_body else .normal; | 4101 | const update_level: Decl.DepType = if (!type_changed and decl.ty.zigTypeTag(mod) == .Fn) .function_body else .normal; |
| 4102 | 4102 | ||
| 4103 | for (decl.dependants.keys(), decl.dependants.values()) |dep_index, dep_type| { | 4103 | for (decl.dependants.keys(), decl.dependants.values()) |dep_index, dep_type| { |
| 4104 | if (@enumToInt(dep_type) < @enumToInt(update_level)) continue; | 4104 | if (@intFromEnum(dep_type) < @intFromEnum(update_level)) continue; |
| 4105 | 4105 | ||
| 4106 | const dep = mod.declPtr(dep_index); | 4106 | const dep = mod.declPtr(dep_index); |
| 4107 | switch (dep.analysis) { | 4107 | switch (dep.analysis) { |
| ... | @@ -4621,7 +4621,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { | ... | @@ -4621,7 +4621,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { |
| 4621 | 4621 | ||
| 4622 | const is_inline = decl.ty.fnCallingConvention(mod) == .Inline; | 4622 | const is_inline = decl.ty.fnCallingConvention(mod) == .Inline; |
| 4623 | if (decl.is_exported) { | 4623 | if (decl.is_exported) { |
| 4624 | const export_src: LazySrcLoc = .{ .token_offset = @boolToInt(decl.is_pub) }; | 4624 | const export_src: LazySrcLoc = .{ .token_offset = @intFromBool(decl.is_pub) }; |
| 4625 | if (is_inline) { | 4625 | if (is_inline) { |
| 4626 | return sema.fail(&block_scope, export_src, "export of inline function", .{}); | 4626 | return sema.fail(&block_scope, export_src, "export of inline function", .{}); |
| 4627 | } | 4627 | } |
| ... | @@ -4721,7 +4721,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { | ... | @@ -4721,7 +4721,7 @@ fn semaDecl(mod: *Module, decl_index: Decl.Index) !bool { |
| 4721 | } | 4721 | } |
| 4722 | 4722 | ||
| 4723 | if (decl.is_exported) { | 4723 | if (decl.is_exported) { |
| 4724 | const export_src: LazySrcLoc = .{ .token_offset = @boolToInt(decl.is_pub) }; | 4724 | const export_src: LazySrcLoc = .{ .token_offset = @intFromBool(decl.is_pub) }; |
| 4725 | // The scope needs to have the decl in it. | 4725 | // The scope needs to have the decl in it. |
| 4726 | try sema.analyzeExport(&block_scope, export_src, .{ .name = decl.name }, decl_index); | 4726 | try sema.analyzeExport(&block_scope, export_src, .{ .name = decl.name }, decl_index); |
| 4727 | } | 4727 | } |
| ... | @@ -4742,7 +4742,7 @@ pub fn declareDeclDependencyType(mod: *Module, depender_index: Decl.Index, depen | ... | @@ -4742,7 +4742,7 @@ pub fn declareDeclDependencyType(mod: *Module, depender_index: Decl.Index, depen |
| 4742 | const dependee = mod.declPtr(dependee_index); | 4742 | const dependee = mod.declPtr(dependee_index); |
| 4743 | 4743 | ||
| 4744 | if (depender.dependencies.get(dependee_index)) |cur_type| { | 4744 | if (depender.dependencies.get(dependee_index)) |cur_type| { |
| 4745 | if (@enumToInt(cur_type) >= @enumToInt(dep_type)) { | 4745 | if (@intFromEnum(cur_type) >= @intFromEnum(dep_type)) { |
| 4746 | // We already have this dependency (or stricter) marked | 4746 | // We already have this dependency (or stricter) marked |
| 4747 | return; | 4747 | return; |
| 4748 | } | 4748 | } |
| ... | @@ -5611,7 +5611,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: Fn.Index, arena: Allocator) SemaE | ... | @@ -5611,7 +5611,7 @@ pub fn analyzeFnBody(mod: *Module, func_index: Fn.Index, arena: Allocator) SemaE |
| 5611 | .body_len = @intCast(u32, inner_block.instructions.items.len), | 5611 | .body_len = @intCast(u32, inner_block.instructions.items.len), |
| 5612 | }); | 5612 | }); |
| 5613 | sema.air_extra.appendSliceAssumeCapacity(inner_block.instructions.items); | 5613 | sema.air_extra.appendSliceAssumeCapacity(inner_block.instructions.items); |
| 5614 | sema.air_extra.items[@enumToInt(Air.ExtraIndex.main_block)] = main_block_index; | 5614 | sema.air_extra.items[@intFromEnum(Air.ExtraIndex.main_block)] = main_block_index; |
| 5615 | 5615 | ||
| 5616 | func.state = .success; | 5616 | func.state = .success; |
| 5617 | 5617 | ||
| ... | @@ -5681,12 +5681,12 @@ fn markOutdatedDecl(mod: *Module, decl_index: Decl.Index) !void { | ... | @@ -5681,12 +5681,12 @@ fn markOutdatedDecl(mod: *Module, decl_index: Decl.Index) !void { |
| 5681 | 5681 | ||
| 5682 | pub fn createNamespace(mod: *Module, initialization: Namespace) !Namespace.Index { | 5682 | pub fn createNamespace(mod: *Module, initialization: Namespace) !Namespace.Index { |
| 5683 | if (mod.namespaces_free_list.popOrNull()) |index| { | 5683 | if (mod.namespaces_free_list.popOrNull()) |index| { |
| 5684 | mod.allocated_namespaces.at(@enumToInt(index)).* = initialization; | 5684 | mod.allocated_namespaces.at(@intFromEnum(index)).* = initialization; |
| 5685 | return index; | 5685 | return index; |
| 5686 | } | 5686 | } |
| 5687 | const ptr = try mod.allocated_namespaces.addOne(mod.gpa); | 5687 | const ptr = try mod.allocated_namespaces.addOne(mod.gpa); |
| 5688 | ptr.* = initialization; | 5688 | ptr.* = initialization; |
| 5689 | return @intToEnum(Namespace.Index, mod.allocated_namespaces.len - 1); | 5689 | return @enumFromInt(Namespace.Index, mod.allocated_namespaces.len - 1); |
| 5690 | } | 5690 | } |
| 5691 | 5691 | ||
| 5692 | pub fn destroyNamespace(mod: *Module, index: Namespace.Index) void { | 5692 | pub fn destroyNamespace(mod: *Module, index: Namespace.Index) void { |
| ... | @@ -5744,7 +5744,7 @@ pub fn allocateNewDecl( | ... | @@ -5744,7 +5744,7 @@ pub fn allocateNewDecl( |
| 5744 | } | 5744 | } |
| 5745 | break :d .{ | 5745 | break :d .{ |
| 5746 | .new_decl = decl, | 5746 | .new_decl = decl, |
| 5747 | .decl_index = @intToEnum(Decl.Index, mod.allocated_decls.len - 1), | 5747 | .decl_index = @enumFromInt(Decl.Index, mod.allocated_decls.len - 1), |
| 5748 | }; | 5748 | }; |
| 5749 | }; | 5749 | }; |
| 5750 | 5750 | ||
| ... | @@ -5808,7 +5808,7 @@ pub fn createAnonymousDeclFromDecl( | ... | @@ -5808,7 +5808,7 @@ pub fn createAnonymousDeclFromDecl( |
| 5808 | const new_decl_index = try mod.allocateNewDecl(namespace, src_decl.src_node, src_scope); | 5808 | const new_decl_index = try mod.allocateNewDecl(namespace, src_decl.src_node, src_scope); |
| 5809 | errdefer mod.destroyDecl(new_decl_index); | 5809 | errdefer mod.destroyDecl(new_decl_index); |
| 5810 | const name = try mod.intern_pool.getOrPutStringFmt(mod.gpa, "{}__anon_{d}", .{ | 5810 | const name = try mod.intern_pool.getOrPutStringFmt(mod.gpa, "{}__anon_{d}", .{ |
| 5811 | src_decl.name.fmt(&mod.intern_pool), @enumToInt(new_decl_index), | 5811 | src_decl.name.fmt(&mod.intern_pool), @intFromEnum(new_decl_index), |
| 5812 | }); | 5812 | }); |
| 5813 | try mod.initNewAnonDecl(new_decl_index, src_decl.src_line, namespace, tv, name); | 5813 | try mod.initNewAnonDecl(new_decl_index, src_decl.src_line, namespace, tv, name); |
| 5814 | return new_decl_index; | 5814 | return new_decl_index; |
| ... | @@ -6172,7 +6172,7 @@ pub fn argSrc( | ... | @@ -6172,7 +6172,7 @@ pub fn argSrc( |
| 6172 | @setCold(true); | 6172 | @setCold(true); |
| 6173 | const gpa = mod.gpa; | 6173 | const gpa = mod.gpa; |
| 6174 | if (start_arg_i == 0 and bound_arg_src != null) return bound_arg_src.?; | 6174 | if (start_arg_i == 0 and bound_arg_src != null) return bound_arg_src.?; |
| 6175 | const arg_i = start_arg_i - @boolToInt(bound_arg_src != null); | 6175 | const arg_i = start_arg_i - @intFromBool(bound_arg_src != null); |
| 6176 | const tree = decl.getFileScope(mod).getTree(gpa) catch |err| { | 6176 | const tree = decl.getFileScope(mod).getTree(gpa) catch |err| { |
| 6177 | // In this case we emit a warning + a less precise source location. | 6177 | // In this case we emit a warning + a less precise source location. |
| 6178 | log.warn("unable to load {s}: {s}", .{ | 6178 | log.warn("unable to load {s}: {s}", .{ |
| ... | @@ -6741,7 +6741,7 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type | ... | @@ -6741,7 +6741,7 @@ pub fn ptrType(mod: *Module, info: InternPool.Key.PtrType) Allocator.Error!Type |
| 6741 | } | 6741 | } |
| 6742 | }, | 6742 | }, |
| 6743 | .runtime => {}, | 6743 | .runtime => {}, |
| 6744 | _ => assert(@enumToInt(info.flags.vector_index) < info.packed_offset.host_size), | 6744 | _ => assert(@intFromEnum(info.flags.vector_index) < info.packed_offset.host_size), |
| 6745 | } | 6745 | } |
| 6746 | 6746 | ||
| 6747 | return (try intern(mod, .{ .ptr_type = canon_info })).toType(); | 6747 | return (try intern(mod, .{ .ptr_type = canon_info })).toType(); |
| ... | @@ -6969,17 +6969,17 @@ pub fn intBitsForValue(mod: *Module, val: Value, sign: bool) u16 { | ... | @@ -6969,17 +6969,17 @@ pub fn intBitsForValue(mod: *Module, val: Value, sign: bool) u16 { |
| 6969 | const key = mod.intern_pool.indexToKey(val.toIntern()); | 6969 | const key = mod.intern_pool.indexToKey(val.toIntern()); |
| 6970 | switch (key.int.storage) { | 6970 | switch (key.int.storage) { |
| 6971 | .i64 => |x| { | 6971 | .i64 => |x| { |
| 6972 | if (std.math.cast(u64, x)) |casted| return Type.smallestUnsignedBits(casted) + @boolToInt(sign); | 6972 | if (std.math.cast(u64, x)) |casted| return Type.smallestUnsignedBits(casted) + @intFromBool(sign); |
| 6973 | assert(sign); | 6973 | assert(sign); |
| 6974 | // Protect against overflow in the following negation. | 6974 | // Protect against overflow in the following negation. |
| 6975 | if (x == std.math.minInt(i64)) return 64; | 6975 | if (x == std.math.minInt(i64)) return 64; |
| 6976 | return Type.smallestUnsignedBits(@intCast(u64, -(x + 1))) + 1; | 6976 | return Type.smallestUnsignedBits(@intCast(u64, -(x + 1))) + 1; |
| 6977 | }, | 6977 | }, |
| 6978 | .u64 => |x| { | 6978 | .u64 => |x| { |
| 6979 | return Type.smallestUnsignedBits(x) + @boolToInt(sign); | 6979 | return Type.smallestUnsignedBits(x) + @intFromBool(sign); |
| 6980 | }, | 6980 | }, |
| 6981 | .big_int => |big| { | 6981 | .big_int => |big| { |
| 6982 | if (big.positive) return @intCast(u16, big.bitCountAbs() + @boolToInt(sign)); | 6982 | if (big.positive) return @intCast(u16, big.bitCountAbs() + @intFromBool(sign)); |
| 6983 | 6983 | ||
| 6984 | // Zero is still a possibility, in which case unsigned is fine | 6984 | // Zero is still a possibility, in which case unsigned is fine |
| 6985 | if (big.eqZero()) return 0; | 6985 | if (big.eqZero()) return 0; |
| ... | @@ -6987,10 +6987,10 @@ pub fn intBitsForValue(mod: *Module, val: Value, sign: bool) u16 { | ... | @@ -6987,10 +6987,10 @@ pub fn intBitsForValue(mod: *Module, val: Value, sign: bool) u16 { |
| 6987 | return @intCast(u16, big.bitCountTwosComp()); | 6987 | return @intCast(u16, big.bitCountTwosComp()); |
| 6988 | }, | 6988 | }, |
| 6989 | .lazy_align => |lazy_ty| { | 6989 | .lazy_align => |lazy_ty| { |
| 6990 | return Type.smallestUnsignedBits(lazy_ty.toType().abiAlignment(mod)) + @boolToInt(sign); | 6990 | return Type.smallestUnsignedBits(lazy_ty.toType().abiAlignment(mod)) + @intFromBool(sign); |
| 6991 | }, | 6991 | }, |
| 6992 | .lazy_size => |lazy_ty| { | 6992 | .lazy_size => |lazy_ty| { |
| 6993 | return Type.smallestUnsignedBits(lazy_ty.toType().abiSize(mod)) + @boolToInt(sign); | 6993 | return Type.smallestUnsignedBits(lazy_ty.toType().abiSize(mod)) + @intFromBool(sign); |
| 6994 | }, | 6994 | }, |
| 6995 | } | 6995 | } |
| 6996 | } | 6996 | } |
src/Package.zig+3-3| ... | @@ -502,7 +502,7 @@ fn fetchAndUnpack( | ... | @@ -502,7 +502,7 @@ fn fetchAndUnpack( |
| 502 | 502 | ||
| 503 | if (req.response.status != .ok) { | 503 | if (req.response.status != .ok) { |
| 504 | return report.fail(dep.url_tok, "Expected response status '200 OK' got '{} {s}'", .{ | 504 | return report.fail(dep.url_tok, "Expected response status '200 OK' got '{} {s}'", .{ |
| 505 | @enumToInt(req.response.status), | 505 | @intFromEnum(req.response.status), |
| 506 | req.response.status.phrase() orelse "", | 506 | req.response.status.phrase() orelse "", |
| 507 | }); | 507 | }); |
| 508 | } | 508 | } |
| ... | @@ -568,7 +568,7 @@ fn fetchAndUnpack( | ... | @@ -568,7 +568,7 @@ fn fetchAndUnpack( |
| 568 | .msg = "url field is missing corresponding hash field", | 568 | .msg = "url field is missing corresponding hash field", |
| 569 | }); | 569 | }); |
| 570 | const notes_start = try eb.reserveNotes(notes_len); | 570 | const notes_start = try eb.reserveNotes(notes_len); |
| 571 | eb.extra.items[notes_start] = @enumToInt(try eb.addErrorMessage(.{ | 571 | eb.extra.items[notes_start] = @intFromEnum(try eb.addErrorMessage(.{ |
| 572 | .msg = try eb.printString("expected .hash = \"{s}\",", .{&actual_hex}), | 572 | .msg = try eb.printString("expected .hash = \"{s}\",", .{&actual_hex}), |
| 573 | })); | 573 | })); |
| 574 | return error.PackageFetchFailed; | 574 | return error.PackageFetchFailed; |
| ... | @@ -715,7 +715,7 @@ fn hashFileFallible(dir: fs.Dir, hashed_file: *HashedFile) HashedFile.Error!void | ... | @@ -715,7 +715,7 @@ fn hashFileFallible(dir: fs.Dir, hashed_file: *HashedFile) HashedFile.Error!void |
| 715 | defer file.close(); | 715 | defer file.close(); |
| 716 | var hasher = Manifest.Hash.init(.{}); | 716 | var hasher = Manifest.Hash.init(.{}); |
| 717 | hasher.update(hashed_file.normalized_path); | 717 | hasher.update(hashed_file.normalized_path); |
| 718 | hasher.update(&.{ 0, @boolToInt(try isExecutable(file)) }); | 718 | hasher.update(&.{ 0, @intFromBool(try isExecutable(file)) }); |
| 719 | while (true) { | 719 | while (true) { |
| 720 | const bytes_read = try file.read(&buf); | 720 | const bytes_read = try file.read(&buf); |
| 721 | if (bytes_read == 0) break; | 721 | if (bytes_read == 0) break; |
src/Sema.zig+136-136| ... | @@ -1387,7 +1387,7 @@ fn analyzeBodyInner( | ... | @@ -1387,7 +1387,7 @@ fn analyzeBodyInner( |
| 1387 | check_block = check_block.parent.?; | 1387 | check_block = check_block.parent.?; |
| 1388 | }; | 1388 | }; |
| 1389 | 1389 | ||
| 1390 | if (@enumToInt(target_runtime_index) < @enumToInt(block.runtime_index)) { | 1390 | if (@intFromEnum(target_runtime_index) < @intFromEnum(block.runtime_index)) { |
| 1391 | const runtime_src = block.runtime_cond orelse block.runtime_loop.?; | 1391 | const runtime_src = block.runtime_cond orelse block.runtime_loop.?; |
| 1392 | const msg = msg: { | 1392 | const msg = msg: { |
| 1393 | const msg = try sema.errMsg(block, src, "comptime control flow inside runtime block", .{}); | 1393 | const msg = try sema.errMsg(block, src, "comptime control flow inside runtime block", .{}); |
| ... | @@ -1761,10 +1761,10 @@ pub fn resolveInstAllowNone(sema: *Sema, zir_ref: Zir.Inst.Ref) !Air.Inst.Ref { | ... | @@ -1761,10 +1761,10 @@ pub fn resolveInstAllowNone(sema: *Sema, zir_ref: Zir.Inst.Ref) !Air.Inst.Ref { |
| 1761 | 1761 | ||
| 1762 | pub fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) !Air.Inst.Ref { | 1762 | pub fn resolveInst(sema: *Sema, zir_ref: Zir.Inst.Ref) !Air.Inst.Ref { |
| 1763 | assert(zir_ref != .none); | 1763 | assert(zir_ref != .none); |
| 1764 | const i = @enumToInt(zir_ref); | 1764 | const i = @intFromEnum(zir_ref); |
| 1765 | // First section of indexes correspond to a set number of constant values. | 1765 | // First section of indexes correspond to a set number of constant values. |
| 1766 | // We intentionally map the same indexes to the same values between ZIR and AIR. | 1766 | // We intentionally map the same indexes to the same values between ZIR and AIR. |
| 1767 | if (i < InternPool.static_len) return @intToEnum(Air.Inst.Ref, i); | 1767 | if (i < InternPool.static_len) return @enumFromInt(Air.Inst.Ref, i); |
| 1768 | // The last section of indexes refers to the map of ZIR => AIR. | 1768 | // The last section of indexes refers to the map of ZIR => AIR. |
| 1769 | const inst = sema.inst_map.get(i - InternPool.static_len).?; | 1769 | const inst = sema.inst_map.get(i - InternPool.static_len).?; |
| 1770 | if (inst == .generic_poison) return error.GenericPoison; | 1770 | if (inst == .generic_poison) return error.GenericPoison; |
| ... | @@ -2038,9 +2038,9 @@ fn resolveMaybeUndefValAllowVariablesMaybeRuntime( | ... | @@ -2038,9 +2038,9 @@ fn resolveMaybeUndefValAllowVariablesMaybeRuntime( |
| 2038 | ) CompileError!?Value { | 2038 | ) CompileError!?Value { |
| 2039 | assert(inst != .none); | 2039 | assert(inst != .none); |
| 2040 | // First section of indexes correspond to a set number of constant values. | 2040 | // First section of indexes correspond to a set number of constant values. |
| 2041 | const int = @enumToInt(inst); | 2041 | const int = @intFromEnum(inst); |
| 2042 | if (int < InternPool.static_len) { | 2042 | if (int < InternPool.static_len) { |
| 2043 | return @intToEnum(InternPool.Index, int).toValue(); | 2043 | return @enumFromInt(InternPool.Index, int).toValue(); |
| 2044 | } | 2044 | } |
| 2045 | 2045 | ||
| 2046 | const i = int - InternPool.static_len; | 2046 | const i = int - InternPool.static_len; |
| ... | @@ -2745,8 +2745,8 @@ pub fn analyzeStructDecl( | ... | @@ -2745,8 +2745,8 @@ pub fn analyzeStructDecl( |
| 2745 | } | 2745 | } |
| 2746 | 2746 | ||
| 2747 | var extra_index: usize = extended.operand; | 2747 | var extra_index: usize = extended.operand; |
| 2748 | extra_index += @boolToInt(small.has_src_node); | 2748 | extra_index += @intFromBool(small.has_src_node); |
| 2749 | extra_index += @boolToInt(small.has_fields_len); | 2749 | extra_index += @intFromBool(small.has_fields_len); |
| 2750 | const decls_len = if (small.has_decls_len) blk: { | 2750 | const decls_len = if (small.has_decls_len) blk: { |
| 2751 | const decls_len = sema.code.extra[extra_index]; | 2751 | const decls_len = sema.code.extra[extra_index]; |
| 2752 | extra_index += 1; | 2752 | extra_index += 1; |
| ... | @@ -2857,7 +2857,7 @@ fn createAnonymousDeclTypeNamed( | ... | @@ -2857,7 +2857,7 @@ fn createAnonymousDeclTypeNamed( |
| 2857 | // renamed. | 2857 | // renamed. |
| 2858 | 2858 | ||
| 2859 | const name = mod.intern_pool.getOrPutStringFmt(gpa, "{}__{s}_{d}", .{ | 2859 | const name = mod.intern_pool.getOrPutStringFmt(gpa, "{}__{s}_{d}", .{ |
| 2860 | src_decl.name.fmt(&mod.intern_pool), anon_prefix, @enumToInt(new_decl_index), | 2860 | src_decl.name.fmt(&mod.intern_pool), anon_prefix, @intFromEnum(new_decl_index), |
| 2861 | }) catch unreachable; | 2861 | }) catch unreachable; |
| 2862 | try mod.initNewAnonDecl(new_decl_index, src_decl.src_line, namespace, typed_value, name); | 2862 | try mod.initNewAnonDecl(new_decl_index, src_decl.src_line, namespace, typed_value, name); |
| 2863 | return new_decl_index; | 2863 | return new_decl_index; |
| ... | @@ -2948,7 +2948,7 @@ fn zirEnumDecl( | ... | @@ -2948,7 +2948,7 @@ fn zirEnumDecl( |
| 2948 | const tag_ty_src: LazySrcLoc = .{ .node_offset_container_tag = src.node_offset.x }; | 2948 | const tag_ty_src: LazySrcLoc = .{ .node_offset_container_tag = src.node_offset.x }; |
| 2949 | 2949 | ||
| 2950 | const tag_type_ref = if (small.has_tag_type) blk: { | 2950 | const tag_type_ref = if (small.has_tag_type) blk: { |
| 2951 | const tag_type_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 2951 | const tag_type_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 2952 | extra_index += 1; | 2952 | extra_index += 1; |
| 2953 | break :blk tag_type_ref; | 2953 | break :blk tag_type_ref; |
| 2954 | } else .none; | 2954 | } else .none; |
| ... | @@ -3131,7 +3131,7 @@ fn zirEnumDecl( | ... | @@ -3131,7 +3131,7 @@ fn zirEnumDecl( |
| 3131 | } | 3131 | } |
| 3132 | 3132 | ||
| 3133 | const tag_overflow = if (has_tag_value) overflow: { | 3133 | const tag_overflow = if (has_tag_value) overflow: { |
| 3134 | const tag_val_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 3134 | const tag_val_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 3135 | extra_index += 1; | 3135 | extra_index += 1; |
| 3136 | const tag_inst = try sema.resolveInst(tag_val_ref); | 3136 | const tag_inst = try sema.resolveInst(tag_val_ref); |
| 3137 | last_tag_val = sema.resolveConstValue(block, .unneeded, tag_inst, "") catch |err| switch (err) { | 3137 | last_tag_val = sema.resolveConstValue(block, .unneeded, tag_inst, "") catch |err| switch (err) { |
| ... | @@ -3222,9 +3222,9 @@ fn zirUnionDecl( | ... | @@ -3222,9 +3222,9 @@ fn zirUnionDecl( |
| 3222 | break :blk LazySrcLoc.nodeOffset(node_offset); | 3222 | break :blk LazySrcLoc.nodeOffset(node_offset); |
| 3223 | } else sema.src; | 3223 | } else sema.src; |
| 3224 | 3224 | ||
| 3225 | extra_index += @boolToInt(small.has_tag_type); | 3225 | extra_index += @intFromBool(small.has_tag_type); |
| 3226 | extra_index += @boolToInt(small.has_body_len); | 3226 | extra_index += @intFromBool(small.has_body_len); |
| 3227 | extra_index += @boolToInt(small.has_fields_len); | 3227 | extra_index += @intFromBool(small.has_fields_len); |
| 3228 | 3228 | ||
| 3229 | const decls_len = if (small.has_decls_len) blk: { | 3229 | const decls_len = if (small.has_decls_len) blk: { |
| 3230 | const decls_len = sema.code.extra[extra_index]; | 3230 | const decls_len = sema.code.extra[extra_index]; |
| ... | @@ -3574,13 +3574,13 @@ fn zirAllocExtended( | ... | @@ -3574,13 +3574,13 @@ fn zirAllocExtended( |
| 3574 | var extra_index: usize = extra.end; | 3574 | var extra_index: usize = extra.end; |
| 3575 | 3575 | ||
| 3576 | const var_ty: Type = if (small.has_type) blk: { | 3576 | const var_ty: Type = if (small.has_type) blk: { |
| 3577 | const type_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 3577 | const type_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 3578 | extra_index += 1; | 3578 | extra_index += 1; |
| 3579 | break :blk try sema.resolveType(block, ty_src, type_ref); | 3579 | break :blk try sema.resolveType(block, ty_src, type_ref); |
| 3580 | } else undefined; | 3580 | } else undefined; |
| 3581 | 3581 | ||
| 3582 | const alignment: u32 = if (small.has_align) blk: { | 3582 | const alignment: u32 = if (small.has_align) blk: { |
| 3583 | const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 3583 | const align_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 3584 | extra_index += 1; | 3584 | extra_index += 1; |
| 3585 | const alignment = try sema.resolveAlign(block, align_src, align_ref); | 3585 | const alignment = try sema.resolveAlign(block, align_src, align_ref); |
| 3586 | break :blk alignment; | 3586 | break :blk alignment; |
| ... | @@ -6006,7 +6006,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co | ... | @@ -6006,7 +6006,7 @@ fn zirFence(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) Co |
| 6006 | const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; | 6006 | const order_src: LazySrcLoc = .{ .node_offset_builtin_call_arg0 = extra.node }; |
| 6007 | const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime-known"); | 6007 | const order = try sema.resolveAtomicOrder(block, order_src, extra.operand, "atomic order of @fence must be comptime-known"); |
| 6008 | 6008 | ||
| 6009 | if (@enumToInt(order) < @enumToInt(std.builtin.AtomicOrder.Acquire)) { | 6009 | if (@intFromEnum(order) < @intFromEnum(std.builtin.AtomicOrder.Acquire)) { |
| 6010 | return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{}); | 6010 | return sema.fail(block, order_src, "atomic ordering must be Acquire or stricter", .{}); |
| 6011 | } | 6011 | } |
| 6012 | 6012 | ||
| ... | @@ -6441,7 +6441,7 @@ fn zirCall( | ... | @@ -6441,7 +6441,7 @@ fn zirCall( |
| 6441 | const extra = sema.code.extraData(ExtraType, inst_data.payload_index); | 6441 | const extra = sema.code.extraData(ExtraType, inst_data.payload_index); |
| 6442 | const args_len = extra.data.flags.args_len; | 6442 | const args_len = extra.data.flags.args_len; |
| 6443 | 6443 | ||
| 6444 | const modifier = @intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier); | 6444 | const modifier = @enumFromInt(std.builtin.CallModifier, extra.data.flags.packed_modifier); |
| 6445 | const ensure_result_used = extra.data.flags.ensure_result_used; | 6445 | const ensure_result_used = extra.data.flags.ensure_result_used; |
| 6446 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; | 6446 | const pop_error_return_trace = extra.data.flags.pop_error_return_trace; |
| 6447 | 6447 | ||
| ... | @@ -6473,7 +6473,7 @@ fn zirCall( | ... | @@ -6473,7 +6473,7 @@ fn zirCall( |
| 6473 | } | 6473 | } |
| 6474 | 6474 | ||
| 6475 | const callee_ty = sema.typeOf(func); | 6475 | const callee_ty = sema.typeOf(func); |
| 6476 | const total_args = args_len + @boolToInt(bound_arg_src != null); | 6476 | const total_args = args_len + @intFromBool(bound_arg_src != null); |
| 6477 | const func_ty = try sema.checkCallArgumentCount(block, func, callee_src, callee_ty, total_args, bound_arg_src != null); | 6477 | const func_ty = try sema.checkCallArgumentCount(block, func, callee_src, callee_ty, total_args, bound_arg_src != null); |
| 6478 | 6478 | ||
| 6479 | const args_body = sema.code.extra[extra.end..]; | 6479 | const args_body = sema.code.extra[extra.end..]; |
| ... | @@ -6612,7 +6612,7 @@ fn checkCallArgumentCount( | ... | @@ -6612,7 +6612,7 @@ fn checkCallArgumentCount( |
| 6612 | 6612 | ||
| 6613 | const func_ty_info = mod.typeToFunc(func_ty).?; | 6613 | const func_ty_info = mod.typeToFunc(func_ty).?; |
| 6614 | const fn_params_len = func_ty_info.param_types.len; | 6614 | const fn_params_len = func_ty_info.param_types.len; |
| 6615 | const args_len = total_args - @boolToInt(member_fn); | 6615 | const args_len = total_args - @intFromBool(member_fn); |
| 6616 | if (func_ty_info.is_var_args) { | 6616 | if (func_ty_info.is_var_args) { |
| 6617 | assert(func_ty_info.cc == .C); | 6617 | assert(func_ty_info.cc == .C); |
| 6618 | if (total_args >= fn_params_len) return func_ty; | 6618 | if (total_args >= fn_params_len) return func_ty; |
| ... | @@ -6631,7 +6631,7 @@ fn checkCallArgumentCount( | ... | @@ -6631,7 +6631,7 @@ fn checkCallArgumentCount( |
| 6631 | .{ | 6631 | .{ |
| 6632 | member_str, | 6632 | member_str, |
| 6633 | variadic_str, | 6633 | variadic_str, |
| 6634 | fn_params_len - @boolToInt(member_fn), | 6634 | fn_params_len - @intFromBool(member_fn), |
| 6635 | args_len, | 6635 | args_len, |
| 6636 | }, | 6636 | }, |
| 6637 | ); | 6637 | ); |
| ... | @@ -7538,7 +7538,7 @@ fn instantiateGenericCall( | ... | @@ -7538,7 +7538,7 @@ fn instantiateGenericCall( |
| 7538 | const new_decl = mod.declPtr(new_decl_index); | 7538 | const new_decl = mod.declPtr(new_decl_index); |
| 7539 | // TODO better names for generic function instantiations | 7539 | // TODO better names for generic function instantiations |
| 7540 | const decl_name = try mod.intern_pool.getOrPutStringFmt(gpa, "{}__anon_{d}", .{ | 7540 | const decl_name = try mod.intern_pool.getOrPutStringFmt(gpa, "{}__anon_{d}", .{ |
| 7541 | fn_owner_decl.name.fmt(&mod.intern_pool), @enumToInt(new_decl_index), | 7541 | fn_owner_decl.name.fmt(&mod.intern_pool), @intFromEnum(new_decl_index), |
| 7542 | }); | 7542 | }); |
| 7543 | new_decl.name = decl_name; | 7543 | new_decl.name = decl_name; |
| 7544 | new_decl.src_line = fn_owner_decl.src_line; | 7544 | new_decl.src_line = fn_owner_decl.src_line; |
| ... | @@ -7982,7 +7982,7 @@ fn zirElemTypeIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr | ... | @@ -7982,7 +7982,7 @@ fn zirElemTypeIndex(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr |
| 7982 | const indexable_ty = try sema.resolveType(block, .unneeded, bin.lhs); | 7982 | const indexable_ty = try sema.resolveType(block, .unneeded, bin.lhs); |
| 7983 | assert(indexable_ty.isIndexable(mod)); // validated by a previous instruction | 7983 | assert(indexable_ty.isIndexable(mod)); // validated by a previous instruction |
| 7984 | if (indexable_ty.zigTypeTag(mod) == .Struct) { | 7984 | if (indexable_ty.zigTypeTag(mod) == .Struct) { |
| 7985 | const elem_type = indexable_ty.structFieldType(@enumToInt(bin.rhs), mod); | 7985 | const elem_type = indexable_ty.structFieldType(@intFromEnum(bin.rhs), mod); |
| 7986 | return sema.addType(elem_type); | 7986 | return sema.addType(elem_type); |
| 7987 | } else { | 7987 | } else { |
| 7988 | const elem_type = indexable_ty.elemType2(mod); | 7988 | const elem_type = indexable_ty.elemType2(mod); |
| ... | @@ -8295,7 +8295,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError | ... | @@ -8295,7 +8295,7 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError |
| 8295 | } | 8295 | } |
| 8296 | 8296 | ||
| 8297 | if (try sema.resolveMaybeUndefVal(enum_tag)) |enum_tag_val| { | 8297 | if (try sema.resolveMaybeUndefVal(enum_tag)) |enum_tag_val| { |
| 8298 | const val = try enum_tag_val.enumToInt(enum_tag_ty, mod); | 8298 | const val = try enum_tag_val.intFromEnum(enum_tag_ty, mod); |
| 8299 | return sema.addConstant(int_tag_ty, try val.copy(sema.arena)); | 8299 | return sema.addConstant(int_tag_ty, try val.copy(sema.arena)); |
| 8300 | } | 8300 | } |
| 8301 | 8301 | ||
| ... | @@ -8729,7 +8729,7 @@ fn zirFunc( | ... | @@ -8729,7 +8729,7 @@ fn zirFunc( |
| 8729 | const ret_ty: Type = switch (extra.data.ret_body_len) { | 8729 | const ret_ty: Type = switch (extra.data.ret_body_len) { |
| 8730 | 0 => Type.void, | 8730 | 0 => Type.void, |
| 8731 | 1 => blk: { | 8731 | 1 => blk: { |
| 8732 | const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 8732 | const ret_ty_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 8733 | extra_index += 1; | 8733 | extra_index += 1; |
| 8734 | if (sema.resolveType(block, ret_ty_src, ret_ty_ref)) |ret_ty| { | 8734 | if (sema.resolveType(block, ret_ty_src, ret_ty_ref)) |ret_ty| { |
| 8735 | break :blk ret_ty; | 8735 | break :blk ret_ty; |
| ... | @@ -9668,8 +9668,8 @@ fn intCast( | ... | @@ -9668,8 +9668,8 @@ fn intCast( |
| 9668 | const wanted_info = dest_scalar_ty.intInfo(mod); | 9668 | const wanted_info = dest_scalar_ty.intInfo(mod); |
| 9669 | const actual_bits = actual_info.bits; | 9669 | const actual_bits = actual_info.bits; |
| 9670 | const wanted_bits = wanted_info.bits; | 9670 | const wanted_bits = wanted_info.bits; |
| 9671 | const actual_value_bits = actual_bits - @boolToInt(actual_info.signedness == .signed); | 9671 | const actual_value_bits = actual_bits - @intFromBool(actual_info.signedness == .signed); |
| 9672 | const wanted_value_bits = wanted_bits - @boolToInt(wanted_info.signedness == .signed); | 9672 | const wanted_value_bits = wanted_bits - @intFromBool(wanted_info.signedness == .signed); |
| 9673 | 9673 | ||
| 9674 | // range shrinkage | 9674 | // range shrinkage |
| 9675 | // requirement: int value fits into target type | 9675 | // requirement: int value fits into target type |
| ... | @@ -9790,7 +9790,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -9790,7 +9790,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9790 | const msg = try sema.errMsg(block, dest_ty_src, "cannot @bitCast to '{}'", .{dest_ty.fmt(mod)}); | 9790 | const msg = try sema.errMsg(block, dest_ty_src, "cannot @bitCast to '{}'", .{dest_ty.fmt(mod)}); |
| 9791 | errdefer msg.destroy(sema.gpa); | 9791 | errdefer msg.destroy(sema.gpa); |
| 9792 | switch (operand_ty.zigTypeTag(mod)) { | 9792 | switch (operand_ty.zigTypeTag(mod)) { |
| 9793 | .Int, .ComptimeInt => try sema.errNote(block, dest_ty_src, msg, "use @intToEnum to cast from '{}'", .{operand_ty.fmt(mod)}), | 9793 | .Int, .ComptimeInt => try sema.errNote(block, dest_ty_src, msg, "use @enumFromInt to cast from '{}'", .{operand_ty.fmt(mod)}), |
| 9794 | else => {}, | 9794 | else => {}, |
| 9795 | } | 9795 | } |
| 9796 | 9796 | ||
| ... | @@ -9804,7 +9804,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -9804,7 +9804,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9804 | const msg = try sema.errMsg(block, dest_ty_src, "cannot @bitCast to '{}'", .{dest_ty.fmt(mod)}); | 9804 | const msg = try sema.errMsg(block, dest_ty_src, "cannot @bitCast to '{}'", .{dest_ty.fmt(mod)}); |
| 9805 | errdefer msg.destroy(sema.gpa); | 9805 | errdefer msg.destroy(sema.gpa); |
| 9806 | switch (operand_ty.zigTypeTag(mod)) { | 9806 | switch (operand_ty.zigTypeTag(mod)) { |
| 9807 | .Int, .ComptimeInt => try sema.errNote(block, dest_ty_src, msg, "use @intToPtr to cast from '{}'", .{operand_ty.fmt(mod)}), | 9807 | .Int, .ComptimeInt => try sema.errNote(block, dest_ty_src, msg, "use @ptrFromInt to cast from '{}'", .{operand_ty.fmt(mod)}), |
| 9808 | .Pointer => try sema.errNote(block, dest_ty_src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(mod)}), | 9808 | .Pointer => try sema.errNote(block, dest_ty_src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(mod)}), |
| 9809 | else => {}, | 9809 | else => {}, |
| 9810 | } | 9810 | } |
| ... | @@ -9854,7 +9854,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -9854,7 +9854,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9854 | const msg = try sema.errMsg(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(mod)}); | 9854 | const msg = try sema.errMsg(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(mod)}); |
| 9855 | errdefer msg.destroy(sema.gpa); | 9855 | errdefer msg.destroy(sema.gpa); |
| 9856 | switch (dest_ty.zigTypeTag(mod)) { | 9856 | switch (dest_ty.zigTypeTag(mod)) { |
| 9857 | .Int, .ComptimeInt => try sema.errNote(block, operand_src, msg, "use @enumToInt to cast to '{}'", .{dest_ty.fmt(mod)}), | 9857 | .Int, .ComptimeInt => try sema.errNote(block, operand_src, msg, "use @intFromEnum to cast to '{}'", .{dest_ty.fmt(mod)}), |
| 9858 | else => {}, | 9858 | else => {}, |
| 9859 | } | 9859 | } |
| 9860 | 9860 | ||
| ... | @@ -9867,7 +9867,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -9867,7 +9867,7 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 9867 | const msg = try sema.errMsg(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(mod)}); | 9867 | const msg = try sema.errMsg(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(mod)}); |
| 9868 | errdefer msg.destroy(sema.gpa); | 9868 | errdefer msg.destroy(sema.gpa); |
| 9869 | switch (dest_ty.zigTypeTag(mod)) { | 9869 | switch (dest_ty.zigTypeTag(mod)) { |
| 9870 | .Int, .ComptimeInt => try sema.errNote(block, operand_src, msg, "use @ptrToInt to cast to '{}'", .{dest_ty.fmt(mod)}), | 9870 | .Int, .ComptimeInt => try sema.errNote(block, operand_src, msg, "use @intFromPtr to cast to '{}'", .{dest_ty.fmt(mod)}), |
| 9871 | .Pointer => try sema.errNote(block, operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(mod)}), | 9871 | .Pointer => try sema.errNote(block, operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(mod)}), |
| 9872 | else => {}, | 9872 | else => {}, |
| 9873 | } | 9873 | } |
| ... | @@ -10547,7 +10547,7 @@ const SwitchProngAnalysis = struct { | ... | @@ -10547,7 +10547,7 @@ const SwitchProngAnalysis = struct { |
| 10547 | try cases_extra.ensureUnusedCapacity(3 + coerce_block.instructions.items.len); | 10547 | try cases_extra.ensureUnusedCapacity(3 + coerce_block.instructions.items.len); |
| 10548 | cases_extra.appendAssumeCapacity(1); // items_len | 10548 | cases_extra.appendAssumeCapacity(1); // items_len |
| 10549 | cases_extra.appendAssumeCapacity(@intCast(u32, coerce_block.instructions.items.len)); // body_len | 10549 | cases_extra.appendAssumeCapacity(@intCast(u32, coerce_block.instructions.items.len)); // body_len |
| 10550 | cases_extra.appendAssumeCapacity(@enumToInt(case_vals[idx])); // item | 10550 | cases_extra.appendAssumeCapacity(@intFromEnum(case_vals[idx])); // item |
| 10551 | cases_extra.appendSliceAssumeCapacity(coerce_block.instructions.items); // body | 10551 | cases_extra.appendSliceAssumeCapacity(coerce_block.instructions.items); // body |
| 10552 | } | 10552 | } |
| 10553 | } | 10553 | } |
| ... | @@ -10834,7 +10834,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -10834,7 +10834,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 10834 | { | 10834 | { |
| 10835 | var scalar_i: u32 = 0; | 10835 | var scalar_i: u32 = 0; |
| 10836 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 10836 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 10837 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 10837 | const item_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 10838 | extra_index += 1; | 10838 | extra_index += 1; |
| 10839 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); | 10839 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); |
| 10840 | extra_index += 1 + info.body_len; | 10840 | extra_index += 1 + info.body_len; |
| ... | @@ -10933,7 +10933,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -10933,7 +10933,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 10933 | { | 10933 | { |
| 10934 | var scalar_i: u32 = 0; | 10934 | var scalar_i: u32 = 0; |
| 10935 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 10935 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 10936 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 10936 | const item_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 10937 | extra_index += 1; | 10937 | extra_index += 1; |
| 10938 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); | 10938 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); |
| 10939 | extra_index += 1 + info.body_len; | 10939 | extra_index += 1 + info.body_len; |
| ... | @@ -11074,7 +11074,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11074,7 +11074,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11074 | { | 11074 | { |
| 11075 | var scalar_i: u32 = 0; | 11075 | var scalar_i: u32 = 0; |
| 11076 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 11076 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 11077 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 11077 | const item_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 11078 | extra_index += 1; | 11078 | extra_index += 1; |
| 11079 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); | 11079 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); |
| 11080 | extra_index += 1 + info.body_len; | 11080 | extra_index += 1 + info.body_len; |
| ... | @@ -11116,9 +11116,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11116,9 +11116,9 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11116 | try case_vals.ensureUnusedCapacity(gpa, 2 * ranges_len); | 11116 | try case_vals.ensureUnusedCapacity(gpa, 2 * ranges_len); |
| 11117 | var range_i: u32 = 0; | 11117 | var range_i: u32 = 0; |
| 11118 | while (range_i < ranges_len) : (range_i += 1) { | 11118 | while (range_i < ranges_len) : (range_i += 1) { |
| 11119 | const item_first = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 11119 | const item_first = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 11120 | extra_index += 1; | 11120 | extra_index += 1; |
| 11121 | const item_last = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 11121 | const item_last = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 11122 | extra_index += 1; | 11122 | extra_index += 1; |
| 11123 | 11123 | ||
| 11124 | const vals = try sema.validateSwitchRange( | 11124 | const vals = try sema.validateSwitchRange( |
| ... | @@ -11169,7 +11169,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11169,7 +11169,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11169 | { | 11169 | { |
| 11170 | var scalar_i: u32 = 0; | 11170 | var scalar_i: u32 = 0; |
| 11171 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 11171 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 11172 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 11172 | const item_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 11173 | extra_index += 1; | 11173 | extra_index += 1; |
| 11174 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); | 11174 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); |
| 11175 | extra_index += 1 + info.body_len; | 11175 | extra_index += 1 + info.body_len; |
| ... | @@ -11251,7 +11251,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11251,7 +11251,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11251 | { | 11251 | { |
| 11252 | var scalar_i: u32 = 0; | 11252 | var scalar_i: u32 = 0; |
| 11253 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 11253 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 11254 | const item_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 11254 | const item_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 11255 | extra_index += 1; | 11255 | extra_index += 1; |
| 11256 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); | 11256 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, sema.code.extra[extra_index]); |
| 11257 | extra_index += 1; | 11257 | extra_index += 1; |
| ... | @@ -11571,7 +11571,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11571,7 +11571,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11571 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11571 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11572 | cases_extra.appendAssumeCapacity(1); // items_len | 11572 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11573 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11573 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11574 | cases_extra.appendAssumeCapacity(@enumToInt(item)); | 11574 | cases_extra.appendAssumeCapacity(@intFromEnum(item)); |
| 11575 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11575 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11576 | } | 11576 | } |
| 11577 | 11577 | ||
| ... | @@ -11656,7 +11656,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11656,7 +11656,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11656 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11656 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11657 | cases_extra.appendAssumeCapacity(1); // items_len | 11657 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11658 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11658 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11659 | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); | 11659 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); |
| 11660 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11660 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11661 | } | 11661 | } |
| 11662 | } | 11662 | } |
| ... | @@ -11702,7 +11702,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11702,7 +11702,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11702 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11702 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11703 | cases_extra.appendAssumeCapacity(1); // items_len | 11703 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11704 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11704 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11705 | cases_extra.appendAssumeCapacity(@enumToInt(item)); | 11705 | cases_extra.appendAssumeCapacity(@intFromEnum(item)); |
| 11706 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11706 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11707 | } | 11707 | } |
| 11708 | 11708 | ||
| ... | @@ -11753,7 +11753,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11753,7 +11753,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11753 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11753 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11754 | 11754 | ||
| 11755 | for (items) |item| { | 11755 | for (items) |item| { |
| 11756 | cases_extra.appendAssumeCapacity(@enumToInt(item)); | 11756 | cases_extra.appendAssumeCapacity(@intFromEnum(item)); |
| 11757 | } | 11757 | } |
| 11758 | 11758 | ||
| 11759 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11759 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| ... | @@ -11903,7 +11903,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11903,7 +11903,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11903 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11903 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11904 | cases_extra.appendAssumeCapacity(1); // items_len | 11904 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11905 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11905 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11906 | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); | 11906 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); |
| 11907 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11907 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11908 | } | 11908 | } |
| 11909 | }, | 11909 | }, |
| ... | @@ -11944,7 +11944,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11944,7 +11944,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11944 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11944 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11945 | cases_extra.appendAssumeCapacity(1); // items_len | 11945 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11946 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11946 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11947 | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); | 11947 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); |
| 11948 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11948 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11949 | } | 11949 | } |
| 11950 | }, | 11950 | }, |
| ... | @@ -11975,7 +11975,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -11975,7 +11975,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 11975 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 11975 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 11976 | cases_extra.appendAssumeCapacity(1); // items_len | 11976 | cases_extra.appendAssumeCapacity(1); // items_len |
| 11977 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 11977 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 11978 | cases_extra.appendAssumeCapacity(@enumToInt(item_ref)); | 11978 | cases_extra.appendAssumeCapacity(@intFromEnum(item_ref)); |
| 11979 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 11979 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 11980 | } | 11980 | } |
| 11981 | }, | 11981 | }, |
| ... | @@ -12003,7 +12003,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -12003,7 +12003,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 12003 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 12003 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12004 | cases_extra.appendAssumeCapacity(1); // items_len | 12004 | cases_extra.appendAssumeCapacity(1); // items_len |
| 12005 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 12005 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 12006 | cases_extra.appendAssumeCapacity(@enumToInt(Air.Inst.Ref.bool_true)); | 12006 | cases_extra.appendAssumeCapacity(@intFromEnum(Air.Inst.Ref.bool_true)); |
| 12007 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 12007 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 12008 | } | 12008 | } |
| 12009 | if (false_count == 0) { | 12009 | if (false_count == 0) { |
| ... | @@ -12029,7 +12029,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r | ... | @@ -12029,7 +12029,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r |
| 12029 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); | 12029 | try cases_extra.ensureUnusedCapacity(gpa, 3 + case_block.instructions.items.len); |
| 12030 | cases_extra.appendAssumeCapacity(1); // items_len | 12030 | cases_extra.appendAssumeCapacity(1); // items_len |
| 12031 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); | 12031 | cases_extra.appendAssumeCapacity(@intCast(u32, case_block.instructions.items.len)); |
| 12032 | cases_extra.appendAssumeCapacity(@enumToInt(Air.Inst.Ref.bool_false)); | 12032 | cases_extra.appendAssumeCapacity(@intFromEnum(Air.Inst.Ref.bool_false)); |
| 12033 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); | 12033 | cases_extra.appendSliceAssumeCapacity(case_block.instructions.items); |
| 12034 | } | 12034 | } |
| 12035 | }, | 12035 | }, |
| ... | @@ -15685,7 +15685,7 @@ fn zirAsm( | ... | @@ -15685,7 +15685,7 @@ fn zirAsm( |
| 15685 | const is_global_assembly = sema.func_index == .none; | 15685 | const is_global_assembly = sema.func_index == .none; |
| 15686 | 15686 | ||
| 15687 | const asm_source: []const u8 = if (tmpl_is_expr) blk: { | 15687 | const asm_source: []const u8 = if (tmpl_is_expr) blk: { |
| 15688 | const tmpl = @intToEnum(Zir.Inst.Ref, extra.data.asm_source); | 15688 | const tmpl = @enumFromInt(Zir.Inst.Ref, extra.data.asm_source); |
| 15689 | const s: []const u8 = try sema.resolveConstString(block, src, tmpl, "assembly code must be comptime-known"); | 15689 | const s: []const u8 = try sema.resolveConstString(block, src, tmpl, "assembly code must be comptime-known"); |
| 15690 | break :blk s; | 15690 | break :blk s; |
| 15691 | } else sema.code.nullTerminatedString(extra.data.asm_source); | 15691 | } else sema.code.nullTerminatedString(extra.data.asm_source); |
| ... | @@ -15789,7 +15789,7 @@ fn zirAsm( | ... | @@ -15789,7 +15789,7 @@ fn zirAsm( |
| 15789 | .source_len = @intCast(u32, asm_source.len), | 15789 | .source_len = @intCast(u32, asm_source.len), |
| 15790 | .outputs_len = outputs_len, | 15790 | .outputs_len = outputs_len, |
| 15791 | .inputs_len = @intCast(u32, args.len), | 15791 | .inputs_len = @intCast(u32, args.len), |
| 15792 | .flags = (@as(u32, @boolToInt(is_volatile)) << 31) | @intCast(u32, clobbers.len), | 15792 | .flags = (@as(u32, @intFromBool(is_volatile)) << 31) | @intCast(u32, clobbers.len), |
| 15793 | }), | 15793 | }), |
| 15794 | } }, | 15794 | } }, |
| 15795 | }); | 15795 | }); |
| ... | @@ -16448,7 +16448,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16448,7 +16448,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16448 | .EnumLiteral, | 16448 | .EnumLiteral, |
| 16449 | => |type_info_tag| return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16449 | => |type_info_tag| return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16450 | .ty = type_info_ty.toIntern(), | 16450 | .ty = type_info_ty.toIntern(), |
| 16451 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(type_info_tag))).toIntern(), | 16451 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(type_info_tag))).toIntern(), |
| 16452 | .val = .void_value, | 16452 | .val = .void_value, |
| 16453 | } })).toValue()), | 16453 | } })).toValue()), |
| 16454 | .Fn => { | 16454 | .Fn => { |
| ... | @@ -16543,7 +16543,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16543,7 +16543,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16543 | 16543 | ||
| 16544 | const field_values = .{ | 16544 | const field_values = .{ |
| 16545 | // calling_convention: CallingConvention, | 16545 | // calling_convention: CallingConvention, |
| 16546 | (try mod.enumValueFieldIndex(callconv_ty, @enumToInt(info.cc))).toIntern(), | 16546 | (try mod.enumValueFieldIndex(callconv_ty, @intFromEnum(info.cc))).toIntern(), |
| 16547 | // alignment: comptime_int, | 16547 | // alignment: comptime_int, |
| 16548 | (try mod.intValue(Type.comptime_int, ty.abiAlignment(mod))).toIntern(), | 16548 | (try mod.intValue(Type.comptime_int, ty.abiAlignment(mod))).toIntern(), |
| 16549 | // is_generic: bool, | 16549 | // is_generic: bool, |
| ... | @@ -16557,7 +16557,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16557,7 +16557,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16557 | }; | 16557 | }; |
| 16558 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16558 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16559 | .ty = type_info_ty.toIntern(), | 16559 | .ty = type_info_ty.toIntern(), |
| 16560 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Fn))).toIntern(), | 16560 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Fn))).toIntern(), |
| 16561 | .val = try mod.intern(.{ .aggregate = .{ | 16561 | .val = try mod.intern(.{ .aggregate = .{ |
| 16562 | .ty = fn_info_ty.toIntern(), | 16562 | .ty = fn_info_ty.toIntern(), |
| 16563 | .storage = .{ .elems = &field_values }, | 16563 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16580,13 +16580,13 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16580,13 +16580,13 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16580 | const info = ty.intInfo(mod); | 16580 | const info = ty.intInfo(mod); |
| 16581 | const field_values = .{ | 16581 | const field_values = .{ |
| 16582 | // signedness: Signedness, | 16582 | // signedness: Signedness, |
| 16583 | try (try mod.enumValueFieldIndex(signedness_ty, @enumToInt(info.signedness))).intern(signedness_ty, mod), | 16583 | try (try mod.enumValueFieldIndex(signedness_ty, @intFromEnum(info.signedness))).intern(signedness_ty, mod), |
| 16584 | // bits: u16, | 16584 | // bits: u16, |
| 16585 | (try mod.intValue(Type.u16, info.bits)).toIntern(), | 16585 | (try mod.intValue(Type.u16, info.bits)).toIntern(), |
| 16586 | }; | 16586 | }; |
| 16587 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16587 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16588 | .ty = type_info_ty.toIntern(), | 16588 | .ty = type_info_ty.toIntern(), |
| 16589 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Int))).toIntern(), | 16589 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Int))).toIntern(), |
| 16590 | .val = try mod.intern(.{ .aggregate = .{ | 16590 | .val = try mod.intern(.{ .aggregate = .{ |
| 16591 | .ty = int_info_ty.toIntern(), | 16591 | .ty = int_info_ty.toIntern(), |
| 16592 | .storage = .{ .elems = &field_values }, | 16592 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16611,7 +16611,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16611,7 +16611,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16611 | }; | 16611 | }; |
| 16612 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16612 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16613 | .ty = type_info_ty.toIntern(), | 16613 | .ty = type_info_ty.toIntern(), |
| 16614 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Float))).toIntern(), | 16614 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Float))).toIntern(), |
| 16615 | .val = try mod.intern(.{ .aggregate = .{ | 16615 | .val = try mod.intern(.{ .aggregate = .{ |
| 16616 | .ty = float_info_ty.toIntern(), | 16616 | .ty = float_info_ty.toIntern(), |
| 16617 | .storage = .{ .elems = &field_vals }, | 16617 | .storage = .{ .elems = &field_vals }, |
| ... | @@ -16653,7 +16653,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16653,7 +16653,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16653 | 16653 | ||
| 16654 | const field_values = .{ | 16654 | const field_values = .{ |
| 16655 | // size: Size, | 16655 | // size: Size, |
| 16656 | try (try mod.enumValueFieldIndex(ptr_size_ty, @enumToInt(info.size))).intern(ptr_size_ty, mod), | 16656 | try (try mod.enumValueFieldIndex(ptr_size_ty, @intFromEnum(info.size))).intern(ptr_size_ty, mod), |
| 16657 | // is_const: bool, | 16657 | // is_const: bool, |
| 16658 | Value.makeBool(!info.mutable).toIntern(), | 16658 | Value.makeBool(!info.mutable).toIntern(), |
| 16659 | // is_volatile: bool, | 16659 | // is_volatile: bool, |
| ... | @@ -16661,7 +16661,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16661,7 +16661,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16661 | // alignment: comptime_int, | 16661 | // alignment: comptime_int, |
| 16662 | alignment.toIntern(), | 16662 | alignment.toIntern(), |
| 16663 | // address_space: AddressSpace | 16663 | // address_space: AddressSpace |
| 16664 | try (try mod.enumValueFieldIndex(addrspace_ty, @enumToInt(info.@"addrspace"))).intern(addrspace_ty, mod), | 16664 | try (try mod.enumValueFieldIndex(addrspace_ty, @intFromEnum(info.@"addrspace"))).intern(addrspace_ty, mod), |
| 16665 | // child: type, | 16665 | // child: type, |
| 16666 | info.pointee_type.toIntern(), | 16666 | info.pointee_type.toIntern(), |
| 16667 | // is_allowzero: bool, | 16667 | // is_allowzero: bool, |
| ... | @@ -16671,7 +16671,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16671,7 +16671,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16671 | }; | 16671 | }; |
| 16672 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16672 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16673 | .ty = type_info_ty.toIntern(), | 16673 | .ty = type_info_ty.toIntern(), |
| 16674 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Pointer))).toIntern(), | 16674 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Pointer))).toIntern(), |
| 16675 | .val = try mod.intern(.{ .aggregate = .{ | 16675 | .val = try mod.intern(.{ .aggregate = .{ |
| 16676 | .ty = pointer_ty.toIntern(), | 16676 | .ty = pointer_ty.toIntern(), |
| 16677 | .storage = .{ .elems = &field_values }, | 16677 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16703,7 +16703,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16703,7 +16703,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16703 | }; | 16703 | }; |
| 16704 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16704 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16705 | .ty = type_info_ty.toIntern(), | 16705 | .ty = type_info_ty.toIntern(), |
| 16706 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Array))).toIntern(), | 16706 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Array))).toIntern(), |
| 16707 | .val = try mod.intern(.{ .aggregate = .{ | 16707 | .val = try mod.intern(.{ .aggregate = .{ |
| 16708 | .ty = array_field_ty.toIntern(), | 16708 | .ty = array_field_ty.toIntern(), |
| 16709 | .storage = .{ .elems = &field_values }, | 16709 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16733,7 +16733,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16733,7 +16733,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16733 | }; | 16733 | }; |
| 16734 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16734 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16735 | .ty = type_info_ty.toIntern(), | 16735 | .ty = type_info_ty.toIntern(), |
| 16736 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Vector))).toIntern(), | 16736 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Vector))).toIntern(), |
| 16737 | .val = try mod.intern(.{ .aggregate = .{ | 16737 | .val = try mod.intern(.{ .aggregate = .{ |
| 16738 | .ty = vector_field_ty.toIntern(), | 16738 | .ty = vector_field_ty.toIntern(), |
| 16739 | .storage = .{ .elems = &field_values }, | 16739 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16760,7 +16760,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16760,7 +16760,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16760 | }; | 16760 | }; |
| 16761 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16761 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16762 | .ty = type_info_ty.toIntern(), | 16762 | .ty = type_info_ty.toIntern(), |
| 16763 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Optional))).toIntern(), | 16763 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Optional))).toIntern(), |
| 16764 | .val = try mod.intern(.{ .aggregate = .{ | 16764 | .val = try mod.intern(.{ .aggregate = .{ |
| 16765 | .ty = optional_field_ty.toIntern(), | 16765 | .ty = optional_field_ty.toIntern(), |
| 16766 | .storage = .{ .elems = &field_values }, | 16766 | .storage = .{ .elems = &field_values }, |
| ... | @@ -16870,7 +16870,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16870,7 +16870,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16870 | // Construct Type{ .ErrorSet = errors_val } | 16870 | // Construct Type{ .ErrorSet = errors_val } |
| 16871 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16871 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16872 | .ty = type_info_ty.toIntern(), | 16872 | .ty = type_info_ty.toIntern(), |
| 16873 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.ErrorSet))).toIntern(), | 16873 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorSet))).toIntern(), |
| 16874 | .val = errors_val, | 16874 | .val = errors_val, |
| 16875 | } })).toValue()); | 16875 | } })).toValue()); |
| 16876 | }, | 16876 | }, |
| ... | @@ -16896,7 +16896,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -16896,7 +16896,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 16896 | }; | 16896 | }; |
| 16897 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 16897 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 16898 | .ty = type_info_ty.toIntern(), | 16898 | .ty = type_info_ty.toIntern(), |
| 16899 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.ErrorUnion))).toIntern(), | 16899 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorUnion))).toIntern(), |
| 16900 | .val = try mod.intern(.{ .aggregate = .{ | 16900 | .val = try mod.intern(.{ .aggregate = .{ |
| 16901 | .ty = error_union_field_ty.toIntern(), | 16901 | .ty = error_union_field_ty.toIntern(), |
| 16902 | .storage = .{ .elems = &field_values }, | 16902 | .storage = .{ .elems = &field_values }, |
| ... | @@ -17023,7 +17023,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17023,7 +17023,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17023 | }; | 17023 | }; |
| 17024 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 17024 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 17025 | .ty = type_info_ty.toIntern(), | 17025 | .ty = type_info_ty.toIntern(), |
| 17026 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Enum))).toIntern(), | 17026 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Enum))).toIntern(), |
| 17027 | .val = try mod.intern(.{ .aggregate = .{ | 17027 | .val = try mod.intern(.{ .aggregate = .{ |
| 17028 | .ty = type_enum_ty.toIntern(), | 17028 | .ty = type_enum_ty.toIntern(), |
| 17029 | .storage = .{ .elems = &field_values }, | 17029 | .storage = .{ .elems = &field_values }, |
| ... | @@ -17164,7 +17164,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17164,7 +17164,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17164 | 17164 | ||
| 17165 | const field_values = .{ | 17165 | const field_values = .{ |
| 17166 | // layout: ContainerLayout, | 17166 | // layout: ContainerLayout, |
| 17167 | (try mod.enumValueFieldIndex(container_layout_ty, @enumToInt(layout))).toIntern(), | 17167 | (try mod.enumValueFieldIndex(container_layout_ty, @intFromEnum(layout))).toIntern(), |
| 17168 | 17168 | ||
| 17169 | // tag_type: ?type, | 17169 | // tag_type: ?type, |
| 17170 | enum_tag_ty_val, | 17170 | enum_tag_ty_val, |
| ... | @@ -17175,7 +17175,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17175,7 +17175,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17175 | }; | 17175 | }; |
| 17176 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 17176 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 17177 | .ty = type_info_ty.toIntern(), | 17177 | .ty = type_info_ty.toIntern(), |
| 17178 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Union))).toIntern(), | 17178 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Union))).toIntern(), |
| 17179 | .val = try mod.intern(.{ .aggregate = .{ | 17179 | .val = try mod.intern(.{ .aggregate = .{ |
| 17180 | .ty = type_union_ty.toIntern(), | 17180 | .ty = type_union_ty.toIntern(), |
| 17181 | .storage = .{ .elems = &field_values }, | 17181 | .storage = .{ .elems = &field_values }, |
| ... | @@ -17393,7 +17393,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17393,7 +17393,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17393 | 17393 | ||
| 17394 | const field_values = [_]InternPool.Index{ | 17394 | const field_values = [_]InternPool.Index{ |
| 17395 | // layout: ContainerLayout, | 17395 | // layout: ContainerLayout, |
| 17396 | (try mod.enumValueFieldIndex(container_layout_ty, @enumToInt(layout))).toIntern(), | 17396 | (try mod.enumValueFieldIndex(container_layout_ty, @intFromEnum(layout))).toIntern(), |
| 17397 | // backing_integer: ?type, | 17397 | // backing_integer: ?type, |
| 17398 | backing_integer_val, | 17398 | backing_integer_val, |
| 17399 | // fields: []const StructField, | 17399 | // fields: []const StructField, |
| ... | @@ -17405,7 +17405,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17405,7 +17405,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17405 | }; | 17405 | }; |
| 17406 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 17406 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 17407 | .ty = type_info_ty.toIntern(), | 17407 | .ty = type_info_ty.toIntern(), |
| 17408 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Struct))).toIntern(), | 17408 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Struct))).toIntern(), |
| 17409 | .val = try mod.intern(.{ .aggregate = .{ | 17409 | .val = try mod.intern(.{ .aggregate = .{ |
| 17410 | .ty = type_struct_ty.toIntern(), | 17410 | .ty = type_struct_ty.toIntern(), |
| 17411 | .storage = .{ .elems = &field_values }, | 17411 | .storage = .{ .elems = &field_values }, |
| ... | @@ -17437,7 +17437,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai | ... | @@ -17437,7 +17437,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai |
| 17437 | }; | 17437 | }; |
| 17438 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ | 17438 | return sema.addConstant(type_info_ty, (try mod.intern(.{ .un = .{ |
| 17439 | .ty = type_info_ty.toIntern(), | 17439 | .ty = type_info_ty.toIntern(), |
| 17440 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @enumToInt(std.builtin.TypeId.Opaque))).toIntern(), | 17440 | .tag = (try mod.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Opaque))).toIntern(), |
| 17441 | .val = try mod.intern(.{ .aggregate = .{ | 17441 | .val = try mod.intern(.{ .aggregate = .{ |
| 17442 | .ty = type_opaque_ty.toIntern(), | 17442 | .ty = type_opaque_ty.toIntern(), |
| 17443 | .storage = .{ .elems = &field_values }, | 17443 | .storage = .{ .elems = &field_values }, |
| ... | @@ -18494,7 +18494,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18494,7 +18494,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18494 | var extra_i = extra.end; | 18494 | var extra_i = extra.end; |
| 18495 | 18495 | ||
| 18496 | const sentinel = if (inst_data.flags.has_sentinel) blk: { | 18496 | const sentinel = if (inst_data.flags.has_sentinel) blk: { |
| 18497 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 18497 | const ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 18498 | extra_i += 1; | 18498 | extra_i += 1; |
| 18499 | const coerced = try sema.coerce(block, elem_ty, try sema.resolveInst(ref), sentinel_src); | 18499 | const coerced = try sema.coerce(block, elem_ty, try sema.resolveInst(ref), sentinel_src); |
| 18500 | const val = try sema.resolveConstValue(block, sentinel_src, coerced, "pointer sentinel value must be comptime-known"); | 18500 | const val = try sema.resolveConstValue(block, sentinel_src, coerced, "pointer sentinel value must be comptime-known"); |
| ... | @@ -18502,7 +18502,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18502,7 +18502,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18502 | } else .none; | 18502 | } else .none; |
| 18503 | 18503 | ||
| 18504 | const abi_align: InternPool.Alignment = if (inst_data.flags.has_align) blk: { | 18504 | const abi_align: InternPool.Alignment = if (inst_data.flags.has_align) blk: { |
| 18505 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 18505 | const ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 18506 | extra_i += 1; | 18506 | extra_i += 1; |
| 18507 | const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src); | 18507 | const coerced = try sema.coerce(block, Type.u32, try sema.resolveInst(ref), align_src); |
| 18508 | const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime-known"); | 18508 | const val = try sema.resolveConstValue(block, align_src, coerced, "pointer alignment must be comptime-known"); |
| ... | @@ -18521,20 +18521,20 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -18521,20 +18521,20 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 18521 | } else .none; | 18521 | } else .none; |
| 18522 | 18522 | ||
| 18523 | const address_space: std.builtin.AddressSpace = if (inst_data.flags.has_addrspace) blk: { | 18523 | const address_space: std.builtin.AddressSpace = if (inst_data.flags.has_addrspace) blk: { |
| 18524 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 18524 | const ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 18525 | extra_i += 1; | 18525 | extra_i += 1; |
| 18526 | break :blk try sema.analyzeAddressSpace(block, addrspace_src, ref, .pointer); | 18526 | break :blk try sema.analyzeAddressSpace(block, addrspace_src, ref, .pointer); |
| 18527 | } else if (elem_ty.zigTypeTag(mod) == .Fn and target.cpu.arch == .avr) .flash else .generic; | 18527 | } else if (elem_ty.zigTypeTag(mod) == .Fn and target.cpu.arch == .avr) .flash else .generic; |
| 18528 | 18528 | ||
| 18529 | const bit_offset = if (inst_data.flags.has_bit_range) blk: { | 18529 | const bit_offset = if (inst_data.flags.has_bit_range) blk: { |
| 18530 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 18530 | const ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 18531 | extra_i += 1; | 18531 | extra_i += 1; |
| 18532 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime-known"); | 18532 | const bit_offset = try sema.resolveInt(block, bitoffset_src, ref, Type.u16, "pointer bit-offset must be comptime-known"); |
| 18533 | break :blk @intCast(u16, bit_offset); | 18533 | break :blk @intCast(u16, bit_offset); |
| 18534 | } else 0; | 18534 | } else 0; |
| 18535 | 18535 | ||
| 18536 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { | 18536 | const host_size: u16 = if (inst_data.flags.has_bit_range) blk: { |
| 18537 | const ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_i]); | 18537 | const ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_i]); |
| 18538 | extra_i += 1; | 18538 | extra_i += 1; |
| 18539 | const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime-known"); | 18539 | const host_size = try sema.resolveInt(block, hostsize_src, ref, Type.u16, "pointer host size must be comptime-known"); |
| 18540 | break :blk @intCast(u16, host_size); | 18540 | break :blk @intCast(u16, host_size); |
| ... | @@ -19093,7 +19093,7 @@ fn zirArrayInit( | ... | @@ -19093,7 +19093,7 @@ fn zirArrayInit( |
| 19093 | const array_ty = try sema.resolveType(block, src, args[0]); | 19093 | const array_ty = try sema.resolveType(block, src, args[0]); |
| 19094 | const sentinel_val = array_ty.sentinel(mod); | 19094 | const sentinel_val = array_ty.sentinel(mod); |
| 19095 | 19095 | ||
| 19096 | const resolved_args = try gpa.alloc(Air.Inst.Ref, args.len - 1 + @boolToInt(sentinel_val != null)); | 19096 | const resolved_args = try gpa.alloc(Air.Inst.Ref, args.len - 1 + @intFromBool(sentinel_val != null)); |
| 19097 | defer gpa.free(resolved_args); | 19097 | defer gpa.free(resolved_args); |
| 19098 | for (args[1..], 0..) |arg, i| { | 19098 | for (args[1..], 0..) |arg, i| { |
| 19099 | const resolved_arg = try sema.resolveInst(arg); | 19099 | const resolved_arg = try sema.resolveInst(arg); |
| ... | @@ -19600,7 +19600,7 @@ fn zirReify( | ... | @@ -19600,7 +19600,7 @@ fn zirReify( |
| 19600 | const mod = sema.mod; | 19600 | const mod = sema.mod; |
| 19601 | const gpa = sema.gpa; | 19601 | const gpa = sema.gpa; |
| 19602 | const ip = &mod.intern_pool; | 19602 | const ip = &mod.intern_pool; |
| 19603 | const name_strategy = @intToEnum(Zir.Inst.NameStrategy, extended.small); | 19603 | const name_strategy = @enumFromInt(Zir.Inst.NameStrategy, extended.small); |
| 19604 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; | 19604 | const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data; |
| 19605 | const src = LazySrcLoc.nodeOffset(extra.node); | 19605 | const src = LazySrcLoc.nodeOffset(extra.node); |
| 19606 | const type_info_ty = try sema.getBuiltinType("Type"); | 19606 | const type_info_ty = try sema.getBuiltinType("Type"); |
| ... | @@ -19612,7 +19612,7 @@ fn zirReify( | ... | @@ -19612,7 +19612,7 @@ fn zirReify( |
| 19612 | const target = mod.getTarget(); | 19612 | const target = mod.getTarget(); |
| 19613 | if (try union_val.val.toValue().anyUndef(mod)) return sema.failWithUseOfUndef(block, src); | 19613 | if (try union_val.val.toValue().anyUndef(mod)) return sema.failWithUseOfUndef(block, src); |
| 19614 | const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag.toValue(), mod).?; | 19614 | const tag_index = type_info_ty.unionTagFieldIndex(union_val.tag.toValue(), mod).?; |
| 19615 | switch (@intToEnum(std.builtin.TypeId, tag_index)) { | 19615 | switch (@enumFromInt(std.builtin.TypeId, tag_index)) { |
| 19616 | .Type => return Air.Inst.Ref.type_type, | 19616 | .Type => return Air.Inst.Ref.type_type, |
| 19617 | .Void => return Air.Inst.Ref.void_type, | 19617 | .Void => return Air.Inst.Ref.void_type, |
| 19618 | .Bool => return Air.Inst.Ref.bool_type, | 19618 | .Bool => return Air.Inst.Ref.bool_type, |
| ... | @@ -20762,7 +20762,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -20762,7 +20762,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 20762 | try sema.checkFloatType(block, operand_src, operand_ty); | 20762 | try sema.checkFloatType(block, operand_src, operand_ty); |
| 20763 | 20763 | ||
| 20764 | if (try sema.resolveMaybeUndefVal(operand)) |val| { | 20764 | if (try sema.resolveMaybeUndefVal(operand)) |val| { |
| 20765 | const result_val = try sema.floatToInt(block, operand_src, val, operand_ty, dest_ty); | 20765 | const result_val = try sema.intFromFloat(block, operand_src, val, operand_ty, dest_ty); |
| 20766 | return sema.addConstant(dest_ty, result_val); | 20766 | return sema.addConstant(dest_ty, result_val); |
| 20767 | } else if (dest_ty.zigTypeTag(mod) == .ComptimeInt) { | 20767 | } else if (dest_ty.zigTypeTag(mod) == .ComptimeInt) { |
| 20768 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime-known"); | 20768 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_int' must be comptime-known"); |
| ... | @@ -20802,7 +20802,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro | ... | @@ -20802,7 +20802,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro |
| 20802 | _ = try sema.checkIntType(block, operand_src, operand_ty); | 20802 | _ = try sema.checkIntType(block, operand_src, operand_ty); |
| 20803 | 20803 | ||
| 20804 | if (try sema.resolveMaybeUndefVal(operand)) |val| { | 20804 | if (try sema.resolveMaybeUndefVal(operand)) |val| { |
| 20805 | const result_val = try val.intToFloatAdvanced(sema.arena, operand_ty, dest_ty, sema.mod, sema); | 20805 | const result_val = try val.floatFromIntAdvanced(sema.arena, operand_ty, dest_ty, sema.mod, sema); |
| 20806 | return sema.addConstant(dest_ty, result_val); | 20806 | return sema.addConstant(dest_ty, result_val); |
| 20807 | } else if (dest_ty.zigTypeTag(mod) == .ComptimeFloat) { | 20807 | } else if (dest_ty.zigTypeTag(mod) == .ComptimeFloat) { |
| 20808 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime-known"); | 20808 | return sema.failWithNeededComptime(block, operand_src, "value being casted to 'comptime_float' must be comptime-known"); |
| ... | @@ -21750,7 +21750,7 @@ fn checkComptimeVarStore( | ... | @@ -21750,7 +21750,7 @@ fn checkComptimeVarStore( |
| 21750 | src: LazySrcLoc, | 21750 | src: LazySrcLoc, |
| 21751 | decl_ref_mut: InternPool.Key.Ptr.Addr.MutDecl, | 21751 | decl_ref_mut: InternPool.Key.Ptr.Addr.MutDecl, |
| 21752 | ) CompileError!void { | 21752 | ) CompileError!void { |
| 21753 | if (@enumToInt(decl_ref_mut.runtime_index) < @enumToInt(block.runtime_index)) { | 21753 | if (@intFromEnum(decl_ref_mut.runtime_index) < @intFromEnum(block.runtime_index)) { |
| 21754 | if (block.runtime_cond) |cond_src| { | 21754 | if (block.runtime_cond) |cond_src| { |
| 21755 | const msg = msg: { | 21755 | const msg = msg: { |
| 21756 | const msg = try sema.errMsg(block, src, "store to comptime variable depends on runtime condition", .{}); | 21756 | const msg = try sema.errMsg(block, src, "store to comptime variable depends on runtime condition", .{}); |
| ... | @@ -22065,13 +22065,13 @@ fn zirCmpxchg( | ... | @@ -22065,13 +22065,13 @@ fn zirCmpxchg( |
| 22065 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime-known"); | 22065 | const success_order = try sema.resolveAtomicOrder(block, success_order_src, extra.success_order, "atomic order of cmpxchg success must be comptime-known"); |
| 22066 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime-known"); | 22066 | const failure_order = try sema.resolveAtomicOrder(block, failure_order_src, extra.failure_order, "atomic order of cmpxchg failure must be comptime-known"); |
| 22067 | 22067 | ||
| 22068 | if (@enumToInt(success_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) { | 22068 | if (@intFromEnum(success_order) < @intFromEnum(std.builtin.AtomicOrder.Monotonic)) { |
| 22069 | return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{}); | 22069 | return sema.fail(block, success_order_src, "success atomic ordering must be Monotonic or stricter", .{}); |
| 22070 | } | 22070 | } |
| 22071 | if (@enumToInt(failure_order) < @enumToInt(std.builtin.AtomicOrder.Monotonic)) { | 22071 | if (@intFromEnum(failure_order) < @intFromEnum(std.builtin.AtomicOrder.Monotonic)) { |
| 22072 | return sema.fail(block, failure_order_src, "failure atomic ordering must be Monotonic or stricter", .{}); | 22072 | return sema.fail(block, failure_order_src, "failure atomic ordering must be Monotonic or stricter", .{}); |
| 22073 | } | 22073 | } |
| 22074 | if (@enumToInt(failure_order) > @enumToInt(success_order)) { | 22074 | if (@intFromEnum(failure_order) > @intFromEnum(success_order)) { |
| 22075 | return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{}); | 22075 | return sema.fail(block, failure_order_src, "failure atomic ordering must be no stricter than success", .{}); |
| 22076 | } | 22076 | } |
| 22077 | if (failure_order == .Release or failure_order == .AcqRel) { | 22077 | if (failure_order == .Release or failure_order == .AcqRel) { |
| ... | @@ -22110,8 +22110,8 @@ fn zirCmpxchg( | ... | @@ -22110,8 +22110,8 @@ fn zirCmpxchg( |
| 22110 | } else break :rs expected_src; | 22110 | } else break :rs expected_src; |
| 22111 | } else ptr_src; | 22111 | } else ptr_src; |
| 22112 | 22112 | ||
| 22113 | const flags: u32 = @as(u32, @enumToInt(success_order)) | | 22113 | const flags: u32 = @as(u32, @intFromEnum(success_order)) | |
| 22114 | (@as(u32, @enumToInt(failure_order)) << 3); | 22114 | (@as(u32, @intFromEnum(failure_order)) << 3); |
| 22115 | 22115 | ||
| 22116 | try sema.requireRuntimeBlock(block, src, runtime_src); | 22116 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 22117 | return block.addInst(.{ | 22117 | return block.addInst(.{ |
| ... | @@ -22610,7 +22610,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -22610,7 +22610,7 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 22610 | } else break :rs ptr_src; | 22610 | } else break :rs ptr_src; |
| 22611 | } else ptr_src; | 22611 | } else ptr_src; |
| 22612 | 22612 | ||
| 22613 | const flags: u32 = @as(u32, @enumToInt(order)) | (@as(u32, @enumToInt(op)) << 3); | 22613 | const flags: u32 = @as(u32, @intFromEnum(order)) | (@as(u32, @intFromEnum(op)) << 3); |
| 22614 | 22614 | ||
| 22615 | try sema.requireRuntimeBlock(block, src, runtime_src); | 22615 | try sema.requireRuntimeBlock(block, src, runtime_src); |
| 22616 | return block.addInst(.{ | 22616 | return block.addInst(.{ |
| ... | @@ -23556,7 +23556,7 @@ fn zirVarExtended( | ... | @@ -23556,7 +23556,7 @@ fn zirVarExtended( |
| 23556 | assert(!small.has_align); | 23556 | assert(!small.has_align); |
| 23557 | 23557 | ||
| 23558 | const uncasted_init: Air.Inst.Ref = if (small.has_init) blk: { | 23558 | const uncasted_init: Air.Inst.Ref = if (small.has_init) blk: { |
| 23559 | const init_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23559 | const init_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23560 | extra_index += 1; | 23560 | extra_index += 1; |
| 23561 | break :blk try sema.resolveInst(init_ref); | 23561 | break :blk try sema.resolveInst(init_ref); |
| 23562 | } else .none; | 23562 | } else .none; |
| ... | @@ -23641,7 +23641,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23641,7 +23641,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23641 | break :blk alignment; | 23641 | break :blk alignment; |
| 23642 | } | 23642 | } |
| 23643 | } else if (extra.data.bits.has_align_ref) blk: { | 23643 | } else if (extra.data.bits.has_align_ref) blk: { |
| 23644 | const align_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23644 | const align_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23645 | extra_index += 1; | 23645 | extra_index += 1; |
| 23646 | const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime-known") catch |err| switch (err) { | 23646 | const align_tv = sema.resolveInstConst(block, align_src, align_ref, "alignment must be comptime-known") catch |err| switch (err) { |
| 23647 | error.GenericPoison => { | 23647 | error.GenericPoison => { |
| ... | @@ -23671,7 +23671,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23671,7 +23671,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23671 | } | 23671 | } |
| 23672 | break :blk mod.toEnum(std.builtin.AddressSpace, val); | 23672 | break :blk mod.toEnum(std.builtin.AddressSpace, val); |
| 23673 | } else if (extra.data.bits.has_addrspace_ref) blk: { | 23673 | } else if (extra.data.bits.has_addrspace_ref) blk: { |
| 23674 | const addrspace_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23674 | const addrspace_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23675 | extra_index += 1; | 23675 | extra_index += 1; |
| 23676 | const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime-known") catch |err| switch (err) { | 23676 | const addrspace_tv = sema.resolveInstConst(block, addrspace_src, addrspace_ref, "addrespace must be comptime-known") catch |err| switch (err) { |
| 23677 | error.GenericPoison => { | 23677 | error.GenericPoison => { |
| ... | @@ -23695,7 +23695,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23695,7 +23695,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23695 | } | 23695 | } |
| 23696 | break :blk FuncLinkSection{ .explicit = try val.toIpString(ty, mod) }; | 23696 | break :blk FuncLinkSection{ .explicit = try val.toIpString(ty, mod) }; |
| 23697 | } else if (extra.data.bits.has_section_ref) blk: { | 23697 | } else if (extra.data.bits.has_section_ref) blk: { |
| 23698 | const section_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23698 | const section_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23699 | extra_index += 1; | 23699 | extra_index += 1; |
| 23700 | const section_name = sema.resolveConstStringIntern(block, section_src, section_ref, "linksection must be comptime-known") catch |err| switch (err) { | 23700 | const section_name = sema.resolveConstStringIntern(block, section_src, section_ref, "linksection must be comptime-known") catch |err| switch (err) { |
| 23701 | error.GenericPoison => { | 23701 | error.GenericPoison => { |
| ... | @@ -23719,7 +23719,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23719,7 +23719,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23719 | } | 23719 | } |
| 23720 | break :blk mod.toEnum(std.builtin.CallingConvention, val); | 23720 | break :blk mod.toEnum(std.builtin.CallingConvention, val); |
| 23721 | } else if (extra.data.bits.has_cc_ref) blk: { | 23721 | } else if (extra.data.bits.has_cc_ref) blk: { |
| 23722 | const cc_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23722 | const cc_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23723 | extra_index += 1; | 23723 | extra_index += 1; |
| 23724 | const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime-known") catch |err| switch (err) { | 23724 | const cc_tv = sema.resolveInstConst(block, cc_src, cc_ref, "calling convention must be comptime-known") catch |err| switch (err) { |
| 23725 | error.GenericPoison => { | 23725 | error.GenericPoison => { |
| ... | @@ -23743,7 +23743,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A | ... | @@ -23743,7 +23743,7 @@ fn zirFuncFancy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 23743 | const ty = val.toType(); | 23743 | const ty = val.toType(); |
| 23744 | break :blk ty; | 23744 | break :blk ty; |
| 23745 | } else if (extra.data.bits.has_ret_ty_ref) blk: { | 23745 | } else if (extra.data.bits.has_ret_ty_ref) blk: { |
| 23746 | const ret_ty_ref = @intToEnum(Zir.Inst.Ref, sema.code.extra[extra_index]); | 23746 | const ret_ty_ref = @enumFromInt(Zir.Inst.Ref, sema.code.extra[extra_index]); |
| 23747 | extra_index += 1; | 23747 | extra_index += 1; |
| 23748 | const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime-known") catch |err| switch (err) { | 23748 | const ret_ty_tv = sema.resolveInstConst(block, ret_src, ret_ty_ref, "return type must be comptime-known") catch |err| switch (err) { |
| 23749 | error.GenericPoison => { | 23749 | error.GenericPoison => { |
| ... | @@ -26354,7 +26354,7 @@ fn elemValArray( | ... | @@ -26354,7 +26354,7 @@ fn elemValArray( |
| 26354 | const array_ty = sema.typeOf(array); | 26354 | const array_ty = sema.typeOf(array); |
| 26355 | const array_sent = array_ty.sentinel(mod); | 26355 | const array_sent = array_ty.sentinel(mod); |
| 26356 | const array_len = array_ty.arrayLen(mod); | 26356 | const array_len = array_ty.arrayLen(mod); |
| 26357 | const array_len_s = array_len + @boolToInt(array_sent != null); | 26357 | const array_len_s = array_len + @intFromBool(array_sent != null); |
| 26358 | const elem_ty = array_ty.childType(mod); | 26358 | const elem_ty = array_ty.childType(mod); |
| 26359 | 26359 | ||
| 26360 | if (array_len_s == 0) { | 26360 | if (array_len_s == 0) { |
| ... | @@ -26419,7 +26419,7 @@ fn elemPtrArray( | ... | @@ -26419,7 +26419,7 @@ fn elemPtrArray( |
| 26419 | const array_ty = array_ptr_ty.childType(mod); | 26419 | const array_ty = array_ptr_ty.childType(mod); |
| 26420 | const array_sent = array_ty.sentinel(mod) != null; | 26420 | const array_sent = array_ty.sentinel(mod) != null; |
| 26421 | const array_len = array_ty.arrayLen(mod); | 26421 | const array_len = array_ty.arrayLen(mod); |
| 26422 | const array_len_s = array_len + @boolToInt(array_sent); | 26422 | const array_len_s = array_len + @intFromBool(array_sent); |
| 26423 | 26423 | ||
| 26424 | if (array_len_s == 0) { | 26424 | if (array_len_s == 0) { |
| 26425 | return sema.fail(block, array_ptr_src, "indexing into empty array is not allowed", .{}); | 26425 | return sema.fail(block, array_ptr_src, "indexing into empty array is not allowed", .{}); |
| ... | @@ -26489,7 +26489,7 @@ fn elemValSlice( | ... | @@ -26489,7 +26489,7 @@ fn elemValSlice( |
| 26489 | if (maybe_slice_val) |slice_val| { | 26489 | if (maybe_slice_val) |slice_val| { |
| 26490 | runtime_src = elem_index_src; | 26490 | runtime_src = elem_index_src; |
| 26491 | const slice_len = slice_val.sliceLen(mod); | 26491 | const slice_len = slice_val.sliceLen(mod); |
| 26492 | const slice_len_s = slice_len + @boolToInt(slice_sent); | 26492 | const slice_len_s = slice_len + @intFromBool(slice_sent); |
| 26493 | if (slice_len_s == 0) { | 26493 | if (slice_len_s == 0) { |
| 26494 | return sema.fail(block, slice_src, "indexing into empty slice is not allowed", .{}); | 26494 | return sema.fail(block, slice_src, "indexing into empty slice is not allowed", .{}); |
| 26495 | } | 26495 | } |
| ... | @@ -26551,7 +26551,7 @@ fn elemPtrSlice( | ... | @@ -26551,7 +26551,7 @@ fn elemPtrSlice( |
| 26551 | return sema.addConstUndef(elem_ptr_ty); | 26551 | return sema.addConstUndef(elem_ptr_ty); |
| 26552 | } | 26552 | } |
| 26553 | const slice_len = slice_val.sliceLen(mod); | 26553 | const slice_len = slice_val.sliceLen(mod); |
| 26554 | const slice_len_s = slice_len + @boolToInt(slice_sent); | 26554 | const slice_len_s = slice_len + @intFromBool(slice_sent); |
| 26555 | if (slice_len_s == 0) { | 26555 | if (slice_len_s == 0) { |
| 26556 | return sema.fail(block, slice_src, "indexing into empty slice is not allowed", .{}); | 26556 | return sema.fail(block, slice_src, "indexing into empty slice is not allowed", .{}); |
| 26557 | } | 26557 | } |
| ... | @@ -27020,7 +27020,7 @@ fn coerceExtra( | ... | @@ -27020,7 +27020,7 @@ fn coerceExtra( |
| 27020 | .{ val.fmtValue(inst_ty, mod), dest_ty.fmt(mod) }, | 27020 | .{ val.fmtValue(inst_ty, mod), dest_ty.fmt(mod) }, |
| 27021 | ); | 27021 | ); |
| 27022 | } | 27022 | } |
| 27023 | const result_val = try sema.floatToInt(block, inst_src, val, inst_ty, dest_ty); | 27023 | const result_val = try sema.intFromFloat(block, inst_src, val, inst_ty, dest_ty); |
| 27024 | return try sema.addConstant(dest_ty, result_val); | 27024 | return try sema.addConstant(dest_ty, result_val); |
| 27025 | }, | 27025 | }, |
| 27026 | .Int, .ComptimeInt => { | 27026 | .Int, .ComptimeInt => { |
| ... | @@ -27102,9 +27102,9 @@ fn coerceExtra( | ... | @@ -27102,9 +27102,9 @@ fn coerceExtra( |
| 27102 | } | 27102 | } |
| 27103 | break :int; | 27103 | break :int; |
| 27104 | }; | 27104 | }; |
| 27105 | const result_val = try val.intToFloatAdvanced(sema.arena, inst_ty, dest_ty, mod, sema); | 27105 | const result_val = try val.floatFromIntAdvanced(sema.arena, inst_ty, dest_ty, mod, sema); |
| 27106 | // TODO implement this compile error | 27106 | // TODO implement this compile error |
| 27107 | //const int_again_val = try result_val.floatToInt(sema.arena, inst_ty); | 27107 | //const int_again_val = try result_val.intFromFloat(sema.arena, inst_ty); |
| 27108 | //if (!int_again_val.eql(val, inst_ty, mod)) { | 27108 | //if (!int_again_val.eql(val, inst_ty, mod)) { |
| 27109 | // return sema.fail( | 27109 | // return sema.fail( |
| 27110 | // block, | 27110 | // block, |
| ... | @@ -30773,7 +30773,7 @@ fn analyzeSlice( | ... | @@ -30773,7 +30773,7 @@ fn analyzeSlice( |
| 30773 | } | 30773 | } |
| 30774 | const has_sentinel = slice_ty.sentinel(mod) != null; | 30774 | const has_sentinel = slice_ty.sentinel(mod) != null; |
| 30775 | const slice_len = slice_val.sliceLen(mod); | 30775 | const slice_len = slice_val.sliceLen(mod); |
| 30776 | const len_plus_sent = slice_len + @boolToInt(has_sentinel); | 30776 | const len_plus_sent = slice_len + @intFromBool(has_sentinel); |
| 30777 | const slice_len_val_with_sentinel = try mod.intValue(Type.usize, len_plus_sent); | 30777 | const slice_len_val_with_sentinel = try mod.intValue(Type.usize, len_plus_sent); |
| 30778 | if (!(try sema.compareAll(end_val, .lte, slice_len_val_with_sentinel, Type.usize))) { | 30778 | if (!(try sema.compareAll(end_val, .lte, slice_len_val_with_sentinel, Type.usize))) { |
| 30779 | const sentinel_label: []const u8 = if (has_sentinel) | 30779 | const sentinel_label: []const u8 = if (has_sentinel) |
| ... | @@ -31234,12 +31234,12 @@ fn cmpNumeric( | ... | @@ -31234,12 +31234,12 @@ fn cmpNumeric( |
| 31234 | } else { | 31234 | } else { |
| 31235 | lhs_bits = lhs_val.intBitCountTwosComp(mod); | 31235 | lhs_bits = lhs_val.intBitCountTwosComp(mod); |
| 31236 | } | 31236 | } |
| 31237 | lhs_bits += @boolToInt(!lhs_is_signed and dest_int_is_signed); | 31237 | lhs_bits += @intFromBool(!lhs_is_signed and dest_int_is_signed); |
| 31238 | } else if (lhs_is_float) { | 31238 | } else if (lhs_is_float) { |
| 31239 | dest_float_type = lhs_ty; | 31239 | dest_float_type = lhs_ty; |
| 31240 | } else { | 31240 | } else { |
| 31241 | const int_info = lhs_ty.intInfo(mod); | 31241 | const int_info = lhs_ty.intInfo(mod); |
| 31242 | lhs_bits = int_info.bits + @boolToInt(int_info.signedness == .unsigned and dest_int_is_signed); | 31242 | lhs_bits = int_info.bits + @intFromBool(int_info.signedness == .unsigned and dest_int_is_signed); |
| 31243 | } | 31243 | } |
| 31244 | 31244 | ||
| 31245 | var rhs_bits: usize = undefined; | 31245 | var rhs_bits: usize = undefined; |
| ... | @@ -31292,12 +31292,12 @@ fn cmpNumeric( | ... | @@ -31292,12 +31292,12 @@ fn cmpNumeric( |
| 31292 | } else { | 31292 | } else { |
| 31293 | rhs_bits = rhs_val.intBitCountTwosComp(mod); | 31293 | rhs_bits = rhs_val.intBitCountTwosComp(mod); |
| 31294 | } | 31294 | } |
| 31295 | rhs_bits += @boolToInt(!rhs_is_signed and dest_int_is_signed); | 31295 | rhs_bits += @intFromBool(!rhs_is_signed and dest_int_is_signed); |
| 31296 | } else if (rhs_is_float) { | 31296 | } else if (rhs_is_float) { |
| 31297 | dest_float_type = rhs_ty; | 31297 | dest_float_type = rhs_ty; |
| 31298 | } else { | 31298 | } else { |
| 31299 | const int_info = rhs_ty.intInfo(mod); | 31299 | const int_info = rhs_ty.intInfo(mod); |
| 31300 | rhs_bits = int_info.bits + @boolToInt(int_info.signedness == .unsigned and dest_int_is_signed); | 31300 | rhs_bits = int_info.bits + @intFromBool(int_info.signedness == .unsigned and dest_int_is_signed); |
| 31301 | } | 31301 | } |
| 31302 | 31302 | ||
| 31303 | const dest_ty = if (dest_float_type) |ft| ft else blk: { | 31303 | const dest_ty = if (dest_float_type) |ft| ft else blk: { |
| ... | @@ -31356,7 +31356,7 @@ fn compareIntsOnlyPossibleResult( | ... | @@ -31356,7 +31356,7 @@ fn compareIntsOnlyPossibleResult( |
| 31356 | .neq, .lt, .lte => true, | 31356 | .neq, .lt, .lte => true, |
| 31357 | }; | 31357 | }; |
| 31358 | 31358 | ||
| 31359 | const sign_adj = @boolToInt(!is_negative and rhs_info.signedness == .signed); | 31359 | const sign_adj = @intFromBool(!is_negative and rhs_info.signedness == .signed); |
| 31360 | const req_bits = lhs_val.intBitCountTwosComp(mod) + sign_adj; | 31360 | const req_bits = lhs_val.intBitCountTwosComp(mod) + sign_adj; |
| 31361 | 31361 | ||
| 31362 | // No sized type can have more than 65535 bits. | 31362 | // No sized type can have more than 65535 bits. |
| ... | @@ -31628,7 +31628,7 @@ const PeerResolveStrategy = enum { | ... | @@ -31628,7 +31628,7 @@ const PeerResolveStrategy = enum { |
| 31628 | // Our merging should be order-independent. Thus, even though the union order is arbitrary, | 31628 | // Our merging should be order-independent. Thus, even though the union order is arbitrary, |
| 31629 | // by sorting the tags and switching first on the smaller, we have half as many cases to | 31629 | // by sorting the tags and switching first on the smaller, we have half as many cases to |
| 31630 | // worry about (since we avoid the duplicates). | 31630 | // worry about (since we avoid the duplicates). |
| 31631 | const s0_is_a = @enumToInt(a) <= @enumToInt(b); | 31631 | const s0_is_a = @intFromEnum(a) <= @intFromEnum(b); |
| 31632 | const s0 = if (s0_is_a) a else b; | 31632 | const s0 = if (s0_is_a) a else b; |
| 31633 | const s1 = if (s0_is_a) b else a; | 31633 | const s1 = if (s0_is_a) b else a; |
| 31634 | 31634 | ||
| ... | @@ -33288,9 +33288,9 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi | ... | @@ -33288,9 +33288,9 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi |
| 33288 | 33288 | ||
| 33289 | if (small.has_backing_int) { | 33289 | if (small.has_backing_int) { |
| 33290 | var extra_index: usize = extended.operand; | 33290 | var extra_index: usize = extended.operand; |
| 33291 | extra_index += @boolToInt(small.has_src_node); | 33291 | extra_index += @intFromBool(small.has_src_node); |
| 33292 | extra_index += @boolToInt(small.has_fields_len); | 33292 | extra_index += @intFromBool(small.has_fields_len); |
| 33293 | extra_index += @boolToInt(small.has_decls_len); | 33293 | extra_index += @intFromBool(small.has_decls_len); |
| 33294 | 33294 | ||
| 33295 | const backing_int_body_len = zir.extra[extra_index]; | 33295 | const backing_int_body_len = zir.extra[extra_index]; |
| 33296 | extra_index += 1; | 33296 | extra_index += 1; |
| ... | @@ -33338,7 +33338,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi | ... | @@ -33338,7 +33338,7 @@ fn semaBackingIntType(mod: *Module, struct_obj: *Module.Struct) CompileError!voi |
| 33338 | const backing_int_src: LazySrcLoc = .{ .node_offset_container_tag = 0 }; | 33338 | const backing_int_src: LazySrcLoc = .{ .node_offset_container_tag = 0 }; |
| 33339 | const backing_int_ty = blk: { | 33339 | const backing_int_ty = blk: { |
| 33340 | if (backing_int_body_len == 0) { | 33340 | if (backing_int_body_len == 0) { |
| 33341 | const backing_int_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 33341 | const backing_int_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 33342 | break :blk try sema.resolveType(&block, backing_int_src, backing_int_ref); | 33342 | break :blk try sema.resolveType(&block, backing_int_src, backing_int_ref); |
| 33343 | } else { | 33343 | } else { |
| 33344 | const body = zir.extra[extra_index..][0..backing_int_body_len]; | 33344 | const body = zir.extra[extra_index..][0..backing_int_body_len]; |
| ... | @@ -34013,7 +34013,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void | ... | @@ -34013,7 +34013,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34013 | var extra_index: usize = extended.operand; | 34013 | var extra_index: usize = extended.operand; |
| 34014 | 34014 | ||
| 34015 | const src = LazySrcLoc.nodeOffset(0); | 34015 | const src = LazySrcLoc.nodeOffset(0); |
| 34016 | extra_index += @boolToInt(small.has_src_node); | 34016 | extra_index += @intFromBool(small.has_src_node); |
| 34017 | 34017 | ||
| 34018 | const fields_len = if (small.has_fields_len) blk: { | 34018 | const fields_len = if (small.has_fields_len) blk: { |
| 34019 | const fields_len = zir.extra[extra_index]; | 34019 | const fields_len = zir.extra[extra_index]; |
| ... | @@ -34140,7 +34140,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void | ... | @@ -34140,7 +34140,7 @@ fn semaStructFields(mod: *Module, struct_obj: *Module.Struct) CompileError!void |
| 34140 | if (has_type_body) { | 34140 | if (has_type_body) { |
| 34141 | fields[field_i].type_body_len = zir.extra[extra_index]; | 34141 | fields[field_i].type_body_len = zir.extra[extra_index]; |
| 34142 | } else { | 34142 | } else { |
| 34143 | fields[field_i].type_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 34143 | fields[field_i].type_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 34144 | } | 34144 | } |
| 34145 | extra_index += 1; | 34145 | extra_index += 1; |
| 34146 | 34146 | ||
| ... | @@ -34364,10 +34364,10 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { | ... | @@ -34364,10 +34364,10 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 34364 | var extra_index: usize = extended.operand; | 34364 | var extra_index: usize = extended.operand; |
| 34365 | 34365 | ||
| 34366 | const src = LazySrcLoc.nodeOffset(0); | 34366 | const src = LazySrcLoc.nodeOffset(0); |
| 34367 | extra_index += @boolToInt(small.has_src_node); | 34367 | extra_index += @intFromBool(small.has_src_node); |
| 34368 | 34368 | ||
| 34369 | const tag_type_ref: Zir.Inst.Ref = if (small.has_tag_type) blk: { | 34369 | const tag_type_ref: Zir.Inst.Ref = if (small.has_tag_type) blk: { |
| 34370 | const ty_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 34370 | const ty_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 34371 | extra_index += 1; | 34371 | extra_index += 1; |
| 34372 | break :blk ty_ref; | 34372 | break :blk ty_ref; |
| 34373 | } else .none; | 34373 | } else .none; |
| ... | @@ -34532,19 +34532,19 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { | ... | @@ -34532,19 +34532,19 @@ fn semaUnionFields(mod: *Module, union_obj: *Module.Union) CompileError!void { |
| 34532 | extra_index += 1; | 34532 | extra_index += 1; |
| 34533 | 34533 | ||
| 34534 | const field_type_ref: Zir.Inst.Ref = if (has_type) blk: { | 34534 | const field_type_ref: Zir.Inst.Ref = if (has_type) blk: { |
| 34535 | const field_type_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 34535 | const field_type_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 34536 | extra_index += 1; | 34536 | extra_index += 1; |
| 34537 | break :blk field_type_ref; | 34537 | break :blk field_type_ref; |
| 34538 | } else .none; | 34538 | } else .none; |
| 34539 | 34539 | ||
| 34540 | const align_ref: Zir.Inst.Ref = if (has_align) blk: { | 34540 | const align_ref: Zir.Inst.Ref = if (has_align) blk: { |
| 34541 | const align_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 34541 | const align_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 34542 | extra_index += 1; | 34542 | extra_index += 1; |
| 34543 | break :blk align_ref; | 34543 | break :blk align_ref; |
| 34544 | } else .none; | 34544 | } else .none; |
| 34545 | 34545 | ||
| 34546 | const tag_ref: Air.Inst.Ref = if (has_tag) blk: { | 34546 | const tag_ref: Air.Inst.Ref = if (has_tag) blk: { |
| 34547 | const tag_ref = @intToEnum(Zir.Inst.Ref, zir.extra[extra_index]); | 34547 | const tag_ref = @enumFromInt(Zir.Inst.Ref, zir.extra[extra_index]); |
| 34548 | extra_index += 1; | 34548 | extra_index += 1; |
| 34549 | break :blk try sema.resolveInst(tag_ref); | 34549 | break :blk try sema.resolveInst(tag_ref); |
| 34550 | } else .none; | 34550 | } else .none; |
| ... | @@ -34955,7 +34955,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { | ... | @@ -34955,7 +34955,7 @@ pub fn typeHasOnePossibleValue(sema: *Sema, ty: Type) CompileError!?Value { |
| 34955 | 34955 | ||
| 34956 | inline .array_type, .vector_type => |seq_type, seq_tag| { | 34956 | inline .array_type, .vector_type => |seq_type, seq_tag| { |
| 34957 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; | 34957 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; |
| 34958 | if (seq_type.len + @boolToInt(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ | 34958 | if (seq_type.len + @intFromBool(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ |
| 34959 | .ty = ty.toIntern(), | 34959 | .ty = ty.toIntern(), |
| 34960 | .storage = .{ .elems = &.{} }, | 34960 | .storage = .{ .elems = &.{} }, |
| 34961 | } })).toValue(); | 34961 | } })).toValue(); |
| ... | @@ -35177,8 +35177,8 @@ pub fn getTmpAir(sema: Sema) Air { | ... | @@ -35177,8 +35177,8 @@ pub fn getTmpAir(sema: Sema) Air { |
| 35177 | } | 35177 | } |
| 35178 | 35178 | ||
| 35179 | pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { | 35179 | pub fn addType(sema: *Sema, ty: Type) !Air.Inst.Ref { |
| 35180 | if (@enumToInt(ty.toIntern()) < Air.ref_start_index) | 35180 | if (@intFromEnum(ty.toIntern()) < Air.ref_start_index) |
| 35181 | return @intToEnum(Air.Inst.Ref, @enumToInt(ty.toIntern())); | 35181 | return @enumFromInt(Air.Inst.Ref, @intFromEnum(ty.toIntern())); |
| 35182 | try sema.air_instructions.append(sema.gpa, .{ | 35182 | try sema.air_instructions.append(sema.gpa, .{ |
| 35183 | .tag = .interned, | 35183 | .tag = .interned, |
| 35184 | .data = .{ .interned = ty.toIntern() }, | 35184 | .data = .{ .interned = ty.toIntern() }, |
| ... | @@ -35209,8 +35209,8 @@ pub fn addConstant(sema: *Sema, ty: Type, val: Value) SemaError!Air.Inst.Ref { | ... | @@ -35209,8 +35209,8 @@ pub fn addConstant(sema: *Sema, ty: Type, val: Value) SemaError!Air.Inst.Ref { |
| 35209 | }); | 35209 | }); |
| 35210 | } | 35210 | } |
| 35211 | } | 35211 | } |
| 35212 | if (@enumToInt(val.toIntern()) < Air.ref_start_index) | 35212 | if (@intFromEnum(val.toIntern()) < Air.ref_start_index) |
| 35213 | return @intToEnum(Air.Inst.Ref, @enumToInt(val.toIntern())); | 35213 | return @enumFromInt(Air.Inst.Ref, @intFromEnum(val.toIntern())); |
| 35214 | try sema.air_instructions.append(gpa, .{ | 35214 | try sema.air_instructions.append(gpa, .{ |
| 35215 | .tag = .interned, | 35215 | .tag = .interned, |
| 35216 | .data = .{ .interned = val.toIntern() }, | 35216 | .data = .{ .interned = val.toIntern() }, |
| ... | @@ -35230,9 +35230,9 @@ pub fn addExtraAssumeCapacity(sema: *Sema, extra: anytype) u32 { | ... | @@ -35230,9 +35230,9 @@ pub fn addExtraAssumeCapacity(sema: *Sema, extra: anytype) u32 { |
| 35230 | inline for (fields) |field| { | 35230 | inline for (fields) |field| { |
| 35231 | sema.air_extra.appendAssumeCapacity(switch (field.type) { | 35231 | sema.air_extra.appendAssumeCapacity(switch (field.type) { |
| 35232 | u32 => @field(extra, field.name), | 35232 | u32 => @field(extra, field.name), |
| 35233 | Air.Inst.Ref => @enumToInt(@field(extra, field.name)), | 35233 | Air.Inst.Ref => @intFromEnum(@field(extra, field.name)), |
| 35234 | i32 => @bitCast(u32, @field(extra, field.name)), | 35234 | i32 => @bitCast(u32, @field(extra, field.name)), |
| 35235 | InternPool.Index => @enumToInt(@field(extra, field.name)), | 35235 | InternPool.Index => @intFromEnum(@field(extra, field.name)), |
| 35236 | else => @compileError("bad field type: " ++ @typeName(field.type)), | 35236 | else => @compileError("bad field type: " ++ @typeName(field.type)), |
| 35237 | }); | 35237 | }); |
| 35238 | } | 35238 | } |
| ... | @@ -36001,12 +36001,12 @@ fn intSubWithOverflowScalar( | ... | @@ -36001,12 +36001,12 @@ fn intSubWithOverflowScalar( |
| 36001 | const overflowed = result_bigint.subWrap(lhs_bigint, rhs_bigint, info.signedness, info.bits); | 36001 | const overflowed = result_bigint.subWrap(lhs_bigint, rhs_bigint, info.signedness, info.bits); |
| 36002 | const wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()); | 36002 | const wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()); |
| 36003 | return Value.OverflowArithmeticResult{ | 36003 | return Value.OverflowArithmeticResult{ |
| 36004 | .overflow_bit = try mod.intValue(Type.u1, @boolToInt(overflowed)), | 36004 | .overflow_bit = try mod.intValue(Type.u1, @intFromBool(overflowed)), |
| 36005 | .wrapped_result = wrapped_result, | 36005 | .wrapped_result = wrapped_result, |
| 36006 | }; | 36006 | }; |
| 36007 | } | 36007 | } |
| 36008 | 36008 | ||
| 36009 | fn floatToInt( | 36009 | fn intFromFloat( |
| 36010 | sema: *Sema, | 36010 | sema: *Sema, |
| 36011 | block: *Block, | 36011 | block: *Block, |
| 36012 | src: LazySrcLoc, | 36012 | src: LazySrcLoc, |
| ... | @@ -36021,14 +36021,14 @@ fn floatToInt( | ... | @@ -36021,14 +36021,14 @@ fn floatToInt( |
| 36021 | const scalar_ty = int_ty.scalarType(mod); | 36021 | const scalar_ty = int_ty.scalarType(mod); |
| 36022 | for (result_data, 0..) |*scalar, i| { | 36022 | for (result_data, 0..) |*scalar, i| { |
| 36023 | const elem_val = try val.elemValue(sema.mod, i); | 36023 | const elem_val = try val.elemValue(sema.mod, i); |
| 36024 | scalar.* = try (try sema.floatToIntScalar(block, src, elem_val, elem_ty, int_ty.scalarType(mod))).intern(scalar_ty, mod); | 36024 | scalar.* = try (try sema.intFromFloatScalar(block, src, elem_val, elem_ty, int_ty.scalarType(mod))).intern(scalar_ty, mod); |
| 36025 | } | 36025 | } |
| 36026 | return (try mod.intern(.{ .aggregate = .{ | 36026 | return (try mod.intern(.{ .aggregate = .{ |
| 36027 | .ty = int_ty.toIntern(), | 36027 | .ty = int_ty.toIntern(), |
| 36028 | .storage = .{ .elems = result_data }, | 36028 | .storage = .{ .elems = result_data }, |
| 36029 | } })).toValue(); | 36029 | } })).toValue(); |
| 36030 | } | 36030 | } |
| 36031 | return sema.floatToIntScalar(block, src, val, float_ty, int_ty); | 36031 | return sema.intFromFloatScalar(block, src, val, float_ty, int_ty); |
| 36032 | } | 36032 | } |
| 36033 | 36033 | ||
| 36034 | // float is expected to be finite and non-NaN | 36034 | // float is expected to be finite and non-NaN |
| ... | @@ -36056,7 +36056,7 @@ fn float128IntPartToBigInt( | ... | @@ -36056,7 +36056,7 @@ fn float128IntPartToBigInt( |
| 36056 | return rational.p; | 36056 | return rational.p; |
| 36057 | } | 36057 | } |
| 36058 | 36058 | ||
| 36059 | fn floatToIntScalar( | 36059 | fn intFromFloatScalar( |
| 36060 | sema: *Sema, | 36060 | sema: *Sema, |
| 36061 | block: *Block, | 36061 | block: *Block, |
| 36062 | src: LazySrcLoc, | 36062 | src: LazySrcLoc, |
| ... | @@ -36123,21 +36123,21 @@ fn intFitsInType( | ... | @@ -36123,21 +36123,21 @@ fn intFitsInType( |
| 36123 | return big_int.fitsInTwosComp(info.signedness, info.bits); | 36123 | return big_int.fitsInTwosComp(info.signedness, info.bits); |
| 36124 | }, | 36124 | }, |
| 36125 | .lazy_align => |lazy_ty| { | 36125 | .lazy_align => |lazy_ty| { |
| 36126 | const max_needed_bits = @as(u16, 16) + @boolToInt(info.signedness == .signed); | 36126 | const max_needed_bits = @as(u16, 16) + @intFromBool(info.signedness == .signed); |
| 36127 | // If it is u16 or bigger we know the alignment fits without resolving it. | 36127 | // If it is u16 or bigger we know the alignment fits without resolving it. |
| 36128 | if (info.bits >= max_needed_bits) return true; | 36128 | if (info.bits >= max_needed_bits) return true; |
| 36129 | const x = try sema.typeAbiAlignment(lazy_ty.toType()); | 36129 | const x = try sema.typeAbiAlignment(lazy_ty.toType()); |
| 36130 | if (x == 0) return true; | 36130 | if (x == 0) return true; |
| 36131 | const actual_needed_bits = std.math.log2(x) + 1 + @boolToInt(info.signedness == .signed); | 36131 | const actual_needed_bits = std.math.log2(x) + 1 + @intFromBool(info.signedness == .signed); |
| 36132 | return info.bits >= actual_needed_bits; | 36132 | return info.bits >= actual_needed_bits; |
| 36133 | }, | 36133 | }, |
| 36134 | .lazy_size => |lazy_ty| { | 36134 | .lazy_size => |lazy_ty| { |
| 36135 | const max_needed_bits = @as(u16, 64) + @boolToInt(info.signedness == .signed); | 36135 | const max_needed_bits = @as(u16, 64) + @intFromBool(info.signedness == .signed); |
| 36136 | // If it is u64 or bigger we know the size fits without resolving it. | 36136 | // If it is u64 or bigger we know the size fits without resolving it. |
| 36137 | if (info.bits >= max_needed_bits) return true; | 36137 | if (info.bits >= max_needed_bits) return true; |
| 36138 | const x = try sema.typeAbiSize(lazy_ty.toType()); | 36138 | const x = try sema.typeAbiSize(lazy_ty.toType()); |
| 36139 | if (x == 0) return true; | 36139 | if (x == 0) return true; |
| 36140 | const actual_needed_bits = std.math.log2(x) + 1 + @boolToInt(info.signedness == .signed); | 36140 | const actual_needed_bits = std.math.log2(x) + 1 + @intFromBool(info.signedness == .signed); |
| 36141 | return info.bits >= actual_needed_bits; | 36141 | return info.bits >= actual_needed_bits; |
| 36142 | }, | 36142 | }, |
| 36143 | }, | 36143 | }, |
| ... | @@ -36146,7 +36146,7 @@ fn intFitsInType( | ... | @@ -36146,7 +36146,7 @@ fn intFitsInType( |
| 36146 | return switch (aggregate.storage) { | 36146 | return switch (aggregate.storage) { |
| 36147 | .bytes => |bytes| for (bytes, 0..) |byte, i| { | 36147 | .bytes => |bytes| for (bytes, 0..) |byte, i| { |
| 36148 | if (byte == 0) continue; | 36148 | if (byte == 0) continue; |
| 36149 | const actual_needed_bits = std.math.log2(byte) + 1 + @boolToInt(info.signedness == .signed); | 36149 | const actual_needed_bits = std.math.log2(byte) + 1 + @intFromBool(info.signedness == .signed); |
| 36150 | if (info.bits >= actual_needed_bits) continue; | 36150 | if (info.bits >= actual_needed_bits) continue; |
| 36151 | if (vector_index) |vi| vi.* = i; | 36151 | if (vector_index) |vi| vi.* = i; |
| 36152 | break false; | 36152 | break false; |
| ... | @@ -36242,7 +36242,7 @@ fn intAddWithOverflowScalar( | ... | @@ -36242,7 +36242,7 @@ fn intAddWithOverflowScalar( |
| 36242 | const overflowed = result_bigint.addWrap(lhs_bigint, rhs_bigint, info.signedness, info.bits); | 36242 | const overflowed = result_bigint.addWrap(lhs_bigint, rhs_bigint, info.signedness, info.bits); |
| 36243 | const result = try mod.intValue_big(ty, result_bigint.toConst()); | 36243 | const result = try mod.intValue_big(ty, result_bigint.toConst()); |
| 36244 | return Value.OverflowArithmeticResult{ | 36244 | return Value.OverflowArithmeticResult{ |
| 36245 | .overflow_bit = try mod.intValue(Type.u1, @boolToInt(overflowed)), | 36245 | .overflow_bit = try mod.intValue(Type.u1, @intFromBool(overflowed)), |
| 36246 | .wrapped_result = result, | 36246 | .wrapped_result = result, |
| 36247 | }; | 36247 | }; |
| 36248 | } | 36248 | } |
| ... | @@ -36352,7 +36352,7 @@ fn elemPtrType(sema: *Sema, ptr_ty: Type, offset: ?usize) !Type { | ... | @@ -36352,7 +36352,7 @@ fn elemPtrType(sema: *Sema, ptr_ty: Type, offset: ?usize) !Type { |
| 36352 | break :blk .{ | 36352 | break :blk .{ |
| 36353 | .host_size = @intCast(u16, parent_ty.arrayLen(mod)), | 36353 | .host_size = @intCast(u16, parent_ty.arrayLen(mod)), |
| 36354 | .alignment = @intCast(u16, parent_ty.abiAlignment(mod)), | 36354 | .alignment = @intCast(u16, parent_ty.abiAlignment(mod)), |
| 36355 | .vector_index = if (offset) |some| @intToEnum(VI, some) else .runtime, | 36355 | .vector_index = if (offset) |some| @enumFromInt(VI, some) else .runtime, |
| 36356 | }; | 36356 | }; |
| 36357 | } else .{}; | 36357 | } else .{}; |
| 36358 | 36358 |
src/TypedValue.zig+3-3| ... | @@ -41,8 +41,8 @@ pub fn hash(tv: TypedValue, hasher: *std.hash.Wyhash, mod: *Module) void { | ... | @@ -41,8 +41,8 @@ pub fn hash(tv: TypedValue, hasher: *std.hash.Wyhash, mod: *Module) void { |
| 41 | return tv.val.hash(tv.ty, hasher, mod); | 41 | return tv.val.hash(tv.ty, hasher, mod); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | pub fn enumToInt(tv: TypedValue, mod: *Module) Allocator.Error!Value { | 44 | pub fn intFromEnum(tv: TypedValue, mod: *Module) Allocator.Error!Value { |
| 45 | return tv.val.enumToInt(tv.ty, mod); | 45 | return tv.val.intFromEnum(tv.ty, mod); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | const max_aggregate_items = 100; | 48 | const max_aggregate_items = 100; |
| ... | @@ -240,7 +240,7 @@ pub fn print( | ... | @@ -240,7 +240,7 @@ pub fn print( |
| 240 | try writer.print(".{i}", .{enum_type.names[tag_index].fmt(ip)}); | 240 | try writer.print(".{i}", .{enum_type.names[tag_index].fmt(ip)}); |
| 241 | return; | 241 | return; |
| 242 | } | 242 | } |
| 243 | try writer.writeAll("@intToEnum("); | 243 | try writer.writeAll("@enumFromInt("); |
| 244 | try print(.{ | 244 | try print(.{ |
| 245 | .ty = Type.type, | 245 | .ty = Type.type, |
| 246 | .val = enum_tag.ty.toValue(), | 246 | .val = enum_tag.ty.toValue(), |
src/Zir.zig+106-106| ... | @@ -74,7 +74,7 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, en | ... | @@ -74,7 +74,7 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, en |
| 74 | inline for (fields) |field| { | 74 | inline for (fields) |field| { |
| 75 | @field(result, field.name) = switch (field.type) { | 75 | @field(result, field.name) = switch (field.type) { |
| 76 | u32 => code.extra[i], | 76 | u32 => code.extra[i], |
| 77 | Inst.Ref => @intToEnum(Inst.Ref, code.extra[i]), | 77 | Inst.Ref => @enumFromInt(Inst.Ref, code.extra[i]), |
| 78 | i32 => @bitCast(i32, code.extra[i]), | 78 | i32 => @bitCast(i32, code.extra[i]), |
| 79 | Inst.Call.Flags => @bitCast(Inst.Call.Flags, code.extra[i]), | 79 | Inst.Call.Flags => @bitCast(Inst.Call.Flags, code.extra[i]), |
| 80 | Inst.BuiltinCall.Flags => @bitCast(Inst.BuiltinCall.Flags, code.extra[i]), | 80 | Inst.BuiltinCall.Flags => @bitCast(Inst.BuiltinCall.Flags, code.extra[i]), |
| ... | @@ -105,7 +105,7 @@ pub fn refSlice(code: Zir, start: usize, len: usize) []Inst.Ref { | ... | @@ -105,7 +105,7 @@ pub fn refSlice(code: Zir, start: usize, len: usize) []Inst.Ref { |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | pub fn hasCompileErrors(code: Zir) bool { | 107 | pub fn hasCompileErrors(code: Zir) bool { |
| 108 | return code.extra[@enumToInt(ExtraIndex.compile_errors)] != 0; | 108 | return code.extra[@intFromEnum(ExtraIndex.compile_errors)] != 0; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | pub fn deinit(code: *Zir, gpa: Allocator) void { | 111 | pub fn deinit(code: *Zir, gpa: Allocator) void { |
| ... | @@ -1934,7 +1934,7 @@ pub const Inst = struct { | ... | @@ -1934,7 +1934,7 @@ pub const Inst = struct { |
| 1934 | /// Implement builtin `@errToInt`. | 1934 | /// Implement builtin `@errToInt`. |
| 1935 | /// `operand` is payload index to `UnNode`. | 1935 | /// `operand` is payload index to `UnNode`. |
| 1936 | int_from_error, | 1936 | int_from_error, |
| 1937 | /// Implement builtin `@intToError`. | 1937 | /// Implement builtin `@errorFromInt`. |
| 1938 | /// `operand` is payload index to `UnNode`. | 1938 | /// `operand` is payload index to `UnNode`. |
| 1939 | error_from_int, | 1939 | error_from_int, |
| 1940 | /// Implement builtin `@Type`. | 1940 | /// Implement builtin `@Type`. |
| ... | @@ -2005,93 +2005,93 @@ pub const Inst = struct { | ... | @@ -2005,93 +2005,93 @@ pub const Inst = struct { |
| 2005 | /// The tag type is specified so that it is safe to bitcast between `[]u32` | 2005 | /// The tag type is specified so that it is safe to bitcast between `[]u32` |
| 2006 | /// and `[]Ref`. | 2006 | /// and `[]Ref`. |
| 2007 | pub const Ref = enum(u32) { | 2007 | pub const Ref = enum(u32) { |
| 2008 | u1_type = @enumToInt(InternPool.Index.u1_type), | 2008 | u1_type = @intFromEnum(InternPool.Index.u1_type), |
| 2009 | u8_type = @enumToInt(InternPool.Index.u8_type), | 2009 | u8_type = @intFromEnum(InternPool.Index.u8_type), |
| 2010 | i8_type = @enumToInt(InternPool.Index.i8_type), | 2010 | i8_type = @intFromEnum(InternPool.Index.i8_type), |
| 2011 | u16_type = @enumToInt(InternPool.Index.u16_type), | 2011 | u16_type = @intFromEnum(InternPool.Index.u16_type), |
| 2012 | i16_type = @enumToInt(InternPool.Index.i16_type), | 2012 | i16_type = @intFromEnum(InternPool.Index.i16_type), |
| 2013 | u29_type = @enumToInt(InternPool.Index.u29_type), | 2013 | u29_type = @intFromEnum(InternPool.Index.u29_type), |
| 2014 | u32_type = @enumToInt(InternPool.Index.u32_type), | 2014 | u32_type = @intFromEnum(InternPool.Index.u32_type), |
| 2015 | i32_type = @enumToInt(InternPool.Index.i32_type), | 2015 | i32_type = @intFromEnum(InternPool.Index.i32_type), |
| 2016 | u64_type = @enumToInt(InternPool.Index.u64_type), | 2016 | u64_type = @intFromEnum(InternPool.Index.u64_type), |
| 2017 | i64_type = @enumToInt(InternPool.Index.i64_type), | 2017 | i64_type = @intFromEnum(InternPool.Index.i64_type), |
| 2018 | u80_type = @enumToInt(InternPool.Index.u80_type), | 2018 | u80_type = @intFromEnum(InternPool.Index.u80_type), |
| 2019 | u128_type = @enumToInt(InternPool.Index.u128_type), | 2019 | u128_type = @intFromEnum(InternPool.Index.u128_type), |
| 2020 | i128_type = @enumToInt(InternPool.Index.i128_type), | 2020 | i128_type = @intFromEnum(InternPool.Index.i128_type), |
| 2021 | usize_type = @enumToInt(InternPool.Index.usize_type), | 2021 | usize_type = @intFromEnum(InternPool.Index.usize_type), |
| 2022 | isize_type = @enumToInt(InternPool.Index.isize_type), | 2022 | isize_type = @intFromEnum(InternPool.Index.isize_type), |
| 2023 | c_char_type = @enumToInt(InternPool.Index.c_char_type), | 2023 | c_char_type = @intFromEnum(InternPool.Index.c_char_type), |
| 2024 | c_short_type = @enumToInt(InternPool.Index.c_short_type), | 2024 | c_short_type = @intFromEnum(InternPool.Index.c_short_type), |
| 2025 | c_ushort_type = @enumToInt(InternPool.Index.c_ushort_type), | 2025 | c_ushort_type = @intFromEnum(InternPool.Index.c_ushort_type), |
| 2026 | c_int_type = @enumToInt(InternPool.Index.c_int_type), | 2026 | c_int_type = @intFromEnum(InternPool.Index.c_int_type), |
| 2027 | c_uint_type = @enumToInt(InternPool.Index.c_uint_type), | 2027 | c_uint_type = @intFromEnum(InternPool.Index.c_uint_type), |
| 2028 | c_long_type = @enumToInt(InternPool.Index.c_long_type), | 2028 | c_long_type = @intFromEnum(InternPool.Index.c_long_type), |
| 2029 | c_ulong_type = @enumToInt(InternPool.Index.c_ulong_type), | 2029 | c_ulong_type = @intFromEnum(InternPool.Index.c_ulong_type), |
| 2030 | c_longlong_type = @enumToInt(InternPool.Index.c_longlong_type), | 2030 | c_longlong_type = @intFromEnum(InternPool.Index.c_longlong_type), |
| 2031 | c_ulonglong_type = @enumToInt(InternPool.Index.c_ulonglong_type), | 2031 | c_ulonglong_type = @intFromEnum(InternPool.Index.c_ulonglong_type), |
| 2032 | c_longdouble_type = @enumToInt(InternPool.Index.c_longdouble_type), | 2032 | c_longdouble_type = @intFromEnum(InternPool.Index.c_longdouble_type), |
| 2033 | f16_type = @enumToInt(InternPool.Index.f16_type), | 2033 | f16_type = @intFromEnum(InternPool.Index.f16_type), |
| 2034 | f32_type = @enumToInt(InternPool.Index.f32_type), | 2034 | f32_type = @intFromEnum(InternPool.Index.f32_type), |
| 2035 | f64_type = @enumToInt(InternPool.Index.f64_type), | 2035 | f64_type = @intFromEnum(InternPool.Index.f64_type), |
| 2036 | f80_type = @enumToInt(InternPool.Index.f80_type), | 2036 | f80_type = @intFromEnum(InternPool.Index.f80_type), |
| 2037 | f128_type = @enumToInt(InternPool.Index.f128_type), | 2037 | f128_type = @intFromEnum(InternPool.Index.f128_type), |
| 2038 | anyopaque_type = @enumToInt(InternPool.Index.anyopaque_type), | 2038 | anyopaque_type = @intFromEnum(InternPool.Index.anyopaque_type), |
| 2039 | bool_type = @enumToInt(InternPool.Index.bool_type), | 2039 | bool_type = @intFromEnum(InternPool.Index.bool_type), |
| 2040 | void_type = @enumToInt(InternPool.Index.void_type), | 2040 | void_type = @intFromEnum(InternPool.Index.void_type), |
| 2041 | type_type = @enumToInt(InternPool.Index.type_type), | 2041 | type_type = @intFromEnum(InternPool.Index.type_type), |
| 2042 | anyerror_type = @enumToInt(InternPool.Index.anyerror_type), | 2042 | anyerror_type = @intFromEnum(InternPool.Index.anyerror_type), |
| 2043 | comptime_int_type = @enumToInt(InternPool.Index.comptime_int_type), | 2043 | comptime_int_type = @intFromEnum(InternPool.Index.comptime_int_type), |
| 2044 | comptime_float_type = @enumToInt(InternPool.Index.comptime_float_type), | 2044 | comptime_float_type = @intFromEnum(InternPool.Index.comptime_float_type), |
| 2045 | noreturn_type = @enumToInt(InternPool.Index.noreturn_type), | 2045 | noreturn_type = @intFromEnum(InternPool.Index.noreturn_type), |
| 2046 | anyframe_type = @enumToInt(InternPool.Index.anyframe_type), | 2046 | anyframe_type = @intFromEnum(InternPool.Index.anyframe_type), |
| 2047 | null_type = @enumToInt(InternPool.Index.null_type), | 2047 | null_type = @intFromEnum(InternPool.Index.null_type), |
| 2048 | undefined_type = @enumToInt(InternPool.Index.undefined_type), | 2048 | undefined_type = @intFromEnum(InternPool.Index.undefined_type), |
| 2049 | enum_literal_type = @enumToInt(InternPool.Index.enum_literal_type), | 2049 | enum_literal_type = @intFromEnum(InternPool.Index.enum_literal_type), |
| 2050 | atomic_order_type = @enumToInt(InternPool.Index.atomic_order_type), | 2050 | atomic_order_type = @intFromEnum(InternPool.Index.atomic_order_type), |
| 2051 | atomic_rmw_op_type = @enumToInt(InternPool.Index.atomic_rmw_op_type), | 2051 | atomic_rmw_op_type = @intFromEnum(InternPool.Index.atomic_rmw_op_type), |
| 2052 | calling_convention_type = @enumToInt(InternPool.Index.calling_convention_type), | 2052 | calling_convention_type = @intFromEnum(InternPool.Index.calling_convention_type), |
| 2053 | address_space_type = @enumToInt(InternPool.Index.address_space_type), | 2053 | address_space_type = @intFromEnum(InternPool.Index.address_space_type), |
| 2054 | float_mode_type = @enumToInt(InternPool.Index.float_mode_type), | 2054 | float_mode_type = @intFromEnum(InternPool.Index.float_mode_type), |
| 2055 | reduce_op_type = @enumToInt(InternPool.Index.reduce_op_type), | 2055 | reduce_op_type = @intFromEnum(InternPool.Index.reduce_op_type), |
| 2056 | call_modifier_type = @enumToInt(InternPool.Index.call_modifier_type), | 2056 | call_modifier_type = @intFromEnum(InternPool.Index.call_modifier_type), |
| 2057 | prefetch_options_type = @enumToInt(InternPool.Index.prefetch_options_type), | 2057 | prefetch_options_type = @intFromEnum(InternPool.Index.prefetch_options_type), |
| 2058 | export_options_type = @enumToInt(InternPool.Index.export_options_type), | 2058 | export_options_type = @intFromEnum(InternPool.Index.export_options_type), |
| 2059 | extern_options_type = @enumToInt(InternPool.Index.extern_options_type), | 2059 | extern_options_type = @intFromEnum(InternPool.Index.extern_options_type), |
| 2060 | type_info_type = @enumToInt(InternPool.Index.type_info_type), | 2060 | type_info_type = @intFromEnum(InternPool.Index.type_info_type), |
| 2061 | manyptr_u8_type = @enumToInt(InternPool.Index.manyptr_u8_type), | 2061 | manyptr_u8_type = @intFromEnum(InternPool.Index.manyptr_u8_type), |
| 2062 | manyptr_const_u8_type = @enumToInt(InternPool.Index.manyptr_const_u8_type), | 2062 | manyptr_const_u8_type = @intFromEnum(InternPool.Index.manyptr_const_u8_type), |
| 2063 | manyptr_const_u8_sentinel_0_type = @enumToInt(InternPool.Index.manyptr_const_u8_sentinel_0_type), | 2063 | manyptr_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.manyptr_const_u8_sentinel_0_type), |
| 2064 | single_const_pointer_to_comptime_int_type = @enumToInt(InternPool.Index.single_const_pointer_to_comptime_int_type), | 2064 | single_const_pointer_to_comptime_int_type = @intFromEnum(InternPool.Index.single_const_pointer_to_comptime_int_type), |
| 2065 | slice_const_u8_type = @enumToInt(InternPool.Index.slice_const_u8_type), | 2065 | slice_const_u8_type = @intFromEnum(InternPool.Index.slice_const_u8_type), |
| 2066 | slice_const_u8_sentinel_0_type = @enumToInt(InternPool.Index.slice_const_u8_sentinel_0_type), | 2066 | slice_const_u8_sentinel_0_type = @intFromEnum(InternPool.Index.slice_const_u8_sentinel_0_type), |
| 2067 | anyerror_void_error_union_type = @enumToInt(InternPool.Index.anyerror_void_error_union_type), | 2067 | anyerror_void_error_union_type = @intFromEnum(InternPool.Index.anyerror_void_error_union_type), |
| 2068 | generic_poison_type = @enumToInt(InternPool.Index.generic_poison_type), | 2068 | generic_poison_type = @intFromEnum(InternPool.Index.generic_poison_type), |
| 2069 | empty_struct_type = @enumToInt(InternPool.Index.empty_struct_type), | 2069 | empty_struct_type = @intFromEnum(InternPool.Index.empty_struct_type), |
| 2070 | undef = @enumToInt(InternPool.Index.undef), | 2070 | undef = @intFromEnum(InternPool.Index.undef), |
| 2071 | zero = @enumToInt(InternPool.Index.zero), | 2071 | zero = @intFromEnum(InternPool.Index.zero), |
| 2072 | zero_usize = @enumToInt(InternPool.Index.zero_usize), | 2072 | zero_usize = @intFromEnum(InternPool.Index.zero_usize), |
| 2073 | zero_u8 = @enumToInt(InternPool.Index.zero_u8), | 2073 | zero_u8 = @intFromEnum(InternPool.Index.zero_u8), |
| 2074 | one = @enumToInt(InternPool.Index.one), | 2074 | one = @intFromEnum(InternPool.Index.one), |
| 2075 | one_usize = @enumToInt(InternPool.Index.one_usize), | 2075 | one_usize = @intFromEnum(InternPool.Index.one_usize), |
| 2076 | one_u8 = @enumToInt(InternPool.Index.one_u8), | 2076 | one_u8 = @intFromEnum(InternPool.Index.one_u8), |
| 2077 | four_u8 = @enumToInt(InternPool.Index.four_u8), | 2077 | four_u8 = @intFromEnum(InternPool.Index.four_u8), |
| 2078 | negative_one = @enumToInt(InternPool.Index.negative_one), | 2078 | negative_one = @intFromEnum(InternPool.Index.negative_one), |
| 2079 | calling_convention_c = @enumToInt(InternPool.Index.calling_convention_c), | 2079 | calling_convention_c = @intFromEnum(InternPool.Index.calling_convention_c), |
| 2080 | calling_convention_inline = @enumToInt(InternPool.Index.calling_convention_inline), | 2080 | calling_convention_inline = @intFromEnum(InternPool.Index.calling_convention_inline), |
| 2081 | void_value = @enumToInt(InternPool.Index.void_value), | 2081 | void_value = @intFromEnum(InternPool.Index.void_value), |
| 2082 | unreachable_value = @enumToInt(InternPool.Index.unreachable_value), | 2082 | unreachable_value = @intFromEnum(InternPool.Index.unreachable_value), |
| 2083 | null_value = @enumToInt(InternPool.Index.null_value), | 2083 | null_value = @intFromEnum(InternPool.Index.null_value), |
| 2084 | bool_true = @enumToInt(InternPool.Index.bool_true), | 2084 | bool_true = @intFromEnum(InternPool.Index.bool_true), |
| 2085 | bool_false = @enumToInt(InternPool.Index.bool_false), | 2085 | bool_false = @intFromEnum(InternPool.Index.bool_false), |
| 2086 | empty_struct = @enumToInt(InternPool.Index.empty_struct), | 2086 | empty_struct = @intFromEnum(InternPool.Index.empty_struct), |
| 2087 | generic_poison = @enumToInt(InternPool.Index.generic_poison), | 2087 | generic_poison = @intFromEnum(InternPool.Index.generic_poison), |
| 2088 | 2088 | ||
| 2089 | /// This tag is here to match Air and InternPool, however it is unused | 2089 | /// This tag is here to match Air and InternPool, however it is unused |
| 2090 | /// for ZIR purposes. | 2090 | /// for ZIR purposes. |
| 2091 | var_args_param_type = @enumToInt(InternPool.Index.var_args_param_type), | 2091 | var_args_param_type = @intFromEnum(InternPool.Index.var_args_param_type), |
| 2092 | /// This Ref does not correspond to any ZIR instruction or constant | 2092 | /// This Ref does not correspond to any ZIR instruction or constant |
| 2093 | /// value and may instead be used as a sentinel to indicate null. | 2093 | /// value and may instead be used as a sentinel to indicate null. |
| 2094 | none = @enumToInt(InternPool.Index.none), | 2094 | none = @intFromEnum(InternPool.Index.none), |
| 2095 | _, | 2095 | _, |
| 2096 | }; | 2096 | }; |
| 2097 | 2097 | ||
| ... | @@ -2691,8 +2691,8 @@ pub const Inst = struct { | ... | @@ -2691,8 +2691,8 @@ pub const Inst = struct { |
| 2691 | pub const ScalarCasesLen = u28; | 2691 | pub const ScalarCasesLen = u28; |
| 2692 | 2692 | ||
| 2693 | pub fn specialProng(bits: Bits) SpecialProng { | 2693 | pub fn specialProng(bits: Bits) SpecialProng { |
| 2694 | const has_else: u2 = @boolToInt(bits.has_else); | 2694 | const has_else: u2 = @intFromBool(bits.has_else); |
| 2695 | const has_under: u2 = @boolToInt(bits.has_under); | 2695 | const has_under: u2 = @intFromBool(bits.has_under); |
| 2696 | return switch ((has_else << 1) | has_under) { | 2696 | return switch ((has_else << 1) | has_under) { |
| 2697 | 0b00 => .none, | 2697 | 0b00 => .none, |
| 2698 | 0b01 => .under, | 2698 | 0b01 => .under, |
| ... | @@ -3241,8 +3241,8 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { | ... | @@ -3241,8 +3241,8 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { |
| 3241 | .struct_decl => { | 3241 | .struct_decl => { |
| 3242 | const small = @bitCast(Inst.StructDecl.Small, extended.small); | 3242 | const small = @bitCast(Inst.StructDecl.Small, extended.small); |
| 3243 | var extra_index: usize = extended.operand; | 3243 | var extra_index: usize = extended.operand; |
| 3244 | extra_index += @boolToInt(small.has_src_node); | 3244 | extra_index += @intFromBool(small.has_src_node); |
| 3245 | extra_index += @boolToInt(small.has_fields_len); | 3245 | extra_index += @intFromBool(small.has_fields_len); |
| 3246 | const decls_len = if (small.has_decls_len) decls_len: { | 3246 | const decls_len = if (small.has_decls_len) decls_len: { |
| 3247 | const decls_len = zir.extra[extra_index]; | 3247 | const decls_len = zir.extra[extra_index]; |
| 3248 | extra_index += 1; | 3248 | extra_index += 1; |
| ... | @@ -3264,10 +3264,10 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { | ... | @@ -3264,10 +3264,10 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { |
| 3264 | .enum_decl => { | 3264 | .enum_decl => { |
| 3265 | const small = @bitCast(Inst.EnumDecl.Small, extended.small); | 3265 | const small = @bitCast(Inst.EnumDecl.Small, extended.small); |
| 3266 | var extra_index: usize = extended.operand; | 3266 | var extra_index: usize = extended.operand; |
| 3267 | extra_index += @boolToInt(small.has_src_node); | 3267 | extra_index += @intFromBool(small.has_src_node); |
| 3268 | extra_index += @boolToInt(small.has_tag_type); | 3268 | extra_index += @intFromBool(small.has_tag_type); |
| 3269 | extra_index += @boolToInt(small.has_body_len); | 3269 | extra_index += @intFromBool(small.has_body_len); |
| 3270 | extra_index += @boolToInt(small.has_fields_len); | 3270 | extra_index += @intFromBool(small.has_fields_len); |
| 3271 | const decls_len = if (small.has_decls_len) decls_len: { | 3271 | const decls_len = if (small.has_decls_len) decls_len: { |
| 3272 | const decls_len = zir.extra[extra_index]; | 3272 | const decls_len = zir.extra[extra_index]; |
| 3273 | extra_index += 1; | 3273 | extra_index += 1; |
| ... | @@ -3279,10 +3279,10 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { | ... | @@ -3279,10 +3279,10 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { |
| 3279 | .union_decl => { | 3279 | .union_decl => { |
| 3280 | const small = @bitCast(Inst.UnionDecl.Small, extended.small); | 3280 | const small = @bitCast(Inst.UnionDecl.Small, extended.small); |
| 3281 | var extra_index: usize = extended.operand; | 3281 | var extra_index: usize = extended.operand; |
| 3282 | extra_index += @boolToInt(small.has_src_node); | 3282 | extra_index += @intFromBool(small.has_src_node); |
| 3283 | extra_index += @boolToInt(small.has_tag_type); | 3283 | extra_index += @intFromBool(small.has_tag_type); |
| 3284 | extra_index += @boolToInt(small.has_body_len); | 3284 | extra_index += @intFromBool(small.has_body_len); |
| 3285 | extra_index += @boolToInt(small.has_fields_len); | 3285 | extra_index += @intFromBool(small.has_fields_len); |
| 3286 | const decls_len = if (small.has_decls_len) decls_len: { | 3286 | const decls_len = if (small.has_decls_len) decls_len: { |
| 3287 | const decls_len = zir.extra[extra_index]; | 3287 | const decls_len = zir.extra[extra_index]; |
| 3288 | extra_index += 1; | 3288 | extra_index += 1; |
| ... | @@ -3294,7 +3294,7 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { | ... | @@ -3294,7 +3294,7 @@ pub fn declIterator(zir: Zir, decl_inst: u32) DeclIterator { |
| 3294 | .opaque_decl => { | 3294 | .opaque_decl => { |
| 3295 | const small = @bitCast(Inst.OpaqueDecl.Small, extended.small); | 3295 | const small = @bitCast(Inst.OpaqueDecl.Small, extended.small); |
| 3296 | var extra_index: usize = extended.operand; | 3296 | var extra_index: usize = extended.operand; |
| 3297 | extra_index += @boolToInt(small.has_src_node); | 3297 | extra_index += @intFromBool(small.has_src_node); |
| 3298 | const decls_len = if (small.has_decls_len) decls_len: { | 3298 | const decls_len = if (small.has_decls_len) decls_len: { |
| 3299 | const decls_len = zir.extra[extra_index]; | 3299 | const decls_len = zir.extra[extra_index]; |
| 3300 | extra_index += 1; | 3300 | extra_index += 1; |
| ... | @@ -3367,7 +3367,7 @@ fn findDeclsInner( | ... | @@ -3367,7 +3367,7 @@ fn findDeclsInner( |
| 3367 | const inst_data = datas[inst].pl_node; | 3367 | const inst_data = datas[inst].pl_node; |
| 3368 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); | 3368 | const extra = zir.extraData(Inst.FuncFancy, inst_data.payload_index); |
| 3369 | var extra_index: usize = extra.end; | 3369 | var extra_index: usize = extra.end; |
| 3370 | extra_index += @boolToInt(extra.data.bits.has_lib_name); | 3370 | extra_index += @intFromBool(extra.data.bits.has_lib_name); |
| 3371 | 3371 | ||
| 3372 | if (extra.data.bits.has_align_body) { | 3372 | if (extra.data.bits.has_align_body) { |
| 3373 | const body_len = zir.extra[extra_index]; | 3373 | const body_len = zir.extra[extra_index]; |
| ... | @@ -3419,7 +3419,7 @@ fn findDeclsInner( | ... | @@ -3419,7 +3419,7 @@ fn findDeclsInner( |
| 3419 | extra_index += 1; | 3419 | extra_index += 1; |
| 3420 | } | 3420 | } |
| 3421 | 3421 | ||
| 3422 | extra_index += @boolToInt(extra.data.bits.has_any_noalias); | 3422 | extra_index += @intFromBool(extra.data.bits.has_any_noalias); |
| 3423 | 3423 | ||
| 3424 | const body = zir.extra[extra_index..][0..extra.data.body_len]; | 3424 | const body = zir.extra[extra_index..][0..extra.data.body_len]; |
| 3425 | return zir.findDeclsBody(list, body); | 3425 | return zir.findDeclsBody(list, body); |
| ... | @@ -3598,7 +3598,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -3598,7 +3598,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 3598 | ret_ty_ref = .void_type; | 3598 | ret_ty_ref = .void_type; |
| 3599 | }, | 3599 | }, |
| 3600 | 1 => { | 3600 | 1 => { |
| 3601 | ret_ty_ref = @intToEnum(Inst.Ref, zir.extra[extra_index]); | 3601 | ret_ty_ref = @enumFromInt(Inst.Ref, zir.extra[extra_index]); |
| 3602 | extra_index += 1; | 3602 | extra_index += 1; |
| 3603 | }, | 3603 | }, |
| 3604 | else => { | 3604 | else => { |
| ... | @@ -3625,7 +3625,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -3625,7 +3625,7 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 3625 | var ret_ty_ref: Inst.Ref = .void_type; | 3625 | var ret_ty_ref: Inst.Ref = .void_type; |
| 3626 | var ret_ty_body: []const Inst.Index = &.{}; | 3626 | var ret_ty_body: []const Inst.Index = &.{}; |
| 3627 | 3627 | ||
| 3628 | extra_index += @boolToInt(extra.data.bits.has_lib_name); | 3628 | extra_index += @intFromBool(extra.data.bits.has_lib_name); |
| 3629 | if (extra.data.bits.has_align_body) { | 3629 | if (extra.data.bits.has_align_body) { |
| 3630 | extra_index += zir.extra[extra_index] + 1; | 3630 | extra_index += zir.extra[extra_index] + 1; |
| 3631 | } else if (extra.data.bits.has_align_ref) { | 3631 | } else if (extra.data.bits.has_align_ref) { |
| ... | @@ -3652,11 +3652,11 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -3652,11 +3652,11 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 3652 | ret_ty_body = zir.extra[extra_index..][0..body_len]; | 3652 | ret_ty_body = zir.extra[extra_index..][0..body_len]; |
| 3653 | extra_index += ret_ty_body.len; | 3653 | extra_index += ret_ty_body.len; |
| 3654 | } else if (extra.data.bits.has_ret_ty_ref) { | 3654 | } else if (extra.data.bits.has_ret_ty_ref) { |
| 3655 | ret_ty_ref = @intToEnum(Inst.Ref, zir.extra[extra_index]); | 3655 | ret_ty_ref = @enumFromInt(Inst.Ref, zir.extra[extra_index]); |
| 3656 | extra_index += 1; | 3656 | extra_index += 1; |
| 3657 | } | 3657 | } |
| 3658 | 3658 | ||
| 3659 | extra_index += @boolToInt(extra.data.bits.has_any_noalias); | 3659 | extra_index += @intFromBool(extra.data.bits.has_any_noalias); |
| 3660 | 3660 | ||
| 3661 | const body = zir.extra[extra_index..][0..extra.data.body_len]; | 3661 | const body = zir.extra[extra_index..][0..extra.data.body_len]; |
| 3662 | extra_index += body.len; | 3662 | extra_index += body.len; |
| ... | @@ -3696,12 +3696,12 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { | ... | @@ -3696,12 +3696,12 @@ pub fn getFnInfo(zir: Zir, fn_inst: Inst.Index) FnInfo { |
| 3696 | pub const ref_start_index: u32 = InternPool.static_len; | 3696 | pub const ref_start_index: u32 = InternPool.static_len; |
| 3697 | 3697 | ||
| 3698 | pub fn indexToRef(inst: Inst.Index) Inst.Ref { | 3698 | pub fn indexToRef(inst: Inst.Index) Inst.Ref { |
| 3699 | return @intToEnum(Inst.Ref, ref_start_index + inst); | 3699 | return @enumFromInt(Inst.Ref, ref_start_index + inst); |
| 3700 | } | 3700 | } |
| 3701 | 3701 | ||
| 3702 | pub fn refToIndex(inst: Inst.Ref) ?Inst.Index { | 3702 | pub fn refToIndex(inst: Inst.Ref) ?Inst.Index { |
| 3703 | assert(inst != .none); | 3703 | assert(inst != .none); |
| 3704 | const ref_int = @enumToInt(inst); | 3704 | const ref_int = @intFromEnum(inst); |
| 3705 | if (ref_int >= ref_start_index) { | 3705 | if (ref_int >= ref_start_index) { |
| 3706 | return ref_int - ref_start_index; | 3706 | return ref_int - ref_start_index; |
| 3707 | } else { | 3707 | } else { |
src/arch/aarch64/CodeGen.zig+6-6| ... | @@ -951,7 +951,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live | ... | @@ -951,7 +951,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live |
| 951 | const dies = @truncate(u1, tomb_bits) != 0; | 951 | const dies = @truncate(u1, tomb_bits) != 0; |
| 952 | tomb_bits >>= 1; | 952 | tomb_bits >>= 1; |
| 953 | if (!dies) continue; | 953 | if (!dies) continue; |
| 954 | const op_int = @enumToInt(op); | 954 | const op_int = @intFromEnum(op); |
| 955 | if (op_int < Air.ref_start_index) continue; | 955 | if (op_int < Air.ref_start_index) continue; |
| 956 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 956 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 957 | self.processDeath(op_index); | 957 | self.processDeath(op_index); |
| ... | @@ -4026,7 +4026,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type | ... | @@ -4026,7 +4026,7 @@ fn store(self: *Self, ptr: MCValue, value: MCValue, ptr_ty: Type, value_ty: Type |
| 4026 | .tag = tag, | 4026 | .tag = tag, |
| 4027 | .data = .{ | 4027 | .data = .{ |
| 4028 | .payload = try self.addExtra(Mir.LoadMemoryPie{ | 4028 | .payload = try self.addExtra(Mir.LoadMemoryPie{ |
| 4029 | .register = @enumToInt(src_reg), | 4029 | .register = @intFromEnum(src_reg), |
| 4030 | .atom_index = atom_index, | 4030 | .atom_index = atom_index, |
| 4031 | .sym_index = load_struct.sym_index, | 4031 | .sym_index = load_struct.sym_index, |
| 4032 | }), | 4032 | }), |
| ... | @@ -4694,7 +4694,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4694,7 +4694,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 4694 | // that death now instead of later as this has an effect on | 4694 | // that death now instead of later as this has an effect on |
| 4695 | // whether it needs to be spilled in the branches | 4695 | // whether it needs to be spilled in the branches |
| 4696 | if (self.liveness.operandDies(inst, 0)) { | 4696 | if (self.liveness.operandDies(inst, 0)) { |
| 4697 | const op_int = @enumToInt(pl_op.operand); | 4697 | const op_int = @intFromEnum(pl_op.operand); |
| 4698 | if (op_int >= Air.ref_start_index) { | 4698 | if (op_int >= Air.ref_start_index) { |
| 4699 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 4699 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 4700 | self.processDeath(op_index); | 4700 | self.processDeath(op_index); |
| ... | @@ -5546,7 +5546,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro | ... | @@ -5546,7 +5546,7 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 5546 | .tag = tag, | 5546 | .tag = tag, |
| 5547 | .data = .{ | 5547 | .data = .{ |
| 5548 | .payload = try self.addExtra(Mir.LoadMemoryPie{ | 5548 | .payload = try self.addExtra(Mir.LoadMemoryPie{ |
| 5549 | .register = @enumToInt(src_reg), | 5549 | .register = @intFromEnum(src_reg), |
| 5550 | .atom_index = atom_index, | 5550 | .atom_index = atom_index, |
| 5551 | .sym_index = load_struct.sym_index, | 5551 | .sym_index = load_struct.sym_index, |
| 5552 | }), | 5552 | }), |
| ... | @@ -5667,7 +5667,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void | ... | @@ -5667,7 +5667,7 @@ fn genSetReg(self: *Self, ty: Type, reg: Register, mcv: MCValue) InnerError!void |
| 5667 | .tag = tag, | 5667 | .tag = tag, |
| 5668 | .data = .{ | 5668 | .data = .{ |
| 5669 | .payload = try self.addExtra(Mir.LoadMemoryPie{ | 5669 | .payload = try self.addExtra(Mir.LoadMemoryPie{ |
| 5670 | .register = @enumToInt(reg), | 5670 | .register = @intFromEnum(reg), |
| 5671 | .atom_index = atom_index, | 5671 | .atom_index = atom_index, |
| 5672 | .sym_index = load_struct.sym_index, | 5672 | .sym_index = load_struct.sym_index, |
| 5673 | }), | 5673 | }), |
| ... | @@ -5864,7 +5864,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I | ... | @@ -5864,7 +5864,7 @@ fn genSetStackArgument(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) I |
| 5864 | .tag = tag, | 5864 | .tag = tag, |
| 5865 | .data = .{ | 5865 | .data = .{ |
| 5866 | .payload = try self.addExtra(Mir.LoadMemoryPie{ | 5866 | .payload = try self.addExtra(Mir.LoadMemoryPie{ |
| 5867 | .register = @enumToInt(src_reg), | 5867 | .register = @intFromEnum(src_reg), |
| 5868 | .atom_index = atom_index, | 5868 | .atom_index = atom_index, |
| 5869 | .sym_index = load_struct.sym_index, | 5869 | .sym_index = load_struct.sym_index, |
| 5870 | }), | 5870 | }), |
src/arch/aarch64/Emit.zig+3-3| ... | @@ -837,7 +837,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -837,7 +837,7 @@ fn mirLoadMemoryPie(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 837 | const tag = emit.mir.instructions.items(.tag)[inst]; | 837 | const tag = emit.mir.instructions.items(.tag)[inst]; |
| 838 | const payload = emit.mir.instructions.items(.data)[inst].payload; | 838 | const payload = emit.mir.instructions.items(.data)[inst].payload; |
| 839 | const data = emit.mir.extraData(Mir.LoadMemoryPie, payload).data; | 839 | const data = emit.mir.extraData(Mir.LoadMemoryPie, payload).data; |
| 840 | const reg = @intToEnum(Register, data.register); | 840 | const reg = @enumFromInt(Register, data.register); |
| 841 | 841 | ||
| 842 | // PC-relative displacement to the entry in memory. | 842 | // PC-relative displacement to the entry in memory. |
| 843 | // adrp | 843 | // adrp |
| ... | @@ -1245,7 +1245,7 @@ fn mirPushPopRegs(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -1245,7 +1245,7 @@ fn mirPushPopRegs(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 1245 | var count: u6 = 0; | 1245 | var count: u6 = 0; |
| 1246 | var other_reg: ?Register = null; | 1246 | var other_reg: ?Register = null; |
| 1247 | while (i > 0) : (i -= 1) { | 1247 | while (i > 0) : (i -= 1) { |
| 1248 | const reg = @intToEnum(Register, i - 1); | 1248 | const reg = @enumFromInt(Register, i - 1); |
| 1249 | if (regListIsSet(reg_list, reg)) { | 1249 | if (regListIsSet(reg_list, reg)) { |
| 1250 | if (count == 0 and odd_number_of_regs) { | 1250 | if (count == 0 and odd_number_of_regs) { |
| 1251 | try emit.writeInstruction(Instruction.ldr( | 1251 | try emit.writeInstruction(Instruction.ldr( |
| ... | @@ -1274,7 +1274,7 @@ fn mirPushPopRegs(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -1274,7 +1274,7 @@ fn mirPushPopRegs(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 1274 | var count: u6 = 0; | 1274 | var count: u6 = 0; |
| 1275 | var other_reg: ?Register = null; | 1275 | var other_reg: ?Register = null; |
| 1276 | while (i < 32) : (i += 1) { | 1276 | while (i < 32) : (i += 1) { |
| 1277 | const reg = @intToEnum(Register, i); | 1277 | const reg = @enumFromInt(Register, i); |
| 1278 | if (regListIsSet(reg_list, reg)) { | 1278 | if (regListIsSet(reg_list, reg)) { |
| 1279 | if (count == number_of_regs - 1 and odd_number_of_regs) { | 1279 | if (count == number_of_regs - 1 and odd_number_of_regs) { |
| 1280 | try emit.writeInstruction(Instruction.str( | 1280 | try emit.writeInstruction(Instruction.str( |
src/arch/aarch64/bits.zig+123-123| ... | @@ -62,84 +62,84 @@ pub const Register = enum(u8) { | ... | @@ -62,84 +62,84 @@ pub const Register = enum(u8) { |
| 62 | // zig fmt: on | 62 | // zig fmt: on |
| 63 | 63 | ||
| 64 | pub fn class(self: Register) RegisterClass { | 64 | pub fn class(self: Register) RegisterClass { |
| 65 | return switch (@enumToInt(self)) { | 65 | return switch (@intFromEnum(self)) { |
| 66 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => .general_purpose, | 66 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => .general_purpose, |
| 67 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => .general_purpose, | 67 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => .general_purpose, |
| 68 | 68 | ||
| 69 | @enumToInt(Register.sp) => .stack_pointer, | 69 | @intFromEnum(Register.sp) => .stack_pointer, |
| 70 | @enumToInt(Register.wsp) => .stack_pointer, | 70 | @intFromEnum(Register.wsp) => .stack_pointer, |
| 71 | 71 | ||
| 72 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => .floating_point, | 72 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => .floating_point, |
| 73 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => .floating_point, | 73 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => .floating_point, |
| 74 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => .floating_point, | 74 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => .floating_point, |
| 75 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => .floating_point, | 75 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => .floating_point, |
| 76 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => .floating_point, | 76 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => .floating_point, |
| 77 | else => unreachable, | 77 | else => unreachable, |
| 78 | }; | 78 | }; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | pub fn id(self: Register) u6 { | 81 | pub fn id(self: Register) u6 { |
| 82 | return switch (@enumToInt(self)) { | 82 | return switch (@intFromEnum(self)) { |
| 83 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.x0)), | 83 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.x0)), |
| 84 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.w0)), | 84 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.w0)), |
| 85 | 85 | ||
| 86 | @enumToInt(Register.sp) => 32, | 86 | @intFromEnum(Register.sp) => 32, |
| 87 | @enumToInt(Register.wsp) => 32, | 87 | @intFromEnum(Register.wsp) => 32, |
| 88 | 88 | ||
| 89 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.q0) + 33), | 89 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.q0) + 33), |
| 90 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.d0) + 33), | 90 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.d0) + 33), |
| 91 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.s0) + 33), | 91 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.s0) + 33), |
| 92 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.h0) + 33), | 92 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.h0) + 33), |
| 93 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intCast(u6, @enumToInt(self) - @enumToInt(Register.b0) + 33), | 93 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @intCast(u6, @intFromEnum(self) - @intFromEnum(Register.b0) + 33), |
| 94 | else => unreachable, | 94 | else => unreachable, |
| 95 | }; | 95 | }; |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | pub fn enc(self: Register) u5 { | 98 | pub fn enc(self: Register) u5 { |
| 99 | return switch (@enumToInt(self)) { | 99 | return switch (@intFromEnum(self)) { |
| 100 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.x0)), | 100 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.x0)), |
| 101 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.w0)), | 101 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.w0)), |
| 102 | 102 | ||
| 103 | @enumToInt(Register.sp) => 31, | 103 | @intFromEnum(Register.sp) => 31, |
| 104 | @enumToInt(Register.wsp) => 31, | 104 | @intFromEnum(Register.wsp) => 31, |
| 105 | 105 | ||
| 106 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.q0)), | 106 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.q0)), |
| 107 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.d0)), | 107 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.d0)), |
| 108 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.s0)), | 108 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.s0)), |
| 109 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.h0)), | 109 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.h0)), |
| 110 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intCast(u5, @enumToInt(self) - @enumToInt(Register.b0)), | 110 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @intCast(u5, @intFromEnum(self) - @intFromEnum(Register.b0)), |
| 111 | else => unreachable, | 111 | else => unreachable, |
| 112 | }; | 112 | }; |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /// Returns the bit-width of the register. | 115 | /// Returns the bit-width of the register. |
| 116 | pub fn size(self: Register) u8 { | 116 | pub fn size(self: Register) u8 { |
| 117 | return switch (@enumToInt(self)) { | 117 | return switch (@intFromEnum(self)) { |
| 118 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => 64, | 118 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => 64, |
| 119 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => 32, | 119 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => 32, |
| 120 | 120 | ||
| 121 | @enumToInt(Register.sp) => 64, | 121 | @intFromEnum(Register.sp) => 64, |
| 122 | @enumToInt(Register.wsp) => 32, | 122 | @intFromEnum(Register.wsp) => 32, |
| 123 | 123 | ||
| 124 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => 128, | 124 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => 128, |
| 125 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => 64, | 125 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => 64, |
| 126 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => 32, | 126 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => 32, |
| 127 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => 16, | 127 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => 16, |
| 128 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => 8, | 128 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => 8, |
| 129 | else => unreachable, | 129 | else => unreachable, |
| 130 | }; | 130 | }; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | /// Convert from a general-purpose register to its 64 bit alias. | 133 | /// Convert from a general-purpose register to its 64 bit alias. |
| 134 | pub fn toX(self: Register) Register { | 134 | pub fn toX(self: Register) Register { |
| 135 | return switch (@enumToInt(self)) { | 135 | return switch (@intFromEnum(self)) { |
| 136 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => @intToEnum( | 136 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => @enumFromInt( |
| 137 | Register, | 137 | Register, |
| 138 | @enumToInt(self) - @enumToInt(Register.x0) + @enumToInt(Register.x0), | 138 | @intFromEnum(self) - @intFromEnum(Register.x0) + @intFromEnum(Register.x0), |
| 139 | ), | 139 | ), |
| 140 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => @intToEnum( | 140 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => @enumFromInt( |
| 141 | Register, | 141 | Register, |
| 142 | @enumToInt(self) - @enumToInt(Register.w0) + @enumToInt(Register.x0), | 142 | @intFromEnum(self) - @intFromEnum(Register.w0) + @intFromEnum(Register.x0), |
| 143 | ), | 143 | ), |
| 144 | else => unreachable, | 144 | else => unreachable, |
| 145 | }; | 145 | }; |
| ... | @@ -147,14 +147,14 @@ pub const Register = enum(u8) { | ... | @@ -147,14 +147,14 @@ pub const Register = enum(u8) { |
| 147 | 147 | ||
| 148 | /// Convert from a general-purpose register to its 32 bit alias. | 148 | /// Convert from a general-purpose register to its 32 bit alias. |
| 149 | pub fn toW(self: Register) Register { | 149 | pub fn toW(self: Register) Register { |
| 150 | return switch (@enumToInt(self)) { | 150 | return switch (@intFromEnum(self)) { |
| 151 | @enumToInt(Register.x0)...@enumToInt(Register.xzr) => @intToEnum( | 151 | @intFromEnum(Register.x0)...@intFromEnum(Register.xzr) => @enumFromInt( |
| 152 | Register, | 152 | Register, |
| 153 | @enumToInt(self) - @enumToInt(Register.x0) + @enumToInt(Register.w0), | 153 | @intFromEnum(self) - @intFromEnum(Register.x0) + @intFromEnum(Register.w0), |
| 154 | ), | 154 | ), |
| 155 | @enumToInt(Register.w0)...@enumToInt(Register.wzr) => @intToEnum( | 155 | @intFromEnum(Register.w0)...@intFromEnum(Register.wzr) => @enumFromInt( |
| 156 | Register, | 156 | Register, |
| 157 | @enumToInt(self) - @enumToInt(Register.w0) + @enumToInt(Register.w0), | 157 | @intFromEnum(self) - @intFromEnum(Register.w0) + @intFromEnum(Register.w0), |
| 158 | ), | 158 | ), |
| 159 | else => unreachable, | 159 | else => unreachable, |
| 160 | }; | 160 | }; |
| ... | @@ -162,26 +162,26 @@ pub const Register = enum(u8) { | ... | @@ -162,26 +162,26 @@ pub const Register = enum(u8) { |
| 162 | 162 | ||
| 163 | /// Convert from a floating-point register to its 128 bit alias. | 163 | /// Convert from a floating-point register to its 128 bit alias. |
| 164 | pub fn toQ(self: Register) Register { | 164 | pub fn toQ(self: Register) Register { |
| 165 | return switch (@enumToInt(self)) { | 165 | return switch (@intFromEnum(self)) { |
| 166 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intToEnum( | 166 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @enumFromInt( |
| 167 | Register, | 167 | Register, |
| 168 | @enumToInt(self) - @enumToInt(Register.q0) + @enumToInt(Register.q0), | 168 | @intFromEnum(self) - @intFromEnum(Register.q0) + @intFromEnum(Register.q0), |
| 169 | ), | 169 | ), |
| 170 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intToEnum( | 170 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @enumFromInt( |
| 171 | Register, | 171 | Register, |
| 172 | @enumToInt(self) - @enumToInt(Register.d0) + @enumToInt(Register.q0), | 172 | @intFromEnum(self) - @intFromEnum(Register.d0) + @intFromEnum(Register.q0), |
| 173 | ), | 173 | ), |
| 174 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intToEnum( | 174 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @enumFromInt( |
| 175 | Register, | 175 | Register, |
| 176 | @enumToInt(self) - @enumToInt(Register.s0) + @enumToInt(Register.q0), | 176 | @intFromEnum(self) - @intFromEnum(Register.s0) + @intFromEnum(Register.q0), |
| 177 | ), | 177 | ), |
| 178 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intToEnum( | 178 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @enumFromInt( |
| 179 | Register, | 179 | Register, |
| 180 | @enumToInt(self) - @enumToInt(Register.h0) + @enumToInt(Register.q0), | 180 | @intFromEnum(self) - @intFromEnum(Register.h0) + @intFromEnum(Register.q0), |
| 181 | ), | 181 | ), |
| 182 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intToEnum( | 182 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @enumFromInt( |
| 183 | Register, | 183 | Register, |
| 184 | @enumToInt(self) - @enumToInt(Register.b0) + @enumToInt(Register.q0), | 184 | @intFromEnum(self) - @intFromEnum(Register.b0) + @intFromEnum(Register.q0), |
| 185 | ), | 185 | ), |
| 186 | else => unreachable, | 186 | else => unreachable, |
| 187 | }; | 187 | }; |
| ... | @@ -189,26 +189,26 @@ pub const Register = enum(u8) { | ... | @@ -189,26 +189,26 @@ pub const Register = enum(u8) { |
| 189 | 189 | ||
| 190 | /// Convert from a floating-point register to its 64 bit alias. | 190 | /// Convert from a floating-point register to its 64 bit alias. |
| 191 | pub fn toD(self: Register) Register { | 191 | pub fn toD(self: Register) Register { |
| 192 | return switch (@enumToInt(self)) { | 192 | return switch (@intFromEnum(self)) { |
| 193 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intToEnum( | 193 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @enumFromInt( |
| 194 | Register, | 194 | Register, |
| 195 | @enumToInt(self) - @enumToInt(Register.q0) + @enumToInt(Register.d0), | 195 | @intFromEnum(self) - @intFromEnum(Register.q0) + @intFromEnum(Register.d0), |
| 196 | ), | 196 | ), |
| 197 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intToEnum( | 197 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @enumFromInt( |
| 198 | Register, | 198 | Register, |
| 199 | @enumToInt(self) - @enumToInt(Register.d0) + @enumToInt(Register.d0), | 199 | @intFromEnum(self) - @intFromEnum(Register.d0) + @intFromEnum(Register.d0), |
| 200 | ), | 200 | ), |
| 201 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intToEnum( | 201 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @enumFromInt( |
| 202 | Register, | 202 | Register, |
| 203 | @enumToInt(self) - @enumToInt(Register.s0) + @enumToInt(Register.d0), | 203 | @intFromEnum(self) - @intFromEnum(Register.s0) + @intFromEnum(Register.d0), |
| 204 | ), | 204 | ), |
| 205 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intToEnum( | 205 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @enumFromInt( |
| 206 | Register, | 206 | Register, |
| 207 | @enumToInt(self) - @enumToInt(Register.h0) + @enumToInt(Register.d0), | 207 | @intFromEnum(self) - @intFromEnum(Register.h0) + @intFromEnum(Register.d0), |
| 208 | ), | 208 | ), |
| 209 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intToEnum( | 209 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @enumFromInt( |
| 210 | Register, | 210 | Register, |
| 211 | @enumToInt(self) - @enumToInt(Register.b0) + @enumToInt(Register.d0), | 211 | @intFromEnum(self) - @intFromEnum(Register.b0) + @intFromEnum(Register.d0), |
| 212 | ), | 212 | ), |
| 213 | else => unreachable, | 213 | else => unreachable, |
| 214 | }; | 214 | }; |
| ... | @@ -216,26 +216,26 @@ pub const Register = enum(u8) { | ... | @@ -216,26 +216,26 @@ pub const Register = enum(u8) { |
| 216 | 216 | ||
| 217 | /// Convert from a floating-point register to its 32 bit alias. | 217 | /// Convert from a floating-point register to its 32 bit alias. |
| 218 | pub fn toS(self: Register) Register { | 218 | pub fn toS(self: Register) Register { |
| 219 | return switch (@enumToInt(self)) { | 219 | return switch (@intFromEnum(self)) { |
| 220 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intToEnum( | 220 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @enumFromInt( |
| 221 | Register, | 221 | Register, |
| 222 | @enumToInt(self) - @enumToInt(Register.q0) + @enumToInt(Register.s0), | 222 | @intFromEnum(self) - @intFromEnum(Register.q0) + @intFromEnum(Register.s0), |
| 223 | ), | 223 | ), |
| 224 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intToEnum( | 224 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @enumFromInt( |
| 225 | Register, | 225 | Register, |
| 226 | @enumToInt(self) - @enumToInt(Register.d0) + @enumToInt(Register.s0), | 226 | @intFromEnum(self) - @intFromEnum(Register.d0) + @intFromEnum(Register.s0), |
| 227 | ), | 227 | ), |
| 228 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intToEnum( | 228 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @enumFromInt( |
| 229 | Register, | 229 | Register, |
| 230 | @enumToInt(self) - @enumToInt(Register.s0) + @enumToInt(Register.s0), | 230 | @intFromEnum(self) - @intFromEnum(Register.s0) + @intFromEnum(Register.s0), |
| 231 | ), | 231 | ), |
| 232 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intToEnum( | 232 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @enumFromInt( |
| 233 | Register, | 233 | Register, |
| 234 | @enumToInt(self) - @enumToInt(Register.h0) + @enumToInt(Register.s0), | 234 | @intFromEnum(self) - @intFromEnum(Register.h0) + @intFromEnum(Register.s0), |
| 235 | ), | 235 | ), |
| 236 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intToEnum( | 236 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @enumFromInt( |
| 237 | Register, | 237 | Register, |
| 238 | @enumToInt(self) - @enumToInt(Register.b0) + @enumToInt(Register.s0), | 238 | @intFromEnum(self) - @intFromEnum(Register.b0) + @intFromEnum(Register.s0), |
| 239 | ), | 239 | ), |
| 240 | else => unreachable, | 240 | else => unreachable, |
| 241 | }; | 241 | }; |
| ... | @@ -243,26 +243,26 @@ pub const Register = enum(u8) { | ... | @@ -243,26 +243,26 @@ pub const Register = enum(u8) { |
| 243 | 243 | ||
| 244 | /// Convert from a floating-point register to its 16 bit alias. | 244 | /// Convert from a floating-point register to its 16 bit alias. |
| 245 | pub fn toH(self: Register) Register { | 245 | pub fn toH(self: Register) Register { |
| 246 | return switch (@enumToInt(self)) { | 246 | return switch (@intFromEnum(self)) { |
| 247 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intToEnum( | 247 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @enumFromInt( |
| 248 | Register, | 248 | Register, |
| 249 | @enumToInt(self) - @enumToInt(Register.q0) + @enumToInt(Register.h0), | 249 | @intFromEnum(self) - @intFromEnum(Register.q0) + @intFromEnum(Register.h0), |
| 250 | ), | 250 | ), |
| 251 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intToEnum( | 251 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @enumFromInt( |
| 252 | Register, | 252 | Register, |
| 253 | @enumToInt(self) - @enumToInt(Register.d0) + @enumToInt(Register.h0), | 253 | @intFromEnum(self) - @intFromEnum(Register.d0) + @intFromEnum(Register.h0), |
| 254 | ), | 254 | ), |
| 255 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intToEnum( | 255 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @enumFromInt( |
| 256 | Register, | 256 | Register, |
| 257 | @enumToInt(self) - @enumToInt(Register.s0) + @enumToInt(Register.h0), | 257 | @intFromEnum(self) - @intFromEnum(Register.s0) + @intFromEnum(Register.h0), |
| 258 | ), | 258 | ), |
| 259 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intToEnum( | 259 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @enumFromInt( |
| 260 | Register, | 260 | Register, |
| 261 | @enumToInt(self) - @enumToInt(Register.h0) + @enumToInt(Register.h0), | 261 | @intFromEnum(self) - @intFromEnum(Register.h0) + @intFromEnum(Register.h0), |
| 262 | ), | 262 | ), |
| 263 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intToEnum( | 263 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @enumFromInt( |
| 264 | Register, | 264 | Register, |
| 265 | @enumToInt(self) - @enumToInt(Register.b0) + @enumToInt(Register.h0), | 265 | @intFromEnum(self) - @intFromEnum(Register.b0) + @intFromEnum(Register.h0), |
| 266 | ), | 266 | ), |
| 267 | else => unreachable, | 267 | else => unreachable, |
| 268 | }; | 268 | }; |
| ... | @@ -270,26 +270,26 @@ pub const Register = enum(u8) { | ... | @@ -270,26 +270,26 @@ pub const Register = enum(u8) { |
| 270 | 270 | ||
| 271 | /// Convert from a floating-point register to its 8 bit alias. | 271 | /// Convert from a floating-point register to its 8 bit alias. |
| 272 | pub fn toB(self: Register) Register { | 272 | pub fn toB(self: Register) Register { |
| 273 | return switch (@enumToInt(self)) { | 273 | return switch (@intFromEnum(self)) { |
| 274 | @enumToInt(Register.q0)...@enumToInt(Register.q31) => @intToEnum( | 274 | @intFromEnum(Register.q0)...@intFromEnum(Register.q31) => @enumFromInt( |
| 275 | Register, | 275 | Register, |
| 276 | @enumToInt(self) - @enumToInt(Register.q0) + @enumToInt(Register.b0), | 276 | @intFromEnum(self) - @intFromEnum(Register.q0) + @intFromEnum(Register.b0), |
| 277 | ), | 277 | ), |
| 278 | @enumToInt(Register.d0)...@enumToInt(Register.d31) => @intToEnum( | 278 | @intFromEnum(Register.d0)...@intFromEnum(Register.d31) => @enumFromInt( |
| 279 | Register, | 279 | Register, |
| 280 | @enumToInt(self) - @enumToInt(Register.d0) + @enumToInt(Register.b0), | 280 | @intFromEnum(self) - @intFromEnum(Register.d0) + @intFromEnum(Register.b0), |
| 281 | ), | 281 | ), |
| 282 | @enumToInt(Register.s0)...@enumToInt(Register.s31) => @intToEnum( | 282 | @intFromEnum(Register.s0)...@intFromEnum(Register.s31) => @enumFromInt( |
| 283 | Register, | 283 | Register, |
| 284 | @enumToInt(self) - @enumToInt(Register.s0) + @enumToInt(Register.b0), | 284 | @intFromEnum(self) - @intFromEnum(Register.s0) + @intFromEnum(Register.b0), |
| 285 | ), | 285 | ), |
| 286 | @enumToInt(Register.h0)...@enumToInt(Register.h31) => @intToEnum( | 286 | @intFromEnum(Register.h0)...@intFromEnum(Register.h31) => @enumFromInt( |
| 287 | Register, | 287 | Register, |
| 288 | @enumToInt(self) - @enumToInt(Register.h0) + @enumToInt(Register.b0), | 288 | @intFromEnum(self) - @intFromEnum(Register.h0) + @intFromEnum(Register.b0), |
| 289 | ), | 289 | ), |
| 290 | @enumToInt(Register.b0)...@enumToInt(Register.b31) => @intToEnum( | 290 | @intFromEnum(Register.b0)...@intFromEnum(Register.b31) => @enumFromInt( |
| 291 | Register, | 291 | Register, |
| 292 | @enumToInt(self) - @enumToInt(Register.b0) + @enumToInt(Register.b0), | 292 | @intFromEnum(self) - @intFromEnum(Register.b0) + @intFromEnum(Register.b0), |
| 293 | ), | 293 | ), |
| 294 | else => unreachable, | 294 | else => unreachable, |
| 295 | }; | 295 | }; |
| ... | @@ -901,7 +901,7 @@ pub const Instruction = union(enum) { | ... | @@ -901,7 +901,7 @@ pub const Instruction = union(enum) { |
| 901 | .rn = rn.enc(), | 901 | .rn = rn.enc(), |
| 902 | .rt2 = rt2.enc(), | 902 | .rt2 = rt2.enc(), |
| 903 | .imm7 = imm7, | 903 | .imm7 = imm7, |
| 904 | .load = @boolToInt(load), | 904 | .load = @intFromBool(load), |
| 905 | .encoding = encoding, | 905 | .encoding = encoding, |
| 906 | .opc = 0b00, | 906 | .opc = 0b00, |
| 907 | }, | 907 | }, |
| ... | @@ -916,7 +916,7 @@ pub const Instruction = union(enum) { | ... | @@ -916,7 +916,7 @@ pub const Instruction = union(enum) { |
| 916 | .rn = rn.enc(), | 916 | .rn = rn.enc(), |
| 917 | .rt2 = rt2.enc(), | 917 | .rt2 = rt2.enc(), |
| 918 | .imm7 = imm7, | 918 | .imm7 = imm7, |
| 919 | .load = @boolToInt(load), | 919 | .load = @intFromBool(load), |
| 920 | .encoding = encoding, | 920 | .encoding = encoding, |
| 921 | .opc = 0b10, | 921 | .opc = 0b10, |
| 922 | }, | 922 | }, |
| ... | @@ -1010,7 +1010,7 @@ pub const Instruction = union(enum) { | ... | @@ -1010,7 +1010,7 @@ pub const Instruction = union(enum) { |
| 1010 | .imm6 = amount, | 1010 | .imm6 = amount, |
| 1011 | .rm = rm.enc(), | 1011 | .rm = rm.enc(), |
| 1012 | .n = n, | 1012 | .n = n, |
| 1013 | .shift = @enumToInt(shift), | 1013 | .shift = @intFromEnum(shift), |
| 1014 | .opc = opc, | 1014 | .opc = opc, |
| 1015 | .sf = switch (rd.size()) { | 1015 | .sf = switch (rd.size()) { |
| 1016 | 32 => 0b0, | 1016 | 32 => 0b0, |
| ... | @@ -1037,7 +1037,7 @@ pub const Instruction = union(enum) { | ... | @@ -1037,7 +1037,7 @@ pub const Instruction = union(enum) { |
| 1037 | .rd = rd.enc(), | 1037 | .rd = rd.enc(), |
| 1038 | .rn = rn.enc(), | 1038 | .rn = rn.enc(), |
| 1039 | .imm12 = imm12, | 1039 | .imm12 = imm12, |
| 1040 | .sh = @boolToInt(shift), | 1040 | .sh = @intFromBool(shift), |
| 1041 | .s = s, | 1041 | .s = s, |
| 1042 | .op = op, | 1042 | .op = op, |
| 1043 | .sf = switch (rd.size()) { | 1043 | .sf = switch (rd.size()) { |
| ... | @@ -1126,7 +1126,7 @@ pub const Instruction = union(enum) { | ... | @@ -1126,7 +1126,7 @@ pub const Instruction = union(enum) { |
| 1126 | .rn = rn.enc(), | 1126 | .rn = rn.enc(), |
| 1127 | .imm6 = imm6, | 1127 | .imm6 = imm6, |
| 1128 | .rm = rm.enc(), | 1128 | .rm = rm.enc(), |
| 1129 | .shift = @enumToInt(shift), | 1129 | .shift = @intFromEnum(shift), |
| 1130 | .s = s, | 1130 | .s = s, |
| 1131 | .op = op, | 1131 | .op = op, |
| 1132 | .sf = switch (rd.size()) { | 1132 | .sf = switch (rd.size()) { |
| ... | @@ -1163,7 +1163,7 @@ pub const Instruction = union(enum) { | ... | @@ -1163,7 +1163,7 @@ pub const Instruction = union(enum) { |
| 1163 | .rd = rd.enc(), | 1163 | .rd = rd.enc(), |
| 1164 | .rn = rn.enc(), | 1164 | .rn = rn.enc(), |
| 1165 | .imm3 = imm3, | 1165 | .imm3 = imm3, |
| 1166 | .option = @enumToInt(extend), | 1166 | .option = @intFromEnum(extend), |
| 1167 | .rm = rm.enc(), | 1167 | .rm = rm.enc(), |
| 1168 | .s = s, | 1168 | .s = s, |
| 1169 | .op = op, | 1169 | .op = op, |
| ... | @@ -1186,7 +1186,7 @@ pub const Instruction = union(enum) { | ... | @@ -1186,7 +1186,7 @@ pub const Instruction = union(enum) { |
| 1186 | 1186 | ||
| 1187 | return Instruction{ | 1187 | return Instruction{ |
| 1188 | .conditional_branch = .{ | 1188 | .conditional_branch = .{ |
| 1189 | .cond = @enumToInt(cond), | 1189 | .cond = @intFromEnum(cond), |
| 1190 | .o0 = o0, | 1190 | .o0 = o0, |
| 1191 | .imm19 = @bitCast(u19, @intCast(i19, offset >> 2)), | 1191 | .imm19 = @bitCast(u19, @intCast(i19, offset >> 2)), |
| 1192 | .o1 = o1, | 1192 | .o1 = o1, |
| ... | @@ -1232,7 +1232,7 @@ pub const Instruction = union(enum) { | ... | @@ -1232,7 +1232,7 @@ pub const Instruction = union(enum) { |
| 1232 | .rd = rd.enc(), | 1232 | .rd = rd.enc(), |
| 1233 | .rn = rn.enc(), | 1233 | .rn = rn.enc(), |
| 1234 | .op2 = op2, | 1234 | .op2 = op2, |
| 1235 | .cond = @enumToInt(cond), | 1235 | .cond = @intFromEnum(cond), |
| 1236 | .rm = rm.enc(), | 1236 | .rm = rm.enc(), |
| 1237 | .s = s, | 1237 | .s = s, |
| 1238 | .op = op, | 1238 | .op = op, |
| ... | @@ -1394,7 +1394,7 @@ pub const Instruction = union(enum) { | ... | @@ -1394,7 +1394,7 @@ pub const Instruction = union(enum) { |
| 1394 | }; | 1394 | }; |
| 1395 | 1395 | ||
| 1396 | pub fn ldp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { | 1396 | pub fn ldp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { |
| 1397 | return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), true); | 1397 | return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @intFromEnum(offset.encoding), true); |
| 1398 | } | 1398 | } |
| 1399 | 1399 | ||
| 1400 | pub fn ldnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { | 1400 | pub fn ldnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { |
| ... | @@ -1402,7 +1402,7 @@ pub const Instruction = union(enum) { | ... | @@ -1402,7 +1402,7 @@ pub const Instruction = union(enum) { |
| 1402 | } | 1402 | } |
| 1403 | 1403 | ||
| 1404 | pub fn stp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { | 1404 | pub fn stp(rt1: Register, rt2: Register, rn: Register, offset: LoadStorePairOffset) Instruction { |
| 1405 | return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @enumToInt(offset.encoding), false); | 1405 | return loadStoreRegisterPair(rt1, rt2, rn, offset.offset, @intFromEnum(offset.encoding), false); |
| 1406 | } | 1406 | } |
| 1407 | 1407 | ||
| 1408 | pub fn stnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { | 1408 | pub fn stnp(rt1: Register, rt2: Register, rn: Register, offset: i9) Instruction { |
src/arch/arm/CodeGen.zig+2-2| ... | @@ -937,7 +937,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live | ... | @@ -937,7 +937,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live |
| 937 | const dies = @truncate(u1, tomb_bits) != 0; | 937 | const dies = @truncate(u1, tomb_bits) != 0; |
| 938 | tomb_bits >>= 1; | 938 | tomb_bits >>= 1; |
| 939 | if (!dies) continue; | 939 | if (!dies) continue; |
| 940 | const op_int = @enumToInt(op); | 940 | const op_int = @intFromEnum(op); |
| 941 | if (op_int < Air.ref_start_index) continue; | 941 | if (op_int < Air.ref_start_index) continue; |
| 942 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 942 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 943 | self.processDeath(op_index); | 943 | self.processDeath(op_index); |
| ... | @@ -4649,7 +4649,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -4649,7 +4649,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 4649 | // that death now instead of later as this has an effect on | 4649 | // that death now instead of later as this has an effect on |
| 4650 | // whether it needs to be spilled in the branches | 4650 | // whether it needs to be spilled in the branches |
| 4651 | if (self.liveness.operandDies(inst, 0)) { | 4651 | if (self.liveness.operandDies(inst, 0)) { |
| 4652 | const op_int = @enumToInt(pl_op.operand); | 4652 | const op_int = @intFromEnum(pl_op.operand); |
| 4653 | if (op_int >= Air.ref_start_index) { | 4653 | if (op_int >= Air.ref_start_index) { |
| 4654 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 4654 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 4655 | self.processDeath(op_index); | 4655 | self.processDeath(op_index); |
src/arch/arm/bits.zig+26-26| ... | @@ -159,7 +159,7 @@ pub const Register = enum(u5) { | ... | @@ -159,7 +159,7 @@ pub const Register = enum(u5) { |
| 159 | /// Returns the unique 4-bit ID of this register which is used in | 159 | /// Returns the unique 4-bit ID of this register which is used in |
| 160 | /// the machine code | 160 | /// the machine code |
| 161 | pub fn id(self: Register) u4 { | 161 | pub fn id(self: Register) u4 { |
| 162 | return @truncate(u4, @enumToInt(self)); | 162 | return @truncate(u4, @intFromEnum(self)); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | pub fn dwarfLocOp(self: Register) u8 { | 165 | pub fn dwarfLocOp(self: Register) u8 { |
| ... | @@ -408,7 +408,7 @@ pub const Instruction = union(enum) { | ... | @@ -408,7 +408,7 @@ pub const Instruction = union(enum) { |
| 408 | return Shift{ | 408 | return Shift{ |
| 409 | .register = .{ | 409 | .register = .{ |
| 410 | .rs = rs.id(), | 410 | .rs = rs.id(), |
| 411 | .typ = @enumToInt(typ), | 411 | .typ = @intFromEnum(typ), |
| 412 | }, | 412 | }, |
| 413 | }; | 413 | }; |
| 414 | } | 414 | } |
| ... | @@ -417,7 +417,7 @@ pub const Instruction = union(enum) { | ... | @@ -417,7 +417,7 @@ pub const Instruction = union(enum) { |
| 417 | return Shift{ | 417 | return Shift{ |
| 418 | .immediate = .{ | 418 | .immediate = .{ |
| 419 | .amount = amount, | 419 | .amount = amount, |
| 420 | .typ = @enumToInt(typ), | 420 | .typ = @intFromEnum(typ), |
| 421 | }, | 421 | }, |
| 422 | }; | 422 | }; |
| 423 | } | 423 | } |
| ... | @@ -633,9 +633,9 @@ pub const Instruction = union(enum) { | ... | @@ -633,9 +633,9 @@ pub const Instruction = union(enum) { |
| 633 | ) Instruction { | 633 | ) Instruction { |
| 634 | return Instruction{ | 634 | return Instruction{ |
| 635 | .data_processing = .{ | 635 | .data_processing = .{ |
| 636 | .cond = @enumToInt(cond), | 636 | .cond = @intFromEnum(cond), |
| 637 | .i = @boolToInt(op2 == .immediate), | 637 | .i = @intFromBool(op2 == .immediate), |
| 638 | .opcode = @enumToInt(opcode), | 638 | .opcode = @intFromEnum(opcode), |
| 639 | .s = s, | 639 | .s = s, |
| 640 | .rn = rn.id(), | 640 | .rn = rn.id(), |
| 641 | .rd = rd.id(), | 641 | .rd = rd.id(), |
| ... | @@ -652,7 +652,7 @@ pub const Instruction = union(enum) { | ... | @@ -652,7 +652,7 @@ pub const Instruction = union(enum) { |
| 652 | ) Instruction { | 652 | ) Instruction { |
| 653 | return Instruction{ | 653 | return Instruction{ |
| 654 | .data_processing = .{ | 654 | .data_processing = .{ |
| 655 | .cond = @enumToInt(cond), | 655 | .cond = @intFromEnum(cond), |
| 656 | .i = 1, | 656 | .i = 1, |
| 657 | .opcode = if (top) 0b1010 else 0b1000, | 657 | .opcode = if (top) 0b1010 else 0b1000, |
| 658 | .s = 0, | 658 | .s = 0, |
| ... | @@ -673,8 +673,8 @@ pub const Instruction = union(enum) { | ... | @@ -673,8 +673,8 @@ pub const Instruction = union(enum) { |
| 673 | ) Instruction { | 673 | ) Instruction { |
| 674 | return Instruction{ | 674 | return Instruction{ |
| 675 | .multiply = .{ | 675 | .multiply = .{ |
| 676 | .cond = @enumToInt(cond), | 676 | .cond = @intFromEnum(cond), |
| 677 | .accumulate = @boolToInt(ra != null), | 677 | .accumulate = @intFromBool(ra != null), |
| 678 | .set_cond = set_cond, | 678 | .set_cond = set_cond, |
| 679 | .rd = rd.id(), | 679 | .rd = rd.id(), |
| 680 | .rn = rn.id(), | 680 | .rn = rn.id(), |
| ... | @@ -696,7 +696,7 @@ pub const Instruction = union(enum) { | ... | @@ -696,7 +696,7 @@ pub const Instruction = union(enum) { |
| 696 | ) Instruction { | 696 | ) Instruction { |
| 697 | return Instruction{ | 697 | return Instruction{ |
| 698 | .multiply_long = .{ | 698 | .multiply_long = .{ |
| 699 | .cond = @enumToInt(cond), | 699 | .cond = @intFromEnum(cond), |
| 700 | .unsigned = signed, | 700 | .unsigned = signed, |
| 701 | .accumulate = accumulate, | 701 | .accumulate = accumulate, |
| 702 | .set_cond = set_cond, | 702 | .set_cond = set_cond, |
| ... | @@ -723,7 +723,7 @@ pub const Instruction = union(enum) { | ... | @@ -723,7 +723,7 @@ pub const Instruction = union(enum) { |
| 723 | .m = m, | 723 | .m = m, |
| 724 | .rm = rm.id(), | 724 | .rm = rm.id(), |
| 725 | .rd = rd.id(), | 725 | .rd = rd.id(), |
| 726 | .cond = @enumToInt(cond), | 726 | .cond = @intFromEnum(cond), |
| 727 | }, | 727 | }, |
| 728 | }; | 728 | }; |
| 729 | } | 729 | } |
| ... | @@ -741,7 +741,7 @@ pub const Instruction = union(enum) { | ... | @@ -741,7 +741,7 @@ pub const Instruction = union(enum) { |
| 741 | .rd = rd.id(), | 741 | .rd = rd.id(), |
| 742 | .rn = rn.id(), | 742 | .rn = rn.id(), |
| 743 | .opc = opc, | 743 | .opc = opc, |
| 744 | .cond = @enumToInt(cond), | 744 | .cond = @intFromEnum(cond), |
| 745 | }, | 745 | }, |
| 746 | }; | 746 | }; |
| 747 | } | 747 | } |
| ... | @@ -762,7 +762,7 @@ pub const Instruction = union(enum) { | ... | @@ -762,7 +762,7 @@ pub const Instruction = union(enum) { |
| 762 | .rd = rd.id(), | 762 | .rd = rd.id(), |
| 763 | .widthm1 = @intCast(u5, width - 1), | 763 | .widthm1 = @intCast(u5, width - 1), |
| 764 | .unsigned = unsigned, | 764 | .unsigned = unsigned, |
| 765 | .cond = @enumToInt(cond), | 765 | .cond = @intFromEnum(cond), |
| 766 | }, | 766 | }, |
| 767 | }; | 767 | }; |
| 768 | } | 768 | } |
| ... | @@ -779,7 +779,7 @@ pub const Instruction = union(enum) { | ... | @@ -779,7 +779,7 @@ pub const Instruction = union(enum) { |
| 779 | ) Instruction { | 779 | ) Instruction { |
| 780 | return Instruction{ | 780 | return Instruction{ |
| 781 | .single_data_transfer = .{ | 781 | .single_data_transfer = .{ |
| 782 | .cond = @enumToInt(cond), | 782 | .cond = @intFromEnum(cond), |
| 783 | .rn = rn.id(), | 783 | .rn = rn.id(), |
| 784 | .rd = rd.id(), | 784 | .rd = rd.id(), |
| 785 | .offset = offset.toU12(), | 785 | .offset = offset.toU12(), |
| ... | @@ -789,12 +789,12 @@ pub const Instruction = union(enum) { | ... | @@ -789,12 +789,12 @@ pub const Instruction = union(enum) { |
| 789 | .pre_index, .post_index => 0b1, | 789 | .pre_index, .post_index => 0b1, |
| 790 | }, | 790 | }, |
| 791 | .byte_word = byte_word, | 791 | .byte_word = byte_word, |
| 792 | .up_down = @boolToInt(positive), | 792 | .up_down = @intFromBool(positive), |
| 793 | .pre_post = switch (mode) { | 793 | .pre_post = switch (mode) { |
| 794 | .offset, .pre_index => 0b1, | 794 | .offset, .pre_index => 0b1, |
| 795 | .post_index => 0b0, | 795 | .post_index => 0b0, |
| 796 | }, | 796 | }, |
| 797 | .imm = @boolToInt(offset != .immediate), | 797 | .imm = @intFromBool(offset != .immediate), |
| 798 | }, | 798 | }, |
| 799 | }; | 799 | }; |
| 800 | } | 800 | } |
| ... | @@ -830,13 +830,13 @@ pub const Instruction = union(enum) { | ... | @@ -830,13 +830,13 @@ pub const Instruction = union(enum) { |
| 830 | .offset => 0b0, | 830 | .offset => 0b0, |
| 831 | .pre_index, .post_index => 0b1, | 831 | .pre_index, .post_index => 0b1, |
| 832 | }, | 832 | }, |
| 833 | .imm = @boolToInt(offset == .immediate), | 833 | .imm = @intFromBool(offset == .immediate), |
| 834 | .up_down = @boolToInt(positive), | 834 | .up_down = @intFromBool(positive), |
| 835 | .pre_index = switch (mode) { | 835 | .pre_index = switch (mode) { |
| 836 | .offset, .pre_index => 0b1, | 836 | .offset, .pre_index => 0b1, |
| 837 | .post_index => 0b0, | 837 | .post_index => 0b0, |
| 838 | }, | 838 | }, |
| 839 | .cond = @enumToInt(cond), | 839 | .cond = @intFromEnum(cond), |
| 840 | }, | 840 | }, |
| 841 | }; | 841 | }; |
| 842 | } | 842 | } |
| ... | @@ -856,11 +856,11 @@ pub const Instruction = union(enum) { | ... | @@ -856,11 +856,11 @@ pub const Instruction = union(enum) { |
| 856 | .register_list = @bitCast(u16, reg_list), | 856 | .register_list = @bitCast(u16, reg_list), |
| 857 | .rn = rn.id(), | 857 | .rn = rn.id(), |
| 858 | .load_store = load_store, | 858 | .load_store = load_store, |
| 859 | .write_back = @boolToInt(write_back), | 859 | .write_back = @intFromBool(write_back), |
| 860 | .psr_or_user = psr_or_user, | 860 | .psr_or_user = psr_or_user, |
| 861 | .up_down = up_down, | 861 | .up_down = up_down, |
| 862 | .pre_post = pre_post, | 862 | .pre_post = pre_post, |
| 863 | .cond = @enumToInt(cond), | 863 | .cond = @intFromEnum(cond), |
| 864 | }, | 864 | }, |
| 865 | }; | 865 | }; |
| 866 | } | 866 | } |
| ... | @@ -868,7 +868,7 @@ pub const Instruction = union(enum) { | ... | @@ -868,7 +868,7 @@ pub const Instruction = union(enum) { |
| 868 | fn branch(cond: Condition, offset: i26, link: u1) Instruction { | 868 | fn branch(cond: Condition, offset: i26, link: u1) Instruction { |
| 869 | return Instruction{ | 869 | return Instruction{ |
| 870 | .branch = .{ | 870 | .branch = .{ |
| 871 | .cond = @enumToInt(cond), | 871 | .cond = @intFromEnum(cond), |
| 872 | .link = link, | 872 | .link = link, |
| 873 | .offset = @bitCast(u24, @intCast(i24, offset >> 2)), | 873 | .offset = @bitCast(u24, @intCast(i24, offset >> 2)), |
| 874 | }, | 874 | }, |
| ... | @@ -878,7 +878,7 @@ pub const Instruction = union(enum) { | ... | @@ -878,7 +878,7 @@ pub const Instruction = union(enum) { |
| 878 | fn branchExchange(cond: Condition, rn: Register, link: u1) Instruction { | 878 | fn branchExchange(cond: Condition, rn: Register, link: u1) Instruction { |
| 879 | return Instruction{ | 879 | return Instruction{ |
| 880 | .branch_exchange = .{ | 880 | .branch_exchange = .{ |
| 881 | .cond = @enumToInt(cond), | 881 | .cond = @intFromEnum(cond), |
| 882 | .link = link, | 882 | .link = link, |
| 883 | .rn = rn.id(), | 883 | .rn = rn.id(), |
| 884 | }, | 884 | }, |
| ... | @@ -888,7 +888,7 @@ pub const Instruction = union(enum) { | ... | @@ -888,7 +888,7 @@ pub const Instruction = union(enum) { |
| 888 | fn supervisorCall(cond: Condition, comment: u24) Instruction { | 888 | fn supervisorCall(cond: Condition, comment: u24) Instruction { |
| 889 | return Instruction{ | 889 | return Instruction{ |
| 890 | .supervisor_call = .{ | 890 | .supervisor_call = .{ |
| 891 | .cond = @enumToInt(cond), | 891 | .cond = @intFromEnum(cond), |
| 892 | .comment = comment, | 892 | .comment = comment, |
| 893 | }, | 893 | }, |
| 894 | }; | 894 | }; |
| ... | @@ -1060,7 +1060,7 @@ pub const Instruction = union(enum) { | ... | @@ -1060,7 +1060,7 @@ pub const Instruction = union(enum) { |
| 1060 | pub fn mrs(cond: Condition, rd: Register, psr: Psr) Instruction { | 1060 | pub fn mrs(cond: Condition, rd: Register, psr: Psr) Instruction { |
| 1061 | return Instruction{ | 1061 | return Instruction{ |
| 1062 | .data_processing = .{ | 1062 | .data_processing = .{ |
| 1063 | .cond = @enumToInt(cond), | 1063 | .cond = @intFromEnum(cond), |
| 1064 | .i = 0, | 1064 | .i = 0, |
| 1065 | .opcode = if (psr == .spsr) 0b1010 else 0b1000, | 1065 | .opcode = if (psr == .spsr) 0b1010 else 0b1000, |
| 1066 | .s = 0, | 1066 | .s = 0, |
| ... | @@ -1074,7 +1074,7 @@ pub const Instruction = union(enum) { | ... | @@ -1074,7 +1074,7 @@ pub const Instruction = union(enum) { |
| 1074 | pub fn msr(cond: Condition, psr: Psr, op: Operand) Instruction { | 1074 | pub fn msr(cond: Condition, psr: Psr, op: Operand) Instruction { |
| 1075 | return Instruction{ | 1075 | return Instruction{ |
| 1076 | .data_processing = .{ | 1076 | .data_processing = .{ |
| 1077 | .cond = @enumToInt(cond), | 1077 | .cond = @intFromEnum(cond), |
| 1078 | .i = 0, | 1078 | .i = 0, |
| 1079 | .opcode = if (psr == .spsr) 0b1011 else 0b1001, | 1079 | .opcode = if (psr == .spsr) 0b1011 else 0b1001, |
| 1080 | .s = 0, | 1080 | .s = 0, |
src/arch/riscv64/CodeGen.zig+1-1| ... | @@ -755,7 +755,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live | ... | @@ -755,7 +755,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live |
| 755 | const dies = @truncate(u1, tomb_bits) != 0; | 755 | const dies = @truncate(u1, tomb_bits) != 0; |
| 756 | tomb_bits >>= 1; | 756 | tomb_bits >>= 1; |
| 757 | if (!dies) continue; | 757 | if (!dies) continue; |
| 758 | const op_int = @enumToInt(op); | 758 | const op_int = @intFromEnum(op); |
| 759 | if (op_int < Air.ref_start_index) continue; | 759 | if (op_int < Air.ref_start_index) continue; |
| 760 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 760 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 761 | self.processDeath(op_index); | 761 | self.processDeath(op_index); |
src/arch/riscv64/bits.zig+1-1| ... | @@ -407,7 +407,7 @@ pub const Register = enum(u6) { | ... | @@ -407,7 +407,7 @@ pub const Register = enum(u6) { |
| 407 | /// Returns the unique 4-bit ID of this register which is used in | 407 | /// Returns the unique 4-bit ID of this register which is used in |
| 408 | /// the machine code | 408 | /// the machine code |
| 409 | pub fn id(self: Register) u5 { | 409 | pub fn id(self: Register) u5 { |
| 410 | return @truncate(u5, @enumToInt(self)); | 410 | return @truncate(u5, @intFromEnum(self)); |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | pub fn dwarfLocOp(reg: Register) u8 { | 413 | pub fn dwarfLocOp(reg: Register) u8 { |
src/arch/sparc64/CodeGen.zig+2-2| ... | @@ -1513,7 +1513,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1513,7 +1513,7 @@ fn airCondBr(self: *Self, inst: Air.Inst.Index) !void { |
| 1513 | // that death now instead of later as this has an effect on | 1513 | // that death now instead of later as this has an effect on |
| 1514 | // whether it needs to be spilled in the branches | 1514 | // whether it needs to be spilled in the branches |
| 1515 | if (self.liveness.operandDies(inst, 0)) { | 1515 | if (self.liveness.operandDies(inst, 0)) { |
| 1516 | const op_int = @enumToInt(pl_op.operand); | 1516 | const op_int = @intFromEnum(pl_op.operand); |
| 1517 | if (op_int >= Air.ref_start_index) { | 1517 | if (op_int >= Air.ref_start_index) { |
| 1518 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 1518 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 1519 | self.processDeath(op_index); | 1519 | self.processDeath(op_index); |
| ... | @@ -3568,7 +3568,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live | ... | @@ -3568,7 +3568,7 @@ fn finishAir(self: *Self, inst: Air.Inst.Index, result: MCValue, operands: [Live |
| 3568 | const dies = @truncate(u1, tomb_bits) != 0; | 3568 | const dies = @truncate(u1, tomb_bits) != 0; |
| 3569 | tomb_bits >>= 1; | 3569 | tomb_bits >>= 1; |
| 3570 | if (!dies) continue; | 3570 | if (!dies) continue; |
| 3571 | const op_int = @enumToInt(op); | 3571 | const op_int = @intFromEnum(op); |
| 3572 | if (op_int < Air.ref_start_index) continue; | 3572 | if (op_int < Air.ref_start_index) continue; |
| 3573 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); | 3573 | const op_index = @intCast(Air.Inst.Index, op_int - Air.ref_start_index); |
| 3574 | self.processDeath(op_index); | 3574 | self.processDeath(op_index); |
src/arch/sparc64/bits.zig+36-36| ... | @@ -16,7 +16,7 @@ pub const Register = enum(u6) { | ... | @@ -16,7 +16,7 @@ pub const Register = enum(u6) { |
| 16 | // zig fmt: on | 16 | // zig fmt: on |
| 17 | 17 | ||
| 18 | pub fn id(self: Register) u5 { | 18 | pub fn id(self: Register) u5 { |
| 19 | return @truncate(u5, @enumToInt(self)); | 19 | return @truncate(u5, @intFromEnum(self)); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | pub fn enc(self: Register) u5 { | 22 | pub fn enc(self: Register) u5 { |
| ... | @@ -96,9 +96,9 @@ pub const FloatingPointRegister = enum(u7) { | ... | @@ -96,9 +96,9 @@ pub const FloatingPointRegister = enum(u7) { |
| 96 | 96 | ||
| 97 | pub fn id(self: FloatingPointRegister) u6 { | 97 | pub fn id(self: FloatingPointRegister) u6 { |
| 98 | return switch (self.size()) { | 98 | return switch (self.size()) { |
| 99 | 32 => @truncate(u6, @enumToInt(self)), | 99 | 32 => @truncate(u6, @intFromEnum(self)), |
| 100 | 64 => @truncate(u6, (@enumToInt(self) - 32) * 2), | 100 | 64 => @truncate(u6, (@intFromEnum(self) - 32) * 2), |
| 101 | 128 => @truncate(u6, (@enumToInt(self) - 64) * 4), | 101 | 128 => @truncate(u6, (@intFromEnum(self) - 64) * 4), |
| 102 | else => unreachable, | 102 | else => unreachable, |
| 103 | }; | 103 | }; |
| 104 | } | 104 | } |
| ... | @@ -114,7 +114,7 @@ pub const FloatingPointRegister = enum(u7) { | ... | @@ -114,7 +114,7 @@ pub const FloatingPointRegister = enum(u7) { |
| 114 | 114 | ||
| 115 | /// Returns the bit-width of the register. | 115 | /// Returns the bit-width of the register. |
| 116 | pub fn size(self: FloatingPointRegister) u8 { | 116 | pub fn size(self: FloatingPointRegister) u8 { |
| 117 | return switch (@enumToInt(self)) { | 117 | return switch (@intFromEnum(self)) { |
| 118 | 0...31 => 32, | 118 | 0...31 => 32, |
| 119 | 32...63 => 64, | 119 | 32...63 => 64, |
| 120 | 64...79 => 128, | 120 | 64...79 => 128, |
| ... | @@ -696,8 +696,8 @@ pub const Instruction = union(enum) { | ... | @@ -696,8 +696,8 @@ pub const Instruction = union(enum) { |
| 696 | /// Encodes the condition into the instruction bit pattern. | 696 | /// Encodes the condition into the instruction bit pattern. |
| 697 | pub fn enc(cond: Condition) u4 { | 697 | pub fn enc(cond: Condition) u4 { |
| 698 | return switch (cond) { | 698 | return switch (cond) { |
| 699 | .icond => |c| @enumToInt(c), | 699 | .icond => |c| @intFromEnum(c), |
| 700 | .fcond => |c| @enumToInt(c), | 700 | .fcond => |c| @intFromEnum(c), |
| 701 | }; | 701 | }; |
| 702 | } | 702 | } |
| 703 | 703 | ||
| ... | @@ -786,7 +786,7 @@ pub const Instruction = union(enum) { | ... | @@ -786,7 +786,7 @@ pub const Instruction = union(enum) { |
| 786 | const udisp_truncated = @truncate(u22, udisp >> 2); | 786 | const udisp_truncated = @truncate(u22, udisp >> 2); |
| 787 | return Instruction{ | 787 | return Instruction{ |
| 788 | .format_2b = .{ | 788 | .format_2b = .{ |
| 789 | .a = @boolToInt(annul), | 789 | .a = @intFromBool(annul), |
| 790 | .cond = cond.enc(), | 790 | .cond = cond.enc(), |
| 791 | .op2 = op2, | 791 | .op2 = op2, |
| 792 | .disp22 = udisp_truncated, | 792 | .disp22 = udisp_truncated, |
| ... | @@ -803,16 +803,16 @@ pub const Instruction = union(enum) { | ... | @@ -803,16 +803,16 @@ pub const Instruction = union(enum) { |
| 803 | // Discard the last two bits since those are implicitly zero. | 803 | // Discard the last two bits since those are implicitly zero. |
| 804 | const udisp_truncated = @truncate(u19, udisp >> 2); | 804 | const udisp_truncated = @truncate(u19, udisp >> 2); |
| 805 | 805 | ||
| 806 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 806 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 807 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 807 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 808 | return Instruction{ | 808 | return Instruction{ |
| 809 | .format_2c = .{ | 809 | .format_2c = .{ |
| 810 | .a = @boolToInt(annul), | 810 | .a = @intFromBool(annul), |
| 811 | .cond = cond.enc(), | 811 | .cond = cond.enc(), |
| 812 | .op2 = op2, | 812 | .op2 = op2, |
| 813 | .cc1 = ccr_cc1, | 813 | .cc1 = ccr_cc1, |
| 814 | .cc0 = ccr_cc0, | 814 | .cc0 = ccr_cc0, |
| 815 | .p = @boolToInt(pt), | 815 | .p = @intFromBool(pt), |
| 816 | .disp19 = udisp_truncated, | 816 | .disp19 = udisp_truncated, |
| 817 | }, | 817 | }, |
| 818 | }; | 818 | }; |
| ... | @@ -831,10 +831,10 @@ pub const Instruction = union(enum) { | ... | @@ -831,10 +831,10 @@ pub const Instruction = union(enum) { |
| 831 | const udisp_lo = @truncate(u14, udisp_truncated & 0b0011_1111_1111_1111); | 831 | const udisp_lo = @truncate(u14, udisp_truncated & 0b0011_1111_1111_1111); |
| 832 | return Instruction{ | 832 | return Instruction{ |
| 833 | .format_2d = .{ | 833 | .format_2d = .{ |
| 834 | .a = @boolToInt(annul), | 834 | .a = @intFromBool(annul), |
| 835 | .rcond = @enumToInt(rcond), | 835 | .rcond = @intFromEnum(rcond), |
| 836 | .op2 = op2, | 836 | .op2 = op2, |
| 837 | .p = @boolToInt(pt), | 837 | .p = @intFromBool(pt), |
| 838 | .rs1 = rs1.enc(), | 838 | .rs1 = rs1.enc(), |
| 839 | .d16hi = udisp_hi, | 839 | .d16hi = udisp_hi, |
| 840 | .d16lo = udisp_lo, | 840 | .d16lo = udisp_lo, |
| ... | @@ -891,7 +891,7 @@ pub const Instruction = union(enum) { | ... | @@ -891,7 +891,7 @@ pub const Instruction = union(enum) { |
| 891 | .rd = rd.enc(), | 891 | .rd = rd.enc(), |
| 892 | .op3 = op3, | 892 | .op3 = op3, |
| 893 | .rs1 = rs1.enc(), | 893 | .rs1 = rs1.enc(), |
| 894 | .rcond = @enumToInt(rcond), | 894 | .rcond = @intFromEnum(rcond), |
| 895 | .rs2 = rs2.enc(), | 895 | .rs2 = rs2.enc(), |
| 896 | }, | 896 | }, |
| 897 | }; | 897 | }; |
| ... | @@ -903,7 +903,7 @@ pub const Instruction = union(enum) { | ... | @@ -903,7 +903,7 @@ pub const Instruction = union(enum) { |
| 903 | .rd = rd.enc(), | 903 | .rd = rd.enc(), |
| 904 | .op3 = op3, | 904 | .op3 = op3, |
| 905 | .rs1 = rs1.enc(), | 905 | .rs1 = rs1.enc(), |
| 906 | .rcond = @enumToInt(rcond), | 906 | .rcond = @intFromEnum(rcond), |
| 907 | .simm10 = @bitCast(u10, imm), | 907 | .simm10 = @bitCast(u10, imm), |
| 908 | }, | 908 | }, |
| 909 | }; | 909 | }; |
| ... | @@ -934,7 +934,7 @@ pub const Instruction = union(enum) { | ... | @@ -934,7 +934,7 @@ pub const Instruction = union(enum) { |
| 934 | .rd = rd.enc(), | 934 | .rd = rd.enc(), |
| 935 | .op3 = op3, | 935 | .op3 = op3, |
| 936 | .rs1 = rs1.enc(), | 936 | .rs1 = rs1.enc(), |
| 937 | .imm_asi = @enumToInt(asi), | 937 | .imm_asi = @intFromEnum(asi), |
| 938 | .rs2 = rs2.enc(), | 938 | .rs2 = rs2.enc(), |
| 939 | }, | 939 | }, |
| 940 | }; | 940 | }; |
| ... | @@ -956,7 +956,7 @@ pub const Instruction = union(enum) { | ... | @@ -956,7 +956,7 @@ pub const Instruction = union(enum) { |
| 956 | .rd = rd.enc(), | 956 | .rd = rd.enc(), |
| 957 | .op3 = op3, | 957 | .op3 = op3, |
| 958 | .rs1 = rs1.enc(), | 958 | .rs1 = rs1.enc(), |
| 959 | .x = @enumToInt(sw), | 959 | .x = @intFromEnum(sw), |
| 960 | .rs2 = rs2.enc(), | 960 | .rs2 = rs2.enc(), |
| 961 | }, | 961 | }, |
| 962 | }; | 962 | }; |
| ... | @@ -995,8 +995,8 @@ pub const Instruction = union(enum) { | ... | @@ -995,8 +995,8 @@ pub const Instruction = union(enum) { |
| 995 | }; | 995 | }; |
| 996 | } | 996 | } |
| 997 | fn format3o(op: u2, op3: u6, opf: u9, ccr: CCR, rs1: Register, rs2: Register) Instruction { | 997 | fn format3o(op: u2, op3: u6, opf: u9, ccr: CCR, rs1: Register, rs2: Register) Instruction { |
| 998 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 998 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 999 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 999 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1000 | return Instruction{ | 1000 | return Instruction{ |
| 1001 | .format_3o = .{ | 1001 | .format_3o = .{ |
| 1002 | .op = op, | 1002 | .op = op, |
| ... | @@ -1051,8 +1051,8 @@ pub const Instruction = union(enum) { | ... | @@ -1051,8 +1051,8 @@ pub const Instruction = union(enum) { |
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | fn format4a(op3: u6, ccr: CCR, rs1: Register, rs2: Register, rd: Register) Instruction { | 1053 | fn format4a(op3: u6, ccr: CCR, rs1: Register, rs2: Register, rd: Register) Instruction { |
| 1054 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 1054 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 1055 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 1055 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1056 | return Instruction{ | 1056 | return Instruction{ |
| 1057 | .format_4a = .{ | 1057 | .format_4a = .{ |
| 1058 | .rd = rd.enc(), | 1058 | .rd = rd.enc(), |
| ... | @@ -1066,8 +1066,8 @@ pub const Instruction = union(enum) { | ... | @@ -1066,8 +1066,8 @@ pub const Instruction = union(enum) { |
| 1066 | } | 1066 | } |
| 1067 | 1067 | ||
| 1068 | fn format4b(op3: u6, ccr: CCR, rs1: Register, imm: i11, rd: Register) Instruction { | 1068 | fn format4b(op3: u6, ccr: CCR, rs1: Register, imm: i11, rd: Register) Instruction { |
| 1069 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 1069 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 1070 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 1070 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1071 | return Instruction{ | 1071 | return Instruction{ |
| 1072 | .format_4b = .{ | 1072 | .format_4b = .{ |
| 1073 | .rd = rd.enc(), | 1073 | .rd = rd.enc(), |
| ... | @@ -1081,9 +1081,9 @@ pub const Instruction = union(enum) { | ... | @@ -1081,9 +1081,9 @@ pub const Instruction = union(enum) { |
| 1081 | } | 1081 | } |
| 1082 | 1082 | ||
| 1083 | fn format4c(op3: u6, cond: Condition, ccr: CCR, rs2: Register, rd: Register) Instruction { | 1083 | fn format4c(op3: u6, cond: Condition, ccr: CCR, rs2: Register, rd: Register) Instruction { |
| 1084 | const ccr_cc2 = @truncate(u1, @enumToInt(ccr) >> 2); | 1084 | const ccr_cc2 = @truncate(u1, @intFromEnum(ccr) >> 2); |
| 1085 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 1085 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 1086 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 1086 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1087 | return Instruction{ | 1087 | return Instruction{ |
| 1088 | .format_4c = .{ | 1088 | .format_4c = .{ |
| 1089 | .rd = rd.enc(), | 1089 | .rd = rd.enc(), |
| ... | @@ -1098,9 +1098,9 @@ pub const Instruction = union(enum) { | ... | @@ -1098,9 +1098,9 @@ pub const Instruction = union(enum) { |
| 1098 | } | 1098 | } |
| 1099 | 1099 | ||
| 1100 | fn format4d(op3: u6, cond: Condition, ccr: CCR, imm: i11, rd: Register) Instruction { | 1100 | fn format4d(op3: u6, cond: Condition, ccr: CCR, imm: i11, rd: Register) Instruction { |
| 1101 | const ccr_cc2 = @truncate(u1, @enumToInt(ccr) >> 2); | 1101 | const ccr_cc2 = @truncate(u1, @intFromEnum(ccr) >> 2); |
| 1102 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 1102 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 1103 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 1103 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1104 | return Instruction{ | 1104 | return Instruction{ |
| 1105 | .format_4d = .{ | 1105 | .format_4d = .{ |
| 1106 | .rd = rd.enc(), | 1106 | .rd = rd.enc(), |
| ... | @@ -1115,8 +1115,8 @@ pub const Instruction = union(enum) { | ... | @@ -1115,8 +1115,8 @@ pub const Instruction = union(enum) { |
| 1115 | } | 1115 | } |
| 1116 | 1116 | ||
| 1117 | fn format4e(op3: u6, ccr: CCR, rs1: Register, rd: Register, sw_trap: u7) Instruction { | 1117 | fn format4e(op3: u6, ccr: CCR, rs1: Register, rd: Register, sw_trap: u7) Instruction { |
| 1118 | const ccr_cc1 = @truncate(u1, @enumToInt(ccr) >> 1); | 1118 | const ccr_cc1 = @truncate(u1, @intFromEnum(ccr) >> 1); |
| 1119 | const ccr_cc0 = @truncate(u1, @enumToInt(ccr)); | 1119 | const ccr_cc0 = @truncate(u1, @intFromEnum(ccr)); |
| 1120 | return Instruction{ | 1120 | return Instruction{ |
| 1121 | .format_4e = .{ | 1121 | .format_4e = .{ |
| 1122 | .rd = rd.enc(), | 1122 | .rd = rd.enc(), |
| ... | @@ -1142,7 +1142,7 @@ pub const Instruction = union(enum) { | ... | @@ -1142,7 +1142,7 @@ pub const Instruction = union(enum) { |
| 1142 | .rd = rd.enc(), | 1142 | .rd = rd.enc(), |
| 1143 | .op3 = op3, | 1143 | .op3 = op3, |
| 1144 | .rs1 = rs1.enc(), | 1144 | .rs1 = rs1.enc(), |
| 1145 | .rcond = @enumToInt(rcond), | 1145 | .rcond = @intFromEnum(rcond), |
| 1146 | .opf_low = opf_low, | 1146 | .opf_low = opf_low, |
| 1147 | .rs2 = rs2.enc(), | 1147 | .rs2 = rs2.enc(), |
| 1148 | }, | 1148 | }, |
| ... | @@ -1468,8 +1468,8 @@ pub const Instruction = union(enum) { | ... | @@ -1468,8 +1468,8 @@ pub const Instruction = union(enum) { |
| 1468 | pub fn trap(comptime s2: type, cond: ICondition, ccr: CCR, rs1: Register, rs2: s2) Instruction { | 1468 | pub fn trap(comptime s2: type, cond: ICondition, ccr: CCR, rs1: Register, rs2: s2) Instruction { |
| 1469 | // Tcc instructions abuse the rd field to store the conditionals. | 1469 | // Tcc instructions abuse the rd field to store the conditionals. |
| 1470 | return switch (s2) { | 1470 | return switch (s2) { |
| 1471 | Register => format4a(0b11_1010, ccr, rs1, rs2, @intToEnum(Register, @enumToInt(cond))), | 1471 | Register => format4a(0b11_1010, ccr, rs1, rs2, @enumFromInt(Register, @intFromEnum(cond))), |
| 1472 | u7 => format4e(0b11_1010, ccr, rs1, @intToEnum(Register, @enumToInt(cond)), rs2), | 1472 | u7 => format4e(0b11_1010, ccr, rs1, @enumFromInt(Register, @intFromEnum(cond)), rs2), |
| 1473 | else => unreachable, | 1473 | else => unreachable, |
| 1474 | }; | 1474 | }; |
| 1475 | } | 1475 | } |
src/arch/wasm/CodeGen.zig+9-9| ... | @@ -116,11 +116,11 @@ const WValue = union(enum) { | ... | @@ -116,11 +116,11 @@ const WValue = union(enum) { |
| 116 | fn free(value: *WValue, gen: *CodeGen) void { | 116 | fn free(value: *WValue, gen: *CodeGen) void { |
| 117 | if (value.* != .local) return; | 117 | if (value.* != .local) return; |
| 118 | const local_value = value.local.value; | 118 | const local_value = value.local.value; |
| 119 | const reserved = gen.args.len + @boolToInt(gen.return_value != .none); | 119 | const reserved = gen.args.len + @intFromBool(gen.return_value != .none); |
| 120 | if (local_value < reserved + 2) return; // reserved locals may never be re-used. Also accounts for 2 stack locals. | 120 | if (local_value < reserved + 2) return; // reserved locals may never be re-used. Also accounts for 2 stack locals. |
| 121 | 121 | ||
| 122 | const index = local_value - reserved; | 122 | const index = local_value - reserved; |
| 123 | const valtype = @intToEnum(wasm.Valtype, gen.locals.items[index]); | 123 | const valtype = @enumFromInt(wasm.Valtype, gen.locals.items[index]); |
| 124 | switch (valtype) { | 124 | switch (valtype) { |
| 125 | .i32 => gen.free_locals_i32.append(gen.gpa, local_value) catch return, // It's ok to fail any of those, a new local can be allocated instead | 125 | .i32 => gen.free_locals_i32.append(gen.gpa, local_value) catch return, // It's ok to fail any of those, a new local can be allocated instead |
| 126 | .i64 => gen.free_locals_i64.append(gen.gpa, local_value) catch return, | 126 | .i64 => gen.free_locals_i64.append(gen.gpa, local_value) catch return, |
| ... | @@ -889,7 +889,7 @@ fn processDeath(func: *CodeGen, ref: Air.Inst.Ref) void { | ... | @@ -889,7 +889,7 @@ fn processDeath(func: *CodeGen, ref: Air.Inst.Ref) void { |
| 889 | // TODO: Upon branch consolidation free any locals if needed. | 889 | // TODO: Upon branch consolidation free any locals if needed. |
| 890 | const value = func.currentBranch().values.getPtr(ref) orelse return; | 890 | const value = func.currentBranch().values.getPtr(ref) orelse return; |
| 891 | if (value.* != .local) return; | 891 | if (value.* != .local) return; |
| 892 | const reserved_indexes = func.args.len + @boolToInt(func.return_value != .none); | 892 | const reserved_indexes = func.args.len + @intFromBool(func.return_value != .none); |
| 893 | if (value.local.value < reserved_indexes) { | 893 | if (value.local.value < reserved_indexes) { |
| 894 | return; // function arguments can never be re-used | 894 | return; // function arguments can never be re-used |
| 895 | } | 895 | } |
| ... | @@ -911,7 +911,7 @@ fn addTag(func: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { | ... | @@ -911,7 +911,7 @@ fn addTag(func: *CodeGen, tag: Mir.Inst.Tag) error{OutOfMemory}!void { |
| 911 | 911 | ||
| 912 | fn addExtended(func: *CodeGen, opcode: wasm.MiscOpcode) error{OutOfMemory}!void { | 912 | fn addExtended(func: *CodeGen, opcode: wasm.MiscOpcode) error{OutOfMemory}!void { |
| 913 | const extra_index = @intCast(u32, func.mir_extra.items.len); | 913 | const extra_index = @intCast(u32, func.mir_extra.items.len); |
| 914 | try func.mir_extra.append(func.gpa, @enumToInt(opcode)); | 914 | try func.mir_extra.append(func.gpa, @intFromEnum(opcode)); |
| 915 | try func.addInst(.{ .tag = .misc_prefix, .data = .{ .payload = extra_index } }); | 915 | try func.addInst(.{ .tag = .misc_prefix, .data = .{ .payload = extra_index } }); |
| 916 | } | 916 | } |
| 917 | 917 | ||
| ... | @@ -3218,7 +3218,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue { | ... | @@ -3218,7 +3218,7 @@ fn lowerConstant(func: *CodeGen, arg_val: Value, ty: Type) InnerError!WValue { |
| 3218 | return WValue{ .imm32 = 0 }; | 3218 | return WValue{ .imm32 = 0 }; |
| 3219 | } | 3219 | } |
| 3220 | } else { | 3220 | } else { |
| 3221 | return WValue{ .imm32 = @boolToInt(!val.isNull(mod)) }; | 3221 | return WValue{ .imm32 = @intFromBool(!val.isNull(mod)) }; |
| 3222 | }, | 3222 | }, |
| 3223 | .aggregate => switch (mod.intern_pool.indexToKey(ty.ip_index)) { | 3223 | .aggregate => switch (mod.intern_pool.indexToKey(ty.ip_index)) { |
| 3224 | .array_type => return func.fail("Wasm TODO: LowerConstant for {}", .{ty.fmt(mod)}), | 3224 | .array_type => return func.fail("Wasm TODO: LowerConstant for {}", .{ty.fmt(mod)}), |
| ... | @@ -3904,7 +3904,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3904,7 +3904,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3904 | } | 3904 | } |
| 3905 | 3905 | ||
| 3906 | // Account for default branch so always add '1' | 3906 | // Account for default branch so always add '1' |
| 3907 | const depth = @intCast(u32, highest - lowest + @boolToInt(has_else_body)) + 1; | 3907 | const depth = @intCast(u32, highest - lowest + @intFromBool(has_else_body)) + 1; |
| 3908 | const jump_table: Mir.JumpTable = .{ .length = depth }; | 3908 | const jump_table: Mir.JumpTable = .{ .length = depth }; |
| 3909 | const table_extra_index = try func.addExtra(jump_table); | 3909 | const table_extra_index = try func.addExtra(jump_table); |
| 3910 | try func.addInst(.{ .tag = .br_table, .data = .{ .payload = table_extra_index } }); | 3910 | try func.addInst(.{ .tag = .br_table, .data = .{ .payload = table_extra_index } }); |
| ... | @@ -3939,7 +3939,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -3939,7 +3939,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 3939 | break :blk target_ty.intInfo(mod).signedness; | 3939 | break :blk target_ty.intInfo(mod).signedness; |
| 3940 | }; | 3940 | }; |
| 3941 | 3941 | ||
| 3942 | try func.branches.ensureUnusedCapacity(func.gpa, case_list.items.len + @boolToInt(has_else_body)); | 3942 | try func.branches.ensureUnusedCapacity(func.gpa, case_list.items.len + @intFromBool(has_else_body)); |
| 3943 | for (case_list.items, 0..) |case, index| { | 3943 | for (case_list.items, 0..) |case, index| { |
| 3944 | // when sparse, we use if/else-chain, so emit conditional checks | 3944 | // when sparse, we use if/else-chain, so emit conditional checks |
| 3945 | if (is_sparse) { | 3945 | if (is_sparse) { |
| ... | @@ -4821,7 +4821,7 @@ fn airIntFromFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4821,7 +4821,7 @@ fn airIntFromFloat(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4821 | const op_ty = func.typeOf(ty_op.operand); | 4821 | const op_ty = func.typeOf(ty_op.operand); |
| 4822 | 4822 | ||
| 4823 | if (op_ty.abiSize(mod) > 8) { | 4823 | if (op_ty.abiSize(mod) > 8) { |
| 4824 | return func.fail("TODO: floatToInt for integers/floats with bitsize larger than 64 bits", .{}); | 4824 | return func.fail("TODO: intFromFloat for integers/floats with bitsize larger than 64 bits", .{}); |
| 4825 | } | 4825 | } |
| 4826 | 4826 | ||
| 4827 | try func.emitWValue(operand); | 4827 | try func.emitWValue(operand); |
| ... | @@ -4846,7 +4846,7 @@ fn airFloatFromInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { | ... | @@ -4846,7 +4846,7 @@ fn airFloatFromInt(func: *CodeGen, inst: Air.Inst.Index) InnerError!void { |
| 4846 | const op_ty = func.typeOf(ty_op.operand); | 4846 | const op_ty = func.typeOf(ty_op.operand); |
| 4847 | 4847 | ||
| 4848 | if (op_ty.abiSize(mod) > 8) { | 4848 | if (op_ty.abiSize(mod) > 8) { |
| 4849 | return func.fail("TODO: intToFloat for integers/floats with bitsize larger than 64 bits", .{}); | 4849 | return func.fail("TODO: floatFromInt for integers/floats with bitsize larger than 64 bits", .{}); |
| 4850 | } | 4850 | } |
| 4851 | 4851 | ||
| 4852 | try func.emitWValue(operand); | 4852 | try func.emitWValue(operand); |
src/arch/wasm/Emit.zig+8-8| ... | @@ -269,12 +269,12 @@ fn emitLocals(emit: *Emit) !void { | ... | @@ -269,12 +269,12 @@ fn emitLocals(emit: *Emit) !void { |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | fn emitTag(emit: *Emit, tag: Mir.Inst.Tag) !void { | 271 | fn emitTag(emit: *Emit, tag: Mir.Inst.Tag) !void { |
| 272 | try emit.code.append(@enumToInt(tag)); | 272 | try emit.code.append(@intFromEnum(tag)); |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | fn emitBlock(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { | 275 | fn emitBlock(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { |
| 276 | const block_type = emit.mir.instructions.items(.data)[inst].block_type; | 276 | const block_type = emit.mir.instructions.items(.data)[inst].block_type; |
| 277 | try emit.code.append(@enumToInt(tag)); | 277 | try emit.code.append(@intFromEnum(tag)); |
| 278 | try emit.code.append(block_type); | 278 | try emit.code.append(block_type); |
| 279 | } | 279 | } |
| 280 | 280 | ||
| ... | @@ -293,13 +293,13 @@ fn emitBrTable(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -293,13 +293,13 @@ fn emitBrTable(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 293 | 293 | ||
| 294 | fn emitLabel(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { | 294 | fn emitLabel(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { |
| 295 | const label = emit.mir.instructions.items(.data)[inst].label; | 295 | const label = emit.mir.instructions.items(.data)[inst].label; |
| 296 | try emit.code.append(@enumToInt(tag)); | 296 | try emit.code.append(@intFromEnum(tag)); |
| 297 | try leb128.writeULEB128(emit.code.writer(), label); | 297 | try leb128.writeULEB128(emit.code.writer(), label); |
| 298 | } | 298 | } |
| 299 | 299 | ||
| 300 | fn emitGlobal(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { | 300 | fn emitGlobal(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { |
| 301 | const label = emit.mir.instructions.items(.data)[inst].label; | 301 | const label = emit.mir.instructions.items(.data)[inst].label; |
| 302 | try emit.code.append(@enumToInt(tag)); | 302 | try emit.code.append(@intFromEnum(tag)); |
| 303 | var buf: [5]u8 = undefined; | 303 | var buf: [5]u8 = undefined; |
| 304 | leb128.writeUnsignedFixed(5, &buf, label); | 304 | leb128.writeUnsignedFixed(5, &buf, label); |
| 305 | const global_offset = emit.offset(); | 305 | const global_offset = emit.offset(); |
| ... | @@ -343,7 +343,7 @@ fn emitFloat64(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -343,7 +343,7 @@ fn emitFloat64(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 343 | fn emitMemArg(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { | 343 | fn emitMemArg(emit: *Emit, tag: Mir.Inst.Tag, inst: Mir.Inst.Index) !void { |
| 344 | const extra_index = emit.mir.instructions.items(.data)[inst].payload; | 344 | const extra_index = emit.mir.instructions.items(.data)[inst].payload; |
| 345 | const mem_arg = emit.mir.extraData(Mir.MemArg, extra_index).data; | 345 | const mem_arg = emit.mir.extraData(Mir.MemArg, extra_index).data; |
| 346 | try emit.code.append(@enumToInt(tag)); | 346 | try emit.code.append(@intFromEnum(tag)); |
| 347 | try encodeMemArg(mem_arg, emit.code.writer()); | 347 | try encodeMemArg(mem_arg, emit.code.writer()); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| ... | @@ -436,7 +436,7 @@ fn emitExtended(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -436,7 +436,7 @@ fn emitExtended(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 436 | const writer = emit.code.writer(); | 436 | const writer = emit.code.writer(); |
| 437 | try emit.code.append(std.wasm.opcode(.misc_prefix)); | 437 | try emit.code.append(std.wasm.opcode(.misc_prefix)); |
| 438 | try leb128.writeULEB128(writer, opcode); | 438 | try leb128.writeULEB128(writer, opcode); |
| 439 | switch (@intToEnum(std.wasm.MiscOpcode, opcode)) { | 439 | switch (@enumFromInt(std.wasm.MiscOpcode, opcode)) { |
| 440 | // bulk-memory opcodes | 440 | // bulk-memory opcodes |
| 441 | .data_drop => { | 441 | .data_drop => { |
| 442 | const segment = emit.mir.extra[extra_index + 1]; | 442 | const segment = emit.mir.extra[extra_index + 1]; |
| ... | @@ -475,7 +475,7 @@ fn emitSimd(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -475,7 +475,7 @@ fn emitSimd(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 475 | const writer = emit.code.writer(); | 475 | const writer = emit.code.writer(); |
| 476 | try emit.code.append(std.wasm.opcode(.simd_prefix)); | 476 | try emit.code.append(std.wasm.opcode(.simd_prefix)); |
| 477 | try leb128.writeULEB128(writer, opcode); | 477 | try leb128.writeULEB128(writer, opcode); |
| 478 | switch (@intToEnum(std.wasm.SimdOpcode, opcode)) { | 478 | switch (@enumFromInt(std.wasm.SimdOpcode, opcode)) { |
| 479 | .v128_store, | 479 | .v128_store, |
| 480 | .v128_load, | 480 | .v128_load, |
| 481 | .v128_load8_splat, | 481 | .v128_load8_splat, |
| ... | @@ -526,7 +526,7 @@ fn emitAtomic(emit: *Emit, inst: Mir.Inst.Index) !void { | ... | @@ -526,7 +526,7 @@ fn emitAtomic(emit: *Emit, inst: Mir.Inst.Index) !void { |
| 526 | const writer = emit.code.writer(); | 526 | const writer = emit.code.writer(); |
| 527 | try emit.code.append(std.wasm.opcode(.atomics_prefix)); | 527 | try emit.code.append(std.wasm.opcode(.atomics_prefix)); |
| 528 | try leb128.writeULEB128(writer, opcode); | 528 | try leb128.writeULEB128(writer, opcode); |
| 529 | switch (@intToEnum(std.wasm.AtomicsOpcode, opcode)) { | 529 | switch (@enumFromInt(std.wasm.AtomicsOpcode, opcode)) { |
| 530 | .i32_atomic_load, | 530 | .i32_atomic_load, |
| 531 | .i64_atomic_load, | 531 | .i64_atomic_load, |
| 532 | .i32_atomic_load8_u, | 532 | .i32_atomic_load8_u, |
src/arch/wasm/Mir.zig+2-2| ... | @@ -544,12 +544,12 @@ pub const Inst = struct { | ... | @@ -544,12 +544,12 @@ pub const Inst = struct { |
| 544 | 544 | ||
| 545 | /// From a given wasm opcode, returns a MIR tag. | 545 | /// From a given wasm opcode, returns a MIR tag. |
| 546 | pub fn fromOpcode(opcode: std.wasm.Opcode) Tag { | 546 | pub fn fromOpcode(opcode: std.wasm.Opcode) Tag { |
| 547 | return @intToEnum(Tag, @enumToInt(opcode)); // Given `Opcode` is not present as a tag for MIR yet | 547 | return @enumFromInt(Tag, @intFromEnum(opcode)); // Given `Opcode` is not present as a tag for MIR yet |
| 548 | } | 548 | } |
| 549 | 549 | ||
| 550 | /// Returns a wasm opcode from a given MIR tag. | 550 | /// Returns a wasm opcode from a given MIR tag. |
| 551 | pub fn toOpcode(self: Tag) std.wasm.Opcode { | 551 | pub fn toOpcode(self: Tag) std.wasm.Opcode { |
| 552 | return @intToEnum(std.wasm.Opcode, @enumToInt(self)); | 552 | return @enumFromInt(std.wasm.Opcode, @intFromEnum(self)); |
| 553 | } | 553 | } |
| 554 | }; | 554 | }; |
| 555 | 555 |
src/arch/x86/bits.zig+5-5| ... | @@ -14,7 +14,7 @@ pub const Register = enum(u8) { | ... | @@ -14,7 +14,7 @@ pub const Register = enum(u8) { |
| 14 | 14 | ||
| 15 | /// Returns the bit-width of the register. | 15 | /// Returns the bit-width of the register. |
| 16 | pub fn size(self: Register) u7 { | 16 | pub fn size(self: Register) u7 { |
| 17 | return switch (@enumToInt(self)) { | 17 | return switch (@intFromEnum(self)) { |
| 18 | 0...7 => 32, | 18 | 0...7 => 32, |
| 19 | 8...15 => 16, | 19 | 8...15 => 16, |
| 20 | 16...23 => 8, | 20 | 16...23 => 8, |
| ... | @@ -26,22 +26,22 @@ pub const Register = enum(u8) { | ... | @@ -26,22 +26,22 @@ pub const Register = enum(u8) { |
| 26 | /// x86 has. It is embedded in some instructions, such as the `B8 +rd` move | 26 | /// x86 has. It is embedded in some instructions, such as the `B8 +rd` move |
| 27 | /// instruction, and is used in the R/M byte. | 27 | /// instruction, and is used in the R/M byte. |
| 28 | pub fn id(self: Register) u3 { | 28 | pub fn id(self: Register) u3 { |
| 29 | return @truncate(u3, @enumToInt(self)); | 29 | return @truncate(u3, @intFromEnum(self)); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | /// Convert from any register to its 32 bit alias. | 32 | /// Convert from any register to its 32 bit alias. |
| 33 | pub fn to32(self: Register) Register { | 33 | pub fn to32(self: Register) Register { |
| 34 | return @intToEnum(Register, @as(u8, self.id())); | 34 | return @enumFromInt(Register, @as(u8, self.id())); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | /// Convert from any register to its 16 bit alias. | 37 | /// Convert from any register to its 16 bit alias. |
| 38 | pub fn to16(self: Register) Register { | 38 | pub fn to16(self: Register) Register { |
| 39 | return @intToEnum(Register, @as(u8, self.id()) + 8); | 39 | return @enumFromInt(Register, @as(u8, self.id()) + 8); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | /// Convert from any register to its 8 bit alias. | 42 | /// Convert from any register to its 8 bit alias. |
| 43 | pub fn to8(self: Register) Register { | 43 | pub fn to8(self: Register) Register { |
| 44 | return @intToEnum(Register, @as(u8, self.id()) + 16); | 44 | return @enumFromInt(Register, @as(u8, self.id()) + 16); |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | pub fn dwarfLocOp(reg: Register) u8 { | 47 | pub fn dwarfLocOp(reg: Register) u8 { |
src/arch/x86_64/CodeGen.zig+32-32| ... | @@ -690,7 +690,7 @@ pub fn generate( | ... | @@ -690,7 +690,7 @@ pub fn generate( |
| 690 | 690 | ||
| 691 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); | 691 | try function.frame_allocs.resize(gpa, FrameIndex.named_count); |
| 692 | function.frame_allocs.set( | 692 | function.frame_allocs.set( |
| 693 | @enumToInt(FrameIndex.stack_frame), | 693 | @intFromEnum(FrameIndex.stack_frame), |
| 694 | FrameAlloc.init(.{ | 694 | FrameAlloc.init(.{ |
| 695 | .size = 0, | 695 | .size = 0, |
| 696 | .alignment = if (mod.align_stack_fns.get(module_fn_index)) |set_align_stack| | 696 | .alignment = if (mod.align_stack_fns.get(module_fn_index)) |set_align_stack| |
| ... | @@ -700,7 +700,7 @@ pub fn generate( | ... | @@ -700,7 +700,7 @@ pub fn generate( |
| 700 | }), | 700 | }), |
| 701 | ); | 701 | ); |
| 702 | function.frame_allocs.set( | 702 | function.frame_allocs.set( |
| 703 | @enumToInt(FrameIndex.call_frame), | 703 | @intFromEnum(FrameIndex.call_frame), |
| 704 | FrameAlloc.init(.{ .size = 0, .alignment = 1 }), | 704 | FrameAlloc.init(.{ .size = 0, .alignment = 1 }), |
| 705 | ); | 705 | ); |
| 706 | 706 | ||
| ... | @@ -721,16 +721,16 @@ pub fn generate( | ... | @@ -721,16 +721,16 @@ pub fn generate( |
| 721 | 721 | ||
| 722 | function.args = call_info.args; | 722 | function.args = call_info.args; |
| 723 | function.ret_mcv = call_info.return_value; | 723 | function.ret_mcv = call_info.return_value; |
| 724 | function.frame_allocs.set(@enumToInt(FrameIndex.ret_addr), FrameAlloc.init(.{ | 724 | function.frame_allocs.set(@intFromEnum(FrameIndex.ret_addr), FrameAlloc.init(.{ |
| 725 | .size = Type.usize.abiSize(mod), | 725 | .size = Type.usize.abiSize(mod), |
| 726 | .alignment = @min(Type.usize.abiAlignment(mod), call_info.stack_align), | 726 | .alignment = @min(Type.usize.abiAlignment(mod), call_info.stack_align), |
| 727 | })); | 727 | })); |
| 728 | function.frame_allocs.set(@enumToInt(FrameIndex.base_ptr), FrameAlloc.init(.{ | 728 | function.frame_allocs.set(@intFromEnum(FrameIndex.base_ptr), FrameAlloc.init(.{ |
| 729 | .size = Type.usize.abiSize(mod), | 729 | .size = Type.usize.abiSize(mod), |
| 730 | .alignment = @min(Type.usize.abiAlignment(mod) * 2, call_info.stack_align), | 730 | .alignment = @min(Type.usize.abiAlignment(mod) * 2, call_info.stack_align), |
| 731 | })); | 731 | })); |
| 732 | function.frame_allocs.set( | 732 | function.frame_allocs.set( |
| 733 | @enumToInt(FrameIndex.args_frame), | 733 | @intFromEnum(FrameIndex.args_frame), |
| 734 | FrameAlloc.init(.{ .size = call_info.stack_byte_count, .alignment = call_info.stack_align }), | 734 | FrameAlloc.init(.{ .size = call_info.stack_byte_count, .alignment = call_info.stack_align }), |
| 735 | ); | 735 | ); |
| 736 | 736 | ||
| ... | @@ -2147,7 +2147,7 @@ fn setFrameLoc( | ... | @@ -2147,7 +2147,7 @@ fn setFrameLoc( |
| 2147 | offset: *i32, | 2147 | offset: *i32, |
| 2148 | comptime aligned: bool, | 2148 | comptime aligned: bool, |
| 2149 | ) void { | 2149 | ) void { |
| 2150 | const frame_i = @enumToInt(frame_index); | 2150 | const frame_i = @intFromEnum(frame_index); |
| 2151 | if (aligned) { | 2151 | if (aligned) { |
| 2152 | const alignment = @as(i32, 1) << self.frame_allocs.items(.abi_align)[frame_i]; | 2152 | const alignment = @as(i32, 1) << self.frame_allocs.items(.abi_align)[frame_i]; |
| 2153 | offset.* = mem.alignForward(i32, offset.*, alignment); | 2153 | offset.* = mem.alignForward(i32, offset.*, alignment); |
| ... | @@ -2167,21 +2167,21 @@ fn computeFrameLayout(self: *Self) !FrameLayout { | ... | @@ -2167,21 +2167,21 @@ fn computeFrameLayout(self: *Self) !FrameLayout { |
| 2167 | const frame_offset = self.frame_locs.items(.disp); | 2167 | const frame_offset = self.frame_locs.items(.disp); |
| 2168 | 2168 | ||
| 2169 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| | 2169 | for (stack_frame_order, FrameIndex.named_count..) |*frame_order, frame_index| |
| 2170 | frame_order.* = @intToEnum(FrameIndex, frame_index); | 2170 | frame_order.* = @enumFromInt(FrameIndex, frame_index); |
| 2171 | { | 2171 | { |
| 2172 | const SortContext = struct { | 2172 | const SortContext = struct { |
| 2173 | frame_align: @TypeOf(frame_align), | 2173 | frame_align: @TypeOf(frame_align), |
| 2174 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { | 2174 | pub fn lessThan(context: @This(), lhs: FrameIndex, rhs: FrameIndex) bool { |
| 2175 | return context.frame_align[@enumToInt(lhs)] > context.frame_align[@enumToInt(rhs)]; | 2175 | return context.frame_align[@intFromEnum(lhs)] > context.frame_align[@intFromEnum(rhs)]; |
| 2176 | } | 2176 | } |
| 2177 | }; | 2177 | }; |
| 2178 | const sort_context = SortContext{ .frame_align = frame_align }; | 2178 | const sort_context = SortContext{ .frame_align = frame_align }; |
| 2179 | mem.sort(FrameIndex, stack_frame_order, sort_context, SortContext.lessThan); | 2179 | mem.sort(FrameIndex, stack_frame_order, sort_context, SortContext.lessThan); |
| 2180 | } | 2180 | } |
| 2181 | 2181 | ||
| 2182 | const call_frame_align = frame_align[@enumToInt(FrameIndex.call_frame)]; | 2182 | const call_frame_align = frame_align[@intFromEnum(FrameIndex.call_frame)]; |
| 2183 | const stack_frame_align = frame_align[@enumToInt(FrameIndex.stack_frame)]; | 2183 | const stack_frame_align = frame_align[@intFromEnum(FrameIndex.stack_frame)]; |
| 2184 | const args_frame_align = frame_align[@enumToInt(FrameIndex.args_frame)]; | 2184 | const args_frame_align = frame_align[@intFromEnum(FrameIndex.args_frame)]; |
| 2185 | const needed_align = @max(call_frame_align, stack_frame_align); | 2185 | const needed_align = @max(call_frame_align, stack_frame_align); |
| 2186 | const need_align_stack = needed_align > args_frame_align; | 2186 | const need_align_stack = needed_align > args_frame_align; |
| 2187 | 2187 | ||
| ... | @@ -2200,7 +2200,7 @@ fn computeFrameLayout(self: *Self) !FrameLayout { | ... | @@ -2200,7 +2200,7 @@ fn computeFrameLayout(self: *Self) !FrameLayout { |
| 2200 | self.setFrameLoc(.ret_addr, .rbp, &rbp_offset, false); | 2200 | self.setFrameLoc(.ret_addr, .rbp, &rbp_offset, false); |
| 2201 | self.setFrameLoc(.args_frame, .rbp, &rbp_offset, false); | 2201 | self.setFrameLoc(.args_frame, .rbp, &rbp_offset, false); |
| 2202 | const stack_frame_align_offset = | 2202 | const stack_frame_align_offset = |
| 2203 | if (need_align_stack) 0 else frame_offset[@enumToInt(FrameIndex.args_frame)]; | 2203 | if (need_align_stack) 0 else frame_offset[@intFromEnum(FrameIndex.args_frame)]; |
| 2204 | 2204 | ||
| 2205 | var rsp_offset: i32 = 0; | 2205 | var rsp_offset: i32 = 0; |
| 2206 | self.setFrameLoc(.call_frame, .rsp, &rsp_offset, true); | 2206 | self.setFrameLoc(.call_frame, .rsp, &rsp_offset, true); |
| ... | @@ -2209,23 +2209,23 @@ fn computeFrameLayout(self: *Self) !FrameLayout { | ... | @@ -2209,23 +2209,23 @@ fn computeFrameLayout(self: *Self) !FrameLayout { |
| 2209 | rsp_offset += stack_frame_align_offset; | 2209 | rsp_offset += stack_frame_align_offset; |
| 2210 | rsp_offset = mem.alignForward(i32, rsp_offset, @as(i32, 1) << needed_align); | 2210 | rsp_offset = mem.alignForward(i32, rsp_offset, @as(i32, 1) << needed_align); |
| 2211 | rsp_offset -= stack_frame_align_offset; | 2211 | rsp_offset -= stack_frame_align_offset; |
| 2212 | frame_size[@enumToInt(FrameIndex.call_frame)] = | 2212 | frame_size[@intFromEnum(FrameIndex.call_frame)] = |
| 2213 | @intCast(u31, rsp_offset - frame_offset[@enumToInt(FrameIndex.stack_frame)]); | 2213 | @intCast(u31, rsp_offset - frame_offset[@intFromEnum(FrameIndex.stack_frame)]); |
| 2214 | 2214 | ||
| 2215 | return .{ | 2215 | return .{ |
| 2216 | .stack_mask = @as(u32, math.maxInt(u32)) << (if (need_align_stack) needed_align else 0), | 2216 | .stack_mask = @as(u32, math.maxInt(u32)) << (if (need_align_stack) needed_align else 0), |
| 2217 | .stack_adjust = @intCast(u32, rsp_offset - frame_offset[@enumToInt(FrameIndex.call_frame)]), | 2217 | .stack_adjust = @intCast(u32, rsp_offset - frame_offset[@intFromEnum(FrameIndex.call_frame)]), |
| 2218 | .save_reg_list = save_reg_list, | 2218 | .save_reg_list = save_reg_list, |
| 2219 | }; | 2219 | }; |
| 2220 | } | 2220 | } |
| 2221 | 2221 | ||
| 2222 | fn getFrameAddrAlignment(self: *Self, frame_addr: FrameAddr) u32 { | 2222 | fn getFrameAddrAlignment(self: *Self, frame_addr: FrameAddr) u32 { |
| 2223 | const alloc_align = @as(u32, 1) << self.frame_allocs.get(@enumToInt(frame_addr.index)).abi_align; | 2223 | const alloc_align = @as(u32, 1) << self.frame_allocs.get(@intFromEnum(frame_addr.index)).abi_align; |
| 2224 | return @min(alloc_align, @bitCast(u32, frame_addr.off) & (alloc_align - 1)); | 2224 | return @min(alloc_align, @bitCast(u32, frame_addr.off) & (alloc_align - 1)); |
| 2225 | } | 2225 | } |
| 2226 | 2226 | ||
| 2227 | fn getFrameAddrSize(self: *Self, frame_addr: FrameAddr) u32 { | 2227 | fn getFrameAddrSize(self: *Self, frame_addr: FrameAddr) u32 { |
| 2228 | return self.frame_allocs.get(@enumToInt(frame_addr.index)).abi_size - @intCast(u31, frame_addr.off); | 2228 | return self.frame_allocs.get(@intFromEnum(frame_addr.index)).abi_size - @intCast(u31, frame_addr.off); |
| 2229 | } | 2229 | } |
| 2230 | 2230 | ||
| 2231 | fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { | 2231 | fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { |
| ... | @@ -2233,19 +2233,19 @@ fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { | ... | @@ -2233,19 +2233,19 @@ fn allocFrameIndex(self: *Self, alloc: FrameAlloc) !FrameIndex { |
| 2233 | const frame_size = frame_allocs_slice.items(.abi_size); | 2233 | const frame_size = frame_allocs_slice.items(.abi_size); |
| 2234 | const frame_align = frame_allocs_slice.items(.abi_align); | 2234 | const frame_align = frame_allocs_slice.items(.abi_align); |
| 2235 | 2235 | ||
| 2236 | const stack_frame_align = &frame_align[@enumToInt(FrameIndex.stack_frame)]; | 2236 | const stack_frame_align = &frame_align[@intFromEnum(FrameIndex.stack_frame)]; |
| 2237 | stack_frame_align.* = @max(stack_frame_align.*, alloc.abi_align); | 2237 | stack_frame_align.* = @max(stack_frame_align.*, alloc.abi_align); |
| 2238 | 2238 | ||
| 2239 | for (self.free_frame_indices.keys(), 0..) |frame_index, free_i| { | 2239 | for (self.free_frame_indices.keys(), 0..) |frame_index, free_i| { |
| 2240 | const abi_size = frame_size[@enumToInt(frame_index)]; | 2240 | const abi_size = frame_size[@intFromEnum(frame_index)]; |
| 2241 | if (abi_size != alloc.abi_size) continue; | 2241 | if (abi_size != alloc.abi_size) continue; |
| 2242 | const abi_align = &frame_align[@enumToInt(frame_index)]; | 2242 | const abi_align = &frame_align[@intFromEnum(frame_index)]; |
| 2243 | abi_align.* = @max(abi_align.*, alloc.abi_align); | 2243 | abi_align.* = @max(abi_align.*, alloc.abi_align); |
| 2244 | 2244 | ||
| 2245 | _ = self.free_frame_indices.swapRemoveAt(free_i); | 2245 | _ = self.free_frame_indices.swapRemoveAt(free_i); |
| 2246 | return frame_index; | 2246 | return frame_index; |
| 2247 | } | 2247 | } |
| 2248 | const frame_index = @intToEnum(FrameIndex, self.frame_allocs.len); | 2248 | const frame_index = @enumFromInt(FrameIndex, self.frame_allocs.len); |
| 2249 | try self.frame_allocs.append(self.gpa, alloc); | 2249 | try self.frame_allocs.append(self.gpa, alloc); |
| 2250 | return frame_index; | 2250 | return frame_index; |
| 2251 | } | 2251 | } |
| ... | @@ -2876,7 +2876,7 @@ fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 { | ... | @@ -2876,7 +2876,7 @@ fn activeIntBits(self: *Self, dst_air: Air.Inst.Ref) u16 { |
| 2876 | var space: Value.BigIntSpace = undefined; | 2876 | var space: Value.BigIntSpace = undefined; |
| 2877 | const src_int = src_val.toBigInt(&space, mod); | 2877 | const src_int = src_val.toBigInt(&space, mod); |
| 2878 | return @intCast(u16, src_int.bitCountTwosComp()) + | 2878 | return @intCast(u16, src_int.bitCountTwosComp()) + |
| 2879 | @boolToInt(src_int.positive and dst_info.signedness == .signed); | 2879 | @intFromBool(src_int.positive and dst_info.signedness == .signed); |
| 2880 | }, | 2880 | }, |
| 2881 | .intcast => { | 2881 | .intcast => { |
| 2882 | const src_ty = self.typeOf(air_data[inst].ty_op.operand); | 2882 | const src_ty = self.typeOf(air_data[inst].ty_op.operand); |
| ... | @@ -8034,10 +8034,10 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier | ... | @@ -8034,10 +8034,10 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier |
| 8034 | FrameAlloc.init(.{ .size = info.stack_byte_count, .alignment = info.stack_align }); | 8034 | FrameAlloc.init(.{ .size = info.stack_byte_count, .alignment = info.stack_align }); |
| 8035 | const frame_allocs_slice = self.frame_allocs.slice(); | 8035 | const frame_allocs_slice = self.frame_allocs.slice(); |
| 8036 | const stack_frame_size = | 8036 | const stack_frame_size = |
| 8037 | &frame_allocs_slice.items(.abi_size)[@enumToInt(FrameIndex.call_frame)]; | 8037 | &frame_allocs_slice.items(.abi_size)[@intFromEnum(FrameIndex.call_frame)]; |
| 8038 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); | 8038 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 8039 | const stack_frame_align = | 8039 | const stack_frame_align = |
| 8040 | &frame_allocs_slice.items(.abi_align)[@enumToInt(FrameIndex.call_frame)]; | 8040 | &frame_allocs_slice.items(.abi_align)[@intFromEnum(FrameIndex.call_frame)]; |
| 8041 | stack_frame_align.* = @max(stack_frame_align.*, needed_call_frame.abi_align); | 8041 | stack_frame_align.* = @max(stack_frame_align.*, needed_call_frame.abi_align); |
| 8042 | } | 8042 | } |
| 8043 | 8043 | ||
| ... | @@ -10915,10 +10915,10 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -10915,10 +10915,10 @@ fn airTagName(self: *Self, inst: Air.Inst.Index) !void { |
| 10915 | }); | 10915 | }); |
| 10916 | const frame_allocs_slice = self.frame_allocs.slice(); | 10916 | const frame_allocs_slice = self.frame_allocs.slice(); |
| 10917 | const stack_frame_size = | 10917 | const stack_frame_size = |
| 10918 | &frame_allocs_slice.items(.abi_size)[@enumToInt(FrameIndex.call_frame)]; | 10918 | &frame_allocs_slice.items(.abi_size)[@intFromEnum(FrameIndex.call_frame)]; |
| 10919 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); | 10919 | stack_frame_size.* = @max(stack_frame_size.*, needed_call_frame.abi_size); |
| 10920 | const stack_frame_align = | 10920 | const stack_frame_align = |
| 10921 | &frame_allocs_slice.items(.abi_align)[@enumToInt(FrameIndex.call_frame)]; | 10921 | &frame_allocs_slice.items(.abi_align)[@intFromEnum(FrameIndex.call_frame)]; |
| 10922 | stack_frame_align.* = @max(stack_frame_align.*, needed_call_frame.abi_align); | 10922 | stack_frame_align.* = @max(stack_frame_align.*, needed_call_frame.abi_align); |
| 10923 | } | 10923 | } |
| 10924 | 10924 | ||
| ... | @@ -11413,7 +11413,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -11413,7 +11413,7 @@ fn airUnionInit(self: *Self, inst: Air.Inst.Index) !void { |
| 11413 | const tag_ty = union_obj.tag_ty; | 11413 | const tag_ty = union_obj.tag_ty; |
| 11414 | const field_index = tag_ty.enumFieldIndex(field_name, mod).?; | 11414 | const field_index = tag_ty.enumFieldIndex(field_name, mod).?; |
| 11415 | const tag_val = try mod.enumValueFieldIndex(tag_ty, field_index); | 11415 | const tag_val = try mod.enumValueFieldIndex(tag_ty, field_index); |
| 11416 | const tag_int_val = try tag_val.enumToInt(tag_ty, mod); | 11416 | const tag_int_val = try tag_val.intFromEnum(tag_ty, mod); |
| 11417 | const tag_int = tag_int_val.toUnsignedInt(mod); | 11417 | const tag_int = tag_int_val.toUnsignedInt(mod); |
| 11418 | const tag_off = if (layout.tag_align < layout.payload_align) | 11418 | const tag_off = if (layout.tag_align < layout.payload_align) |
| 11419 | @intCast(i32, layout.payload_size) | 11419 | @intCast(i32, layout.payload_size) |
| ... | @@ -11637,7 +11637,7 @@ fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCV | ... | @@ -11637,7 +11637,7 @@ fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCV |
| 11637 | switch (mcv) { | 11637 | switch (mcv) { |
| 11638 | .immediate => |imm| { | 11638 | .immediate => |imm| { |
| 11639 | // This immediate is unsigned. | 11639 | // This immediate is unsigned. |
| 11640 | const U = std.meta.Int(.unsigned, ti.bits - @boolToInt(ti.signedness == .signed)); | 11640 | const U = std.meta.Int(.unsigned, ti.bits - @intFromBool(ti.signedness == .signed)); |
| 11641 | if (imm >= math.maxInt(U)) { | 11641 | if (imm >= math.maxInt(U)) { |
| 11642 | return MCValue{ .register = try self.copyToTmpRegister(Type.usize, mcv) }; | 11642 | return MCValue{ .register = try self.copyToTmpRegister(Type.usize, mcv) }; |
| 11643 | } | 11643 | } |
| ... | @@ -11782,17 +11782,17 @@ fn resolveCallingConventionValues( | ... | @@ -11782,17 +11782,17 @@ fn resolveCallingConventionValues( |
| 11782 | }, | 11782 | }, |
| 11783 | .float, .sse => switch (self.target.os.tag) { | 11783 | .float, .sse => switch (self.target.os.tag) { |
| 11784 | .windows => if (param_reg_i < 4) { | 11784 | .windows => if (param_reg_i < 4) { |
| 11785 | arg.* = .{ .register = @intToEnum( | 11785 | arg.* = .{ .register = @enumFromInt( |
| 11786 | Register, | 11786 | Register, |
| 11787 | @enumToInt(Register.xmm0) + param_reg_i, | 11787 | @intFromEnum(Register.xmm0) + param_reg_i, |
| 11788 | ) }; | 11788 | ) }; |
| 11789 | param_reg_i += 1; | 11789 | param_reg_i += 1; |
| 11790 | continue; | 11790 | continue; |
| 11791 | }, | 11791 | }, |
| 11792 | else => if (param_sse_reg_i < 8) { | 11792 | else => if (param_sse_reg_i < 8) { |
| 11793 | arg.* = .{ .register = @intToEnum( | 11793 | arg.* = .{ .register = @enumFromInt( |
| 11794 | Register, | 11794 | Register, |
| 11795 | @enumToInt(Register.xmm0) + param_sse_reg_i, | 11795 | @intFromEnum(Register.xmm0) + param_sse_reg_i, |
| 11796 | ) }; | 11796 | ) }; |
| 11797 | param_sse_reg_i += 1; | 11797 | param_sse_reg_i += 1; |
| 11798 | continue; | 11798 | continue; |
src/arch/x86_64/Encoding.zig+4-4| ... | @@ -56,7 +56,7 @@ pub fn findByMnemonic( | ... | @@ -56,7 +56,7 @@ pub fn findByMnemonic( |
| 56 | 56 | ||
| 57 | var shortest_enc: ?Encoding = null; | 57 | var shortest_enc: ?Encoding = null; |
| 58 | var shortest_len: ?usize = null; | 58 | var shortest_len: ?usize = null; |
| 59 | next: for (mnemonic_to_encodings_map[@enumToInt(mnemonic)]) |data| { | 59 | next: for (mnemonic_to_encodings_map[@intFromEnum(mnemonic)]) |data| { |
| 60 | switch (data.mode) { | 60 | switch (data.mode) { |
| 61 | .none, .short => if (rex_required) continue, | 61 | .none, .short => if (rex_required) continue, |
| 62 | .rex, .rex_short => if (!rex_required) continue, | 62 | .rex, .rex_short => if (!rex_required) continue, |
| ... | @@ -85,7 +85,7 @@ pub fn findByOpcode(opc: []const u8, prefixes: struct { | ... | @@ -85,7 +85,7 @@ pub fn findByOpcode(opc: []const u8, prefixes: struct { |
| 85 | rex: Rex, | 85 | rex: Rex, |
| 86 | }, modrm_ext: ?u3) ?Encoding { | 86 | }, modrm_ext: ?u3) ?Encoding { |
| 87 | for (mnemonic_to_encodings_map, 0..) |encs, mnemonic_int| for (encs) |data| { | 87 | for (mnemonic_to_encodings_map, 0..) |encs, mnemonic_int| for (encs) |data| { |
| 88 | const enc = Encoding{ .mnemonic = @intToEnum(Mnemonic, mnemonic_int), .data = data }; | 88 | const enc = Encoding{ .mnemonic = @enumFromInt(Mnemonic, mnemonic_int), .data = data }; |
| 89 | if (modrm_ext) |ext| if (ext != data.modrm_ext) continue; | 89 | if (modrm_ext) |ext| if (ext != data.modrm_ext) continue; |
| 90 | if (!std.mem.eql(u8, opc, enc.opcode())) continue; | 90 | if (!std.mem.eql(u8, opc, enc.opcode())) continue; |
| 91 | if (prefixes.rex.w) { | 91 | if (prefixes.rex.w) { |
| ... | @@ -772,7 +772,7 @@ const mnemonic_to_encodings_map = init: { | ... | @@ -772,7 +772,7 @@ const mnemonic_to_encodings_map = init: { |
| 772 | var entries = encodings.table; | 772 | var entries = encodings.table; |
| 773 | std.mem.sort(encodings.Entry, &entries, {}, struct { | 773 | std.mem.sort(encodings.Entry, &entries, {}, struct { |
| 774 | fn lessThan(_: void, lhs: encodings.Entry, rhs: encodings.Entry) bool { | 774 | fn lessThan(_: void, lhs: encodings.Entry, rhs: encodings.Entry) bool { |
| 775 | return @enumToInt(lhs[0]) < @enumToInt(rhs[0]); | 775 | return @intFromEnum(lhs[0]) < @intFromEnum(rhs[0]); |
| 776 | } | 776 | } |
| 777 | }.lessThan); | 777 | }.lessThan); |
| 778 | var data_storage: [entries.len]Data = undefined; | 778 | var data_storage: [entries.len]Data = undefined; |
| ... | @@ -794,7 +794,7 @@ const mnemonic_to_encodings_map = init: { | ... | @@ -794,7 +794,7 @@ const mnemonic_to_encodings_map = init: { |
| 794 | std.mem.copyForwards(Op, &data.ops, entry[2]); | 794 | std.mem.copyForwards(Op, &data.ops, entry[2]); |
| 795 | std.mem.copyForwards(u8, &data.opc, entry[3]); | 795 | std.mem.copyForwards(u8, &data.opc, entry[3]); |
| 796 | 796 | ||
| 797 | while (mnemonic_int < @enumToInt(entry[0])) : (mnemonic_int += 1) { | 797 | while (mnemonic_int < @intFromEnum(entry[0])) : (mnemonic_int += 1) { |
| 798 | mnemonic_map[mnemonic_int] = data_storage[mnemonic_start..data_index]; | 798 | mnemonic_map[mnemonic_int] = data_storage[mnemonic_start..data_index]; |
| 799 | mnemonic_start = data_index; | 799 | mnemonic_start = data_index; |
| 800 | } | 800 | } |
src/arch/x86_64/Mir.zig+16-16| ... | @@ -1053,16 +1053,16 @@ pub const MemorySib = struct { | ... | @@ -1053,16 +1053,16 @@ pub const MemorySib = struct { |
| 1053 | const sib = mem.sib; | 1053 | const sib = mem.sib; |
| 1054 | assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale)); | 1054 | assert(sib.scale_index.scale == 0 or std.math.isPowerOfTwo(sib.scale_index.scale)); |
| 1055 | return .{ | 1055 | return .{ |
| 1056 | .ptr_size = @enumToInt(sib.ptr_size), | 1056 | .ptr_size = @intFromEnum(sib.ptr_size), |
| 1057 | .base_tag = @enumToInt(@as(Memory.Base.Tag, sib.base)), | 1057 | .base_tag = @intFromEnum(@as(Memory.Base.Tag, sib.base)), |
| 1058 | .base = switch (sib.base) { | 1058 | .base = switch (sib.base) { |
| 1059 | .none => undefined, | 1059 | .none => undefined, |
| 1060 | .reg => |r| @enumToInt(r), | 1060 | .reg => |r| @intFromEnum(r), |
| 1061 | .frame => |fi| @enumToInt(fi), | 1061 | .frame => |fi| @intFromEnum(fi), |
| 1062 | }, | 1062 | }, |
| 1063 | .scale_index = @as(u32, sib.scale_index.scale) << 0 | | 1063 | .scale_index = @as(u32, sib.scale_index.scale) << 0 | |
| 1064 | @as(u32, if (sib.scale_index.scale > 0) | 1064 | @as(u32, if (sib.scale_index.scale > 0) |
| 1065 | @enumToInt(sib.scale_index.index) | 1065 | @intFromEnum(sib.scale_index.index) |
| 1066 | else | 1066 | else |
| 1067 | undefined) << 4, | 1067 | undefined) << 4, |
| 1068 | .disp = sib.disp, | 1068 | .disp = sib.disp, |
| ... | @@ -1073,15 +1073,15 @@ pub const MemorySib = struct { | ... | @@ -1073,15 +1073,15 @@ pub const MemorySib = struct { |
| 1073 | const scale = @truncate(u4, msib.scale_index); | 1073 | const scale = @truncate(u4, msib.scale_index); |
| 1074 | assert(scale == 0 or std.math.isPowerOfTwo(scale)); | 1074 | assert(scale == 0 or std.math.isPowerOfTwo(scale)); |
| 1075 | return .{ .sib = .{ | 1075 | return .{ .sib = .{ |
| 1076 | .ptr_size = @intToEnum(Memory.PtrSize, msib.ptr_size), | 1076 | .ptr_size = @enumFromInt(Memory.PtrSize, msib.ptr_size), |
| 1077 | .base = switch (@intToEnum(Memory.Base.Tag, msib.base_tag)) { | 1077 | .base = switch (@enumFromInt(Memory.Base.Tag, msib.base_tag)) { |
| 1078 | .none => .none, | 1078 | .none => .none, |
| 1079 | .reg => .{ .reg = @intToEnum(Register, msib.base) }, | 1079 | .reg => .{ .reg = @enumFromInt(Register, msib.base) }, |
| 1080 | .frame => .{ .frame = @intToEnum(bits.FrameIndex, msib.base) }, | 1080 | .frame => .{ .frame = @enumFromInt(bits.FrameIndex, msib.base) }, |
| 1081 | }, | 1081 | }, |
| 1082 | .scale_index = .{ | 1082 | .scale_index = .{ |
| 1083 | .scale = scale, | 1083 | .scale = scale, |
| 1084 | .index = if (scale > 0) @intToEnum(Register, msib.scale_index >> 4) else undefined, | 1084 | .index = if (scale > 0) @enumFromInt(Register, msib.scale_index >> 4) else undefined, |
| 1085 | }, | 1085 | }, |
| 1086 | .disp = msib.disp, | 1086 | .disp = msib.disp, |
| 1087 | } }; | 1087 | } }; |
| ... | @@ -1096,14 +1096,14 @@ pub const MemoryRip = struct { | ... | @@ -1096,14 +1096,14 @@ pub const MemoryRip = struct { |
| 1096 | 1096 | ||
| 1097 | pub fn encode(mem: Memory) MemoryRip { | 1097 | pub fn encode(mem: Memory) MemoryRip { |
| 1098 | return .{ | 1098 | return .{ |
| 1099 | .ptr_size = @enumToInt(mem.rip.ptr_size), | 1099 | .ptr_size = @intFromEnum(mem.rip.ptr_size), |
| 1100 | .disp = mem.rip.disp, | 1100 | .disp = mem.rip.disp, |
| 1101 | }; | 1101 | }; |
| 1102 | } | 1102 | } |
| 1103 | 1103 | ||
| 1104 | pub fn decode(mrip: MemoryRip) Memory { | 1104 | pub fn decode(mrip: MemoryRip) Memory { |
| 1105 | return .{ .rip = .{ | 1105 | return .{ .rip = .{ |
| 1106 | .ptr_size = @intToEnum(Memory.PtrSize, mrip.ptr_size), | 1106 | .ptr_size = @enumFromInt(Memory.PtrSize, mrip.ptr_size), |
| 1107 | .disp = mrip.disp, | 1107 | .disp = mrip.disp, |
| 1108 | } }; | 1108 | } }; |
| 1109 | } | 1109 | } |
| ... | @@ -1119,7 +1119,7 @@ pub const MemoryMoffs = struct { | ... | @@ -1119,7 +1119,7 @@ pub const MemoryMoffs = struct { |
| 1119 | 1119 | ||
| 1120 | pub fn encode(seg: Register, offset: u64) MemoryMoffs { | 1120 | pub fn encode(seg: Register, offset: u64) MemoryMoffs { |
| 1121 | return .{ | 1121 | return .{ |
| 1122 | .seg = @enumToInt(seg), | 1122 | .seg = @intFromEnum(seg), |
| 1123 | .msb = @truncate(u32, offset >> 32), | 1123 | .msb = @truncate(u32, offset >> 32), |
| 1124 | .lsb = @truncate(u32, offset >> 0), | 1124 | .lsb = @truncate(u32, offset >> 0), |
| 1125 | }; | 1125 | }; |
| ... | @@ -1127,7 +1127,7 @@ pub const MemoryMoffs = struct { | ... | @@ -1127,7 +1127,7 @@ pub const MemoryMoffs = struct { |
| 1127 | 1127 | ||
| 1128 | pub fn decode(moffs: MemoryMoffs) Memory { | 1128 | pub fn decode(moffs: MemoryMoffs) Memory { |
| 1129 | return .{ .moffs = .{ | 1129 | return .{ .moffs = .{ |
| 1130 | .seg = @intToEnum(Register, moffs.seg), | 1130 | .seg = @enumFromInt(Register, moffs.seg), |
| 1131 | .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0, | 1131 | .offset = @as(u64, moffs.msb) << 32 | @as(u64, moffs.lsb) << 0, |
| 1132 | } }; | 1132 | } }; |
| 1133 | } | 1133 | } |
| ... | @@ -1168,8 +1168,8 @@ pub fn resolveFrameLoc(mir: Mir, mem: Memory) Memory { | ... | @@ -1168,8 +1168,8 @@ pub fn resolveFrameLoc(mir: Mir, mem: Memory) Memory { |
| 1168 | .sib => |sib| switch (sib.base) { | 1168 | .sib => |sib| switch (sib.base) { |
| 1169 | .none, .reg => mem, | 1169 | .none, .reg => mem, |
| 1170 | .frame => |index| if (mir.frame_locs.len > 0) Memory.sib(sib.ptr_size, .{ | 1170 | .frame => |index| if (mir.frame_locs.len > 0) Memory.sib(sib.ptr_size, .{ |
| 1171 | .base = .{ .reg = mir.frame_locs.items(.base)[@enumToInt(index)] }, | 1171 | .base = .{ .reg = mir.frame_locs.items(.base)[@intFromEnum(index)] }, |
| 1172 | .disp = mir.frame_locs.items(.disp)[@enumToInt(index)] + sib.disp, | 1172 | .disp = mir.frame_locs.items(.disp)[@intFromEnum(index)] + sib.disp, |
| 1173 | .scale_index = mem.scaleIndex(), | 1173 | .scale_index = mem.scaleIndex(), |
| 1174 | }) else mem, | 1174 | }) else mem, |
| 1175 | }, | 1175 | }, |
src/arch/x86_64/bits.zig+70-70| ... | @@ -193,20 +193,20 @@ pub const Register = enum(u7) { | ... | @@ -193,20 +193,20 @@ pub const Register = enum(u7) { |
| 193 | }; | 193 | }; |
| 194 | 194 | ||
| 195 | pub fn class(reg: Register) Class { | 195 | pub fn class(reg: Register) Class { |
| 196 | return switch (@enumToInt(reg)) { | 196 | return switch (@intFromEnum(reg)) { |
| 197 | // zig fmt: off | 197 | // zig fmt: off |
| 198 | @enumToInt(Register.rax) ... @enumToInt(Register.r15) => .general_purpose, | 198 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => .general_purpose, |
| 199 | @enumToInt(Register.eax) ... @enumToInt(Register.r15d) => .general_purpose, | 199 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => .general_purpose, |
| 200 | @enumToInt(Register.ax) ... @enumToInt(Register.r15w) => .general_purpose, | 200 | @intFromEnum(Register.ax) ... @intFromEnum(Register.r15w) => .general_purpose, |
| 201 | @enumToInt(Register.al) ... @enumToInt(Register.r15b) => .general_purpose, | 201 | @intFromEnum(Register.al) ... @intFromEnum(Register.r15b) => .general_purpose, |
| 202 | @enumToInt(Register.ah) ... @enumToInt(Register.bh) => .general_purpose, | 202 | @intFromEnum(Register.ah) ... @intFromEnum(Register.bh) => .general_purpose, |
| 203 | 203 | ||
| 204 | @enumToInt(Register.ymm0) ... @enumToInt(Register.ymm15) => .sse, | 204 | @intFromEnum(Register.ymm0) ... @intFromEnum(Register.ymm15) => .sse, |
| 205 | @enumToInt(Register.xmm0) ... @enumToInt(Register.xmm15) => .sse, | 205 | @intFromEnum(Register.xmm0) ... @intFromEnum(Register.xmm15) => .sse, |
| 206 | @enumToInt(Register.mm0) ... @enumToInt(Register.mm7) => .mmx, | 206 | @intFromEnum(Register.mm0) ... @intFromEnum(Register.mm7) => .mmx, |
| 207 | @enumToInt(Register.st0) ... @enumToInt(Register.st7) => .x87, | 207 | @intFromEnum(Register.st0) ... @intFromEnum(Register.st7) => .x87, |
| 208 | 208 | ||
| 209 | @enumToInt(Register.es) ... @enumToInt(Register.gs) => .segment, | 209 | @intFromEnum(Register.es) ... @intFromEnum(Register.gs) => .segment, |
| 210 | 210 | ||
| 211 | else => unreachable, | 211 | else => unreachable, |
| 212 | // zig fmt: on | 212 | // zig fmt: on |
| ... | @@ -214,42 +214,42 @@ pub const Register = enum(u7) { | ... | @@ -214,42 +214,42 @@ pub const Register = enum(u7) { |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | pub fn id(reg: Register) u6 { | 216 | pub fn id(reg: Register) u6 { |
| 217 | const base = switch (@enumToInt(reg)) { | 217 | const base = switch (@intFromEnum(reg)) { |
| 218 | // zig fmt: off | 218 | // zig fmt: off |
| 219 | @enumToInt(Register.rax) ... @enumToInt(Register.r15) => @enumToInt(Register.rax), | 219 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 220 | @enumToInt(Register.eax) ... @enumToInt(Register.r15d) => @enumToInt(Register.eax), | 220 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| 221 | @enumToInt(Register.ax) ... @enumToInt(Register.r15w) => @enumToInt(Register.ax), | 221 | @intFromEnum(Register.ax) ... @intFromEnum(Register.r15w) => @intFromEnum(Register.ax), |
| 222 | @enumToInt(Register.al) ... @enumToInt(Register.r15b) => @enumToInt(Register.al), | 222 | @intFromEnum(Register.al) ... @intFromEnum(Register.r15b) => @intFromEnum(Register.al), |
| 223 | @enumToInt(Register.ah) ... @enumToInt(Register.bh) => @enumToInt(Register.ah) - 4, | 223 | @intFromEnum(Register.ah) ... @intFromEnum(Register.bh) => @intFromEnum(Register.ah) - 4, |
| 224 | 224 | ||
| 225 | @enumToInt(Register.ymm0) ... @enumToInt(Register.ymm15) => @enumToInt(Register.ymm0) - 16, | 225 | @intFromEnum(Register.ymm0) ... @intFromEnum(Register.ymm15) => @intFromEnum(Register.ymm0) - 16, |
| 226 | @enumToInt(Register.xmm0) ... @enumToInt(Register.xmm15) => @enumToInt(Register.xmm0) - 16, | 226 | @intFromEnum(Register.xmm0) ... @intFromEnum(Register.xmm15) => @intFromEnum(Register.xmm0) - 16, |
| 227 | @enumToInt(Register.mm0) ... @enumToInt(Register.mm7) => @enumToInt(Register.mm0) - 32, | 227 | @intFromEnum(Register.mm0) ... @intFromEnum(Register.mm7) => @intFromEnum(Register.mm0) - 32, |
| 228 | @enumToInt(Register.st0) ... @enumToInt(Register.st7) => @enumToInt(Register.st0) - 40, | 228 | @intFromEnum(Register.st0) ... @intFromEnum(Register.st7) => @intFromEnum(Register.st0) - 40, |
| 229 | 229 | ||
| 230 | @enumToInt(Register.es) ... @enumToInt(Register.gs) => @enumToInt(Register.es) - 48, | 230 | @intFromEnum(Register.es) ... @intFromEnum(Register.gs) => @intFromEnum(Register.es) - 48, |
| 231 | 231 | ||
| 232 | else => unreachable, | 232 | else => unreachable, |
| 233 | // zig fmt: on | 233 | // zig fmt: on |
| 234 | }; | 234 | }; |
| 235 | return @intCast(u6, @enumToInt(reg) - base); | 235 | return @intCast(u6, @intFromEnum(reg) - base); |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | pub fn bitSize(reg: Register) u64 { | 238 | pub fn bitSize(reg: Register) u64 { |
| 239 | return switch (@enumToInt(reg)) { | 239 | return switch (@intFromEnum(reg)) { |
| 240 | // zig fmt: off | 240 | // zig fmt: off |
| 241 | @enumToInt(Register.rax) ... @enumToInt(Register.r15) => 64, | 241 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => 64, |
| 242 | @enumToInt(Register.eax) ... @enumToInt(Register.r15d) => 32, | 242 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => 32, |
| 243 | @enumToInt(Register.ax) ... @enumToInt(Register.r15w) => 16, | 243 | @intFromEnum(Register.ax) ... @intFromEnum(Register.r15w) => 16, |
| 244 | @enumToInt(Register.al) ... @enumToInt(Register.r15b) => 8, | 244 | @intFromEnum(Register.al) ... @intFromEnum(Register.r15b) => 8, |
| 245 | @enumToInt(Register.ah) ... @enumToInt(Register.bh) => 8, | 245 | @intFromEnum(Register.ah) ... @intFromEnum(Register.bh) => 8, |
| 246 | 246 | ||
| 247 | @enumToInt(Register.ymm0) ... @enumToInt(Register.ymm15) => 256, | 247 | @intFromEnum(Register.ymm0) ... @intFromEnum(Register.ymm15) => 256, |
| 248 | @enumToInt(Register.xmm0) ... @enumToInt(Register.xmm15) => 128, | 248 | @intFromEnum(Register.xmm0) ... @intFromEnum(Register.xmm15) => 128, |
| 249 | @enumToInt(Register.mm0) ... @enumToInt(Register.mm7) => 64, | 249 | @intFromEnum(Register.mm0) ... @intFromEnum(Register.mm7) => 64, |
| 250 | @enumToInt(Register.st0) ... @enumToInt(Register.st7) => 80, | 250 | @intFromEnum(Register.st0) ... @intFromEnum(Register.st7) => 80, |
| 251 | 251 | ||
| 252 | @enumToInt(Register.es) ... @enumToInt(Register.gs) => 16, | 252 | @intFromEnum(Register.es) ... @intFromEnum(Register.gs) => 16, |
| 253 | 253 | ||
| 254 | else => unreachable, | 254 | else => unreachable, |
| 255 | // zig fmt: on | 255 | // zig fmt: on |
| ... | @@ -257,15 +257,15 @@ pub const Register = enum(u7) { | ... | @@ -257,15 +257,15 @@ pub const Register = enum(u7) { |
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | pub fn isExtended(reg: Register) bool { | 259 | pub fn isExtended(reg: Register) bool { |
| 260 | return switch (@enumToInt(reg)) { | 260 | return switch (@intFromEnum(reg)) { |
| 261 | // zig fmt: off | 261 | // zig fmt: off |
| 262 | @enumToInt(Register.r8) ... @enumToInt(Register.r15) => true, | 262 | @intFromEnum(Register.r8) ... @intFromEnum(Register.r15) => true, |
| 263 | @enumToInt(Register.r8d) ... @enumToInt(Register.r15d) => true, | 263 | @intFromEnum(Register.r8d) ... @intFromEnum(Register.r15d) => true, |
| 264 | @enumToInt(Register.r8w) ... @enumToInt(Register.r15w) => true, | 264 | @intFromEnum(Register.r8w) ... @intFromEnum(Register.r15w) => true, |
| 265 | @enumToInt(Register.r8b) ... @enumToInt(Register.r15b) => true, | 265 | @intFromEnum(Register.r8b) ... @intFromEnum(Register.r15b) => true, |
| 266 | 266 | ||
| 267 | @enumToInt(Register.ymm8) ... @enumToInt(Register.ymm15) => true, | 267 | @intFromEnum(Register.ymm8) ... @intFromEnum(Register.ymm15) => true, |
| 268 | @enumToInt(Register.xmm8) ... @enumToInt(Register.xmm15) => true, | 268 | @intFromEnum(Register.xmm8) ... @intFromEnum(Register.xmm15) => true, |
| 269 | 269 | ||
| 270 | else => false, | 270 | else => false, |
| 271 | // zig fmt: on | 271 | // zig fmt: on |
| ... | @@ -273,25 +273,25 @@ pub const Register = enum(u7) { | ... | @@ -273,25 +273,25 @@ pub const Register = enum(u7) { |
| 273 | } | 273 | } |
| 274 | 274 | ||
| 275 | pub fn enc(reg: Register) u4 { | 275 | pub fn enc(reg: Register) u4 { |
| 276 | const base = switch (@enumToInt(reg)) { | 276 | const base = switch (@intFromEnum(reg)) { |
| 277 | // zig fmt: off | 277 | // zig fmt: off |
| 278 | @enumToInt(Register.rax) ... @enumToInt(Register.r15) => @enumToInt(Register.rax), | 278 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 279 | @enumToInt(Register.eax) ... @enumToInt(Register.r15d) => @enumToInt(Register.eax), | 279 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| 280 | @enumToInt(Register.ax) ... @enumToInt(Register.r15w) => @enumToInt(Register.ax), | 280 | @intFromEnum(Register.ax) ... @intFromEnum(Register.r15w) => @intFromEnum(Register.ax), |
| 281 | @enumToInt(Register.al) ... @enumToInt(Register.r15b) => @enumToInt(Register.al), | 281 | @intFromEnum(Register.al) ... @intFromEnum(Register.r15b) => @intFromEnum(Register.al), |
| 282 | @enumToInt(Register.ah) ... @enumToInt(Register.bh) => @enumToInt(Register.ah) - 4, | 282 | @intFromEnum(Register.ah) ... @intFromEnum(Register.bh) => @intFromEnum(Register.ah) - 4, |
| 283 | 283 | ||
| 284 | @enumToInt(Register.ymm0) ... @enumToInt(Register.ymm15) => @enumToInt(Register.ymm0), | 284 | @intFromEnum(Register.ymm0) ... @intFromEnum(Register.ymm15) => @intFromEnum(Register.ymm0), |
| 285 | @enumToInt(Register.xmm0) ... @enumToInt(Register.xmm15) => @enumToInt(Register.xmm0), | 285 | @intFromEnum(Register.xmm0) ... @intFromEnum(Register.xmm15) => @intFromEnum(Register.xmm0), |
| 286 | @enumToInt(Register.mm0) ... @enumToInt(Register.mm7) => @enumToInt(Register.mm0), | 286 | @intFromEnum(Register.mm0) ... @intFromEnum(Register.mm7) => @intFromEnum(Register.mm0), |
| 287 | @enumToInt(Register.st0) ... @enumToInt(Register.st7) => @enumToInt(Register.st0), | 287 | @intFromEnum(Register.st0) ... @intFromEnum(Register.st7) => @intFromEnum(Register.st0), |
| 288 | 288 | ||
| 289 | @enumToInt(Register.es) ... @enumToInt(Register.gs) => @enumToInt(Register.es), | 289 | @intFromEnum(Register.es) ... @intFromEnum(Register.gs) => @intFromEnum(Register.es), |
| 290 | 290 | ||
| 291 | else => unreachable, | 291 | else => unreachable, |
| 292 | // zig fmt: on | 292 | // zig fmt: on |
| 293 | }; | 293 | }; |
| 294 | return @truncate(u4, @enumToInt(reg) - base); | 294 | return @truncate(u4, @intFromEnum(reg) - base); |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | pub fn lowEnc(reg: Register) u3 { | 297 | pub fn lowEnc(reg: Register) u3 { |
| ... | @@ -312,49 +312,49 @@ pub const Register = enum(u7) { | ... | @@ -312,49 +312,49 @@ pub const Register = enum(u7) { |
| 312 | 312 | ||
| 313 | fn gpBase(reg: Register) u7 { | 313 | fn gpBase(reg: Register) u7 { |
| 314 | assert(reg.class() == .general_purpose); | 314 | assert(reg.class() == .general_purpose); |
| 315 | return switch (@enumToInt(reg)) { | 315 | return switch (@intFromEnum(reg)) { |
| 316 | // zig fmt: off | 316 | // zig fmt: off |
| 317 | @enumToInt(Register.rax) ... @enumToInt(Register.r15) => @enumToInt(Register.rax), | 317 | @intFromEnum(Register.rax) ... @intFromEnum(Register.r15) => @intFromEnum(Register.rax), |
| 318 | @enumToInt(Register.eax) ... @enumToInt(Register.r15d) => @enumToInt(Register.eax), | 318 | @intFromEnum(Register.eax) ... @intFromEnum(Register.r15d) => @intFromEnum(Register.eax), |
| 319 | @enumToInt(Register.ax) ... @enumToInt(Register.r15w) => @enumToInt(Register.ax), | 319 | @intFromEnum(Register.ax) ... @intFromEnum(Register.r15w) => @intFromEnum(Register.ax), |
| 320 | @enumToInt(Register.al) ... @enumToInt(Register.r15b) => @enumToInt(Register.al), | 320 | @intFromEnum(Register.al) ... @intFromEnum(Register.r15b) => @intFromEnum(Register.al), |
| 321 | @enumToInt(Register.ah) ... @enumToInt(Register.bh) => @enumToInt(Register.ah) - 4, | 321 | @intFromEnum(Register.ah) ... @intFromEnum(Register.bh) => @intFromEnum(Register.ah) - 4, |
| 322 | else => unreachable, | 322 | else => unreachable, |
| 323 | // zig fmt: on | 323 | // zig fmt: on |
| 324 | }; | 324 | }; |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | pub fn to64(reg: Register) Register { | 327 | pub fn to64(reg: Register) Register { |
| 328 | return @intToEnum(Register, @enumToInt(reg) - reg.gpBase() + @enumToInt(Register.rax)); | 328 | return @enumFromInt(Register, @intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.rax)); |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | pub fn to32(reg: Register) Register { | 331 | pub fn to32(reg: Register) Register { |
| 332 | return @intToEnum(Register, @enumToInt(reg) - reg.gpBase() + @enumToInt(Register.eax)); | 332 | return @enumFromInt(Register, @intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.eax)); |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | pub fn to16(reg: Register) Register { | 335 | pub fn to16(reg: Register) Register { |
| 336 | return @intToEnum(Register, @enumToInt(reg) - reg.gpBase() + @enumToInt(Register.ax)); | 336 | return @enumFromInt(Register, @intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.ax)); |
| 337 | } | 337 | } |
| 338 | 338 | ||
| 339 | pub fn to8(reg: Register) Register { | 339 | pub fn to8(reg: Register) Register { |
| 340 | return @intToEnum(Register, @enumToInt(reg) - reg.gpBase() + @enumToInt(Register.al)); | 340 | return @enumFromInt(Register, @intFromEnum(reg) - reg.gpBase() + @intFromEnum(Register.al)); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | fn sseBase(reg: Register) u7 { | 343 | fn sseBase(reg: Register) u7 { |
| 344 | assert(reg.class() == .sse); | 344 | assert(reg.class() == .sse); |
| 345 | return switch (@enumToInt(reg)) { | 345 | return switch (@intFromEnum(reg)) { |
| 346 | @enumToInt(Register.ymm0)...@enumToInt(Register.ymm15) => @enumToInt(Register.ymm0), | 346 | @intFromEnum(Register.ymm0)...@intFromEnum(Register.ymm15) => @intFromEnum(Register.ymm0), |
| 347 | @enumToInt(Register.xmm0)...@enumToInt(Register.xmm15) => @enumToInt(Register.xmm0), | 347 | @intFromEnum(Register.xmm0)...@intFromEnum(Register.xmm15) => @intFromEnum(Register.xmm0), |
| 348 | else => unreachable, | 348 | else => unreachable, |
| 349 | }; | 349 | }; |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | pub fn to256(reg: Register) Register { | 352 | pub fn to256(reg: Register) Register { |
| 353 | return @intToEnum(Register, @enumToInt(reg) - reg.sseBase() + @enumToInt(Register.ymm0)); | 353 | return @enumFromInt(Register, @intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.ymm0)); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | pub fn to128(reg: Register) Register { | 356 | pub fn to128(reg: Register) Register { |
| 357 | return @intToEnum(Register, @enumToInt(reg) - reg.sseBase() + @enumToInt(Register.xmm0)); | 357 | return @enumFromInt(Register, @intFromEnum(reg) - reg.sseBase() + @intFromEnum(Register.xmm0)); |
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | /// DWARF register encoding | 360 | /// DWARF register encoding |
| ... | @@ -421,7 +421,7 @@ pub const FrameIndex = enum(u32) { | ... | @@ -421,7 +421,7 @@ pub const FrameIndex = enum(u32) { |
| 421 | pub const named_count = @typeInfo(FrameIndex).Enum.fields.len; | 421 | pub const named_count = @typeInfo(FrameIndex).Enum.fields.len; |
| 422 | 422 | ||
| 423 | pub fn isNamed(fi: FrameIndex) bool { | 423 | pub fn isNamed(fi: FrameIndex) bool { |
| 424 | return @enumToInt(fi) < named_count; | 424 | return @intFromEnum(fi) < named_count; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | pub fn format( | 427 | pub fn format( |
| ... | @@ -436,7 +436,7 @@ pub const FrameIndex = enum(u32) { | ... | @@ -436,7 +436,7 @@ pub const FrameIndex = enum(u32) { |
| 436 | try writer.writeAll(@tagName(fi)); | 436 | try writer.writeAll(@tagName(fi)); |
| 437 | } else { | 437 | } else { |
| 438 | try writer.writeByte('('); | 438 | try writer.writeByte('('); |
| 439 | try std.fmt.formatType(@enumToInt(fi), fmt, options, writer, 0); | 439 | try std.fmt.formatType(@intFromEnum(fi), fmt, options, writer, 0); |
| 440 | try writer.writeByte(')'); | 440 | try writer.writeByte(')'); |
| 441 | } | 441 | } |
| 442 | } | 442 | } |
src/arch/x86_64/encoder.zig+11-11| ... | @@ -267,7 +267,7 @@ pub const Instruction = struct { | ... | @@ -267,7 +267,7 @@ pub const Instruction = struct { |
| 267 | 267 | ||
| 268 | fn encodeOpcode(inst: Instruction, encoder: anytype) !void { | 268 | fn encodeOpcode(inst: Instruction, encoder: anytype) !void { |
| 269 | const opcode = inst.encoding.opcode(); | 269 | const opcode = inst.encoding.opcode(); |
| 270 | const first = @boolToInt(inst.encoding.mandatoryPrefix() != null); | 270 | const first = @intFromBool(inst.encoding.mandatoryPrefix() != null); |
| 271 | const final = opcode.len - 1; | 271 | const final = opcode.len - 1; |
| 272 | for (opcode[first..final]) |byte| try encoder.opcode_1byte(byte); | 272 | for (opcode[first..final]) |byte| try encoder.opcode_1byte(byte); |
| 273 | switch (inst.encoding.data.op_en) { | 273 | switch (inst.encoding.data.op_en) { |
| ... | @@ -647,25 +647,25 @@ fn Encoder(comptime T: type, comptime opts: Options) type { | ... | @@ -647,25 +647,25 @@ fn Encoder(comptime T: type, comptime opts: Options) type { |
| 647 | try self.writer.writeByte(0b1100_0100); | 647 | try self.writer.writeByte(0b1100_0100); |
| 648 | 648 | ||
| 649 | try self.writer.writeByte( | 649 | try self.writer.writeByte( |
| 650 | @as(u8, ~@boolToInt(fields.r)) << 7 | | 650 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 651 | @as(u8, ~@boolToInt(fields.x)) << 6 | | 651 | @as(u8, ~@intFromBool(fields.x)) << 6 | |
| 652 | @as(u8, ~@boolToInt(fields.b)) << 5 | | 652 | @as(u8, ~@intFromBool(fields.b)) << 5 | |
| 653 | @as(u8, @enumToInt(fields.m)) << 0, | 653 | @as(u8, @intFromEnum(fields.m)) << 0, |
| 654 | ); | 654 | ); |
| 655 | 655 | ||
| 656 | try self.writer.writeByte( | 656 | try self.writer.writeByte( |
| 657 | @as(u8, @boolToInt(fields.w)) << 7 | | 657 | @as(u8, @intFromBool(fields.w)) << 7 | |
| 658 | @as(u8, ~fields.v.enc()) << 3 | | 658 | @as(u8, ~fields.v.enc()) << 3 | |
| 659 | @as(u8, @boolToInt(fields.l)) << 2 | | 659 | @as(u8, @intFromBool(fields.l)) << 2 | |
| 660 | @as(u8, @enumToInt(fields.p)) << 0, | 660 | @as(u8, @intFromEnum(fields.p)) << 0, |
| 661 | ); | 661 | ); |
| 662 | } else { | 662 | } else { |
| 663 | try self.writer.writeByte(0b1100_0101); | 663 | try self.writer.writeByte(0b1100_0101); |
| 664 | try self.writer.writeByte( | 664 | try self.writer.writeByte( |
| 665 | @as(u8, ~@boolToInt(fields.r)) << 7 | | 665 | @as(u8, ~@intFromBool(fields.r)) << 7 | |
| 666 | @as(u8, ~fields.v.enc()) << 3 | | 666 | @as(u8, ~fields.v.enc()) << 3 | |
| 667 | @as(u8, @boolToInt(fields.l)) << 2 | | 667 | @as(u8, @intFromBool(fields.l)) << 2 | |
| 668 | @as(u8, @enumToInt(fields.p)) << 0, | 668 | @as(u8, @intFromEnum(fields.p)) << 0, |
| 669 | ); | 669 | ); |
| 670 | } | 670 | } |
| 671 | } | 671 | } |
src/clang.zig+1-1| ... | @@ -1448,7 +1448,7 @@ pub const CK = enum(c_int) { | ... | @@ -1448,7 +1448,7 @@ pub const CK = enum(c_int) { |
| 1448 | IntegralToBoolean, | 1448 | IntegralToBoolean, |
| 1449 | IntegralToFloating, | 1449 | IntegralToFloating, |
| 1450 | FloatingToFixedPoint, | 1450 | FloatingToFixedPoint, |
| 1451 | FixedPointToFloating, | 1451 | FixedPofloatFromInting, |
| 1452 | FixedPointCast, | 1452 | FixedPointCast, |
| 1453 | FixedPointToIntegral, | 1453 | FixedPointToIntegral, |
| 1454 | IntegralToFixedPoint, | 1454 | IntegralToFixedPoint, |
src/codegen.zig+4-4| ... | @@ -381,7 +381,7 @@ pub fn generateSymbol( | ... | @@ -381,7 +381,7 @@ pub fn generateSymbol( |
| 381 | .fail => |em| return Result{ .fail = em }, | 381 | .fail => |em| return Result{ .fail = em }, |
| 382 | } | 382 | } |
| 383 | } | 383 | } |
| 384 | try code.writer().writeByte(@boolToInt(payload_val != null)); | 384 | try code.writer().writeByte(@intFromBool(payload_val != null)); |
| 385 | try code.writer().writeByteNTimes(0, padding); | 385 | try code.writer().writeByteNTimes(0, padding); |
| 386 | } | 386 | } |
| 387 | }, | 387 | }, |
| ... | @@ -391,7 +391,7 @@ pub fn generateSymbol( | ... | @@ -391,7 +391,7 @@ pub fn generateSymbol( |
| 391 | .elems, .repeated_elem => { | 391 | .elems, .repeated_elem => { |
| 392 | var index: u64 = 0; | 392 | var index: u64 = 0; |
| 393 | var len_including_sentinel = | 393 | var len_including_sentinel = |
| 394 | array_type.len + @boolToInt(array_type.sentinel != .none); | 394 | array_type.len + @intFromBool(array_type.sentinel != .none); |
| 395 | while (index < len_including_sentinel) : (index += 1) { | 395 | while (index < len_including_sentinel) : (index += 1) { |
| 396 | switch (try generateSymbol(bin_file, src_loc, .{ | 396 | switch (try generateSymbol(bin_file, src_loc, .{ |
| 397 | .ty = array_type.child.toType(), | 397 | .ty = array_type.child.toType(), |
| ... | @@ -952,7 +952,7 @@ pub fn genTypedValue( | ... | @@ -952,7 +952,7 @@ pub fn genTypedValue( |
| 952 | } | 952 | } |
| 953 | }, | 953 | }, |
| 954 | .Bool => { | 954 | .Bool => { |
| 955 | return GenResult.mcv(.{ .immediate = @boolToInt(typed_value.val.toBool()) }); | 955 | return GenResult.mcv(.{ .immediate = @intFromBool(typed_value.val.toBool()) }); |
| 956 | }, | 956 | }, |
| 957 | .Optional => { | 957 | .Optional => { |
| 958 | if (typed_value.ty.isPtrLikeOptional(mod)) { | 958 | if (typed_value.ty.isPtrLikeOptional(mod)) { |
| ... | @@ -961,7 +961,7 @@ pub fn genTypedValue( | ... | @@ -961,7 +961,7 @@ pub fn genTypedValue( |
| 961 | .val = typed_value.val.optionalValue(mod) orelse return GenResult.mcv(.{ .immediate = 0 }), | 961 | .val = typed_value.val.optionalValue(mod) orelse return GenResult.mcv(.{ .immediate = 0 }), |
| 962 | }, owner_decl_index); | 962 | }, owner_decl_index); |
| 963 | } else if (typed_value.ty.abiSize(mod) == 1) { | 963 | } else if (typed_value.ty.abiSize(mod) == 1) { |
| 964 | return GenResult.mcv(.{ .immediate = @boolToInt(!typed_value.val.isNull(mod)) }); | 964 | return GenResult.mcv(.{ .immediate = @intFromBool(!typed_value.val.isNull(mod)) }); |
| 965 | } | 965 | } |
| 966 | }, | 966 | }, |
| 967 | .Enum => { | 967 | .Enum => { |
src/codegen/c.zig+8-8| ... | @@ -462,7 +462,7 @@ pub const Function = struct { | ... | @@ -462,7 +462,7 @@ pub const Function = struct { |
| 462 | => |owner_decl| try std.fmt.allocPrint(arena, "zig_{s}_{}__{d}", .{ | 462 | => |owner_decl| try std.fmt.allocPrint(arena, "zig_{s}_{}__{d}", .{ |
| 463 | @tagName(key), | 463 | @tagName(key), |
| 464 | fmtIdent(mod.intern_pool.stringToSlice(mod.declPtr(owner_decl).name)), | 464 | fmtIdent(mod.intern_pool.stringToSlice(mod.declPtr(owner_decl).name)), |
| 465 | @enumToInt(owner_decl), | 465 | @intFromEnum(owner_decl), |
| 466 | }), | 466 | }), |
| 467 | }, | 467 | }, |
| 468 | .data = switch (key) { | 468 | .data = switch (key) { |
| ... | @@ -1865,7 +1865,7 @@ pub const DeclGen = struct { | ... | @@ -1865,7 +1865,7 @@ pub const DeclGen = struct { |
| 1865 | }; | 1865 | }; |
| 1866 | try writer.print("{}__{d}", .{ | 1866 | try writer.print("{}__{d}", .{ |
| 1867 | fmtIdent(name_stream.getWritten()), | 1867 | fmtIdent(name_stream.getWritten()), |
| 1868 | @enumToInt(decl_index), | 1868 | @intFromEnum(decl_index), |
| 1869 | }); | 1869 | }); |
| 1870 | } | 1870 | } |
| 1871 | } | 1871 | } |
| ... | @@ -1991,7 +1991,7 @@ fn renderTypeName( | ... | @@ -1991,7 +1991,7 @@ fn renderTypeName( |
| 1991 | @tagName(tag)["fwd_".len..], | 1991 | @tagName(tag)["fwd_".len..], |
| 1992 | attributes, | 1992 | attributes, |
| 1993 | fmtIdent(mod.intern_pool.stringToSlice(mod.declPtr(owner_decl).name)), | 1993 | fmtIdent(mod.intern_pool.stringToSlice(mod.declPtr(owner_decl).name)), |
| 1994 | @enumToInt(owner_decl), | 1994 | @intFromEnum(owner_decl), |
| 1995 | }); | 1995 | }); |
| 1996 | }, | 1996 | }, |
| 1997 | } | 1997 | } |
| ... | @@ -2100,7 +2100,7 @@ fn renderTypePrefix( | ... | @@ -2100,7 +2100,7 @@ fn renderTypePrefix( |
| 2100 | .fwd_anon_struct, | 2100 | .fwd_anon_struct, |
| 2101 | .fwd_anon_union, | 2101 | .fwd_anon_union, |
| 2102 | => if (decl.unwrap()) |decl_index| | 2102 | => if (decl.unwrap()) |decl_index| |
| 2103 | try w.print("anon__{d}_{d}", .{ @enumToInt(decl_index), idx }) | 2103 | try w.print("anon__{d}_{d}", .{ @intFromEnum(decl_index), idx }) |
| 2104 | else | 2104 | else |
| 2105 | try renderTypeName(mod, w, idx, cty, ""), | 2105 | try renderTypeName(mod, w, idx, cty, ""), |
| 2106 | 2106 | ||
| ... | @@ -2514,7 +2514,7 @@ pub fn genLazyFn(o: *Object, lazy_fn: LazyFnMap.Entry) !void { | ... | @@ -2514,7 +2514,7 @@ pub fn genLazyFn(o: *Object, lazy_fn: LazyFnMap.Entry) !void { |
| 2514 | const name = mod.intern_pool.stringToSlice(name_ip); | 2514 | const name = mod.intern_pool.stringToSlice(name_ip); |
| 2515 | const tag_val = try mod.enumValueFieldIndex(enum_ty, index); | 2515 | const tag_val = try mod.enumValueFieldIndex(enum_ty, index); |
| 2516 | 2516 | ||
| 2517 | const int_val = try tag_val.enumToInt(enum_ty, mod); | 2517 | const int_val = try tag_val.intFromEnum(enum_ty, mod); |
| 2518 | 2518 | ||
| 2519 | const name_ty = try mod.arrayType(.{ | 2519 | const name_ty = try mod.arrayType(.{ |
| 2520 | .len = name.len, | 2520 | .len = name.len, |
| ... | @@ -4701,7 +4701,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -4701,7 +4701,7 @@ fn airSwitchBr(f: *Function, inst: Air.Inst.Index) !CValue { |
| 4701 | 4701 | ||
| 4702 | // On the final iteration we do not need to fix any state. This is because, like in the `else` | 4702 | // On the final iteration we do not need to fix any state. This is because, like in the `else` |
| 4703 | // branch of a `cond_br`, our parent has to do it for this entire body anyway. | 4703 | // branch of a `cond_br`, our parent has to do it for this entire body anyway. |
| 4704 | const last_case_i = switch_br.data.cases_len - @boolToInt(switch_br.data.else_body_len == 0); | 4704 | const last_case_i = switch_br.data.cases_len - @intFromBool(switch_br.data.else_body_len == 0); |
| 4705 | 4705 | ||
| 4706 | var extra_index: usize = switch_br.end; | 4706 | var extra_index: usize = switch_br.end; |
| 4707 | for (0..switch_br.data.cases_len) |case_i| { | 4707 | for (0..switch_br.data.cases_len) |case_i| { |
| ... | @@ -6894,7 +6894,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6894,7 +6894,7 @@ fn airUnionInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6894 | 6894 | ||
| 6895 | const tag_val = try mod.enumValueFieldIndex(tag_ty, field_index); | 6895 | const tag_val = try mod.enumValueFieldIndex(tag_ty, field_index); |
| 6896 | 6896 | ||
| 6897 | const int_val = try tag_val.enumToInt(tag_ty, mod); | 6897 | const int_val = try tag_val.intFromEnum(tag_ty, mod); |
| 6898 | 6898 | ||
| 6899 | const a = try Assignment.start(f, writer, tag_ty); | 6899 | const a = try Assignment.start(f, writer, tag_ty); |
| 6900 | try f.writeCValueMember(writer, local, .{ .identifier = "tag" }); | 6900 | try f.writeCValueMember(writer, local, .{ .identifier = "tag" }); |
| ... | @@ -6924,7 +6924,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { | ... | @@ -6924,7 +6924,7 @@ fn airPrefetch(f: *Function, inst: Air.Inst.Index) !CValue { |
| 6924 | .data => { | 6924 | .data => { |
| 6925 | try writer.writeAll("zig_prefetch("); | 6925 | try writer.writeAll("zig_prefetch("); |
| 6926 | try f.writeCValue(writer, ptr, .FunctionArgument); | 6926 | try f.writeCValue(writer, ptr, .FunctionArgument); |
| 6927 | try writer.print(", {d}, {d});\n", .{ @enumToInt(prefetch.rw), prefetch.locality }); | 6927 | try writer.print(", {d}, {d});\n", .{ @intFromEnum(prefetch.rw), prefetch.locality }); |
| 6928 | }, | 6928 | }, |
| 6929 | // The available prefetch intrinsics do not accept a cache argument; only | 6929 | // The available prefetch intrinsics do not accept a cache argument; only |
| 6930 | // address, rw, and locality. | 6930 | // address, rw, and locality. |
src/codegen/c/type.zig+5-5| ... | @@ -129,15 +129,15 @@ pub const CType = extern union { | ... | @@ -129,15 +129,15 @@ pub const CType = extern union { |
| 129 | varargs_function, | 129 | varargs_function, |
| 130 | 130 | ||
| 131 | pub const last_no_payload_tag = Tag.zig_c_longdouble; | 131 | pub const last_no_payload_tag = Tag.zig_c_longdouble; |
| 132 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; | 132 | pub const no_payload_count = @intFromEnum(last_no_payload_tag) + 1; |
| 133 | 133 | ||
| 134 | pub fn hasPayload(self: Tag) bool { | 134 | pub fn hasPayload(self: Tag) bool { |
| 135 | return @enumToInt(self) >= no_payload_count; | 135 | return @intFromEnum(self) >= no_payload_count; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | pub fn toIndex(self: Tag) Index { | 138 | pub fn toIndex(self: Tag) Index { |
| 139 | assert(!self.hasPayload()); | 139 | assert(!self.hasPayload()); |
| 140 | return @intCast(Index, @enumToInt(self)); | 140 | return @intCast(Index, @intFromEnum(self)); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | pub fn Type(comptime self: Tag) type { | 143 | pub fn Type(comptime self: Tag) type { |
| ... | @@ -334,7 +334,7 @@ pub const CType = extern union { | ... | @@ -334,7 +334,7 @@ pub const CType = extern union { |
| 334 | map: Map = .{}, | 334 | map: Map = .{}, |
| 335 | 335 | ||
| 336 | pub fn indexToCType(self: Set, index: Index) CType { | 336 | pub fn indexToCType(self: Set, index: Index) CType { |
| 337 | if (index < Tag.no_payload_count) return initTag(@intToEnum(Tag, index)); | 337 | if (index < Tag.no_payload_count) return initTag(@enumFromInt(Tag, index)); |
| 338 | return self.map.keys()[index - Tag.no_payload_count]; | 338 | return self.map.keys()[index - Tag.no_payload_count]; |
| 339 | } | 339 | } |
| 340 | 340 | ||
| ... | @@ -370,7 +370,7 @@ pub const CType = extern union { | ... | @@ -370,7 +370,7 @@ pub const CType = extern union { |
| 370 | 370 | ||
| 371 | pub fn cTypeToIndex(self: *Promoted, cty: CType) Allocator.Error!Index { | 371 | pub fn cTypeToIndex(self: *Promoted, cty: CType) Allocator.Error!Index { |
| 372 | const t = cty.tag(); | 372 | const t = cty.tag(); |
| 373 | if (@enumToInt(t) < Tag.no_payload_count) return @intCast(Index, @enumToInt(t)); | 373 | if (@intFromEnum(t) < Tag.no_payload_count) return @intCast(Index, @intFromEnum(t)); |
| 374 | 374 | ||
| 375 | const gop = try self.set.map.getOrPutContext(self.gpa(), cty, .{ .store = &self.set }); | 375 | const gop = try self.set.map.getOrPutContext(self.gpa(), cty, .{ .store = &self.set }); |
| 376 | if (!gop.found_existing) gop.key_ptr.* = cty; | 376 | if (!gop.found_existing) gop.key_ptr.* = cty; |
src/codegen/llvm.zig+41-41| ... | @@ -949,7 +949,7 @@ pub const Object = struct { | ... | @@ -949,7 +949,7 @@ pub const Object = struct { |
| 949 | mod.comp.bin_file.options.error_return_tracing; | 949 | mod.comp.bin_file.options.error_return_tracing; |
| 950 | 950 | ||
| 951 | const err_ret_trace = if (err_return_tracing) | 951 | const err_ret_trace = if (err_return_tracing) |
| 952 | llvm_func.getParam(@boolToInt(ret_ptr != null)) | 952 | llvm_func.getParam(@intFromBool(ret_ptr != null)) |
| 953 | else | 953 | else |
| 954 | null; | 954 | null; |
| 955 | 955 | ||
| ... | @@ -960,7 +960,7 @@ pub const Object = struct { | ... | @@ -960,7 +960,7 @@ pub const Object = struct { |
| 960 | defer args.deinit(); | 960 | defer args.deinit(); |
| 961 | 961 | ||
| 962 | { | 962 | { |
| 963 | var llvm_arg_i = @as(c_uint, @boolToInt(ret_ptr != null)) + @boolToInt(err_return_tracing); | 963 | var llvm_arg_i = @as(c_uint, @intFromBool(ret_ptr != null)) + @intFromBool(err_return_tracing); |
| 964 | var it = iterateParamTypes(&dg, fn_info); | 964 | var it = iterateParamTypes(&dg, fn_info); |
| 965 | while (it.next()) |lowering| switch (lowering) { | 965 | while (it.next()) |lowering| switch (lowering) { |
| 966 | .no_bits => continue, | 966 | .no_bits => continue, |
| ... | @@ -2570,7 +2570,7 @@ pub const DeclGen = struct { | ... | @@ -2570,7 +2570,7 @@ pub const DeclGen = struct { |
| 2570 | mod.comp.bin_file.options.error_return_tracing; | 2570 | mod.comp.bin_file.options.error_return_tracing; |
| 2571 | 2571 | ||
| 2572 | if (err_return_tracing) { | 2572 | if (err_return_tracing) { |
| 2573 | dg.addArgAttr(llvm_fn, @boolToInt(sret), "nonnull"); | 2573 | dg.addArgAttr(llvm_fn, @intFromBool(sret), "nonnull"); |
| 2574 | } | 2574 | } |
| 2575 | 2575 | ||
| 2576 | switch (fn_info.cc) { | 2576 | switch (fn_info.cc) { |
| ... | @@ -2604,8 +2604,8 @@ pub const DeclGen = struct { | ... | @@ -2604,8 +2604,8 @@ pub const DeclGen = struct { |
| 2604 | // because functions with bodies are handled in `updateFunc`. | 2604 | // because functions with bodies are handled in `updateFunc`. |
| 2605 | if (is_extern) { | 2605 | if (is_extern) { |
| 2606 | var it = iterateParamTypes(dg, fn_info); | 2606 | var it = iterateParamTypes(dg, fn_info); |
| 2607 | it.llvm_index += @boolToInt(sret); | 2607 | it.llvm_index += @intFromBool(sret); |
| 2608 | it.llvm_index += @boolToInt(err_return_tracing); | 2608 | it.llvm_index += @intFromBool(err_return_tracing); |
| 2609 | while (it.next()) |lowering| switch (lowering) { | 2609 | while (it.next()) |lowering| switch (lowering) { |
| 2610 | .byval => { | 2610 | .byval => { |
| 2611 | const param_index = it.zig_index - 1; | 2611 | const param_index = it.zig_index - 1; |
| ... | @@ -2812,7 +2812,7 @@ pub const DeclGen = struct { | ... | @@ -2812,7 +2812,7 @@ pub const DeclGen = struct { |
| 2812 | const elem_ty = t.childType(mod); | 2812 | const elem_ty = t.childType(mod); |
| 2813 | if (std.debug.runtime_safety) assert((try elem_ty.onePossibleValue(mod)) == null); | 2813 | if (std.debug.runtime_safety) assert((try elem_ty.onePossibleValue(mod)) == null); |
| 2814 | const elem_llvm_ty = try dg.lowerType(elem_ty); | 2814 | const elem_llvm_ty = try dg.lowerType(elem_ty); |
| 2815 | const total_len = t.arrayLen(mod) + @boolToInt(t.sentinel(mod) != null); | 2815 | const total_len = t.arrayLen(mod) + @intFromBool(t.sentinel(mod) != null); |
| 2816 | return elem_llvm_ty.arrayType(@intCast(c_uint, total_len)); | 2816 | return elem_llvm_ty.arrayType(@intCast(c_uint, total_len)); |
| 2817 | }, | 2817 | }, |
| 2818 | .Vector => { | 2818 | .Vector => { |
| ... | @@ -3307,7 +3307,7 @@ pub const DeclGen = struct { | ... | @@ -3307,7 +3307,7 @@ pub const DeclGen = struct { |
| 3307 | } | 3307 | } |
| 3308 | }, | 3308 | }, |
| 3309 | .enum_tag => { | 3309 | .enum_tag => { |
| 3310 | const int_val = try tv.enumToInt(mod); | 3310 | const int_val = try tv.intFromEnum(mod); |
| 3311 | 3311 | ||
| 3312 | var bigint_space: Value.BigIntSpace = undefined; | 3312 | var bigint_space: Value.BigIntSpace = undefined; |
| 3313 | const bigint = int_val.toBigInt(&bigint_space, mod); | 3313 | const bigint = int_val.toBigInt(&bigint_space, mod); |
| ... | @@ -3476,7 +3476,7 @@ pub const DeclGen = struct { | ... | @@ -3476,7 +3476,7 @@ pub const DeclGen = struct { |
| 3476 | const elem_ty = tv.ty.childType(mod); | 3476 | const elem_ty = tv.ty.childType(mod); |
| 3477 | const sentinel = tv.ty.sentinel(mod); | 3477 | const sentinel = tv.ty.sentinel(mod); |
| 3478 | const len = @intCast(usize, tv.ty.arrayLen(mod)); | 3478 | const len = @intCast(usize, tv.ty.arrayLen(mod)); |
| 3479 | const len_including_sent = len + @boolToInt(sentinel != null); | 3479 | const len_including_sent = len + @intFromBool(sentinel != null); |
| 3480 | const gpa = dg.gpa; | 3480 | const gpa = dg.gpa; |
| 3481 | const llvm_elems = try gpa.alloc(*llvm.Value, len_including_sent); | 3481 | const llvm_elems = try gpa.alloc(*llvm.Value, len_including_sent); |
| 3482 | defer gpa.free(llvm_elems); | 3482 | defer gpa.free(llvm_elems); |
| ... | @@ -3923,7 +3923,7 @@ pub const DeclGen = struct { | ... | @@ -3923,7 +3923,7 @@ pub const DeclGen = struct { |
| 3923 | const llvm_pl_index = if (layout.tag_size == 0) | 3923 | const llvm_pl_index = if (layout.tag_size == 0) |
| 3924 | 0 | 3924 | 0 |
| 3925 | else | 3925 | else |
| 3926 | @boolToInt(layout.tag_align >= layout.payload_align); | 3926 | @intFromBool(layout.tag_align >= layout.payload_align); |
| 3927 | const indices: [2]*llvm.Value = .{ | 3927 | const indices: [2]*llvm.Value = .{ |
| 3928 | llvm_u32.constInt(0, .False), | 3928 | llvm_u32.constInt(0, .False), |
| 3929 | llvm_u32.constInt(llvm_pl_index, .False), | 3929 | llvm_u32.constInt(llvm_pl_index, .False), |
| ... | @@ -3959,7 +3959,7 @@ pub const DeclGen = struct { | ... | @@ -3959,7 +3959,7 @@ pub const DeclGen = struct { |
| 3959 | }; | 3959 | }; |
| 3960 | return parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len); | 3960 | return parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len); |
| 3961 | } else { | 3961 | } else { |
| 3962 | const llvm_index = llvm_u32.constInt(@boolToInt(parent_ty.hasRuntimeBitsIgnoreComptime(mod)), .False); | 3962 | const llvm_index = llvm_u32.constInt(@intFromBool(parent_ty.hasRuntimeBitsIgnoreComptime(mod)), .False); |
| 3963 | const indices: [1]*llvm.Value = .{llvm_index}; | 3963 | const indices: [1]*llvm.Value = .{llvm_index}; |
| 3964 | return parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len); | 3964 | return parent_llvm_ty.constInBoundsGEP(parent_llvm_ptr, &indices, indices.len); |
| 3965 | } | 3965 | } |
| ... | @@ -4762,8 +4762,8 @@ pub const FuncGen = struct { | ... | @@ -4762,8 +4762,8 @@ pub const FuncGen = struct { |
| 4762 | if (callee_ty.zigTypeTag(mod) == .Pointer) { | 4762 | if (callee_ty.zigTypeTag(mod) == .Pointer) { |
| 4763 | // Add argument attributes for function pointer calls. | 4763 | // Add argument attributes for function pointer calls. |
| 4764 | it = iterateParamTypes(self.dg, fn_info); | 4764 | it = iterateParamTypes(self.dg, fn_info); |
| 4765 | it.llvm_index += @boolToInt(sret); | 4765 | it.llvm_index += @intFromBool(sret); |
| 4766 | it.llvm_index += @boolToInt(err_return_tracing); | 4766 | it.llvm_index += @intFromBool(err_return_tracing); |
| 4767 | while (it.next()) |lowering| switch (lowering) { | 4767 | while (it.next()) |lowering| switch (lowering) { |
| 4768 | .byval => { | 4768 | .byval => { |
| 4769 | const param_index = it.zig_index - 1; | 4769 | const param_index = it.zig_index - 1; |
| ... | @@ -5857,7 +5857,7 @@ pub const FuncGen = struct { | ... | @@ -5857,7 +5857,7 @@ pub const FuncGen = struct { |
| 5857 | .Union => { | 5857 | .Union => { |
| 5858 | const union_llvm_ty = try self.dg.lowerType(struct_ty); | 5858 | const union_llvm_ty = try self.dg.lowerType(struct_ty); |
| 5859 | const layout = struct_ty.unionGetLayout(mod); | 5859 | const layout = struct_ty.unionGetLayout(mod); |
| 5860 | const payload_index = @boolToInt(layout.tag_align >= layout.payload_align); | 5860 | const payload_index = @intFromBool(layout.tag_align >= layout.payload_align); |
| 5861 | const field_ptr = self.builder.buildStructGEP(union_llvm_ty, struct_llvm_val, payload_index, ""); | 5861 | const field_ptr = self.builder.buildStructGEP(union_llvm_ty, struct_llvm_val, payload_index, ""); |
| 5862 | const llvm_field_ty = try self.dg.lowerType(field_ty); | 5862 | const llvm_field_ty = try self.dg.lowerType(field_ty); |
| 5863 | if (isByRef(field_ty, mod)) { | 5863 | if (isByRef(field_ty, mod)) { |
| ... | @@ -8444,7 +8444,7 @@ pub const FuncGen = struct { | ... | @@ -8444,7 +8444,7 @@ pub const FuncGen = struct { |
| 8444 | return null; | 8444 | return null; |
| 8445 | } | 8445 | } |
| 8446 | const un_llvm_ty = try self.dg.lowerType(un_ty); | 8446 | const un_llvm_ty = try self.dg.lowerType(un_ty); |
| 8447 | const tag_index = @boolToInt(layout.tag_align < layout.payload_align); | 8447 | const tag_index = @intFromBool(layout.tag_align < layout.payload_align); |
| 8448 | const tag_field_ptr = self.builder.buildStructGEP(un_llvm_ty, union_ptr, tag_index, ""); | 8448 | const tag_field_ptr = self.builder.buildStructGEP(un_llvm_ty, union_ptr, tag_index, ""); |
| 8449 | // TODO alignment on this store | 8449 | // TODO alignment on this store |
| 8450 | _ = self.builder.buildStore(new_tag, tag_field_ptr); | 8450 | _ = self.builder.buildStore(new_tag, tag_field_ptr); |
| ... | @@ -8463,14 +8463,14 @@ pub const FuncGen = struct { | ... | @@ -8463,14 +8463,14 @@ pub const FuncGen = struct { |
| 8463 | if (layout.payload_size == 0) { | 8463 | if (layout.payload_size == 0) { |
| 8464 | return self.builder.buildLoad(llvm_un_ty, union_handle, ""); | 8464 | return self.builder.buildLoad(llvm_un_ty, union_handle, ""); |
| 8465 | } | 8465 | } |
| 8466 | const tag_index = @boolToInt(layout.tag_align < layout.payload_align); | 8466 | const tag_index = @intFromBool(layout.tag_align < layout.payload_align); |
| 8467 | const tag_field_ptr = self.builder.buildStructGEP(llvm_un_ty, union_handle, tag_index, ""); | 8467 | const tag_field_ptr = self.builder.buildStructGEP(llvm_un_ty, union_handle, tag_index, ""); |
| 8468 | return self.builder.buildLoad(llvm_un_ty.structGetTypeAtIndex(tag_index), tag_field_ptr, ""); | 8468 | return self.builder.buildLoad(llvm_un_ty.structGetTypeAtIndex(tag_index), tag_field_ptr, ""); |
| 8469 | } else { | 8469 | } else { |
| 8470 | if (layout.payload_size == 0) { | 8470 | if (layout.payload_size == 0) { |
| 8471 | return union_handle; | 8471 | return union_handle; |
| 8472 | } | 8472 | } |
| 8473 | const tag_index = @boolToInt(layout.tag_align < layout.payload_align); | 8473 | const tag_index = @intFromBool(layout.tag_align < layout.payload_align); |
| 8474 | return self.builder.buildExtractValue(union_handle, tag_index, ""); | 8474 | return self.builder.buildExtractValue(union_handle, tag_index, ""); |
| 8475 | } | 8475 | } |
| 8476 | } | 8476 | } |
| ... | @@ -9206,7 +9206,7 @@ pub const FuncGen = struct { | ... | @@ -9206,7 +9206,7 @@ pub const FuncGen = struct { |
| 9206 | const union_field_name = union_obj.fields.keys()[extra.field_index]; | 9206 | const union_field_name = union_obj.fields.keys()[extra.field_index]; |
| 9207 | const enum_field_index = tag_ty.enumFieldIndex(union_field_name, mod).?; | 9207 | const enum_field_index = tag_ty.enumFieldIndex(union_field_name, mod).?; |
| 9208 | const tag_val = try mod.enumValueFieldIndex(tag_ty, enum_field_index); | 9208 | const tag_val = try mod.enumValueFieldIndex(tag_ty, enum_field_index); |
| 9209 | const tag_int_val = try tag_val.enumToInt(tag_ty, mod); | 9209 | const tag_int_val = try tag_val.intFromEnum(tag_ty, mod); |
| 9210 | break :blk tag_int_val.toUnsignedInt(mod); | 9210 | break :blk tag_int_val.toUnsignedInt(mod); |
| 9211 | }; | 9211 | }; |
| 9212 | if (layout.payload_size == 0) { | 9212 | if (layout.payload_size == 0) { |
| ... | @@ -9288,7 +9288,7 @@ pub const FuncGen = struct { | ... | @@ -9288,7 +9288,7 @@ pub const FuncGen = struct { |
| 9288 | { | 9288 | { |
| 9289 | const indices: [3]*llvm.Value = .{ | 9289 | const indices: [3]*llvm.Value = .{ |
| 9290 | index_type.constNull(), | 9290 | index_type.constNull(), |
| 9291 | index_type.constInt(@boolToInt(layout.tag_align >= layout.payload_align), .False), | 9291 | index_type.constInt(@intFromBool(layout.tag_align >= layout.payload_align), .False), |
| 9292 | index_type.constNull(), | 9292 | index_type.constNull(), |
| 9293 | }; | 9293 | }; |
| 9294 | const len: c_uint = if (field_size == layout.payload_size) 2 else 3; | 9294 | const len: c_uint = if (field_size == layout.payload_size) 2 else 3; |
| ... | @@ -9298,7 +9298,7 @@ pub const FuncGen = struct { | ... | @@ -9298,7 +9298,7 @@ pub const FuncGen = struct { |
| 9298 | { | 9298 | { |
| 9299 | const indices: [2]*llvm.Value = .{ | 9299 | const indices: [2]*llvm.Value = .{ |
| 9300 | index_type.constNull(), | 9300 | index_type.constNull(), |
| 9301 | index_type.constInt(@boolToInt(layout.tag_align < layout.payload_align), .False), | 9301 | index_type.constInt(@intFromBool(layout.tag_align < layout.payload_align), .False), |
| 9302 | }; | 9302 | }; |
| 9303 | const field_ptr = self.builder.buildInBoundsGEP(llvm_union_ty, result_ptr, &indices, indices.len, ""); | 9303 | const field_ptr = self.builder.buildInBoundsGEP(llvm_union_ty, result_ptr, &indices, indices.len, ""); |
| 9304 | const tag_llvm_ty = try self.dg.lowerType(union_obj.tag_ty); | 9304 | const tag_llvm_ty = try self.dg.lowerType(union_obj.tag_ty); |
| ... | @@ -9313,15 +9313,15 @@ pub const FuncGen = struct { | ... | @@ -9313,15 +9313,15 @@ pub const FuncGen = struct { |
| 9313 | fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { | 9313 | fn airPrefetch(self: *FuncGen, inst: Air.Inst.Index) !?*llvm.Value { |
| 9314 | const prefetch = self.air.instructions.items(.data)[inst].prefetch; | 9314 | const prefetch = self.air.instructions.items(.data)[inst].prefetch; |
| 9315 | 9315 | ||
| 9316 | comptime assert(@enumToInt(std.builtin.PrefetchOptions.Rw.read) == 0); | 9316 | comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.read) == 0); |
| 9317 | comptime assert(@enumToInt(std.builtin.PrefetchOptions.Rw.write) == 1); | 9317 | comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Rw.write) == 1); |
| 9318 | 9318 | ||
| 9319 | // TODO these two asserts should be able to be comptime because the type is a u2 | 9319 | // TODO these two asserts should be able to be comptime because the type is a u2 |
| 9320 | assert(prefetch.locality >= 0); | 9320 | assert(prefetch.locality >= 0); |
| 9321 | assert(prefetch.locality <= 3); | 9321 | assert(prefetch.locality <= 3); |
| 9322 | 9322 | ||
| 9323 | comptime assert(@enumToInt(std.builtin.PrefetchOptions.Cache.instruction) == 0); | 9323 | comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.instruction) == 0); |
| 9324 | comptime assert(@enumToInt(std.builtin.PrefetchOptions.Cache.data) == 1); | 9324 | comptime assert(@intFromEnum(std.builtin.PrefetchOptions.Cache.data) == 1); |
| 9325 | 9325 | ||
| 9326 | // LLVM fails during codegen of instruction cache prefetchs for these architectures. | 9326 | // LLVM fails during codegen of instruction cache prefetchs for these architectures. |
| 9327 | // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported | 9327 | // This is an LLVM bug as the prefetch intrinsic should be a noop if not supported |
| ... | @@ -9368,9 +9368,9 @@ pub const FuncGen = struct { | ... | @@ -9368,9 +9368,9 @@ pub const FuncGen = struct { |
| 9368 | 9368 | ||
| 9369 | const params = [_]*llvm.Value{ | 9369 | const params = [_]*llvm.Value{ |
| 9370 | ptr, | 9370 | ptr, |
| 9371 | llvm_u32.constInt(@enumToInt(prefetch.rw), .False), | 9371 | llvm_u32.constInt(@intFromEnum(prefetch.rw), .False), |
| 9372 | llvm_u32.constInt(prefetch.locality, .False), | 9372 | llvm_u32.constInt(prefetch.locality, .False), |
| 9373 | llvm_u32.constInt(@enumToInt(prefetch.cache), .False), | 9373 | llvm_u32.constInt(@intFromEnum(prefetch.cache), .False), |
| 9374 | }; | 9374 | }; |
| 9375 | _ = self.builder.buildCall(fn_val.globalGetValueType(), fn_val, &params, params.len, .C, .Auto, ""); | 9375 | _ = self.builder.buildCall(fn_val.globalGetValueType(), fn_val, &params, params.len, .C, .Auto, ""); |
| 9376 | return null; | 9376 | return null; |
| ... | @@ -9596,7 +9596,7 @@ pub const FuncGen = struct { | ... | @@ -9596,7 +9596,7 @@ pub const FuncGen = struct { |
| 9596 | // the index to the element at index `1` to get a pointer to the end of | 9596 | // the index to the element at index `1` to get a pointer to the end of |
| 9597 | // the struct. | 9597 | // the struct. |
| 9598 | const llvm_u32 = self.context.intType(32); | 9598 | const llvm_u32 = self.context.intType(32); |
| 9599 | const llvm_index = llvm_u32.constInt(@boolToInt(struct_ty.hasRuntimeBitsIgnoreComptime(mod)), .False); | 9599 | const llvm_index = llvm_u32.constInt(@intFromBool(struct_ty.hasRuntimeBitsIgnoreComptime(mod)), .False); |
| 9600 | const indices: [1]*llvm.Value = .{llvm_index}; | 9600 | const indices: [1]*llvm.Value = .{llvm_index}; |
| 9601 | return self.builder.buildInBoundsGEP(struct_llvm_ty, struct_ptr, &indices, indices.len, ""); | 9601 | return self.builder.buildInBoundsGEP(struct_llvm_ty, struct_ptr, &indices, indices.len, ""); |
| 9602 | } | 9602 | } |
| ... | @@ -9605,7 +9605,7 @@ pub const FuncGen = struct { | ... | @@ -9605,7 +9605,7 @@ pub const FuncGen = struct { |
| 9605 | .Union => { | 9605 | .Union => { |
| 9606 | const layout = struct_ty.unionGetLayout(mod); | 9606 | const layout = struct_ty.unionGetLayout(mod); |
| 9607 | if (layout.payload_size == 0 or struct_ty.containerLayout(mod) == .Packed) return struct_ptr; | 9607 | if (layout.payload_size == 0 or struct_ty.containerLayout(mod) == .Packed) return struct_ptr; |
| 9608 | const payload_index = @boolToInt(layout.tag_align >= layout.payload_align); | 9608 | const payload_index = @intFromBool(layout.tag_align >= layout.payload_align); |
| 9609 | const union_llvm_ty = try self.dg.lowerType(struct_ty); | 9609 | const union_llvm_ty = try self.dg.lowerType(struct_ty); |
| 9610 | const union_field_ptr = self.builder.buildStructGEP(union_llvm_ty, struct_ptr, payload_index, ""); | 9610 | const union_field_ptr = self.builder.buildStructGEP(union_llvm_ty, struct_ptr, payload_index, ""); |
| 9611 | return union_field_ptr; | 9611 | return union_field_ptr; |
| ... | @@ -9658,7 +9658,7 @@ pub const FuncGen = struct { | ... | @@ -9658,7 +9658,7 @@ pub const FuncGen = struct { |
| 9658 | 9658 | ||
| 9659 | assert(info.vector_index != .runtime); | 9659 | assert(info.vector_index != .runtime); |
| 9660 | if (info.vector_index != .none) { | 9660 | if (info.vector_index != .none) { |
| 9661 | const index_u32 = self.context.intType(32).constInt(@enumToInt(info.vector_index), .False); | 9661 | const index_u32 = self.context.intType(32).constInt(@intFromEnum(info.vector_index), .False); |
| 9662 | const vec_elem_ty = try self.dg.lowerType(info.pointee_type); | 9662 | const vec_elem_ty = try self.dg.lowerType(info.pointee_type); |
| 9663 | const vec_ty = vec_elem_ty.vectorType(info.host_size); | 9663 | const vec_ty = vec_elem_ty.vectorType(info.host_size); |
| 9664 | 9664 | ||
| ... | @@ -9734,7 +9734,7 @@ pub const FuncGen = struct { | ... | @@ -9734,7 +9734,7 @@ pub const FuncGen = struct { |
| 9734 | 9734 | ||
| 9735 | assert(info.vector_index != .runtime); | 9735 | assert(info.vector_index != .runtime); |
| 9736 | if (info.vector_index != .none) { | 9736 | if (info.vector_index != .none) { |
| 9737 | const index_u32 = self.context.intType(32).constInt(@enumToInt(info.vector_index), .False); | 9737 | const index_u32 = self.context.intType(32).constInt(@intFromEnum(info.vector_index), .False); |
| 9738 | const vec_elem_ty = try self.dg.lowerType(elem_ty); | 9738 | const vec_elem_ty = try self.dg.lowerType(elem_ty); |
| 9739 | const vec_ty = vec_elem_ty.vectorType(info.host_size); | 9739 | const vec_ty = vec_elem_ty.vectorType(info.host_size); |
| 9740 | 9740 | ||
| ... | @@ -11025,29 +11025,29 @@ const AnnotatedDITypePtr = enum(usize) { | ... | @@ -11025,29 +11025,29 @@ const AnnotatedDITypePtr = enum(usize) { |
| 11025 | _, | 11025 | _, |
| 11026 | 11026 | ||
| 11027 | fn initFwd(di_type: *llvm.DIType) AnnotatedDITypePtr { | 11027 | fn initFwd(di_type: *llvm.DIType) AnnotatedDITypePtr { |
| 11028 | const addr = @ptrToInt(di_type); | 11028 | const addr = @intFromPtr(di_type); |
| 11029 | assert(@truncate(u1, addr) == 0); | 11029 | assert(@truncate(u1, addr) == 0); |
| 11030 | return @intToEnum(AnnotatedDITypePtr, addr | 1); | 11030 | return @enumFromInt(AnnotatedDITypePtr, addr | 1); |
| 11031 | } | 11031 | } |
| 11032 | 11032 | ||
| 11033 | fn initFull(di_type: *llvm.DIType) AnnotatedDITypePtr { | 11033 | fn initFull(di_type: *llvm.DIType) AnnotatedDITypePtr { |
| 11034 | const addr = @ptrToInt(di_type); | 11034 | const addr = @intFromPtr(di_type); |
| 11035 | return @intToEnum(AnnotatedDITypePtr, addr); | 11035 | return @enumFromInt(AnnotatedDITypePtr, addr); |
| 11036 | } | 11036 | } |
| 11037 | 11037 | ||
| 11038 | fn init(di_type: *llvm.DIType, resolve: Object.DebugResolveStatus) AnnotatedDITypePtr { | 11038 | fn init(di_type: *llvm.DIType, resolve: Object.DebugResolveStatus) AnnotatedDITypePtr { |
| 11039 | const addr = @ptrToInt(di_type); | 11039 | const addr = @intFromPtr(di_type); |
| 11040 | const bit = @boolToInt(resolve == .fwd); | 11040 | const bit = @intFromBool(resolve == .fwd); |
| 11041 | return @intToEnum(AnnotatedDITypePtr, addr | bit); | 11041 | return @enumFromInt(AnnotatedDITypePtr, addr | bit); |
| 11042 | } | 11042 | } |
| 11043 | 11043 | ||
| 11044 | fn toDIType(self: AnnotatedDITypePtr) *llvm.DIType { | 11044 | fn toDIType(self: AnnotatedDITypePtr) *llvm.DIType { |
| 11045 | const fixed_addr = @enumToInt(self) & ~@as(usize, 1); | 11045 | const fixed_addr = @intFromEnum(self) & ~@as(usize, 1); |
| 11046 | return @intToPtr(*llvm.DIType, fixed_addr); | 11046 | return @ptrFromInt(*llvm.DIType, fixed_addr); |
| 11047 | } | 11047 | } |
| 11048 | 11048 | ||
| 11049 | fn isFwdOnly(self: AnnotatedDITypePtr) bool { | 11049 | fn isFwdOnly(self: AnnotatedDITypePtr) bool { |
| 11050 | return @truncate(u1, @enumToInt(self)) != 0; | 11050 | return @truncate(u1, @intFromEnum(self)) != 0; |
| 11051 | } | 11051 | } |
| 11052 | }; | 11052 | }; |
| 11053 | 11053 | ||
| ... | @@ -11118,11 +11118,11 @@ fn buildAllocaInner( | ... | @@ -11118,11 +11118,11 @@ fn buildAllocaInner( |
| 11118 | } | 11118 | } |
| 11119 | 11119 | ||
| 11120 | fn errUnionPayloadOffset(payload_ty: Type, mod: *Module) u1 { | 11120 | fn errUnionPayloadOffset(payload_ty: Type, mod: *Module) u1 { |
| 11121 | return @boolToInt(Type.anyerror.abiAlignment(mod) > payload_ty.abiAlignment(mod)); | 11121 | return @intFromBool(Type.anyerror.abiAlignment(mod) > payload_ty.abiAlignment(mod)); |
| 11122 | } | 11122 | } |
| 11123 | 11123 | ||
| 11124 | fn errUnionErrorOffset(payload_ty: Type, mod: *Module) u1 { | 11124 | fn errUnionErrorOffset(payload_ty: Type, mod: *Module) u1 { |
| 11125 | return @boolToInt(Type.anyerror.abiAlignment(mod) <= payload_ty.abiAlignment(mod)); | 11125 | return @intFromBool(Type.anyerror.abiAlignment(mod) <= payload_ty.abiAlignment(mod)); |
| 11126 | } | 11126 | } |
| 11127 | 11127 | ||
| 11128 | /// Returns true for asm constraint (e.g. "=*m", "=r") if it accepts a memory location | 11128 | /// Returns true for asm constraint (e.g. "=*m", "=r") if it accepts a memory location |
src/codegen/llvm/bindings.zig+1-1| ... | @@ -8,7 +8,7 @@ pub const Bool = enum(c_int) { | ... | @@ -8,7 +8,7 @@ pub const Bool = enum(c_int) { |
| 8 | _, | 8 | _, |
| 9 | 9 | ||
| 10 | pub fn fromBool(b: bool) Bool { | 10 | pub fn fromBool(b: bool) Bool { |
| 11 | return @intToEnum(Bool, @boolToInt(b)); | 11 | return @enumFromInt(Bool, @intFromBool(b)); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | pub fn toBool(b: Bool) bool { | 14 | pub fn toBool(b: Bool) bool { |
src/codegen/spirv.zig+10-10| ... | @@ -387,7 +387,7 @@ pub const DeclGen = struct { | ... | @@ -387,7 +387,7 @@ pub const DeclGen = struct { |
| 387 | switch (repr) { | 387 | switch (repr) { |
| 388 | .indirect => { | 388 | .indirect => { |
| 389 | const int_ty_ref = try self.intType(.unsigned, 1); | 389 | const int_ty_ref = try self.intType(.unsigned, 1); |
| 390 | return self.spv.constInt(int_ty_ref, @boolToInt(value)); | 390 | return self.spv.constInt(int_ty_ref, @intFromBool(value)); |
| 391 | }, | 391 | }, |
| 392 | .direct => { | 392 | .direct => { |
| 393 | const bool_ty_ref = try self.resolveType(Type.bool, .direct); | 393 | const bool_ty_ref = try self.resolveType(Type.bool, .direct); |
| ... | @@ -532,7 +532,7 @@ pub const DeclGen = struct { | ... | @@ -532,7 +532,7 @@ pub const DeclGen = struct { |
| 532 | } | 532 | } |
| 533 | 533 | ||
| 534 | fn addConstBool(self: *@This(), value: bool) !void { | 534 | fn addConstBool(self: *@This(), value: bool) !void { |
| 535 | try self.addByte(@boolToInt(value)); // TODO: Keep in sync with something? | 535 | try self.addByte(@intFromBool(value)); // TODO: Keep in sync with something? |
| 536 | } | 536 | } |
| 537 | 537 | ||
| 538 | fn addInt(self: *@This(), ty: Type, val: Value) !void { | 538 | fn addInt(self: *@This(), ty: Type, val: Value) !void { |
| ... | @@ -697,7 +697,7 @@ pub const DeclGen = struct { | ... | @@ -697,7 +697,7 @@ pub const DeclGen = struct { |
| 697 | try self.addUndef(padding); | 697 | try self.addUndef(padding); |
| 698 | }, | 698 | }, |
| 699 | .enum_tag => { | 699 | .enum_tag => { |
| 700 | const int_val = try val.enumToInt(ty, mod); | 700 | const int_val = try val.intFromEnum(ty, mod); |
| 701 | 701 | ||
| 702 | const int_ty = ty.intTagType(mod); | 702 | const int_ty = ty.intTagType(mod); |
| 703 | 703 | ||
| ... | @@ -873,7 +873,7 @@ pub const DeclGen = struct { | ... | @@ -873,7 +873,7 @@ pub const DeclGen = struct { |
| 873 | assert(storage_class != .Generic and storage_class != .Function); | 873 | assert(storage_class != .Generic and storage_class != .Function); |
| 874 | 874 | ||
| 875 | const var_id = self.spv.allocId(); | 875 | const var_id = self.spv.allocId(); |
| 876 | log.debug("lowerIndirectConstant: id = {}, index = {}, ty = {}, val = {}", .{ var_id.id, @enumToInt(spv_decl_index), ty.fmt(self.module), val.fmtDebug() }); | 876 | log.debug("lowerIndirectConstant: id = {}, index = {}, ty = {}, val = {}", .{ var_id.id, @intFromEnum(spv_decl_index), ty.fmt(self.module), val.fmtDebug() }); |
| 877 | 877 | ||
| 878 | const section = &self.spv.globals.section; | 878 | const section = &self.spv.globals.section; |
| 879 | 879 | ||
| ... | @@ -1010,7 +1010,7 @@ pub const DeclGen = struct { | ... | @@ -1010,7 +1010,7 @@ pub const DeclGen = struct { |
| 1010 | false, | 1010 | false, |
| 1011 | alignment, | 1011 | alignment, |
| 1012 | ); | 1012 | ); |
| 1013 | log.debug("indirect constant: index = {}", .{@enumToInt(spv_decl_index)}); | 1013 | log.debug("indirect constant: index = {}", .{@intFromEnum(spv_decl_index)}); |
| 1014 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); | 1014 | try self.func.decl_deps.put(self.spv.gpa, spv_decl_index, {}); |
| 1015 | 1015 | ||
| 1016 | try self.func.body.emit(self.spv.gpa, .OpLoad, .{ | 1016 | try self.func.body.emit(self.spv.gpa, .OpLoad, .{ |
| ... | @@ -1578,7 +1578,7 @@ pub const DeclGen = struct { | ... | @@ -1578,7 +1578,7 @@ pub const DeclGen = struct { |
| 1578 | } | 1578 | } |
| 1579 | } | 1579 | } |
| 1580 | 1580 | ||
| 1581 | fn boolToInt(self: *DeclGen, result_ty_ref: CacheRef, condition_id: IdRef) !IdRef { | 1581 | fn intFromBool(self: *DeclGen, result_ty_ref: CacheRef, condition_id: IdRef) !IdRef { |
| 1582 | const zero_id = try self.spv.constInt(result_ty_ref, 0); | 1582 | const zero_id = try self.spv.constInt(result_ty_ref, 0); |
| 1583 | const one_id = try self.spv.constInt(result_ty_ref, 1); | 1583 | const one_id = try self.spv.constInt(result_ty_ref, 1); |
| 1584 | const result_id = self.spv.allocId(); | 1584 | const result_id = self.spv.allocId(); |
| ... | @@ -1621,7 +1621,7 @@ pub const DeclGen = struct { | ... | @@ -1621,7 +1621,7 @@ pub const DeclGen = struct { |
| 1621 | return switch (ty.zigTypeTag(mod)) { | 1621 | return switch (ty.zigTypeTag(mod)) { |
| 1622 | .Bool => blk: { | 1622 | .Bool => blk: { |
| 1623 | const indirect_bool_ty_ref = try self.resolveType(ty, .indirect); | 1623 | const indirect_bool_ty_ref = try self.resolveType(ty, .indirect); |
| 1624 | break :blk self.boolToInt(indirect_bool_ty_ref, operand_id); | 1624 | break :blk self.intFromBool(indirect_bool_ty_ref, operand_id); |
| 1625 | }, | 1625 | }, |
| 1626 | else => operand_id, | 1626 | else => operand_id, |
| 1627 | }; | 1627 | }; |
| ... | @@ -2011,7 +2011,7 @@ pub const DeclGen = struct { | ... | @@ -2011,7 +2011,7 @@ pub const DeclGen = struct { |
| 2011 | 2011 | ||
| 2012 | // Construct the struct that Zig wants as result. | 2012 | // Construct the struct that Zig wants as result. |
| 2013 | // The value should already be the correct type. | 2013 | // The value should already be the correct type. |
| 2014 | const ov_id = try self.boolToInt(ov_ty_ref, overflowed_id); | 2014 | const ov_id = try self.intFromBool(ov_ty_ref, overflowed_id); |
| 2015 | const result_ty_ref = try self.resolveType(result_ty, .direct); | 2015 | const result_ty_ref = try self.resolveType(result_ty, .direct); |
| 2016 | return try self.constructStruct(result_ty_ref, &.{ | 2016 | return try self.constructStruct(result_ty_ref, &.{ |
| 2017 | value_id, | 2017 | value_id, |
| ... | @@ -2515,7 +2515,7 @@ pub const DeclGen = struct { | ... | @@ -2515,7 +2515,7 @@ pub const DeclGen = struct { |
| 2515 | if (layout.payload_size == 0) return union_handle; | 2515 | if (layout.payload_size == 0) return union_handle; |
| 2516 | 2516 | ||
| 2517 | const tag_ty = un_ty.unionTagTypeSafety().?; | 2517 | const tag_ty = un_ty.unionTagTypeSafety().?; |
| 2518 | const tag_index = @boolToInt(layout.tag_align < layout.payload_align); | 2518 | const tag_index = @intFromBool(layout.tag_align < layout.payload_align); |
| 2519 | return try self.extractField(tag_ty, union_handle, tag_index); | 2519 | return try self.extractField(tag_ty, union_handle, tag_index); |
| 2520 | } | 2520 | } |
| 2521 | 2521 | ||
| ... | @@ -3105,7 +3105,7 @@ pub const DeclGen = struct { | ... | @@ -3105,7 +3105,7 @@ pub const DeclGen = struct { |
| 3105 | .Int => if (cond_ty.isSignedInt(mod)) @bitCast(u64, value.toSignedInt(mod)) else value.toUnsignedInt(mod), | 3105 | .Int => if (cond_ty.isSignedInt(mod)) @bitCast(u64, value.toSignedInt(mod)) else value.toUnsignedInt(mod), |
| 3106 | .Enum => blk: { | 3106 | .Enum => blk: { |
| 3107 | // TODO: figure out of cond_ty is correct (something with enum literals) | 3107 | // TODO: figure out of cond_ty is correct (something with enum literals) |
| 3108 | break :blk (try value.enumToInt(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants | 3108 | break :blk (try value.intFromEnum(cond_ty, mod)).toUnsignedInt(mod); // TODO: composite integer constants |
| 3109 | }, | 3109 | }, |
| 3110 | else => unreachable, | 3110 | else => unreachable, |
| 3111 | }; | 3111 | }; |
src/codegen/spirv/Assembler.zig+4-4| ... | @@ -306,7 +306,7 @@ fn processTypeInstruction(self: *Assembler) !AsmValue { | ... | @@ -306,7 +306,7 @@ fn processTypeInstruction(self: *Assembler) !AsmValue { |
| 306 | }, | 306 | }, |
| 307 | .OpTypePointer => try self.spv.ptrType( | 307 | .OpTypePointer => try self.spv.ptrType( |
| 308 | try self.resolveTypeRef(operands[2].ref_id), | 308 | try self.resolveTypeRef(operands[2].ref_id), |
| 309 | @intToEnum(spec.StorageClass, operands[1].value), | 309 | @enumFromInt(spec.StorageClass, operands[1].value), |
| 310 | ), | 310 | ), |
| 311 | .OpTypeFunction => blk: { | 311 | .OpTypeFunction => blk: { |
| 312 | const param_operands = operands[2..]; | 312 | const param_operands = operands[2..]; |
| ... | @@ -340,7 +340,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { | ... | @@ -340,7 +340,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { |
| 340 | else => switch (self.inst.opcode) { | 340 | else => switch (self.inst.opcode) { |
| 341 | .OpEntryPoint => unreachable, | 341 | .OpEntryPoint => unreachable, |
| 342 | .OpExecutionMode, .OpExecutionModeId => &self.spv.sections.execution_modes, | 342 | .OpExecutionMode, .OpExecutionModeId => &self.spv.sections.execution_modes, |
| 343 | .OpVariable => switch (@intToEnum(spec.StorageClass, operands[2].value)) { | 343 | .OpVariable => switch (@enumFromInt(spec.StorageClass, operands[2].value)) { |
| 344 | .Function => &self.func.prologue, | 344 | .Function => &self.func.prologue, |
| 345 | else => { | 345 | else => { |
| 346 | // This is currently disabled because global variables are required to be | 346 | // This is currently disabled because global variables are required to be |
| ... | @@ -391,7 +391,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { | ... | @@ -391,7 +391,7 @@ fn processGenericInstruction(self: *Assembler) !?AsmValue { |
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | const actual_word_count = section.instructions.items.len - first_word; | 393 | const actual_word_count = section.instructions.items.len - first_word; |
| 394 | section.instructions.items[first_word] |= @as(u32, @intCast(u16, actual_word_count)) << 16 | @enumToInt(self.inst.opcode); | 394 | section.instructions.items[first_word] |= @as(u32, @intCast(u16, actual_word_count)) << 16 | @intFromEnum(self.inst.opcode); |
| 395 | 395 | ||
| 396 | if (maybe_result_id) |result| { | 396 | if (maybe_result_id) |result| { |
| 397 | return AsmValue{ .value = result }; | 397 | return AsmValue{ .value = result }; |
| ... | @@ -695,7 +695,7 @@ fn parseContextDependentInt(self: *Assembler, signedness: std.builtin.Signedness | ... | @@ -695,7 +695,7 @@ fn parseContextDependentInt(self: *Assembler, signedness: std.builtin.Signedness |
| 695 | .unsigned => 0, | 695 | .unsigned => 0, |
| 696 | .signed => -(@as(i128, 1) << (@intCast(u7, width) - 1)), | 696 | .signed => -(@as(i128, 1) << (@intCast(u7, width) - 1)), |
| 697 | }; | 697 | }; |
| 698 | const max = (@as(i128, 1) << (@intCast(u7, width) - @boolToInt(signedness == .signed))) - 1; | 698 | const max = (@as(i128, 1) << (@intCast(u7, width) - @intFromBool(signedness == .signed))) - 1; |
| 699 | if (int < min or int > max) { | 699 | if (int < min or int > max) { |
| 700 | break :invalid; | 700 | break :invalid; |
| 701 | } | 701 | } |
src/codegen/spirv/Cache.zig+30-30| ... | @@ -411,7 +411,7 @@ pub const Key = union(enum) { | ... | @@ -411,7 +411,7 @@ pub const Key = union(enum) { |
| 411 | 411 | ||
| 412 | pub fn eql(ctx: @This(), a: Key, b_void: void, b_index: usize) bool { | 412 | pub fn eql(ctx: @This(), a: Key, b_void: void, b_index: usize) bool { |
| 413 | _ = b_void; | 413 | _ = b_void; |
| 414 | return ctx.self.lookup(@intToEnum(Ref, b_index)).eql(a); | 414 | return ctx.self.lookup(@enumFromInt(Ref, b_index)).eql(a); |
| 415 | } | 415 | } |
| 416 | 416 | ||
| 417 | pub fn hash(ctx: @This(), a: Key) u32 { | 417 | pub fn hash(ctx: @This(), a: Key) u32 { |
| ... | @@ -445,7 +445,7 @@ pub fn materialize(self: *const Self, spv: *Module) !Section { | ... | @@ -445,7 +445,7 @@ pub fn materialize(self: *const Self, spv: *Module) !Section { |
| 445 | var section = Section{}; | 445 | var section = Section{}; |
| 446 | errdefer section.deinit(spv.gpa); | 446 | errdefer section.deinit(spv.gpa); |
| 447 | for (self.items.items(.result_id), 0..) |result_id, index| { | 447 | for (self.items.items(.result_id), 0..) |result_id, index| { |
| 448 | try self.emit(spv, result_id, @intToEnum(Ref, index), &section); | 448 | try self.emit(spv, result_id, @enumFromInt(Ref, index), &section); |
| 449 | } | 449 | } |
| 450 | return section; | 450 | return section; |
| 451 | } | 451 | } |
| ... | @@ -603,14 +603,14 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { | ... | @@ -603,14 +603,14 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { |
| 603 | const adapter: Key.Adapter = .{ .self = self }; | 603 | const adapter: Key.Adapter = .{ .self = self }; |
| 604 | const entry = try self.map.getOrPutAdapted(spv.gpa, key, adapter); | 604 | const entry = try self.map.getOrPutAdapted(spv.gpa, key, adapter); |
| 605 | if (entry.found_existing) { | 605 | if (entry.found_existing) { |
| 606 | return @intToEnum(Ref, entry.index); | 606 | return @enumFromInt(Ref, entry.index); |
| 607 | } | 607 | } |
| 608 | const result_id = spv.allocId(); | 608 | const result_id = spv.allocId(); |
| 609 | const item: Item = switch (key) { | 609 | const item: Item = switch (key) { |
| 610 | inline .void_type, .bool_type => .{ | 610 | inline .void_type, .bool_type => .{ |
| 611 | .tag = .type_simple, | 611 | .tag = .type_simple, |
| 612 | .result_id = result_id, | 612 | .result_id = result_id, |
| 613 | .data = @enumToInt(key.toSimpleType()), | 613 | .data = @intFromEnum(key.toSimpleType()), |
| 614 | }, | 614 | }, |
| 615 | .int_type => |int| blk: { | 615 | .int_type => |int| blk: { |
| 616 | const t: Tag = switch (int.signedness) { | 616 | const t: Tag = switch (int.signedness) { |
| ... | @@ -654,17 +654,17 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { | ... | @@ -654,17 +654,17 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { |
| 654 | .Generic => Item{ | 654 | .Generic => Item{ |
| 655 | .tag = .type_ptr_generic, | 655 | .tag = .type_ptr_generic, |
| 656 | .result_id = result_id, | 656 | .result_id = result_id, |
| 657 | .data = @enumToInt(ptr.child_type), | 657 | .data = @intFromEnum(ptr.child_type), |
| 658 | }, | 658 | }, |
| 659 | .CrossWorkgroup => Item{ | 659 | .CrossWorkgroup => Item{ |
| 660 | .tag = .type_ptr_crosswgp, | 660 | .tag = .type_ptr_crosswgp, |
| 661 | .result_id = result_id, | 661 | .result_id = result_id, |
| 662 | .data = @enumToInt(ptr.child_type), | 662 | .data = @intFromEnum(ptr.child_type), |
| 663 | }, | 663 | }, |
| 664 | .Function => Item{ | 664 | .Function => Item{ |
| 665 | .tag = .type_ptr_function, | 665 | .tag = .type_ptr_function, |
| 666 | .result_id = result_id, | 666 | .result_id = result_id, |
| 667 | .data = @enumToInt(ptr.child_type), | 667 | .data = @intFromEnum(ptr.child_type), |
| 668 | }, | 668 | }, |
| 669 | else => |storage_class| Item{ | 669 | else => |storage_class| Item{ |
| 670 | .tag = .type_ptr_simple, | 670 | .tag = .type_ptr_simple, |
| ... | @@ -770,12 +770,12 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { | ... | @@ -770,12 +770,12 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { |
| 770 | .undef => |undef| .{ | 770 | .undef => |undef| .{ |
| 771 | .tag = .undef, | 771 | .tag = .undef, |
| 772 | .result_id = result_id, | 772 | .result_id = result_id, |
| 773 | .data = @enumToInt(undef.ty), | 773 | .data = @intFromEnum(undef.ty), |
| 774 | }, | 774 | }, |
| 775 | .null => |null_info| .{ | 775 | .null => |null_info| .{ |
| 776 | .tag = .null, | 776 | .tag = .null, |
| 777 | .result_id = result_id, | 777 | .result_id = result_id, |
| 778 | .data = @enumToInt(null_info.ty), | 778 | .data = @intFromEnum(null_info.ty), |
| 779 | }, | 779 | }, |
| 780 | .bool => |bool_info| .{ | 780 | .bool => |bool_info| .{ |
| 781 | .tag = switch (bool_info.value) { | 781 | .tag = switch (bool_info.value) { |
| ... | @@ -783,21 +783,21 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { | ... | @@ -783,21 +783,21 @@ pub fn resolve(self: *Self, spv: *Module, key: Key) !Ref { |
| 783 | false => Tag.bool_false, | 783 | false => Tag.bool_false, |
| 784 | }, | 784 | }, |
| 785 | .result_id = result_id, | 785 | .result_id = result_id, |
| 786 | .data = @enumToInt(bool_info.ty), | 786 | .data = @intFromEnum(bool_info.ty), |
| 787 | }, | 787 | }, |
| 788 | }; | 788 | }; |
| 789 | try self.items.append(spv.gpa, item); | 789 | try self.items.append(spv.gpa, item); |
| 790 | 790 | ||
| 791 | return @intToEnum(Ref, entry.index); | 791 | return @enumFromInt(Ref, entry.index); |
| 792 | } | 792 | } |
| 793 | 793 | ||
| 794 | /// Turn a Ref back into a Key. | 794 | /// Turn a Ref back into a Key. |
| 795 | /// The Key is valid until the next call to resolve(). | 795 | /// The Key is valid until the next call to resolve(). |
| 796 | pub fn lookup(self: *const Self, ref: Ref) Key { | 796 | pub fn lookup(self: *const Self, ref: Ref) Key { |
| 797 | const item = self.items.get(@enumToInt(ref)); | 797 | const item = self.items.get(@intFromEnum(ref)); |
| 798 | const data = item.data; | 798 | const data = item.data; |
| 799 | return switch (item.tag) { | 799 | return switch (item.tag) { |
| 800 | .type_simple => switch (@intToEnum(Tag.SimpleType, data)) { | 800 | .type_simple => switch (@enumFromInt(Tag.SimpleType, data)) { |
| 801 | .void => .void_type, | 801 | .void => .void_type, |
| 802 | .bool => .bool_type, | 802 | .bool => .bool_type, |
| 803 | }, | 803 | }, |
| ... | @@ -826,19 +826,19 @@ pub fn lookup(self: *const Self, ref: Ref) Key { | ... | @@ -826,19 +826,19 @@ pub fn lookup(self: *const Self, ref: Ref) Key { |
| 826 | .type_ptr_generic => .{ | 826 | .type_ptr_generic => .{ |
| 827 | .ptr_type = .{ | 827 | .ptr_type = .{ |
| 828 | .storage_class = .Generic, | 828 | .storage_class = .Generic, |
| 829 | .child_type = @intToEnum(Ref, data), | 829 | .child_type = @enumFromInt(Ref, data), |
| 830 | }, | 830 | }, |
| 831 | }, | 831 | }, |
| 832 | .type_ptr_crosswgp => .{ | 832 | .type_ptr_crosswgp => .{ |
| 833 | .ptr_type = .{ | 833 | .ptr_type = .{ |
| 834 | .storage_class = .CrossWorkgroup, | 834 | .storage_class = .CrossWorkgroup, |
| 835 | .child_type = @intToEnum(Ref, data), | 835 | .child_type = @enumFromInt(Ref, data), |
| 836 | }, | 836 | }, |
| 837 | }, | 837 | }, |
| 838 | .type_ptr_function => .{ | 838 | .type_ptr_function => .{ |
| 839 | .ptr_type = .{ | 839 | .ptr_type = .{ |
| 840 | .storage_class = .Function, | 840 | .storage_class = .Function, |
| 841 | .child_type = @intToEnum(Ref, data), | 841 | .child_type = @enumFromInt(Ref, data), |
| 842 | }, | 842 | }, |
| 843 | }, | 843 | }, |
| 844 | .type_ptr_simple => { | 844 | .type_ptr_simple => { |
| ... | @@ -923,17 +923,17 @@ pub fn lookup(self: *const Self, ref: Ref) Key { | ... | @@ -923,17 +923,17 @@ pub fn lookup(self: *const Self, ref: Ref) Key { |
| 923 | } }; | 923 | } }; |
| 924 | }, | 924 | }, |
| 925 | .undef => .{ .undef = .{ | 925 | .undef => .{ .undef = .{ |
| 926 | .ty = @intToEnum(Ref, data), | 926 | .ty = @enumFromInt(Ref, data), |
| 927 | } }, | 927 | } }, |
| 928 | .null => .{ .null = .{ | 928 | .null => .{ .null = .{ |
| 929 | .ty = @intToEnum(Ref, data), | 929 | .ty = @enumFromInt(Ref, data), |
| 930 | } }, | 930 | } }, |
| 931 | .bool_true => .{ .bool = .{ | 931 | .bool_true => .{ .bool = .{ |
| 932 | .ty = @intToEnum(Ref, data), | 932 | .ty = @enumFromInt(Ref, data), |
| 933 | .value = true, | 933 | .value = true, |
| 934 | } }, | 934 | } }, |
| 935 | .bool_false => .{ .bool = .{ | 935 | .bool_false => .{ .bool = .{ |
| 936 | .ty = @intToEnum(Ref, data), | 936 | .ty = @enumFromInt(Ref, data), |
| 937 | .value = false, | 937 | .value = false, |
| 938 | } }, | 938 | } }, |
| 939 | }; | 939 | }; |
| ... | @@ -942,14 +942,14 @@ pub fn lookup(self: *const Self, ref: Ref) Key { | ... | @@ -942,14 +942,14 @@ pub fn lookup(self: *const Self, ref: Ref) Key { |
| 942 | /// Look op the result-id that corresponds to a particular | 942 | /// Look op the result-id that corresponds to a particular |
| 943 | /// ref. | 943 | /// ref. |
| 944 | pub fn resultId(self: Self, ref: Ref) IdResult { | 944 | pub fn resultId(self: Self, ref: Ref) IdResult { |
| 945 | return self.items.items(.result_id)[@enumToInt(ref)]; | 945 | return self.items.items(.result_id)[@intFromEnum(ref)]; |
| 946 | } | 946 | } |
| 947 | 947 | ||
| 948 | /// Get the ref for a key that has already been added to the cache. | 948 | /// Get the ref for a key that has already been added to the cache. |
| 949 | fn get(self: *const Self, key: Key) Ref { | 949 | fn get(self: *const Self, key: Key) Ref { |
| 950 | const adapter: Key.Adapter = .{ .self = self }; | 950 | const adapter: Key.Adapter = .{ .self = self }; |
| 951 | const index = self.map.getIndexAdapted(key, adapter).?; | 951 | const index = self.map.getIndexAdapted(key, adapter).?; |
| 952 | return @intToEnum(Ref, index); | 952 | return @enumFromInt(Ref, index); |
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | fn addExtra(self: *Self, spv: *Module, extra: anytype) !u32 { | 955 | fn addExtra(self: *Self, spv: *Module, extra: anytype) !u32 { |
| ... | @@ -965,9 +965,9 @@ fn addExtraAssumeCapacity(self: *Self, extra: anytype) !u32 { | ... | @@ -965,9 +965,9 @@ fn addExtraAssumeCapacity(self: *Self, extra: anytype) !u32 { |
| 965 | const word = switch (field.type) { | 965 | const word = switch (field.type) { |
| 966 | u32 => field_val, | 966 | u32 => field_val, |
| 967 | i32 => @bitCast(u32, field_val), | 967 | i32 => @bitCast(u32, field_val), |
| 968 | Ref => @enumToInt(field_val), | 968 | Ref => @intFromEnum(field_val), |
| 969 | StorageClass => @enumToInt(field_val), | 969 | StorageClass => @intFromEnum(field_val), |
| 970 | String => @enumToInt(field_val), | 970 | String => @intFromEnum(field_val), |
| 971 | else => @compileError("Invalid type: " ++ @typeName(field.type)), | 971 | else => @compileError("Invalid type: " ++ @typeName(field.type)), |
| 972 | }; | 972 | }; |
| 973 | self.extra.appendAssumeCapacity(word); | 973 | self.extra.appendAssumeCapacity(word); |
| ... | @@ -987,9 +987,9 @@ fn extraDataTrail(self: Self, comptime T: type, offset: u32) struct { data: T, t | ... | @@ -987,9 +987,9 @@ fn extraDataTrail(self: Self, comptime T: type, offset: u32) struct { data: T, t |
| 987 | @field(result, field.name) = switch (field.type) { | 987 | @field(result, field.name) = switch (field.type) { |
| 988 | u32 => word, | 988 | u32 => word, |
| 989 | i32 => @bitCast(i32, word), | 989 | i32 => @bitCast(i32, word), |
| 990 | Ref => @intToEnum(Ref, word), | 990 | Ref => @enumFromInt(Ref, word), |
| 991 | StorageClass => @intToEnum(StorageClass, word), | 991 | StorageClass => @enumFromInt(StorageClass, word), |
| 992 | String => @intToEnum(String, word), | 992 | String => @enumFromInt(String, word), |
| 993 | else => @compileError("Invalid type: " ++ @typeName(field.type)), | 993 | else => @compileError("Invalid type: " ++ @typeName(field.type)), |
| 994 | }; | 994 | }; |
| 995 | } | 995 | } |
| ... | @@ -1035,12 +1035,12 @@ pub fn addString(self: *Self, spv: *Module, str: []const u8) !String { | ... | @@ -1035,12 +1035,12 @@ pub fn addString(self: *Self, spv: *Module, str: []const u8) !String { |
| 1035 | entry.value_ptr.* = @intCast(u32, offset); | 1035 | entry.value_ptr.* = @intCast(u32, offset); |
| 1036 | } | 1036 | } |
| 1037 | 1037 | ||
| 1038 | return @intToEnum(String, entry.index); | 1038 | return @enumFromInt(String, entry.index); |
| 1039 | } | 1039 | } |
| 1040 | 1040 | ||
| 1041 | pub fn getString(self: *const Self, ref: String) ?[]const u8 { | 1041 | pub fn getString(self: *const Self, ref: String) ?[]const u8 { |
| 1042 | return switch (ref) { | 1042 | return switch (ref) { |
| 1043 | .none => null, | 1043 | .none => null, |
| 1044 | else => std.mem.sliceTo(self.string_bytes.items[self.strings.values()[@enumToInt(ref)]..], 0), | 1044 | else => std.mem.sliceTo(self.string_bytes.items[self.strings.values()[@intFromEnum(ref)]..], 0), |
| 1045 | }; | 1045 | }; |
| 1046 | } | 1046 | } |
src/codegen/spirv/Module.zig+7-7| ... | @@ -246,10 +246,10 @@ fn orderGlobalsInto( | ... | @@ -246,10 +246,10 @@ fn orderGlobalsInto( |
| 246 | const global = self.globalPtr(decl_index).?; | 246 | const global = self.globalPtr(decl_index).?; |
| 247 | const insts = self.globals.section.instructions.items[global.begin_inst..global.end_inst]; | 247 | const insts = self.globals.section.instructions.items[global.begin_inst..global.end_inst]; |
| 248 | 248 | ||
| 249 | seen.set(@enumToInt(decl_index)); | 249 | seen.set(@intFromEnum(decl_index)); |
| 250 | 250 | ||
| 251 | for (deps) |dep| { | 251 | for (deps) |dep| { |
| 252 | if (!seen.isSet(@enumToInt(dep))) { | 252 | if (!seen.isSet(@intFromEnum(dep))) { |
| 253 | try self.orderGlobalsInto(dep, section, seen); | 253 | try self.orderGlobalsInto(dep, section, seen); |
| 254 | } | 254 | } |
| 255 | } | 255 | } |
| ... | @@ -267,7 +267,7 @@ fn orderGlobals(self: *Module) !Section { | ... | @@ -267,7 +267,7 @@ fn orderGlobals(self: *Module) !Section { |
| 267 | errdefer ordered_globals.deinit(self.gpa); | 267 | errdefer ordered_globals.deinit(self.gpa); |
| 268 | 268 | ||
| 269 | for (globals) |decl_index| { | 269 | for (globals) |decl_index| { |
| 270 | if (!seen.isSet(@enumToInt(decl_index))) { | 270 | if (!seen.isSet(@intFromEnum(decl_index))) { |
| 271 | try self.orderGlobalsInto(decl_index, &ordered_globals, &seen); | 271 | try self.orderGlobalsInto(decl_index, &ordered_globals, &seen); |
| 272 | } | 272 | } |
| 273 | } | 273 | } |
| ... | @@ -284,14 +284,14 @@ fn addEntryPointDeps( | ... | @@ -284,14 +284,14 @@ fn addEntryPointDeps( |
| 284 | const decl = self.declPtr(decl_index); | 284 | const decl = self.declPtr(decl_index); |
| 285 | const deps = self.decl_deps.items[decl.begin_dep..decl.end_dep]; | 285 | const deps = self.decl_deps.items[decl.begin_dep..decl.end_dep]; |
| 286 | 286 | ||
| 287 | seen.set(@enumToInt(decl_index)); | 287 | seen.set(@intFromEnum(decl_index)); |
| 288 | 288 | ||
| 289 | if (self.globalPtr(decl_index)) |global| { | 289 | if (self.globalPtr(decl_index)) |global| { |
| 290 | try interface.append(global.result_id); | 290 | try interface.append(global.result_id); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | for (deps) |dep| { | 293 | for (deps) |dep| { |
| 294 | if (!seen.isSet(@enumToInt(dep))) { | 294 | if (!seen.isSet(@intFromEnum(dep))) { |
| 295 | try self.addEntryPointDeps(dep, seen, interface); | 295 | try self.addEntryPointDeps(dep, seen, interface); |
| 296 | } | 296 | } |
| 297 | } | 297 | } |
| ... | @@ -516,7 +516,7 @@ pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index { | ... | @@ -516,7 +516,7 @@ pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index { |
| 516 | .begin_dep = undefined, | 516 | .begin_dep = undefined, |
| 517 | .end_dep = undefined, | 517 | .end_dep = undefined, |
| 518 | }); | 518 | }); |
| 519 | const index = @intToEnum(Decl.Index, @intCast(u32, self.decls.items.len - 1)); | 519 | const index = @enumFromInt(Decl.Index, @intCast(u32, self.decls.items.len - 1)); |
| 520 | switch (kind) { | 520 | switch (kind) { |
| 521 | .func => {}, | 521 | .func => {}, |
| 522 | // If the decl represents a global, also allocate a global node. | 522 | // If the decl represents a global, also allocate a global node. |
| ... | @@ -531,7 +531,7 @@ pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index { | ... | @@ -531,7 +531,7 @@ pub fn allocDecl(self: *Module, kind: DeclKind) !Decl.Index { |
| 531 | } | 531 | } |
| 532 | 532 | ||
| 533 | pub fn declPtr(self: *Module, index: Decl.Index) *Decl { | 533 | pub fn declPtr(self: *Module, index: Decl.Index) *Decl { |
| 534 | return &self.decls.items[@enumToInt(index)]; | 534 | return &self.decls.items[@intFromEnum(index)]; |
| 535 | } | 535 | } |
| 536 | 536 | ||
| 537 | pub fn globalPtr(self: *Module, index: Decl.Index) ?*Global { | 537 | pub fn globalPtr(self: *Module, index: Decl.Index) ?*Global { |
src/codegen/spirv/Section.zig+12-12| ... | @@ -50,7 +50,7 @@ pub fn emitRaw( | ... | @@ -50,7 +50,7 @@ pub fn emitRaw( |
| 50 | ) !void { | 50 | ) !void { |
| 51 | const word_count = 1 + operand_words; | 51 | const word_count = 1 + operand_words; |
| 52 | try section.instructions.ensureUnusedCapacity(allocator, word_count); | 52 | try section.instructions.ensureUnusedCapacity(allocator, word_count); |
| 53 | section.writeWord((@intCast(Word, word_count << 16)) | @enumToInt(opcode)); | 53 | section.writeWord((@intCast(Word, word_count << 16)) | @intFromEnum(opcode)); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | pub fn emit( | 56 | pub fn emit( |
| ... | @@ -61,7 +61,7 @@ pub fn emit( | ... | @@ -61,7 +61,7 @@ pub fn emit( |
| 61 | ) !void { | 61 | ) !void { |
| 62 | const word_count = instructionSize(opcode, operands); | 62 | const word_count = instructionSize(opcode, operands); |
| 63 | try section.instructions.ensureUnusedCapacity(allocator, word_count); | 63 | try section.instructions.ensureUnusedCapacity(allocator, word_count); |
| 64 | section.writeWord(@intCast(Word, word_count << 16) | @enumToInt(opcode)); | 64 | section.writeWord(@intCast(Word, word_count << 16) | @intFromEnum(opcode)); |
| 65 | section.writeOperands(opcode.Operands(), operands); | 65 | section.writeOperands(opcode.Operands(), operands); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| ... | @@ -126,14 +126,14 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) | ... | @@ -126,14 +126,14 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand) |
| 126 | // TODO: Where this type is used (OpSpecConstantOp) is currently not correct in the spec json, | 126 | // TODO: Where this type is used (OpSpecConstantOp) is currently not correct in the spec json, |
| 127 | // so it most likely needs to be altered into something that can actually describe the entire | 127 | // so it most likely needs to be altered into something that can actually describe the entire |
| 128 | // instruction in which it is used. | 128 | // instruction in which it is used. |
| 129 | spec.LiteralSpecConstantOpInteger => section.writeWord(@enumToInt(operand.opcode)), | 129 | spec.LiteralSpecConstantOpInteger => section.writeWord(@intFromEnum(operand.opcode)), |
| 130 | 130 | ||
| 131 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, operand.label.id }), | 131 | spec.PairLiteralIntegerIdRef => section.writeWords(&.{ operand.value, operand.label.id }), |
| 132 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ operand.target.id, operand.member }), | 132 | spec.PairIdRefLiteralInteger => section.writeWords(&.{ operand.target.id, operand.member }), |
| 133 | spec.PairIdRefIdRef => section.writeWords(&.{ operand[0].id, operand[1].id }), | 133 | spec.PairIdRefIdRef => section.writeWords(&.{ operand[0].id, operand[1].id }), |
| 134 | 134 | ||
| 135 | else => switch (@typeInfo(Operand)) { | 135 | else => switch (@typeInfo(Operand)) { |
| 136 | .Enum => section.writeWord(@enumToInt(operand)), | 136 | .Enum => section.writeWord(@intFromEnum(operand)), |
| 137 | .Optional => |info| if (operand) |child| { | 137 | .Optional => |info| if (operand) |child| { |
| 138 | section.writeOperand(info.child, child); | 138 | section.writeOperand(info.child, child); |
| 139 | }, | 139 | }, |
| ... | @@ -217,7 +217,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand | ... | @@ -217,7 +217,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand |
| 217 | 217 | ||
| 218 | fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { | 218 | fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operand) void { |
| 219 | const tag = std.meta.activeTag(operand); | 219 | const tag = std.meta.activeTag(operand); |
| 220 | section.writeWord(@enumToInt(tag)); | 220 | section.writeWord(@intFromEnum(tag)); |
| 221 | 221 | ||
| 222 | inline for (@typeInfo(Operand).Union.fields) |field| { | 222 | inline for (@typeInfo(Operand).Union.fields) |field| { |
| 223 | if (@field(Operand, field.name) == tag) { | 223 | if (@field(Operand, field.name) == tag) { |
| ... | @@ -327,7 +327,7 @@ test "SPIR-V Section emit() - no operands" { | ... | @@ -327,7 +327,7 @@ test "SPIR-V Section emit() - no operands" { |
| 327 | 327 | ||
| 328 | try section.emit(std.testing.allocator, .OpNop, {}); | 328 | try section.emit(std.testing.allocator, .OpNop, {}); |
| 329 | 329 | ||
| 330 | try testing.expect(section.instructions.items[0] == (@as(Word, 1) << 16) | @enumToInt(Opcode.OpNop)); | 330 | try testing.expect(section.instructions.items[0] == (@as(Word, 1) << 16) | @intFromEnum(Opcode.OpNop)); |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | test "SPIR-V Section emit() - simple" { | 333 | test "SPIR-V Section emit() - simple" { |
| ... | @@ -340,7 +340,7 @@ test "SPIR-V Section emit() - simple" { | ... | @@ -340,7 +340,7 @@ test "SPIR-V Section emit() - simple" { |
| 340 | }); | 340 | }); |
| 341 | 341 | ||
| 342 | try testing.expectEqualSlices(Word, &.{ | 342 | try testing.expectEqualSlices(Word, &.{ |
| 343 | (@as(Word, 3) << 16) | @enumToInt(Opcode.OpUndef), | 343 | (@as(Word, 3) << 16) | @intFromEnum(Opcode.OpUndef), |
| 344 | 0, | 344 | 0, |
| 345 | 1, | 345 | 1, |
| 346 | }, section.instructions.items); | 346 | }, section.instructions.items); |
| ... | @@ -358,8 +358,8 @@ test "SPIR-V Section emit() - string" { | ... | @@ -358,8 +358,8 @@ test "SPIR-V Section emit() - string" { |
| 358 | }); | 358 | }); |
| 359 | 359 | ||
| 360 | try testing.expectEqualSlices(Word, &.{ | 360 | try testing.expectEqualSlices(Word, &.{ |
| 361 | (@as(Word, 10) << 16) | @enumToInt(Opcode.OpSource), | 361 | (@as(Word, 10) << 16) | @intFromEnum(Opcode.OpSource), |
| 362 | @enumToInt(spec.SourceLanguage.Unknown), | 362 | @intFromEnum(spec.SourceLanguage.Unknown), |
| 363 | 123, | 363 | 123, |
| 364 | 456, | 364 | 456, |
| 365 | std.mem.bytesToValue(Word, "pub "), | 365 | std.mem.bytesToValue(Word, "pub "), |
| ... | @@ -389,7 +389,7 @@ test "SPIR-V Section emit() - extended mask" { | ... | @@ -389,7 +389,7 @@ test "SPIR-V Section emit() - extended mask" { |
| 389 | }); | 389 | }); |
| 390 | 390 | ||
| 391 | try testing.expectEqualSlices(Word, &.{ | 391 | try testing.expectEqualSlices(Word, &.{ |
| 392 | (@as(Word, 5) << 16) | @enumToInt(Opcode.OpLoopMerge), | 392 | (@as(Word, 5) << 16) | @intFromEnum(Opcode.OpLoopMerge), |
| 393 | 10, | 393 | 10, |
| 394 | 20, | 394 | 20, |
| 395 | @bitCast(Word, spec.LoopControl{ .Unroll = true, .DependencyLength = true }), | 395 | @bitCast(Word, spec.LoopControl{ .Unroll = true, .DependencyLength = true }), |
| ... | @@ -409,9 +409,9 @@ test "SPIR-V Section emit() - extended union" { | ... | @@ -409,9 +409,9 @@ test "SPIR-V Section emit() - extended union" { |
| 409 | }); | 409 | }); |
| 410 | 410 | ||
| 411 | try testing.expectEqualSlices(Word, &.{ | 411 | try testing.expectEqualSlices(Word, &.{ |
| 412 | (@as(Word, 6) << 16) | @enumToInt(Opcode.OpExecutionMode), | 412 | (@as(Word, 6) << 16) | @intFromEnum(Opcode.OpExecutionMode), |
| 413 | 888, | 413 | 888, |
| 414 | @enumToInt(spec.ExecutionMode.LocalSize), | 414 | @intFromEnum(spec.ExecutionMode.LocalSize), |
| 415 | 4, | 415 | 4, |
| 416 | 8, | 416 | 8, |
| 417 | 16, | 417 | 16, |
src/crash_report.zig+6-6| ... | @@ -186,11 +186,11 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any | ... | @@ -186,11 +186,11 @@ fn handleSegfaultPosix(sig: i32, info: *const os.siginfo_t, ctx_ptr: ?*const any |
| 186 | PanicSwitch.preDispatch(); | 186 | PanicSwitch.preDispatch(); |
| 187 | 187 | ||
| 188 | const addr = switch (builtin.os.tag) { | 188 | const addr = switch (builtin.os.tag) { |
| 189 | .linux => @ptrToInt(info.fields.sigfault.addr), | 189 | .linux => @intFromPtr(info.fields.sigfault.addr), |
| 190 | .freebsd, .macos => @ptrToInt(info.addr), | 190 | .freebsd, .macos => @intFromPtr(info.addr), |
| 191 | .netbsd => @ptrToInt(info.info.reason.fault.addr), | 191 | .netbsd => @intFromPtr(info.info.reason.fault.addr), |
| 192 | .openbsd => @ptrToInt(info.data.fault.addr), | 192 | .openbsd => @intFromPtr(info.data.fault.addr), |
| 193 | .solaris => @ptrToInt(info.reason.fault.addr), | 193 | .solaris => @intFromPtr(info.reason.fault.addr), |
| 194 | else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"), | 194 | else => @compileError("TODO implement handleSegfaultPosix for new POSIX OS"), |
| 195 | }; | 195 | }; |
| 196 | 196 | ||
| ... | @@ -279,7 +279,7 @@ fn handleSegfaultWindowsExtra(info: *os.windows.EXCEPTION_POINTERS, comptime msg | ... | @@ -279,7 +279,7 @@ fn handleSegfaultWindowsExtra(info: *os.windows.EXCEPTION_POINTERS, comptime msg |
| 279 | const regs = info.ContextRecord.getRegs(); | 279 | const regs = info.ContextRecord.getRegs(); |
| 280 | break :ctx StackContext{ .exception = .{ .bp = regs.bp, .ip = regs.ip } }; | 280 | break :ctx StackContext{ .exception = .{ .bp = regs.bp, .ip = regs.ip } }; |
| 281 | } else ctx: { | 281 | } else ctx: { |
| 282 | const addr = @ptrToInt(info.ExceptionRecord.ExceptionAddress); | 282 | const addr = @intFromPtr(info.ExceptionRecord.ExceptionAddress); |
| 283 | break :ctx StackContext{ .current = .{ .ret_addr = addr } }; | 283 | break :ctx StackContext{ .current = .{ .ret_addr = addr } }; |
| 284 | }; | 284 | }; |
| 285 | 285 |
src/libcxx.zig+4-4| ... | @@ -128,10 +128,10 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -128,10 +128,10 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 128 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); | 128 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 129 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); | 129 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); |
| 130 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ | 130 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ |
| 131 | @enumToInt(comp.libcxx_abi_version), | 131 | @intFromEnum(comp.libcxx_abi_version), |
| 132 | }); | 132 | }); |
| 133 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ | 133 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 134 | @enumToInt(comp.libcxx_abi_version), | 134 | @intFromEnum(comp.libcxx_abi_version), |
| 135 | }); | 135 | }); |
| 136 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); | 136 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxx_files.len); |
| 137 | 137 | ||
| ... | @@ -302,10 +302,10 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { | ... | @@ -302,10 +302,10 @@ pub fn buildLibCXXABI(comp: *Compilation, prog_node: *std.Progress.Node) !void { |
| 302 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); | 302 | const cxx_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "include" }); |
| 303 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); | 303 | const cxx_src_include_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libcxx", "src" }); |
| 304 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ | 304 | const abi_version_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_VERSION={d}", .{ |
| 305 | @enumToInt(comp.libcxx_abi_version), | 305 | @intFromEnum(comp.libcxx_abi_version), |
| 306 | }); | 306 | }); |
| 307 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ | 307 | const abi_namespace_arg = try std.fmt.allocPrint(arena, "-D_LIBCPP_ABI_NAMESPACE=__{d}", .{ |
| 308 | @enumToInt(comp.libcxx_abi_version), | 308 | @intFromEnum(comp.libcxx_abi_version), |
| 309 | }); | 309 | }); |
| 310 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); | 310 | var c_source_files = try std.ArrayList(Compilation.CSourceFile).initCapacity(arena, libcxxabi_files.len); |
| 311 | 311 |
src/link/Coff.zig+17-17| ... | @@ -538,7 +538,7 @@ fn allocateAtom(self: *Coff, atom_index: Atom.Index, new_atom_size: u32, alignme | ... | @@ -538,7 +538,7 @@ fn allocateAtom(self: *Coff, atom_index: Atom.Index, new_atom_size: u32, alignme |
| 538 | defer tracy.end(); | 538 | defer tracy.end(); |
| 539 | 539 | ||
| 540 | const atom = self.getAtom(atom_index); | 540 | const atom = self.getAtom(atom_index); |
| 541 | const sect_id = @enumToInt(atom.getSymbol(self).section_number) - 1; | 541 | const sect_id = @intFromEnum(atom.getSymbol(self).section_number) - 1; |
| 542 | const header = &self.sections.items(.header)[sect_id]; | 542 | const header = &self.sections.items(.header)[sect_id]; |
| 543 | const free_list = &self.sections.items(.free_list)[sect_id]; | 543 | const free_list = &self.sections.items(.free_list)[sect_id]; |
| 544 | const maybe_last_atom_index = &self.sections.items(.last_atom_index)[sect_id]; | 544 | const maybe_last_atom_index = &self.sections.items(.last_atom_index)[sect_id]; |
| ... | @@ -739,7 +739,7 @@ fn shrinkAtom(self: *Coff, atom_index: Atom.Index, new_block_size: u32) void { | ... | @@ -739,7 +739,7 @@ fn shrinkAtom(self: *Coff, atom_index: Atom.Index, new_block_size: u32) void { |
| 739 | fn writeAtom(self: *Coff, atom_index: Atom.Index, code: []u8) !void { | 739 | fn writeAtom(self: *Coff, atom_index: Atom.Index, code: []u8) !void { |
| 740 | const atom = self.getAtom(atom_index); | 740 | const atom = self.getAtom(atom_index); |
| 741 | const sym = atom.getSymbol(self); | 741 | const sym = atom.getSymbol(self); |
| 742 | const section = self.sections.get(@enumToInt(sym.section_number) - 1); | 742 | const section = self.sections.get(@intFromEnum(sym.section_number) - 1); |
| 743 | const file_offset = section.header.pointer_to_raw_data + sym.value - section.header.virtual_address; | 743 | const file_offset = section.header.pointer_to_raw_data + sym.value - section.header.virtual_address; |
| 744 | 744 | ||
| 745 | log.debug("writing atom for symbol {s} at file offset 0x{x} to 0x{x}", .{ | 745 | log.debug("writing atom for symbol {s} at file offset 0x{x} to 0x{x}", .{ |
| ... | @@ -769,14 +769,14 @@ fn writeAtom(self: *Coff, atom_index: Atom.Index, code: []u8) !void { | ... | @@ -769,14 +769,14 @@ fn writeAtom(self: *Coff, atom_index: Atom.Index, code: []u8) !void { |
| 769 | 769 | ||
| 770 | if (is_hot_update_compatible) { | 770 | if (is_hot_update_compatible) { |
| 771 | if (self.base.child_pid) |handle| { | 771 | if (self.base.child_pid) |handle| { |
| 772 | const slide = @ptrToInt(self.hot_state.loaded_base_address.?); | 772 | const slide = @intFromPtr(self.hot_state.loaded_base_address.?); |
| 773 | 773 | ||
| 774 | const mem_code = try gpa.dupe(u8, code); | 774 | const mem_code = try gpa.dupe(u8, code); |
| 775 | defer gpa.free(mem_code); | 775 | defer gpa.free(mem_code); |
| 776 | self.resolveRelocs(atom_index, relocs.items, mem_code, slide); | 776 | self.resolveRelocs(atom_index, relocs.items, mem_code, slide); |
| 777 | 777 | ||
| 778 | const vaddr = sym.value + slide; | 778 | const vaddr = sym.value + slide; |
| 779 | const pvaddr = @intToPtr(*anyopaque, vaddr); | 779 | const pvaddr = @ptrFromInt(*anyopaque, vaddr); |
| 780 | 780 | ||
| 781 | log.debug("writing to memory at address {x}", .{vaddr}); | 781 | log.debug("writing to memory at address {x}", .{vaddr}); |
| 782 | 782 | ||
| ... | @@ -860,9 +860,9 @@ fn writeOffsetTableEntry(self: *Coff, index: usize) !void { | ... | @@ -860,9 +860,9 @@ fn writeOffsetTableEntry(self: *Coff, index: usize) !void { |
| 860 | if (is_hot_update_compatible) { | 860 | if (is_hot_update_compatible) { |
| 861 | if (self.base.child_pid) |handle| { | 861 | if (self.base.child_pid) |handle| { |
| 862 | const gpa = self.base.allocator; | 862 | const gpa = self.base.allocator; |
| 863 | const slide = @ptrToInt(self.hot_state.loaded_base_address.?); | 863 | const slide = @intFromPtr(self.hot_state.loaded_base_address.?); |
| 864 | const actual_vmaddr = vmaddr + slide; | 864 | const actual_vmaddr = vmaddr + slide; |
| 865 | const pvaddr = @intToPtr(*anyopaque, actual_vmaddr); | 865 | const pvaddr = @ptrFromInt(*anyopaque, actual_vmaddr); |
| 866 | log.debug("writing GOT entry to memory at address {x}", .{actual_vmaddr}); | 866 | log.debug("writing GOT entry to memory at address {x}", .{actual_vmaddr}); |
| 867 | if (build_options.enable_logging) { | 867 | if (build_options.enable_logging) { |
| 868 | switch (self.ptr_width) { | 868 | switch (self.ptr_width) { |
| ... | @@ -970,7 +970,7 @@ fn freeAtom(self: *Coff, atom_index: Atom.Index) void { | ... | @@ -970,7 +970,7 @@ fn freeAtom(self: *Coff, atom_index: Atom.Index) void { |
| 970 | 970 | ||
| 971 | const atom = self.getAtom(atom_index); | 971 | const atom = self.getAtom(atom_index); |
| 972 | const sym = atom.getSymbol(self); | 972 | const sym = atom.getSymbol(self); |
| 973 | const sect_id = @enumToInt(sym.section_number) - 1; | 973 | const sect_id = @intFromEnum(sym.section_number) - 1; |
| 974 | const free_list = &self.sections.items(.free_list)[sect_id]; | 974 | const free_list = &self.sections.items(.free_list)[sect_id]; |
| 975 | var already_have_free_list_node = false; | 975 | var already_have_free_list_node = false; |
| 976 | { | 976 | { |
| ... | @@ -1107,7 +1107,7 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In | ... | @@ -1107,7 +1107,7 @@ pub fn lowerUnnamedConst(self: *Coff, tv: TypedValue, decl_index: Module.Decl.In |
| 1107 | const atom = self.getAtom(atom_index); | 1107 | const atom = self.getAtom(atom_index); |
| 1108 | const sym = atom.getSymbolPtr(self); | 1108 | const sym = atom.getSymbolPtr(self); |
| 1109 | try self.setSymbolName(sym, sym_name); | 1109 | try self.setSymbolName(sym, sym_name); |
| 1110 | sym.section_number = @intToEnum(coff.SectionNumber, self.rdata_section_index.? + 1); | 1110 | sym.section_number = @enumFromInt(coff.SectionNumber, self.rdata_section_index.? + 1); |
| 1111 | } | 1111 | } |
| 1112 | 1112 | ||
| 1113 | const res = try codegen.generateSymbol(&self.base, decl.srcLoc(mod), tv, &code_buffer, .none, .{ | 1113 | const res = try codegen.generateSymbol(&self.base, decl.srcLoc(mod), tv, &code_buffer, .none, .{ |
| ... | @@ -1244,7 +1244,7 @@ fn updateLazySymbolAtom( | ... | @@ -1244,7 +1244,7 @@ fn updateLazySymbolAtom( |
| 1244 | const code_len = @intCast(u32, code.len); | 1244 | const code_len = @intCast(u32, code.len); |
| 1245 | const symbol = atom.getSymbolPtr(self); | 1245 | const symbol = atom.getSymbolPtr(self); |
| 1246 | try self.setSymbolName(symbol, name); | 1246 | try self.setSymbolName(symbol, name); |
| 1247 | symbol.section_number = @intToEnum(coff.SectionNumber, section_index + 1); | 1247 | symbol.section_number = @enumFromInt(coff.SectionNumber, section_index + 1); |
| 1248 | symbol.type = .{ .complex_type = .NULL, .base_type = .NULL }; | 1248 | symbol.type = .{ .complex_type = .NULL, .base_type = .NULL }; |
| 1249 | 1249 | ||
| 1250 | const vaddr = try self.allocateAtom(atom_index, code_len, required_alignment); | 1250 | const vaddr = try self.allocateAtom(atom_index, code_len, required_alignment); |
| ... | @@ -1341,7 +1341,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []u8, comple | ... | @@ -1341,7 +1341,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []u8, comple |
| 1341 | if (atom.size != 0) { | 1341 | if (atom.size != 0) { |
| 1342 | const sym = atom.getSymbolPtr(self); | 1342 | const sym = atom.getSymbolPtr(self); |
| 1343 | try self.setSymbolName(sym, decl_name); | 1343 | try self.setSymbolName(sym, decl_name); |
| 1344 | sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1); | 1344 | sym.section_number = @enumFromInt(coff.SectionNumber, sect_index + 1); |
| 1345 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; | 1345 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; |
| 1346 | 1346 | ||
| 1347 | const capacity = atom.capacity(self); | 1347 | const capacity = atom.capacity(self); |
| ... | @@ -1365,7 +1365,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []u8, comple | ... | @@ -1365,7 +1365,7 @@ fn updateDeclCode(self: *Coff, decl_index: Module.Decl.Index, code: []u8, comple |
| 1365 | } else { | 1365 | } else { |
| 1366 | const sym = atom.getSymbolPtr(self); | 1366 | const sym = atom.getSymbolPtr(self); |
| 1367 | try self.setSymbolName(sym, decl_name); | 1367 | try self.setSymbolName(sym, decl_name); |
| 1368 | sym.section_number = @intToEnum(coff.SectionNumber, sect_index + 1); | 1368 | sym.section_number = @enumFromInt(coff.SectionNumber, sect_index + 1); |
| 1369 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; | 1369 | sym.type = .{ .complex_type = complex_type, .base_type = .NULL }; |
| 1370 | 1370 | ||
| 1371 | const vaddr = try self.allocateAtom(atom_index, code_len, required_alignment); | 1371 | const vaddr = try self.allocateAtom(atom_index, code_len, required_alignment); |
| ... | @@ -1502,7 +1502,7 @@ pub fn updateDeclExports( | ... | @@ -1502,7 +1502,7 @@ pub fn updateDeclExports( |
| 1502 | const sym = self.getSymbolPtr(sym_loc); | 1502 | const sym = self.getSymbolPtr(sym_loc); |
| 1503 | try self.setSymbolName(sym, mod.intern_pool.stringToSlice(exp.opts.name)); | 1503 | try self.setSymbolName(sym, mod.intern_pool.stringToSlice(exp.opts.name)); |
| 1504 | sym.value = decl_sym.value; | 1504 | sym.value = decl_sym.value; |
| 1505 | sym.section_number = @intToEnum(coff.SectionNumber, self.text_section_index.? + 1); | 1505 | sym.section_number = @enumFromInt(coff.SectionNumber, self.text_section_index.? + 1); |
| 1506 | sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL }; | 1506 | sym.type = .{ .complex_type = .FUNCTION, .base_type = .NULL }; |
| 1507 | 1507 | ||
| 1508 | switch (exp.opts.linkage) { | 1508 | switch (exp.opts.linkage) { |
| ... | @@ -1668,7 +1668,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod | ... | @@ -1668,7 +1668,7 @@ pub fn flushModule(self: *Coff, comp: *Compilation, prog_node: *std.Progress.Nod |
| 1668 | 1668 | ||
| 1669 | const atom = self.getAtom(atom_index); | 1669 | const atom = self.getAtom(atom_index); |
| 1670 | const sym = atom.getSymbol(self); | 1670 | const sym = atom.getSymbol(self); |
| 1671 | const section = self.sections.get(@enumToInt(sym.section_number) - 1).header; | 1671 | const section = self.sections.get(@intFromEnum(sym.section_number) - 1).header; |
| 1672 | const file_offset = section.pointer_to_raw_data + sym.value - section.virtual_address; | 1672 | const file_offset = section.pointer_to_raw_data + sym.value - section.virtual_address; |
| 1673 | 1673 | ||
| 1674 | var code = std.ArrayList(u8).init(gpa); | 1674 | var code = std.ArrayList(u8).init(gpa); |
| ... | @@ -1878,7 +1878,7 @@ fn writeBaseRelocations(self: *Coff) !void { | ... | @@ -1878,7 +1878,7 @@ fn writeBaseRelocations(self: *Coff) !void { |
| 1878 | 1878 | ||
| 1879 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); | 1879 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); |
| 1880 | 1880 | ||
| 1881 | self.data_directories[@enumToInt(coff.DirectoryEntry.BASERELOC)] = .{ | 1881 | self.data_directories[@intFromEnum(coff.DirectoryEntry.BASERELOC)] = .{ |
| 1882 | .virtual_address = header.virtual_address, | 1882 | .virtual_address = header.virtual_address, |
| 1883 | .size = needed_size, | 1883 | .size = needed_size, |
| 1884 | }; | 1884 | }; |
| ... | @@ -2011,11 +2011,11 @@ fn writeImportTables(self: *Coff) !void { | ... | @@ -2011,11 +2011,11 @@ fn writeImportTables(self: *Coff) !void { |
| 2011 | 2011 | ||
| 2012 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); | 2012 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); |
| 2013 | 2013 | ||
| 2014 | self.data_directories[@enumToInt(coff.DirectoryEntry.IMPORT)] = .{ | 2014 | self.data_directories[@intFromEnum(coff.DirectoryEntry.IMPORT)] = .{ |
| 2015 | .virtual_address = header.virtual_address + iat_size, | 2015 | .virtual_address = header.virtual_address + iat_size, |
| 2016 | .size = dir_table_size, | 2016 | .size = dir_table_size, |
| 2017 | }; | 2017 | }; |
| 2018 | self.data_directories[@enumToInt(coff.DirectoryEntry.IAT)] = .{ | 2018 | self.data_directories[@intFromEnum(coff.DirectoryEntry.IAT)] = .{ |
| 2019 | .virtual_address = header.virtual_address, | 2019 | .virtual_address = header.virtual_address, |
| 2020 | .size = iat_size, | 2020 | .size = iat_size, |
| 2021 | }; | 2021 | }; |
| ... | @@ -2469,7 +2469,7 @@ fn logSymtab(self: *Coff) void { | ... | @@ -2469,7 +2469,7 @@ fn logSymtab(self: *Coff) void { |
| 2469 | .UNDEFINED => 0, // TODO | 2469 | .UNDEFINED => 0, // TODO |
| 2470 | .ABSOLUTE => unreachable, // TODO | 2470 | .ABSOLUTE => unreachable, // TODO |
| 2471 | .DEBUG => unreachable, // TODO | 2471 | .DEBUG => unreachable, // TODO |
| 2472 | else => @enumToInt(sym.section_number), | 2472 | else => @intFromEnum(sym.section_number), |
| 2473 | }; | 2473 | }; |
| 2474 | log.debug(" %{d}: {?s} @{x} in {s}({d}), {s}", .{ | 2474 | log.debug(" %{d}: {?s} @{x} in {s}({d}), {s}", .{ |
| 2475 | sym_id, | 2475 | sym_id, |
src/link/Dwarf.zig+65-65| ... | @@ -171,11 +171,11 @@ pub const DeclState = struct { | ... | @@ -171,11 +171,11 @@ pub const DeclState = struct { |
| 171 | switch (ty.zigTypeTag(mod)) { | 171 | switch (ty.zigTypeTag(mod)) { |
| 172 | .NoReturn => unreachable, | 172 | .NoReturn => unreachable, |
| 173 | .Void => { | 173 | .Void => { |
| 174 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.pad1)); | 174 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.pad1)); |
| 175 | }, | 175 | }, |
| 176 | .Bool => { | 176 | .Bool => { |
| 177 | try dbg_info_buffer.ensureUnusedCapacity(12); | 177 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 178 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.base_type)); | 178 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 179 | // DW.AT.encoding, DW.FORM.data1 | 179 | // DW.AT.encoding, DW.FORM.data1 |
| 180 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.boolean); | 180 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.boolean); |
| 181 | // DW.AT.byte_size, DW.FORM.udata | 181 | // DW.AT.byte_size, DW.FORM.udata |
| ... | @@ -186,7 +186,7 @@ pub const DeclState = struct { | ... | @@ -186,7 +186,7 @@ pub const DeclState = struct { |
| 186 | .Int => { | 186 | .Int => { |
| 187 | const info = ty.intInfo(mod); | 187 | const info = ty.intInfo(mod); |
| 188 | try dbg_info_buffer.ensureUnusedCapacity(12); | 188 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 189 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.base_type)); | 189 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 190 | // DW.AT.encoding, DW.FORM.data1 | 190 | // DW.AT.encoding, DW.FORM.data1 |
| 191 | dbg_info_buffer.appendAssumeCapacity(switch (info.signedness) { | 191 | dbg_info_buffer.appendAssumeCapacity(switch (info.signedness) { |
| 192 | .signed => DW.ATE.signed, | 192 | .signed => DW.ATE.signed, |
| ... | @@ -200,7 +200,7 @@ pub const DeclState = struct { | ... | @@ -200,7 +200,7 @@ pub const DeclState = struct { |
| 200 | .Optional => { | 200 | .Optional => { |
| 201 | if (ty.isPtrLikeOptional(mod)) { | 201 | if (ty.isPtrLikeOptional(mod)) { |
| 202 | try dbg_info_buffer.ensureUnusedCapacity(12); | 202 | try dbg_info_buffer.ensureUnusedCapacity(12); |
| 203 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.base_type)); | 203 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.base_type)); |
| 204 | // DW.AT.encoding, DW.FORM.data1 | 204 | // DW.AT.encoding, DW.FORM.data1 |
| 205 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.address); | 205 | dbg_info_buffer.appendAssumeCapacity(DW.ATE.address); |
| 206 | // DW.AT.byte_size, DW.FORM.udata | 206 | // DW.AT.byte_size, DW.FORM.udata |
| ... | @@ -211,7 +211,7 @@ pub const DeclState = struct { | ... | @@ -211,7 +211,7 @@ pub const DeclState = struct { |
| 211 | // Non-pointer optionals are structs: struct { .maybe = *, .val = * } | 211 | // Non-pointer optionals are structs: struct { .maybe = *, .val = * } |
| 212 | const payload_ty = ty.optionalChild(mod); | 212 | const payload_ty = ty.optionalChild(mod); |
| 213 | // DW.AT.structure_type | 213 | // DW.AT.structure_type |
| 214 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); | 214 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 215 | // DW.AT.byte_size, DW.FORM.udata | 215 | // DW.AT.byte_size, DW.FORM.udata |
| 216 | const abi_size = ty.abiSize(mod); | 216 | const abi_size = ty.abiSize(mod); |
| 217 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); | 217 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | @@ -219,7 +219,7 @@ pub const DeclState = struct { | ... | @@ -219,7 +219,7 @@ pub const DeclState = struct { |
| 219 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); | 219 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 220 | // DW.AT.member | 220 | // DW.AT.member |
| 221 | try dbg_info_buffer.ensureUnusedCapacity(7); | 221 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 222 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 222 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 223 | // DW.AT.name, DW.FORM.string | 223 | // DW.AT.name, DW.FORM.string |
| 224 | dbg_info_buffer.appendSliceAssumeCapacity("maybe"); | 224 | dbg_info_buffer.appendSliceAssumeCapacity("maybe"); |
| 225 | dbg_info_buffer.appendAssumeCapacity(0); | 225 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -231,7 +231,7 @@ pub const DeclState = struct { | ... | @@ -231,7 +231,7 @@ pub const DeclState = struct { |
| 231 | try dbg_info_buffer.ensureUnusedCapacity(6); | 231 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 232 | dbg_info_buffer.appendAssumeCapacity(0); | 232 | dbg_info_buffer.appendAssumeCapacity(0); |
| 233 | // DW.AT.member | 233 | // DW.AT.member |
| 234 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 234 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 235 | // DW.AT.name, DW.FORM.string | 235 | // DW.AT.name, DW.FORM.string |
| 236 | dbg_info_buffer.appendSliceAssumeCapacity("val"); | 236 | dbg_info_buffer.appendSliceAssumeCapacity("val"); |
| 237 | dbg_info_buffer.appendAssumeCapacity(0); | 237 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -253,14 +253,14 @@ pub const DeclState = struct { | ... | @@ -253,14 +253,14 @@ pub const DeclState = struct { |
| 253 | const ptr_bytes = @intCast(u8, @divExact(ptr_bits, 8)); | 253 | const ptr_bytes = @intCast(u8, @divExact(ptr_bits, 8)); |
| 254 | // DW.AT.structure_type | 254 | // DW.AT.structure_type |
| 255 | try dbg_info_buffer.ensureUnusedCapacity(2); | 255 | try dbg_info_buffer.ensureUnusedCapacity(2); |
| 256 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_type)); | 256 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_type)); |
| 257 | // DW.AT.byte_size, DW.FORM.udata | 257 | // DW.AT.byte_size, DW.FORM.udata |
| 258 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); | 258 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 259 | // DW.AT.name, DW.FORM.string | 259 | // DW.AT.name, DW.FORM.string |
| 260 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); | 260 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 261 | // DW.AT.member | 261 | // DW.AT.member |
| 262 | try dbg_info_buffer.ensureUnusedCapacity(5); | 262 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 263 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 263 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 264 | // DW.AT.name, DW.FORM.string | 264 | // DW.AT.name, DW.FORM.string |
| 265 | dbg_info_buffer.appendSliceAssumeCapacity("ptr"); | 265 | dbg_info_buffer.appendSliceAssumeCapacity("ptr"); |
| 266 | dbg_info_buffer.appendAssumeCapacity(0); | 266 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -273,7 +273,7 @@ pub const DeclState = struct { | ... | @@ -273,7 +273,7 @@ pub const DeclState = struct { |
| 273 | try dbg_info_buffer.ensureUnusedCapacity(6); | 273 | try dbg_info_buffer.ensureUnusedCapacity(6); |
| 274 | dbg_info_buffer.appendAssumeCapacity(0); | 274 | dbg_info_buffer.appendAssumeCapacity(0); |
| 275 | // DW.AT.member | 275 | // DW.AT.member |
| 276 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 276 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 277 | // DW.AT.name, DW.FORM.string | 277 | // DW.AT.name, DW.FORM.string |
| 278 | dbg_info_buffer.appendSliceAssumeCapacity("len"); | 278 | dbg_info_buffer.appendSliceAssumeCapacity("len"); |
| 279 | dbg_info_buffer.appendAssumeCapacity(0); | 279 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -288,7 +288,7 @@ pub const DeclState = struct { | ... | @@ -288,7 +288,7 @@ pub const DeclState = struct { |
| 288 | dbg_info_buffer.appendAssumeCapacity(0); | 288 | dbg_info_buffer.appendAssumeCapacity(0); |
| 289 | } else { | 289 | } else { |
| 290 | try dbg_info_buffer.ensureUnusedCapacity(5); | 290 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 291 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.ptr_type)); | 291 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.ptr_type)); |
| 292 | // DW.AT.type, DW.FORM.ref4 | 292 | // DW.AT.type, DW.FORM.ref4 |
| 293 | const index = dbg_info_buffer.items.len; | 293 | const index = dbg_info_buffer.items.len; |
| 294 | try dbg_info_buffer.resize(index + 4); | 294 | try dbg_info_buffer.resize(index + 4); |
| ... | @@ -297,7 +297,7 @@ pub const DeclState = struct { | ... | @@ -297,7 +297,7 @@ pub const DeclState = struct { |
| 297 | }, | 297 | }, |
| 298 | .Array => { | 298 | .Array => { |
| 299 | // DW.AT.array_type | 299 | // DW.AT.array_type |
| 300 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.array_type)); | 300 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.array_type)); |
| 301 | // DW.AT.name, DW.FORM.string | 301 | // DW.AT.name, DW.FORM.string |
| 302 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); | 302 | try dbg_info_buffer.writer().print("{}\x00", .{ty.fmt(mod)}); |
| 303 | // DW.AT.type, DW.FORM.ref4 | 303 | // DW.AT.type, DW.FORM.ref4 |
| ... | @@ -305,7 +305,7 @@ pub const DeclState = struct { | ... | @@ -305,7 +305,7 @@ pub const DeclState = struct { |
| 305 | try dbg_info_buffer.resize(index + 4); | 305 | try dbg_info_buffer.resize(index + 4); |
| 306 | try self.addTypeRelocGlobal(atom_index, ty.childType(mod), @intCast(u32, index)); | 306 | try self.addTypeRelocGlobal(atom_index, ty.childType(mod), @intCast(u32, index)); |
| 307 | // DW.AT.subrange_type | 307 | // DW.AT.subrange_type |
| 308 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.array_dim)); | 308 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.array_dim)); |
| 309 | // DW.AT.type, DW.FORM.ref4 | 309 | // DW.AT.type, DW.FORM.ref4 |
| 310 | index = dbg_info_buffer.items.len; | 310 | index = dbg_info_buffer.items.len; |
| 311 | try dbg_info_buffer.resize(index + 4); | 311 | try dbg_info_buffer.resize(index + 4); |
| ... | @@ -318,7 +318,7 @@ pub const DeclState = struct { | ... | @@ -318,7 +318,7 @@ pub const DeclState = struct { |
| 318 | }, | 318 | }, |
| 319 | .Struct => blk: { | 319 | .Struct => blk: { |
| 320 | // DW.AT.structure_type | 320 | // DW.AT.structure_type |
| 321 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); | 321 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 322 | // DW.AT.byte_size, DW.FORM.udata | 322 | // DW.AT.byte_size, DW.FORM.udata |
| 323 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); | 323 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 324 | 324 | ||
| ... | @@ -329,7 +329,7 @@ pub const DeclState = struct { | ... | @@ -329,7 +329,7 @@ pub const DeclState = struct { |
| 329 | 329 | ||
| 330 | for (fields.types, 0..) |field_ty, field_index| { | 330 | for (fields.types, 0..) |field_ty, field_index| { |
| 331 | // DW.AT.member | 331 | // DW.AT.member |
| 332 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_member)); | 332 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_member)); |
| 333 | // DW.AT.name, DW.FORM.string | 333 | // DW.AT.name, DW.FORM.string |
| 334 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); | 334 | try dbg_info_buffer.writer().print("{d}\x00", .{field_index}); |
| 335 | // DW.AT.type, DW.FORM.ref4 | 335 | // DW.AT.type, DW.FORM.ref4 |
| ... | @@ -363,7 +363,7 @@ pub const DeclState = struct { | ... | @@ -363,7 +363,7 @@ pub const DeclState = struct { |
| 363 | const field_name = mod.intern_pool.stringToSlice(field_name_ip); | 363 | const field_name = mod.intern_pool.stringToSlice(field_name_ip); |
| 364 | // DW.AT.member | 364 | // DW.AT.member |
| 365 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2); | 365 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2); |
| 366 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 366 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 367 | // DW.AT.name, DW.FORM.string | 367 | // DW.AT.name, DW.FORM.string |
| 368 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); | 368 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 369 | dbg_info_buffer.appendAssumeCapacity(0); | 369 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -384,7 +384,7 @@ pub const DeclState = struct { | ... | @@ -384,7 +384,7 @@ pub const DeclState = struct { |
| 384 | }, | 384 | }, |
| 385 | .Enum => { | 385 | .Enum => { |
| 386 | // DW.AT.enumeration_type | 386 | // DW.AT.enumeration_type |
| 387 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.enum_type)); | 387 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.enum_type)); |
| 388 | // DW.AT.byte_size, DW.FORM.udata | 388 | // DW.AT.byte_size, DW.FORM.udata |
| 389 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); | 389 | try leb128.writeULEB128(dbg_info_buffer.writer(), ty.abiSize(mod)); |
| 390 | // DW.AT.name, DW.FORM.string | 390 | // DW.AT.name, DW.FORM.string |
| ... | @@ -398,7 +398,7 @@ pub const DeclState = struct { | ... | @@ -398,7 +398,7 @@ pub const DeclState = struct { |
| 398 | const field_name = mod.intern_pool.stringToSlice(field_name_index); | 398 | const field_name = mod.intern_pool.stringToSlice(field_name_index); |
| 399 | // DW.AT.enumerator | 399 | // DW.AT.enumerator |
| 400 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2 + @sizeOf(u64)); | 400 | try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2 + @sizeOf(u64)); |
| 401 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); | 401 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 402 | // DW.AT.name, DW.FORM.string | 402 | // DW.AT.name, DW.FORM.string |
| 403 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); | 403 | dbg_info_buffer.appendSliceAssumeCapacity(field_name); |
| 404 | dbg_info_buffer.appendAssumeCapacity(0); | 404 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -408,7 +408,7 @@ pub const DeclState = struct { | ... | @@ -408,7 +408,7 @@ pub const DeclState = struct { |
| 408 | const value = enum_type.values[field_i]; | 408 | const value = enum_type.values[field_i]; |
| 409 | // TODO do not assume a 64bit enum value - could be bigger. | 409 | // TODO do not assume a 64bit enum value - could be bigger. |
| 410 | // See https://github.com/ziglang/zig/issues/645 | 410 | // See https://github.com/ziglang/zig/issues/645 |
| 411 | const field_int_val = try value.toValue().enumToInt(ty, mod); | 411 | const field_int_val = try value.toValue().intFromEnum(ty, mod); |
| 412 | break :value @bitCast(u64, field_int_val.toSignedInt(mod)); | 412 | break :value @bitCast(u64, field_int_val.toSignedInt(mod)); |
| 413 | }; | 413 | }; |
| 414 | mem.writeInt(u64, dbg_info_buffer.addManyAsArrayAssumeCapacity(8), value, target_endian); | 414 | mem.writeInt(u64, dbg_info_buffer.addManyAsArrayAssumeCapacity(8), value, target_endian); |
| ... | @@ -430,7 +430,7 @@ pub const DeclState = struct { | ... | @@ -430,7 +430,7 @@ pub const DeclState = struct { |
| 430 | // for untagged unions. | 430 | // for untagged unions. |
| 431 | if (is_tagged) { | 431 | if (is_tagged) { |
| 432 | // DW.AT.structure_type | 432 | // DW.AT.structure_type |
| 433 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); | 433 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 434 | // DW.AT.byte_size, DW.FORM.udata | 434 | // DW.AT.byte_size, DW.FORM.udata |
| 435 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.abi_size); | 435 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.abi_size); |
| 436 | // DW.AT.name, DW.FORM.string | 436 | // DW.AT.name, DW.FORM.string |
| ... | @@ -440,7 +440,7 @@ pub const DeclState = struct { | ... | @@ -440,7 +440,7 @@ pub const DeclState = struct { |
| 440 | 440 | ||
| 441 | // DW.AT.member | 441 | // DW.AT.member |
| 442 | try dbg_info_buffer.ensureUnusedCapacity(9); | 442 | try dbg_info_buffer.ensureUnusedCapacity(9); |
| 443 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 443 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 444 | // DW.AT.name, DW.FORM.string | 444 | // DW.AT.name, DW.FORM.string |
| 445 | dbg_info_buffer.appendSliceAssumeCapacity("payload"); | 445 | dbg_info_buffer.appendSliceAssumeCapacity("payload"); |
| 446 | dbg_info_buffer.appendAssumeCapacity(0); | 446 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -453,7 +453,7 @@ pub const DeclState = struct { | ... | @@ -453,7 +453,7 @@ pub const DeclState = struct { |
| 453 | } | 453 | } |
| 454 | 454 | ||
| 455 | // DW.AT.union_type | 455 | // DW.AT.union_type |
| 456 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.union_type)); | 456 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.union_type)); |
| 457 | // DW.AT.byte_size, DW.FORM.udata, | 457 | // DW.AT.byte_size, DW.FORM.udata, |
| 458 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.payload_size); | 458 | try leb128.writeULEB128(dbg_info_buffer.writer(), layout.payload_size); |
| 459 | // DW.AT.name, DW.FORM.string | 459 | // DW.AT.name, DW.FORM.string |
| ... | @@ -468,7 +468,7 @@ pub const DeclState = struct { | ... | @@ -468,7 +468,7 @@ pub const DeclState = struct { |
| 468 | const field = fields.get(field_name).?; | 468 | const field = fields.get(field_name).?; |
| 469 | if (!field.ty.hasRuntimeBits(mod)) continue; | 469 | if (!field.ty.hasRuntimeBits(mod)) continue; |
| 470 | // DW.AT.member | 470 | // DW.AT.member |
| 471 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_member)); | 471 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_member)); |
| 472 | // DW.AT.name, DW.FORM.string | 472 | // DW.AT.name, DW.FORM.string |
| 473 | try dbg_info_buffer.appendSlice(mod.intern_pool.stringToSlice(field_name)); | 473 | try dbg_info_buffer.appendSlice(mod.intern_pool.stringToSlice(field_name)); |
| 474 | try dbg_info_buffer.append(0); | 474 | try dbg_info_buffer.append(0); |
| ... | @@ -485,7 +485,7 @@ pub const DeclState = struct { | ... | @@ -485,7 +485,7 @@ pub const DeclState = struct { |
| 485 | if (is_tagged) { | 485 | if (is_tagged) { |
| 486 | // DW.AT.member | 486 | // DW.AT.member |
| 487 | try dbg_info_buffer.ensureUnusedCapacity(5); | 487 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 488 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 488 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 489 | // DW.AT.name, DW.FORM.string | 489 | // DW.AT.name, DW.FORM.string |
| 490 | dbg_info_buffer.appendSliceAssumeCapacity("tag"); | 490 | dbg_info_buffer.appendSliceAssumeCapacity("tag"); |
| 491 | dbg_info_buffer.appendAssumeCapacity(0); | 491 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -519,7 +519,7 @@ pub const DeclState = struct { | ... | @@ -519,7 +519,7 @@ pub const DeclState = struct { |
| 519 | const error_off = if (error_align >= payload_align) 0 else payload_ty.abiSize(mod); | 519 | const error_off = if (error_align >= payload_align) 0 else payload_ty.abiSize(mod); |
| 520 | 520 | ||
| 521 | // DW.AT.structure_type | 521 | // DW.AT.structure_type |
| 522 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.struct_type)); | 522 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.struct_type)); |
| 523 | // DW.AT.byte_size, DW.FORM.udata | 523 | // DW.AT.byte_size, DW.FORM.udata |
| 524 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); | 524 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| 525 | // DW.AT.name, DW.FORM.string | 525 | // DW.AT.name, DW.FORM.string |
| ... | @@ -529,7 +529,7 @@ pub const DeclState = struct { | ... | @@ -529,7 +529,7 @@ pub const DeclState = struct { |
| 529 | if (!payload_ty.isNoReturn(mod)) { | 529 | if (!payload_ty.isNoReturn(mod)) { |
| 530 | // DW.AT.member | 530 | // DW.AT.member |
| 531 | try dbg_info_buffer.ensureUnusedCapacity(7); | 531 | try dbg_info_buffer.ensureUnusedCapacity(7); |
| 532 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 532 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 533 | // DW.AT.name, DW.FORM.string | 533 | // DW.AT.name, DW.FORM.string |
| 534 | dbg_info_buffer.appendSliceAssumeCapacity("value"); | 534 | dbg_info_buffer.appendSliceAssumeCapacity("value"); |
| 535 | dbg_info_buffer.appendAssumeCapacity(0); | 535 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -544,7 +544,7 @@ pub const DeclState = struct { | ... | @@ -544,7 +544,7 @@ pub const DeclState = struct { |
| 544 | { | 544 | { |
| 545 | // DW.AT.member | 545 | // DW.AT.member |
| 546 | try dbg_info_buffer.ensureUnusedCapacity(5); | 546 | try dbg_info_buffer.ensureUnusedCapacity(5); |
| 547 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.struct_member)); | 547 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.struct_member)); |
| 548 | // DW.AT.name, DW.FORM.string | 548 | // DW.AT.name, DW.FORM.string |
| 549 | dbg_info_buffer.appendSliceAssumeCapacity("err"); | 549 | dbg_info_buffer.appendSliceAssumeCapacity("err"); |
| 550 | dbg_info_buffer.appendAssumeCapacity(0); | 550 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -561,7 +561,7 @@ pub const DeclState = struct { | ... | @@ -561,7 +561,7 @@ pub const DeclState = struct { |
| 561 | }, | 561 | }, |
| 562 | else => { | 562 | else => { |
| 563 | log.debug("TODO implement .debug_info for type '{}'", .{ty.fmt(self.mod)}); | 563 | log.debug("TODO implement .debug_info for type '{}'", .{ty.fmt(self.mod)}); |
| 564 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.pad1)); | 564 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.pad1)); |
| 565 | }, | 565 | }, |
| 566 | } | 566 | } |
| 567 | } | 567 | } |
| ... | @@ -595,7 +595,7 @@ pub const DeclState = struct { | ... | @@ -595,7 +595,7 @@ pub const DeclState = struct { |
| 595 | switch (loc) { | 595 | switch (loc) { |
| 596 | .register => |reg| { | 596 | .register => |reg| { |
| 597 | try dbg_info.ensureUnusedCapacity(4); | 597 | try dbg_info.ensureUnusedCapacity(4); |
| 598 | dbg_info.appendAssumeCapacity(@enumToInt(AbbrevKind.parameter)); | 598 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 599 | // DW.AT.location, DW.FORM.exprloc | 599 | // DW.AT.location, DW.FORM.exprloc |
| 600 | var expr_len = std.io.countingWriter(std.io.null_writer); | 600 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 601 | if (reg < 32) { | 601 | if (reg < 32) { |
| ... | @@ -614,7 +614,7 @@ pub const DeclState = struct { | ... | @@ -614,7 +614,7 @@ pub const DeclState = struct { |
| 614 | }, | 614 | }, |
| 615 | .stack => |info| { | 615 | .stack => |info| { |
| 616 | try dbg_info.ensureUnusedCapacity(9); | 616 | try dbg_info.ensureUnusedCapacity(9); |
| 617 | dbg_info.appendAssumeCapacity(@enumToInt(AbbrevKind.parameter)); | 617 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 618 | // DW.AT.location, DW.FORM.exprloc | 618 | // DW.AT.location, DW.FORM.exprloc |
| 619 | var expr_len = std.io.countingWriter(std.io.null_writer); | 619 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 620 | if (info.fp_register < 32) { | 620 | if (info.fp_register < 32) { |
| ... | @@ -643,7 +643,7 @@ pub const DeclState = struct { | ... | @@ -643,7 +643,7 @@ pub const DeclState = struct { |
| 643 | // where each argument is encoded as | 643 | // where each argument is encoded as |
| 644 | // <opcode> i:uleb128 | 644 | // <opcode> i:uleb128 |
| 645 | dbg_info.appendSliceAssumeCapacity(&.{ | 645 | dbg_info.appendSliceAssumeCapacity(&.{ |
| 646 | @enumToInt(AbbrevKind.parameter), | 646 | @intFromEnum(AbbrevKind.parameter), |
| 647 | DW.OP.WASM_location, | 647 | DW.OP.WASM_location, |
| 648 | DW.OP.WASM_local, | 648 | DW.OP.WASM_local, |
| 649 | }); | 649 | }); |
| ... | @@ -670,7 +670,7 @@ pub const DeclState = struct { | ... | @@ -670,7 +670,7 @@ pub const DeclState = struct { |
| 670 | const dbg_info = &self.dbg_info; | 670 | const dbg_info = &self.dbg_info; |
| 671 | const atom_index = self.di_atom_decls.get(owner_decl).?; | 671 | const atom_index = self.di_atom_decls.get(owner_decl).?; |
| 672 | const name_with_null = name.ptr[0 .. name.len + 1]; | 672 | const name_with_null = name.ptr[0 .. name.len + 1]; |
| 673 | try dbg_info.append(@enumToInt(AbbrevKind.variable)); | 673 | try dbg_info.append(@intFromEnum(AbbrevKind.variable)); |
| 674 | const mod = self.mod; | 674 | const mod = self.mod; |
| 675 | const target = mod.getTarget(); | 675 | const target = mod.getTarget(); |
| 676 | const endian = target.cpu.arch.endian(); | 676 | const endian = target.cpu.arch.endian(); |
| ... | @@ -679,7 +679,7 @@ pub const DeclState = struct { | ... | @@ -679,7 +679,7 @@ pub const DeclState = struct { |
| 679 | switch (loc) { | 679 | switch (loc) { |
| 680 | .register => |reg| { | 680 | .register => |reg| { |
| 681 | try dbg_info.ensureUnusedCapacity(4); | 681 | try dbg_info.ensureUnusedCapacity(4); |
| 682 | dbg_info.appendAssumeCapacity(@enumToInt(AbbrevKind.parameter)); | 682 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 683 | // DW.AT.location, DW.FORM.exprloc | 683 | // DW.AT.location, DW.FORM.exprloc |
| 684 | var expr_len = std.io.countingWriter(std.io.null_writer); | 684 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 685 | if (reg < 32) { | 685 | if (reg < 32) { |
| ... | @@ -699,7 +699,7 @@ pub const DeclState = struct { | ... | @@ -699,7 +699,7 @@ pub const DeclState = struct { |
| 699 | 699 | ||
| 700 | .stack => |info| { | 700 | .stack => |info| { |
| 701 | try dbg_info.ensureUnusedCapacity(9); | 701 | try dbg_info.ensureUnusedCapacity(9); |
| 702 | dbg_info.appendAssumeCapacity(@enumToInt(AbbrevKind.parameter)); | 702 | dbg_info.appendAssumeCapacity(@intFromEnum(AbbrevKind.parameter)); |
| 703 | // DW.AT.location, DW.FORM.exprloc | 703 | // DW.AT.location, DW.FORM.exprloc |
| 704 | var expr_len = std.io.countingWriter(std.io.null_writer); | 704 | var expr_len = std.io.countingWriter(std.io.null_writer); |
| 705 | if (info.fp_register < 32) { | 705 | if (info.fp_register < 32) { |
| ... | @@ -741,7 +741,7 @@ pub const DeclState = struct { | ... | @@ -741,7 +741,7 @@ pub const DeclState = struct { |
| 741 | const ptr_width = @intCast(u8, @divExact(target.ptrBitWidth(), 8)); | 741 | const ptr_width = @intCast(u8, @divExact(target.ptrBitWidth(), 8)); |
| 742 | try dbg_info.ensureUnusedCapacity(2 + ptr_width); | 742 | try dbg_info.ensureUnusedCapacity(2 + ptr_width); |
| 743 | dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc | 743 | dbg_info.appendSliceAssumeCapacity(&[2]u8{ // DW.AT.location, DW.FORM.exprloc |
| 744 | 1 + ptr_width + @boolToInt(is_ptr), | 744 | 1 + ptr_width + @intFromBool(is_ptr), |
| 745 | DW.OP.addr, // literal address | 745 | DW.OP.addr, // literal address |
| 746 | }); | 746 | }); |
| 747 | const offset = @intCast(u32, dbg_info.items.len); | 747 | const offset = @intCast(u32, dbg_info.items.len); |
| ... | @@ -1015,9 +1015,9 @@ pub fn initDeclState(self: *Dwarf, mod: *Module, decl_index: Module.Decl.Index) | ... | @@ -1015,9 +1015,9 @@ pub fn initDeclState(self: *Dwarf, mod: *Module, decl_index: Module.Decl.Index) |
| 1015 | const fn_ret_type = decl.ty.fnReturnType(mod); | 1015 | const fn_ret_type = decl.ty.fnReturnType(mod); |
| 1016 | const fn_ret_has_bits = fn_ret_type.hasRuntimeBits(mod); | 1016 | const fn_ret_has_bits = fn_ret_type.hasRuntimeBits(mod); |
| 1017 | if (fn_ret_has_bits) { | 1017 | if (fn_ret_has_bits) { |
| 1018 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.subprogram)); | 1018 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.subprogram)); |
| 1019 | } else { | 1019 | } else { |
| 1020 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.subprogram_retvoid)); | 1020 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.subprogram_retvoid)); |
| 1021 | } | 1021 | } |
| 1022 | // These get overwritten after generating the machine code. These values are | 1022 | // These get overwritten after generating the machine code. These values are |
| 1023 | // "relocations" and have to be in this fixed place so that functions can be | 1023 | // "relocations" and have to be in this fixed place so that functions can be |
| ... | @@ -1617,14 +1617,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1617,14 +1617,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1617 | // These are LEB encoded but since the values are all less than 127 | 1617 | // These are LEB encoded but since the values are all less than 127 |
| 1618 | // we can simply append these bytes. | 1618 | // we can simply append these bytes. |
| 1619 | const abbrev_buf = [_]u8{ | 1619 | const abbrev_buf = [_]u8{ |
| 1620 | @enumToInt(AbbrevKind.compile_unit), DW.TAG.compile_unit, DW.CHILDREN.yes, // header | 1620 | @intFromEnum(AbbrevKind.compile_unit), DW.TAG.compile_unit, DW.CHILDREN.yes, // header |
| 1621 | DW.AT.stmt_list, DW.FORM.sec_offset, DW.AT.low_pc, | 1621 | DW.AT.stmt_list, DW.FORM.sec_offset, DW.AT.low_pc, |
| 1622 | DW.FORM.addr, DW.AT.high_pc, DW.FORM.addr, | 1622 | DW.FORM.addr, DW.AT.high_pc, DW.FORM.addr, |
| 1623 | DW.AT.name, DW.FORM.strp, DW.AT.comp_dir, | 1623 | DW.AT.name, DW.FORM.strp, DW.AT.comp_dir, |
| 1624 | DW.FORM.strp, DW.AT.producer, DW.FORM.strp, | 1624 | DW.FORM.strp, DW.AT.producer, DW.FORM.strp, |
| 1625 | DW.AT.language, DW.FORM.data2, 0, | 1625 | DW.AT.language, DW.FORM.data2, 0, |
| 1626 | 0, // table sentinel | 1626 | 0, // table sentinel |
| 1627 | @enumToInt(AbbrevKind.subprogram), | 1627 | @intFromEnum(AbbrevKind.subprogram), |
| 1628 | DW.TAG.subprogram, | 1628 | DW.TAG.subprogram, |
| 1629 | DW.CHILDREN.yes, // header | 1629 | DW.CHILDREN.yes, // header |
| 1630 | DW.AT.low_pc, | 1630 | DW.AT.low_pc, |
| ... | @@ -1635,15 +1635,15 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1635,15 +1635,15 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1635 | DW.FORM.ref4, | 1635 | DW.FORM.ref4, |
| 1636 | DW.AT.name, | 1636 | DW.AT.name, |
| 1637 | DW.FORM.string, | 1637 | DW.FORM.string, |
| 1638 | 0, 0, // table sentinel | 1638 | 0, 0, // table sentinel |
| 1639 | @enumToInt(AbbrevKind.subprogram_retvoid), | 1639 | @intFromEnum(AbbrevKind.subprogram_retvoid), |
| 1640 | DW.TAG.subprogram, DW.CHILDREN.yes, // header | 1640 | DW.TAG.subprogram, DW.CHILDREN.yes, // header |
| 1641 | DW.AT.low_pc, DW.FORM.addr, | 1641 | DW.AT.low_pc, DW.FORM.addr, |
| 1642 | DW.AT.high_pc, DW.FORM.data4, | 1642 | DW.AT.high_pc, DW.FORM.data4, |
| 1643 | DW.AT.name, DW.FORM.string, | 1643 | DW.AT.name, DW.FORM.string, |
| 1644 | 0, | 1644 | 0, |
| 1645 | 0, // table sentinel | 1645 | 0, // table sentinel |
| 1646 | @enumToInt(AbbrevKind.base_type), | 1646 | @intFromEnum(AbbrevKind.base_type), |
| 1647 | DW.TAG.base_type, | 1647 | DW.TAG.base_type, |
| 1648 | DW.CHILDREN.no, // header | 1648 | DW.CHILDREN.no, // header |
| 1649 | DW.AT.encoding, | 1649 | DW.AT.encoding, |
| ... | @@ -1654,14 +1654,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1654,14 +1654,14 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1654 | DW.FORM.string, | 1654 | DW.FORM.string, |
| 1655 | 0, | 1655 | 0, |
| 1656 | 0, // table sentinel | 1656 | 0, // table sentinel |
| 1657 | @enumToInt(AbbrevKind.ptr_type), | 1657 | @intFromEnum(AbbrevKind.ptr_type), |
| 1658 | DW.TAG.pointer_type, | 1658 | DW.TAG.pointer_type, |
| 1659 | DW.CHILDREN.no, // header | 1659 | DW.CHILDREN.no, // header |
| 1660 | DW.AT.type, | 1660 | DW.AT.type, |
| 1661 | DW.FORM.ref4, | 1661 | DW.FORM.ref4, |
| 1662 | 0, | 1662 | 0, |
| 1663 | 0, // table sentinel | 1663 | 0, // table sentinel |
| 1664 | @enumToInt(AbbrevKind.struct_type), | 1664 | @intFromEnum(AbbrevKind.struct_type), |
| 1665 | DW.TAG.structure_type, | 1665 | DW.TAG.structure_type, |
| 1666 | DW.CHILDREN.yes, // header | 1666 | DW.CHILDREN.yes, // header |
| 1667 | DW.AT.byte_size, | 1667 | DW.AT.byte_size, |
| ... | @@ -1670,7 +1670,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1670,7 +1670,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1670 | DW.FORM.string, | 1670 | DW.FORM.string, |
| 1671 | 0, | 1671 | 0, |
| 1672 | 0, // table sentinel | 1672 | 0, // table sentinel |
| 1673 | @enumToInt(AbbrevKind.struct_member), | 1673 | @intFromEnum(AbbrevKind.struct_member), |
| 1674 | DW.TAG.member, | 1674 | DW.TAG.member, |
| 1675 | DW.CHILDREN.no, // header | 1675 | DW.CHILDREN.no, // header |
| 1676 | DW.AT.name, | 1676 | DW.AT.name, |
| ... | @@ -1681,7 +1681,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1681,7 +1681,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1681 | DW.FORM.udata, | 1681 | DW.FORM.udata, |
| 1682 | 0, | 1682 | 0, |
| 1683 | 0, // table sentinel | 1683 | 0, // table sentinel |
| 1684 | @enumToInt(AbbrevKind.enum_type), | 1684 | @intFromEnum(AbbrevKind.enum_type), |
| 1685 | DW.TAG.enumeration_type, | 1685 | DW.TAG.enumeration_type, |
| 1686 | DW.CHILDREN.yes, // header | 1686 | DW.CHILDREN.yes, // header |
| 1687 | DW.AT.byte_size, | 1687 | DW.AT.byte_size, |
| ... | @@ -1690,7 +1690,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1690,7 +1690,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1690 | DW.FORM.string, | 1690 | DW.FORM.string, |
| 1691 | 0, | 1691 | 0, |
| 1692 | 0, // table sentinel | 1692 | 0, // table sentinel |
| 1693 | @enumToInt(AbbrevKind.enum_variant), | 1693 | @intFromEnum(AbbrevKind.enum_variant), |
| 1694 | DW.TAG.enumerator, | 1694 | DW.TAG.enumerator, |
| 1695 | DW.CHILDREN.no, // header | 1695 | DW.CHILDREN.no, // header |
| 1696 | DW.AT.name, | 1696 | DW.AT.name, |
| ... | @@ -1699,7 +1699,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1699,7 +1699,7 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1699 | DW.FORM.data8, | 1699 | DW.FORM.data8, |
| 1700 | 0, | 1700 | 0, |
| 1701 | 0, // table sentinel | 1701 | 0, // table sentinel |
| 1702 | @enumToInt(AbbrevKind.union_type), | 1702 | @intFromEnum(AbbrevKind.union_type), |
| 1703 | DW.TAG.union_type, | 1703 | DW.TAG.union_type, |
| 1704 | DW.CHILDREN.yes, // header | 1704 | DW.CHILDREN.yes, // header |
| 1705 | DW.AT.byte_size, | 1705 | DW.AT.byte_size, |
| ... | @@ -1708,32 +1708,32 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { | ... | @@ -1708,32 +1708,32 @@ pub fn writeDbgAbbrev(self: *Dwarf) !void { |
| 1708 | DW.FORM.string, | 1708 | DW.FORM.string, |
| 1709 | 0, | 1709 | 0, |
| 1710 | 0, // table sentinel | 1710 | 0, // table sentinel |
| 1711 | @enumToInt(AbbrevKind.pad1), | 1711 | @intFromEnum(AbbrevKind.pad1), |
| 1712 | DW.TAG.unspecified_type, | 1712 | DW.TAG.unspecified_type, |
| 1713 | DW.CHILDREN.no, // header | 1713 | DW.CHILDREN.no, // header |
| 1714 | 0, | 1714 | 0, |
| 1715 | 0, // table sentinel | 1715 | 0, // table sentinel |
| 1716 | @enumToInt(AbbrevKind.parameter), | 1716 | @intFromEnum(AbbrevKind.parameter), |
| 1717 | DW.TAG.formal_parameter, DW.CHILDREN.no, // header | 1717 | DW.TAG.formal_parameter, DW.CHILDREN.no, // header |
| 1718 | DW.AT.location, DW.FORM.exprloc, | 1718 | DW.AT.location, DW.FORM.exprloc, |
| 1719 | DW.AT.type, DW.FORM.ref4, | 1719 | DW.AT.type, DW.FORM.ref4, |
| 1720 | DW.AT.name, DW.FORM.string, | 1720 | DW.AT.name, DW.FORM.string, |
| 1721 | 0, | 1721 | 0, |
| 1722 | 0, // table sentinel | 1722 | 0, // table sentinel |
| 1723 | @enumToInt(AbbrevKind.variable), | 1723 | @intFromEnum(AbbrevKind.variable), |
| 1724 | DW.TAG.variable, DW.CHILDREN.no, // header | 1724 | DW.TAG.variable, DW.CHILDREN.no, // header |
| 1725 | DW.AT.location, DW.FORM.exprloc, | 1725 | DW.AT.location, DW.FORM.exprloc, |
| 1726 | DW.AT.type, DW.FORM.ref4, | 1726 | DW.AT.type, DW.FORM.ref4, |
| 1727 | DW.AT.name, DW.FORM.string, | 1727 | DW.AT.name, DW.FORM.string, |
| 1728 | 0, | 1728 | 0, |
| 1729 | 0, // table sentinel | 1729 | 0, // table sentinel |
| 1730 | @enumToInt(AbbrevKind.array_type), | 1730 | @intFromEnum(AbbrevKind.array_type), |
| 1731 | DW.TAG.array_type, DW.CHILDREN.yes, // header | 1731 | DW.TAG.array_type, DW.CHILDREN.yes, // header |
| 1732 | DW.AT.name, DW.FORM.string, | 1732 | DW.AT.name, DW.FORM.string, |
| 1733 | DW.AT.type, DW.FORM.ref4, | 1733 | DW.AT.type, DW.FORM.ref4, |
| 1734 | 0, | 1734 | 0, |
| 1735 | 0, // table sentinel | 1735 | 0, // table sentinel |
| 1736 | @enumToInt(AbbrevKind.array_dim), | 1736 | @intFromEnum(AbbrevKind.array_dim), |
| 1737 | DW.TAG.subrange_type, DW.CHILDREN.no, // header | 1737 | DW.TAG.subrange_type, DW.CHILDREN.no, // header |
| 1738 | DW.AT.type, DW.FORM.ref4, | 1738 | DW.AT.type, DW.FORM.ref4, |
| 1739 | DW.AT.count, DW.FORM.udata, | 1739 | DW.AT.count, DW.FORM.udata, |
| ... | @@ -1838,7 +1838,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, module: *Module, low_pc: u64, high_pc: u | ... | @@ -1838,7 +1838,7 @@ pub fn writeDbgInfoHeader(self: *Dwarf, module: *Module, low_pc: u64, high_pc: u |
| 1838 | const comp_dir_strp = try self.strtab.insert(self.allocator, compile_unit_dir); | 1838 | const comp_dir_strp = try self.strtab.insert(self.allocator, compile_unit_dir); |
| 1839 | const producer_strp = try self.strtab.insert(self.allocator, link.producer_string); | 1839 | const producer_strp = try self.strtab.insert(self.allocator, link.producer_string); |
| 1840 | 1840 | ||
| 1841 | di_buf.appendAssumeCapacity(@enumToInt(AbbrevKind.compile_unit)); | 1841 | di_buf.appendAssumeCapacity(@intFromEnum(AbbrevKind.compile_unit)); |
| 1842 | if (self.bin_file.tag == .macho) { | 1842 | if (self.bin_file.tag == .macho) { |
| 1843 | mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), 0); // DW.AT.stmt_list, DW.FORM.sec_offset | 1843 | mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), 0); // DW.AT.stmt_list, DW.FORM.sec_offset |
| 1844 | mem.writeIntLittle(u64, di_buf.addManyAsArrayAssumeCapacity(8), low_pc); | 1844 | mem.writeIntLittle(u64, di_buf.addManyAsArrayAssumeCapacity(8), low_pc); |
| ... | @@ -2038,7 +2038,7 @@ fn pwriteDbgInfoNops( | ... | @@ -2038,7 +2038,7 @@ fn pwriteDbgInfoNops( |
| 2038 | const tracy = trace(@src()); | 2038 | const tracy = trace(@src()); |
| 2039 | defer tracy.end(); | 2039 | defer tracy.end(); |
| 2040 | 2040 | ||
| 2041 | const page_of_nops = [1]u8{@enumToInt(AbbrevKind.pad1)} ** 4096; | 2041 | const page_of_nops = [1]u8{@intFromEnum(AbbrevKind.pad1)} ** 4096; |
| 2042 | var vecs: [32]std.os.iovec_const = undefined; | 2042 | var vecs: [32]std.os.iovec_const = undefined; |
| 2043 | var vec_index: usize = 0; | 2043 | var vec_index: usize = 0; |
| 2044 | { | 2044 | { |
| ... | @@ -2110,9 +2110,9 @@ fn writeDbgInfoNopsToArrayList( | ... | @@ -2110,9 +2110,9 @@ fn writeDbgInfoNopsToArrayList( |
| 2110 | buffer.items.len, | 2110 | buffer.items.len, |
| 2111 | offset + content.len + next_padding_size + 1, | 2111 | offset + content.len + next_padding_size + 1, |
| 2112 | )); | 2112 | )); |
| 2113 | @memset(buffer.items[offset - prev_padding_size .. offset], @enumToInt(AbbrevKind.pad1)); | 2113 | @memset(buffer.items[offset - prev_padding_size .. offset], @intFromEnum(AbbrevKind.pad1)); |
| 2114 | @memcpy(buffer.items[offset..][0..content.len], content); | 2114 | @memcpy(buffer.items[offset..][0..content.len], content); |
| 2115 | @memset(buffer.items[offset + content.len ..][0..next_padding_size], @enumToInt(AbbrevKind.pad1)); | 2115 | @memset(buffer.items[offset + content.len ..][0..next_padding_size], @intFromEnum(AbbrevKind.pad1)); |
| 2116 | 2116 | ||
| 2117 | if (trailing_zero) { | 2117 | if (trailing_zero) { |
| 2118 | buffer.items[offset + content.len + next_padding_size] = 0; | 2118 | buffer.items[offset + content.len + next_padding_size] = 0; |
| ... | @@ -2653,7 +2653,7 @@ fn addDbgInfoErrorSet( | ... | @@ -2653,7 +2653,7 @@ fn addDbgInfoErrorSet( |
| 2653 | const target_endian = target.cpu.arch.endian(); | 2653 | const target_endian = target.cpu.arch.endian(); |
| 2654 | 2654 | ||
| 2655 | // DW.AT.enumeration_type | 2655 | // DW.AT.enumeration_type |
| 2656 | try dbg_info_buffer.append(@enumToInt(AbbrevKind.enum_type)); | 2656 | try dbg_info_buffer.append(@intFromEnum(AbbrevKind.enum_type)); |
| 2657 | // DW.AT.byte_size, DW.FORM.udata | 2657 | // DW.AT.byte_size, DW.FORM.udata |
| 2658 | const abi_size = Type.anyerror.abiSize(mod); | 2658 | const abi_size = Type.anyerror.abiSize(mod); |
| 2659 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); | 2659 | try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size); |
| ... | @@ -2664,7 +2664,7 @@ fn addDbgInfoErrorSet( | ... | @@ -2664,7 +2664,7 @@ fn addDbgInfoErrorSet( |
| 2664 | // DW.AT.enumerator | 2664 | // DW.AT.enumerator |
| 2665 | const no_error = "(no error)"; | 2665 | const no_error = "(no error)"; |
| 2666 | try dbg_info_buffer.ensureUnusedCapacity(no_error.len + 2 + @sizeOf(u64)); | 2666 | try dbg_info_buffer.ensureUnusedCapacity(no_error.len + 2 + @sizeOf(u64)); |
| 2667 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); | 2667 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 2668 | // DW.AT.name, DW.FORM.string | 2668 | // DW.AT.name, DW.FORM.string |
| 2669 | dbg_info_buffer.appendSliceAssumeCapacity(no_error); | 2669 | dbg_info_buffer.appendSliceAssumeCapacity(no_error); |
| 2670 | dbg_info_buffer.appendAssumeCapacity(0); | 2670 | dbg_info_buffer.appendAssumeCapacity(0); |
| ... | @@ -2677,7 +2677,7 @@ fn addDbgInfoErrorSet( | ... | @@ -2677,7 +2677,7 @@ fn addDbgInfoErrorSet( |
| 2677 | const error_name = mod.intern_pool.stringToSlice(error_name_ip); | 2677 | const error_name = mod.intern_pool.stringToSlice(error_name_ip); |
| 2678 | // DW.AT.enumerator | 2678 | // DW.AT.enumerator |
| 2679 | try dbg_info_buffer.ensureUnusedCapacity(error_name.len + 2 + @sizeOf(u64)); | 2679 | try dbg_info_buffer.ensureUnusedCapacity(error_name.len + 2 + @sizeOf(u64)); |
| 2680 | dbg_info_buffer.appendAssumeCapacity(@enumToInt(AbbrevKind.enum_variant)); | 2680 | dbg_info_buffer.appendAssumeCapacity(@intFromEnum(AbbrevKind.enum_variant)); |
| 2681 | // DW.AT.name, DW.FORM.string | 2681 | // DW.AT.name, DW.FORM.string |
| 2682 | dbg_info_buffer.appendSliceAssumeCapacity(error_name); | 2682 | dbg_info_buffer.appendSliceAssumeCapacity(error_name); |
| 2683 | dbg_info_buffer.appendAssumeCapacity(0); | 2683 | dbg_info_buffer.appendAssumeCapacity(0); |
src/link/Elf.zig+5-5| ... | @@ -1826,7 +1826,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v | ... | @@ -1826,7 +1826,7 @@ fn linkWithLLD(self: *Elf, comp: *Compilation, prog_node: *std.Progress.Node) !v |
| 1826 | 1826 | ||
| 1827 | for (system_libs, 0..) |link_lib, i| { | 1827 | for (system_libs, 0..) |link_lib, i| { |
| 1828 | const lib_as_needed = !system_libs_values[i].needed; | 1828 | const lib_as_needed = !system_libs_values[i].needed; |
| 1829 | switch ((@as(u2, @boolToInt(lib_as_needed)) << 1) | @boolToInt(as_needed)) { | 1829 | switch ((@as(u2, @intFromBool(lib_as_needed)) << 1) | @intFromBool(as_needed)) { |
| 1830 | 0b00, 0b11 => {}, | 1830 | 0b00, 0b11 => {}, |
| 1831 | 0b01 => { | 1831 | 0b01 => { |
| 1832 | argv.appendAssumeCapacity("--no-as-needed"); | 1832 | argv.appendAssumeCapacity("--no-as-needed"); |
| ... | @@ -2048,11 +2048,11 @@ fn writeElfHeader(self: *Elf) !void { | ... | @@ -2048,11 +2048,11 @@ fn writeElfHeader(self: *Elf) !void { |
| 2048 | .Dynamic => elf.ET.DYN, | 2048 | .Dynamic => elf.ET.DYN, |
| 2049 | }, | 2049 | }, |
| 2050 | }; | 2050 | }; |
| 2051 | mem.writeInt(u16, hdr_buf[index..][0..2], @enumToInt(elf_type), endian); | 2051 | mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(elf_type), endian); |
| 2052 | index += 2; | 2052 | index += 2; |
| 2053 | 2053 | ||
| 2054 | const machine = self.base.options.target.cpu.arch.toElfMachine(); | 2054 | const machine = self.base.options.target.cpu.arch.toElfMachine(); |
| 2055 | mem.writeInt(u16, hdr_buf[index..][0..2], @enumToInt(machine), endian); | 2055 | mem.writeInt(u16, hdr_buf[index..][0..2], @intFromEnum(machine), endian); |
| 2056 | index += 2; | 2056 | index += 2; |
| 2057 | 2057 | ||
| 2058 | // ELF Version, again | 2058 | // ELF Version, again |
| ... | @@ -2557,7 +2557,7 @@ fn updateDeclCode(self: *Elf, decl_index: Module.Decl.Index, code: []const u8, s | ... | @@ -2557,7 +2557,7 @@ fn updateDeclCode(self: *Elf, decl_index: Module.Decl.Index, code: []const u8, s |
| 2557 | .iov_len = code.len, | 2557 | .iov_len = code.len, |
| 2558 | }}; | 2558 | }}; |
| 2559 | var remote_vec: [1]std.os.iovec_const = .{.{ | 2559 | var remote_vec: [1]std.os.iovec_const = .{.{ |
| 2560 | .iov_base = @intToPtr([*]u8, @intCast(usize, local_sym.st_value)), | 2560 | .iov_base = @ptrFromInt([*]u8, @intCast(usize, local_sym.st_value)), |
| 2561 | .iov_len = code.len, | 2561 | .iov_len = code.len, |
| 2562 | }}; | 2562 | }}; |
| 2563 | const rc = std.os.linux.process_vm_writev(pid, &code_vec, &remote_vec, 0); | 2563 | const rc = std.os.linux.process_vm_writev(pid, &code_vec, &remote_vec, 0); |
| ... | @@ -3051,7 +3051,7 @@ fn writeOffsetTableEntry(self: *Elf, index: @TypeOf(self.got_table).Index) !void | ... | @@ -3051,7 +3051,7 @@ fn writeOffsetTableEntry(self: *Elf, index: @TypeOf(self.got_table).Index) !void |
| 3051 | .iov_len = buf.len, | 3051 | .iov_len = buf.len, |
| 3052 | }}; | 3052 | }}; |
| 3053 | var remote_vec: [1]std.os.iovec_const = .{.{ | 3053 | var remote_vec: [1]std.os.iovec_const = .{.{ |
| 3054 | .iov_base = @intToPtr([*]u8, @intCast(usize, vaddr)), | 3054 | .iov_base = @ptrFromInt([*]u8, @intCast(usize, vaddr)), |
| 3055 | .iov_len = buf.len, | 3055 | .iov_len = buf.len, |
| 3056 | }}; | 3056 | }}; |
| 3057 | const rc = std.os.linux.process_vm_writev(pid, &local_vec, &remote_vec, 0); | 3057 | const rc = std.os.linux.process_vm_writev(pid, &local_vec, &remote_vec, 0); |
src/link/MachO/UnwindInfo.zig+4-4| ... | @@ -760,14 +760,14 @@ pub const UnwindEncoding = struct { | ... | @@ -760,14 +760,14 @@ pub const UnwindEncoding = struct { |
| 760 | pub fn isDwarf(enc: macho.compact_unwind_encoding_t, cpu_arch: std.Target.Cpu.Arch) bool { | 760 | pub fn isDwarf(enc: macho.compact_unwind_encoding_t, cpu_arch: std.Target.Cpu.Arch) bool { |
| 761 | const mode = getMode(enc); | 761 | const mode = getMode(enc); |
| 762 | return switch (cpu_arch) { | 762 | return switch (cpu_arch) { |
| 763 | .aarch64 => @intToEnum(macho.UNWIND_ARM64_MODE, mode) == .DWARF, | 763 | .aarch64 => @enumFromInt(macho.UNWIND_ARM64_MODE, mode) == .DWARF, |
| 764 | .x86_64 => @intToEnum(macho.UNWIND_X86_64_MODE, mode) == .DWARF, | 764 | .x86_64 => @enumFromInt(macho.UNWIND_X86_64_MODE, mode) == .DWARF, |
| 765 | else => unreachable, | 765 | else => unreachable, |
| 766 | }; | 766 | }; |
| 767 | } | 767 | } |
| 768 | 768 | ||
| 769 | pub fn setMode(enc: *macho.compact_unwind_encoding_t, mode: anytype) void { | 769 | pub fn setMode(enc: *macho.compact_unwind_encoding_t, mode: anytype) void { |
| 770 | enc.* |= @intCast(u32, @enumToInt(mode)) << 24; | 770 | enc.* |= @intCast(u32, @intFromEnum(mode)) << 24; |
| 771 | } | 771 | } |
| 772 | 772 | ||
| 773 | pub fn hasLsda(enc: macho.compact_unwind_encoding_t) bool { | 773 | pub fn hasLsda(enc: macho.compact_unwind_encoding_t) bool { |
| ... | @@ -776,7 +776,7 @@ pub const UnwindEncoding = struct { | ... | @@ -776,7 +776,7 @@ pub const UnwindEncoding = struct { |
| 776 | } | 776 | } |
| 777 | 777 | ||
| 778 | pub fn setHasLsda(enc: *macho.compact_unwind_encoding_t, has_lsda: bool) void { | 778 | pub fn setHasLsda(enc: *macho.compact_unwind_encoding_t, has_lsda: bool) void { |
| 779 | const mask = @intCast(u32, @boolToInt(has_lsda)) << 31; | 779 | const mask = @intCast(u32, @intFromBool(has_lsda)) << 31; |
| 780 | enc.* |= mask; | 780 | enc.* |= mask; |
| 781 | } | 781 | } |
| 782 | 782 |
src/link/MachO/ZldAtom.zig+7-7| ... | @@ -214,7 +214,7 @@ pub fn parseRelocTarget(zld: *Zld, ctx: struct { | ... | @@ -214,7 +214,7 @@ pub fn parseRelocTarget(zld: *Zld, ctx: struct { |
| 214 | mem.readIntLittle(u32, ctx.code[rel_offset..][0..4]); | 214 | mem.readIntLittle(u32, ctx.code[rel_offset..][0..4]); |
| 215 | } else blk: { | 215 | } else blk: { |
| 216 | assert(zld.options.target.cpu.arch == .x86_64); | 216 | assert(zld.options.target.cpu.arch == .x86_64); |
| 217 | const correction: u3 = switch (@intToEnum(macho.reloc_type_x86_64, ctx.rel.r_type)) { | 217 | const correction: u3 = switch (@enumFromInt(macho.reloc_type_x86_64, ctx.rel.r_type)) { |
| 218 | .X86_64_RELOC_SIGNED => 0, | 218 | .X86_64_RELOC_SIGNED => 0, |
| 219 | .X86_64_RELOC_SIGNED_1 => 1, | 219 | .X86_64_RELOC_SIGNED_1 => 1, |
| 220 | .X86_64_RELOC_SIGNED_2 => 2, | 220 | .X86_64_RELOC_SIGNED_2 => 2, |
| ... | @@ -272,7 +272,7 @@ pub fn getRelocTargetAtomIndex(zld: *Zld, target: SymbolWithLoc, is_via_got: boo | ... | @@ -272,7 +272,7 @@ pub fn getRelocTargetAtomIndex(zld: *Zld, target: SymbolWithLoc, is_via_got: boo |
| 272 | 272 | ||
| 273 | fn scanAtomRelocsArm64(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) const macho.relocation_info) !void { | 273 | fn scanAtomRelocsArm64(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) const macho.relocation_info) !void { |
| 274 | for (relocs) |rel| { | 274 | for (relocs) |rel| { |
| 275 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 275 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 276 | 276 | ||
| 277 | switch (rel_type) { | 277 | switch (rel_type) { |
| 278 | .ARM64_RELOC_ADDEND, .ARM64_RELOC_SUBTRACTOR => continue, | 278 | .ARM64_RELOC_ADDEND, .ARM64_RELOC_SUBTRACTOR => continue, |
| ... | @@ -321,7 +321,7 @@ fn scanAtomRelocsArm64(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) cons | ... | @@ -321,7 +321,7 @@ fn scanAtomRelocsArm64(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) cons |
| 321 | 321 | ||
| 322 | fn scanAtomRelocsX86(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) const macho.relocation_info) !void { | 322 | fn scanAtomRelocsX86(zld: *Zld, atom_index: AtomIndex, relocs: []align(1) const macho.relocation_info) !void { |
| 323 | for (relocs) |rel| { | 323 | for (relocs) |rel| { |
| 324 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 324 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 325 | 325 | ||
| 326 | switch (rel_type) { | 326 | switch (rel_type) { |
| 327 | .X86_64_RELOC_SUBTRACTOR => continue, | 327 | .X86_64_RELOC_SUBTRACTOR => continue, |
| ... | @@ -495,7 +495,7 @@ fn resolveRelocsArm64( | ... | @@ -495,7 +495,7 @@ fn resolveRelocsArm64( |
| 495 | var subtractor: ?SymbolWithLoc = null; | 495 | var subtractor: ?SymbolWithLoc = null; |
| 496 | 496 | ||
| 497 | for (atom_relocs) |rel| { | 497 | for (atom_relocs) |rel| { |
| 498 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 498 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 499 | 499 | ||
| 500 | switch (rel_type) { | 500 | switch (rel_type) { |
| 501 | .ARM64_RELOC_ADDEND => { | 501 | .ARM64_RELOC_ADDEND => { |
| ... | @@ -797,7 +797,7 @@ fn resolveRelocsX86( | ... | @@ -797,7 +797,7 @@ fn resolveRelocsX86( |
| 797 | var subtractor: ?SymbolWithLoc = null; | 797 | var subtractor: ?SymbolWithLoc = null; |
| 798 | 798 | ||
| 799 | for (atom_relocs) |rel| { | 799 | for (atom_relocs) |rel| { |
| 800 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 800 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 801 | 801 | ||
| 802 | switch (rel_type) { | 802 | switch (rel_type) { |
| 803 | .X86_64_RELOC_SUBTRACTOR => { | 803 | .X86_64_RELOC_SUBTRACTOR => { |
| ... | @@ -1004,14 +1004,14 @@ pub fn getAtomRelocs(zld: *Zld, atom_index: AtomIndex) []const macho.relocation_ | ... | @@ -1004,14 +1004,14 @@ pub fn getAtomRelocs(zld: *Zld, atom_index: AtomIndex) []const macho.relocation_ |
| 1004 | 1004 | ||
| 1005 | pub fn relocRequiresGot(zld: *Zld, rel: macho.relocation_info) bool { | 1005 | pub fn relocRequiresGot(zld: *Zld, rel: macho.relocation_info) bool { |
| 1006 | switch (zld.options.target.cpu.arch) { | 1006 | switch (zld.options.target.cpu.arch) { |
| 1007 | .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, rel.r_type)) { | 1007 | .aarch64 => switch (@enumFromInt(macho.reloc_type_arm64, rel.r_type)) { |
| 1008 | .ARM64_RELOC_GOT_LOAD_PAGE21, | 1008 | .ARM64_RELOC_GOT_LOAD_PAGE21, |
| 1009 | .ARM64_RELOC_GOT_LOAD_PAGEOFF12, | 1009 | .ARM64_RELOC_GOT_LOAD_PAGEOFF12, |
| 1010 | .ARM64_RELOC_POINTER_TO_GOT, | 1010 | .ARM64_RELOC_POINTER_TO_GOT, |
| 1011 | => return true, | 1011 | => return true, |
| 1012 | else => return false, | 1012 | else => return false, |
| 1013 | }, | 1013 | }, |
| 1014 | .x86_64 => switch (@intToEnum(macho.reloc_type_x86_64, rel.r_type)) { | 1014 | .x86_64 => switch (@enumFromInt(macho.reloc_type_x86_64, rel.r_type)) { |
| 1015 | .X86_64_RELOC_GOT, | 1015 | .X86_64_RELOC_GOT, |
| 1016 | .X86_64_RELOC_GOT_LOAD, | 1016 | .X86_64_RELOC_GOT_LOAD, |
| 1017 | => return true, | 1017 | => return true, |
src/link/MachO/dead_strip.zig+2-2| ... | @@ -148,7 +148,7 @@ fn markLive(zld: *Zld, atom_index: AtomIndex, alive: *AtomTable) void { | ... | @@ -148,7 +148,7 @@ fn markLive(zld: *Zld, atom_index: AtomIndex, alive: *AtomTable) void { |
| 148 | 148 | ||
| 149 | for (relocs) |rel| { | 149 | for (relocs) |rel| { |
| 150 | const target = switch (cpu_arch) { | 150 | const target = switch (cpu_arch) { |
| 151 | .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, rel.r_type)) { | 151 | .aarch64 => switch (@enumFromInt(macho.reloc_type_arm64, rel.r_type)) { |
| 152 | .ARM64_RELOC_ADDEND => continue, | 152 | .ARM64_RELOC_ADDEND => continue, |
| 153 | else => Atom.parseRelocTarget(zld, .{ | 153 | else => Atom.parseRelocTarget(zld, .{ |
| 154 | .object_id = atom.getFile().?, | 154 | .object_id = atom.getFile().?, |
| ... | @@ -208,7 +208,7 @@ fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable) bool { | ... | @@ -208,7 +208,7 @@ fn refersLive(zld: *Zld, atom_index: AtomIndex, alive: AtomTable) bool { |
| 208 | 208 | ||
| 209 | for (relocs) |rel| { | 209 | for (relocs) |rel| { |
| 210 | const target = switch (cpu_arch) { | 210 | const target = switch (cpu_arch) { |
| 211 | .aarch64 => switch (@intToEnum(macho.reloc_type_arm64, rel.r_type)) { | 211 | .aarch64 => switch (@enumFromInt(macho.reloc_type_arm64, rel.r_type)) { |
| 212 | .ARM64_RELOC_ADDEND => continue, | 212 | .ARM64_RELOC_ADDEND => continue, |
| 213 | else => Atom.parseRelocTarget(zld, .{ | 213 | else => Atom.parseRelocTarget(zld, .{ |
| 214 | .object_id = atom.getFile().?, | 214 | .object_id = atom.getFile().?, |
src/link/MachO/eh_frame.zig+4-4| ... | @@ -291,7 +291,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { | ... | @@ -291,7 +291,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { |
| 291 | for (relocs) |rel| { | 291 | for (relocs) |rel| { |
| 292 | switch (cpu_arch) { | 292 | switch (cpu_arch) { |
| 293 | .aarch64 => { | 293 | .aarch64 => { |
| 294 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 294 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 295 | switch (rel_type) { | 295 | switch (rel_type) { |
| 296 | .ARM64_RELOC_SUBTRACTOR, | 296 | .ARM64_RELOC_SUBTRACTOR, |
| 297 | .ARM64_RELOC_UNSIGNED, | 297 | .ARM64_RELOC_UNSIGNED, |
| ... | @@ -301,7 +301,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { | ... | @@ -301,7 +301,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { |
| 301 | } | 301 | } |
| 302 | }, | 302 | }, |
| 303 | .x86_64 => { | 303 | .x86_64 => { |
| 304 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 304 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 305 | switch (rel_type) { | 305 | switch (rel_type) { |
| 306 | .X86_64_RELOC_GOT => {}, | 306 | .X86_64_RELOC_GOT => {}, |
| 307 | else => unreachable, | 307 | else => unreachable, |
| ... | @@ -342,7 +342,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { | ... | @@ -342,7 +342,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { |
| 342 | 342 | ||
| 343 | switch (cpu_arch) { | 343 | switch (cpu_arch) { |
| 344 | .aarch64 => { | 344 | .aarch64 => { |
| 345 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 345 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 346 | switch (rel_type) { | 346 | switch (rel_type) { |
| 347 | .ARM64_RELOC_SUBTRACTOR => { | 347 | .ARM64_RELOC_SUBTRACTOR => { |
| 348 | // Address of the __eh_frame in the source object file | 348 | // Address of the __eh_frame in the source object file |
| ... | @@ -363,7 +363,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { | ... | @@ -363,7 +363,7 @@ pub fn EhFrameRecord(comptime is_mutable: bool) type { |
| 363 | } | 363 | } |
| 364 | }, | 364 | }, |
| 365 | .x86_64 => { | 365 | .x86_64 => { |
| 366 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 366 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 367 | switch (rel_type) { | 367 | switch (rel_type) { |
| 368 | .X86_64_RELOC_GOT => { | 368 | .X86_64_RELOC_GOT => { |
| 369 | const target_addr = try Atom.getRelocTargetAddress(zld, target, true, false); | 369 | const target_addr = try Atom.getRelocTargetAddress(zld, target, true, false); |
src/link/MachO/thunks.zig+1-1| ... | @@ -289,7 +289,7 @@ fn scanRelocs( | ... | @@ -289,7 +289,7 @@ fn scanRelocs( |
| 289 | } | 289 | } |
| 290 | 290 | ||
| 291 | inline fn relocNeedsThunk(rel: macho.relocation_info) bool { | 291 | inline fn relocNeedsThunk(rel: macho.relocation_info) bool { |
| 292 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 292 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 293 | return rel_type == .ARM64_RELOC_BRANCH26; | 293 | return rel_type == .ARM64_RELOC_BRANCH26; |
| 294 | } | 294 | } |
| 295 | 295 |
src/link/MachO/zld.zig+4-4| ... | @@ -1819,12 +1819,12 @@ pub const Zld = struct { | ... | @@ -1819,12 +1819,12 @@ pub const Zld = struct { |
| 1819 | for (relocs) |rel| { | 1819 | for (relocs) |rel| { |
| 1820 | switch (cpu_arch) { | 1820 | switch (cpu_arch) { |
| 1821 | .aarch64 => { | 1821 | .aarch64 => { |
| 1822 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 1822 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 1823 | if (rel_type != .ARM64_RELOC_UNSIGNED) continue; | 1823 | if (rel_type != .ARM64_RELOC_UNSIGNED) continue; |
| 1824 | if (rel.r_length != 3) continue; | 1824 | if (rel.r_length != 3) continue; |
| 1825 | }, | 1825 | }, |
| 1826 | .x86_64 => { | 1826 | .x86_64 => { |
| 1827 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 1827 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 1828 | if (rel_type != .X86_64_RELOC_UNSIGNED) continue; | 1828 | if (rel_type != .X86_64_RELOC_UNSIGNED) continue; |
| 1829 | if (rel.r_length != 3) continue; | 1829 | if (rel.r_length != 3) continue; |
| 1830 | }, | 1830 | }, |
| ... | @@ -1958,12 +1958,12 @@ pub const Zld = struct { | ... | @@ -1958,12 +1958,12 @@ pub const Zld = struct { |
| 1958 | for (relocs) |rel| { | 1958 | for (relocs) |rel| { |
| 1959 | switch (cpu_arch) { | 1959 | switch (cpu_arch) { |
| 1960 | .aarch64 => { | 1960 | .aarch64 => { |
| 1961 | const rel_type = @intToEnum(macho.reloc_type_arm64, rel.r_type); | 1961 | const rel_type = @enumFromInt(macho.reloc_type_arm64, rel.r_type); |
| 1962 | if (rel_type != .ARM64_RELOC_UNSIGNED) continue; | 1962 | if (rel_type != .ARM64_RELOC_UNSIGNED) continue; |
| 1963 | if (rel.r_length != 3) continue; | 1963 | if (rel.r_length != 3) continue; |
| 1964 | }, | 1964 | }, |
| 1965 | .x86_64 => { | 1965 | .x86_64 => { |
| 1966 | const rel_type = @intToEnum(macho.reloc_type_x86_64, rel.r_type); | 1966 | const rel_type = @enumFromInt(macho.reloc_type_x86_64, rel.r_type); |
| 1967 | if (rel_type != .X86_64_RELOC_UNSIGNED) continue; | 1967 | if (rel_type != .X86_64_RELOC_UNSIGNED) continue; |
| 1968 | if (rel.r_length != 3) continue; | 1968 | if (rel.r_length != 3) continue; |
| 1969 | }, | 1969 | }, |
src/link/Plan9.zig+1-1| ... | @@ -1192,7 +1192,7 @@ pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { | ... | @@ -1192,7 +1192,7 @@ pub fn writeSym(self: *Plan9, w: anytype, sym: aout.Sym) !void { |
| 1192 | } else { | 1192 | } else { |
| 1193 | try w.writeIntBig(u64, sym.value); | 1193 | try w.writeIntBig(u64, sym.value); |
| 1194 | } | 1194 | } |
| 1195 | try w.writeByte(@enumToInt(sym.type)); | 1195 | try w.writeByte(@intFromEnum(sym.type)); |
| 1196 | try w.writeAll(sym.name); | 1196 | try w.writeAll(sym.name); |
| 1197 | try w.writeByte(0); | 1197 | try w.writeByte(0); |
| 1198 | } | 1198 | } |
src/link/Wasm.zig+35-35| ... | @@ -196,7 +196,7 @@ pub const Segment = struct { | ... | @@ -196,7 +196,7 @@ pub const Segment = struct { |
| 196 | }; | 196 | }; |
| 197 | 197 | ||
| 198 | pub fn isPassive(segment: Segment) bool { | 198 | pub fn isPassive(segment: Segment) bool { |
| 199 | return segment.flags & @enumToInt(Flag.WASM_DATA_SEGMENT_IS_PASSIVE) != 0; | 199 | return segment.flags & @intFromEnum(Flag.WASM_DATA_SEGMENT_IS_PASSIVE) != 0; |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | /// For a given segment, determines if it needs passive initialization | 202 | /// For a given segment, determines if it needs passive initialization |
| ... | @@ -1094,14 +1094,14 @@ fn validateFeatures( | ... | @@ -1094,14 +1094,14 @@ fn validateFeatures( |
| 1094 | const value = @intCast(u16, object_index) << 1 | @as(u1, 1); | 1094 | const value = @intCast(u16, object_index) << 1 | @as(u1, 1); |
| 1095 | switch (feature.prefix) { | 1095 | switch (feature.prefix) { |
| 1096 | .used => { | 1096 | .used => { |
| 1097 | used[@enumToInt(feature.tag)] = value; | 1097 | used[@intFromEnum(feature.tag)] = value; |
| 1098 | }, | 1098 | }, |
| 1099 | .disallowed => { | 1099 | .disallowed => { |
| 1100 | disallowed[@enumToInt(feature.tag)] = value; | 1100 | disallowed[@intFromEnum(feature.tag)] = value; |
| 1101 | }, | 1101 | }, |
| 1102 | .required => { | 1102 | .required => { |
| 1103 | required[@enumToInt(feature.tag)] = value; | 1103 | required[@intFromEnum(feature.tag)] = value; |
| 1104 | used[@enumToInt(feature.tag)] = value; | 1104 | used[@intFromEnum(feature.tag)] = value; |
| 1105 | }, | 1105 | }, |
| 1106 | } | 1106 | } |
| 1107 | } | 1107 | } |
| ... | @@ -1120,9 +1120,9 @@ fn validateFeatures( | ... | @@ -1120,9 +1120,9 @@ fn validateFeatures( |
| 1120 | const is_enabled = @truncate(u1, used_set) != 0; | 1120 | const is_enabled = @truncate(u1, used_set) != 0; |
| 1121 | if (infer) { | 1121 | if (infer) { |
| 1122 | allowed[used_index] = is_enabled; | 1122 | allowed[used_index] = is_enabled; |
| 1123 | emit_features_count.* += @boolToInt(is_enabled); | 1123 | emit_features_count.* += @intFromBool(is_enabled); |
| 1124 | } else if (is_enabled and !allowed[used_index]) { | 1124 | } else if (is_enabled and !allowed[used_index]) { |
| 1125 | log.err("feature '{}' not allowed, but used by linked object", .{@intToEnum(types.Feature.Tag, used_index)}); | 1125 | log.err("feature '{}' not allowed, but used by linked object", .{@enumFromInt(types.Feature.Tag, used_index)}); |
| 1126 | log.err(" defined in '{s}'", .{wasm.objects.items[used_set >> 1].name}); | 1126 | log.err(" defined in '{s}'", .{wasm.objects.items[used_set >> 1].name}); |
| 1127 | valid_feature_set = false; | 1127 | valid_feature_set = false; |
| 1128 | } | 1128 | } |
| ... | @@ -1133,7 +1133,7 @@ fn validateFeatures( | ... | @@ -1133,7 +1133,7 @@ fn validateFeatures( |
| 1133 | } | 1133 | } |
| 1134 | 1134 | ||
| 1135 | if (wasm.base.options.shared_memory) { | 1135 | if (wasm.base.options.shared_memory) { |
| 1136 | const disallowed_feature = disallowed[@enumToInt(types.Feature.Tag.shared_mem)]; | 1136 | const disallowed_feature = disallowed[@intFromEnum(types.Feature.Tag.shared_mem)]; |
| 1137 | if (@truncate(u1, disallowed_feature) != 0) { | 1137 | if (@truncate(u1, disallowed_feature) != 0) { |
| 1138 | log.err( | 1138 | log.err( |
| 1139 | "shared-memory is disallowed by '{s}' because it wasn't compiled with 'atomics' and 'bulk-memory' features enabled", | 1139 | "shared-memory is disallowed by '{s}' because it wasn't compiled with 'atomics' and 'bulk-memory' features enabled", |
| ... | @@ -1143,7 +1143,7 @@ fn validateFeatures( | ... | @@ -1143,7 +1143,7 @@ fn validateFeatures( |
| 1143 | } | 1143 | } |
| 1144 | 1144 | ||
| 1145 | for ([_]types.Feature.Tag{ .atomics, .bulk_memory }) |feature| { | 1145 | for ([_]types.Feature.Tag{ .atomics, .bulk_memory }) |feature| { |
| 1146 | if (!allowed[@enumToInt(feature)]) { | 1146 | if (!allowed[@intFromEnum(feature)]) { |
| 1147 | log.err("feature '{}' is not used but is required for shared-memory", .{feature}); | 1147 | log.err("feature '{}' is not used but is required for shared-memory", .{feature}); |
| 1148 | } | 1148 | } |
| 1149 | } | 1149 | } |
| ... | @@ -1151,7 +1151,7 @@ fn validateFeatures( | ... | @@ -1151,7 +1151,7 @@ fn validateFeatures( |
| 1151 | 1151 | ||
| 1152 | if (has_tls) { | 1152 | if (has_tls) { |
| 1153 | for ([_]types.Feature.Tag{ .atomics, .bulk_memory }) |feature| { | 1153 | for ([_]types.Feature.Tag{ .atomics, .bulk_memory }) |feature| { |
| 1154 | if (!allowed[@enumToInt(feature)]) { | 1154 | if (!allowed[@intFromEnum(feature)]) { |
| 1155 | log.err("feature '{}' is not used but is required for thread-local storage", .{feature}); | 1155 | log.err("feature '{}' is not used but is required for thread-local storage", .{feature}); |
| 1156 | } | 1156 | } |
| 1157 | } | 1157 | } |
| ... | @@ -1162,7 +1162,7 @@ fn validateFeatures( | ... | @@ -1162,7 +1162,7 @@ fn validateFeatures( |
| 1162 | for (object.features) |feature| { | 1162 | for (object.features) |feature| { |
| 1163 | if (feature.prefix == .disallowed) continue; // already defined in 'disallowed' set. | 1163 | if (feature.prefix == .disallowed) continue; // already defined in 'disallowed' set. |
| 1164 | // from here a feature is always used | 1164 | // from here a feature is always used |
| 1165 | const disallowed_feature = disallowed[@enumToInt(feature.tag)]; | 1165 | const disallowed_feature = disallowed[@intFromEnum(feature.tag)]; |
| 1166 | if (@truncate(u1, disallowed_feature) != 0) { | 1166 | if (@truncate(u1, disallowed_feature) != 0) { |
| 1167 | log.err("feature '{}' is disallowed, but used by linked object", .{feature.tag}); | 1167 | log.err("feature '{}' is disallowed, but used by linked object", .{feature.tag}); |
| 1168 | log.err(" disallowed by '{s}'", .{wasm.objects.items[disallowed_feature >> 1].name}); | 1168 | log.err(" disallowed by '{s}'", .{wasm.objects.items[disallowed_feature >> 1].name}); |
| ... | @@ -1170,14 +1170,14 @@ fn validateFeatures( | ... | @@ -1170,14 +1170,14 @@ fn validateFeatures( |
| 1170 | valid_feature_set = false; | 1170 | valid_feature_set = false; |
| 1171 | } | 1171 | } |
| 1172 | 1172 | ||
| 1173 | object_used_features[@enumToInt(feature.tag)] = true; | 1173 | object_used_features[@intFromEnum(feature.tag)] = true; |
| 1174 | } | 1174 | } |
| 1175 | 1175 | ||
| 1176 | // validate the linked object file has each required feature | 1176 | // validate the linked object file has each required feature |
| 1177 | for (required, 0..) |required_feature, feature_index| { | 1177 | for (required, 0..) |required_feature, feature_index| { |
| 1178 | const is_required = @truncate(u1, required_feature) != 0; | 1178 | const is_required = @truncate(u1, required_feature) != 0; |
| 1179 | if (is_required and !object_used_features[feature_index]) { | 1179 | if (is_required and !object_used_features[feature_index]) { |
| 1180 | log.err("feature '{}' is required but not used in linked object", .{@intToEnum(types.Feature.Tag, feature_index)}); | 1180 | log.err("feature '{}' is required but not used in linked object", .{@enumFromInt(types.Feature.Tag, feature_index)}); |
| 1181 | log.err(" required by '{s}'", .{wasm.objects.items[required_feature >> 1].name}); | 1181 | log.err(" required by '{s}'", .{wasm.objects.items[required_feature >> 1].name}); |
| 1182 | log.err(" missing in '{s}'", .{object.name}); | 1182 | log.err(" missing in '{s}'", .{object.name}); |
| 1183 | valid_feature_set = false; | 1183 | valid_feature_set = false; |
| ... | @@ -1324,7 +1324,7 @@ pub fn allocateSymbol(wasm: *Wasm) !u32 { | ... | @@ -1324,7 +1324,7 @@ pub fn allocateSymbol(wasm: *Wasm) !u32 { |
| 1324 | try wasm.symbols.ensureUnusedCapacity(wasm.base.allocator, 1); | 1324 | try wasm.symbols.ensureUnusedCapacity(wasm.base.allocator, 1); |
| 1325 | var symbol: Symbol = .{ | 1325 | var symbol: Symbol = .{ |
| 1326 | .name = undefined, // will be set after updateDecl | 1326 | .name = undefined, // will be set after updateDecl |
| 1327 | .flags = @enumToInt(Symbol.Flag.WASM_SYM_BINDING_LOCAL), | 1327 | .flags = @intFromEnum(Symbol.Flag.WASM_SYM_BINDING_LOCAL), |
| 1328 | .tag = undefined, // will be set after updateDecl | 1328 | .tag = undefined, // will be set after updateDecl |
| 1329 | .index = undefined, // will be set after updateDecl | 1329 | .index = undefined, // will be set after updateDecl |
| 1330 | .virtual_address = undefined, // will be set during atom allocation | 1330 | .virtual_address = undefined, // will be set during atom allocation |
| ... | @@ -1560,7 +1560,7 @@ pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: Module.Decl.In | ... | @@ -1560,7 +1560,7 @@ pub fn lowerUnnamedConst(wasm: *Wasm, tv: TypedValue, decl_index: Module.Decl.In |
| 1560 | atom.alignment = tv.ty.abiAlignment(mod); | 1560 | atom.alignment = tv.ty.abiAlignment(mod); |
| 1561 | wasm.symbols.items[atom.sym_index] = .{ | 1561 | wasm.symbols.items[atom.sym_index] = .{ |
| 1562 | .name = try wasm.string_table.put(wasm.base.allocator, name), | 1562 | .name = try wasm.string_table.put(wasm.base.allocator, name), |
| 1563 | .flags = @enumToInt(Symbol.Flag.WASM_SYM_BINDING_LOCAL), | 1563 | .flags = @intFromEnum(Symbol.Flag.WASM_SYM_BINDING_LOCAL), |
| 1564 | .tag = .data, | 1564 | .tag = .data, |
| 1565 | .index = undefined, | 1565 | .index = undefined, |
| 1566 | .virtual_address = undefined, | 1566 | .virtual_address = undefined, |
| ... | @@ -2028,7 +2028,7 @@ fn parseAtom(wasm: *Wasm, atom_index: Atom.Index, kind: Kind) !void { | ... | @@ -2028,7 +2028,7 @@ fn parseAtom(wasm: *Wasm, atom_index: Atom.Index, kind: Kind) !void { |
| 2028 | const index = @intCast(u32, wasm.segments.items.len); | 2028 | const index = @intCast(u32, wasm.segments.items.len); |
| 2029 | var flags: u32 = 0; | 2029 | var flags: u32 = 0; |
| 2030 | if (wasm.base.options.shared_memory) { | 2030 | if (wasm.base.options.shared_memory) { |
| 2031 | flags |= @enumToInt(Segment.Flag.WASM_DATA_SEGMENT_IS_PASSIVE); | 2031 | flags |= @intFromEnum(Segment.Flag.WASM_DATA_SEGMENT_IS_PASSIVE); |
| 2032 | } | 2032 | } |
| 2033 | try wasm.segments.append(wasm.base.allocator, .{ | 2033 | try wasm.segments.append(wasm.base.allocator, .{ |
| 2034 | .alignment = atom.alignment, | 2034 | .alignment = atom.alignment, |
| ... | @@ -2868,7 +2868,7 @@ pub fn getMatchingSegment(wasm: *Wasm, object_index: u16, relocatable_index: u32 | ... | @@ -2868,7 +2868,7 @@ pub fn getMatchingSegment(wasm: *Wasm, object_index: u16, relocatable_index: u32 |
| 2868 | result.value_ptr.* = index; | 2868 | result.value_ptr.* = index; |
| 2869 | var flags: u32 = 0; | 2869 | var flags: u32 = 0; |
| 2870 | if (wasm.base.options.shared_memory) { | 2870 | if (wasm.base.options.shared_memory) { |
| 2871 | flags |= @enumToInt(Segment.Flag.WASM_DATA_SEGMENT_IS_PASSIVE); | 2871 | flags |= @intFromEnum(Segment.Flag.WASM_DATA_SEGMENT_IS_PASSIVE); |
| 2872 | } | 2872 | } |
| 2873 | try wasm.segments.append(wasm.base.allocator, .{ | 2873 | try wasm.segments.append(wasm.base.allocator, .{ |
| 2874 | .alignment = 1, | 2874 | .alignment = 1, |
| ... | @@ -3073,7 +3073,7 @@ pub fn createDebugSectionForIndex(wasm: *Wasm, index: *?u32, name: []const u8) ! | ... | @@ -3073,7 +3073,7 @@ pub fn createDebugSectionForIndex(wasm: *Wasm, index: *?u32, name: []const u8) ! |
| 3073 | .tag = .section, | 3073 | .tag = .section, |
| 3074 | .name = try wasm.string_table.put(wasm.base.allocator, name), | 3074 | .name = try wasm.string_table.put(wasm.base.allocator, name), |
| 3075 | .index = 0, | 3075 | .index = 0, |
| 3076 | .flags = @enumToInt(Symbol.Flag.WASM_SYM_BINDING_LOCAL), | 3076 | .flags = @intFromEnum(Symbol.Flag.WASM_SYM_BINDING_LOCAL), |
| 3077 | }; | 3077 | }; |
| 3078 | 3078 | ||
| 3079 | atom.alignment = 1; // debug sections are always 1-byte-aligned | 3079 | atom.alignment = 1; // debug sections are always 1-byte-aligned |
| ... | @@ -3544,7 +3544,7 @@ fn writeToFile( | ... | @@ -3544,7 +3544,7 @@ fn writeToFile( |
| 3544 | header_offset, | 3544 | header_offset, |
| 3545 | .import, | 3545 | .import, |
| 3546 | @intCast(u32, binary_bytes.items.len - header_offset - header_size), | 3546 | @intCast(u32, binary_bytes.items.len - header_offset - header_size), |
| 3547 | @intCast(u32, wasm.imports.count() + @boolToInt(import_memory)), | 3547 | @intCast(u32, wasm.imports.count() + @intFromBool(import_memory)), |
| 3548 | ); | 3548 | ); |
| 3549 | section_count += 1; | 3549 | section_count += 1; |
| 3550 | } | 3550 | } |
| ... | @@ -3606,7 +3606,7 @@ fn writeToFile( | ... | @@ -3606,7 +3606,7 @@ fn writeToFile( |
| 3606 | 3606 | ||
| 3607 | for (wasm.wasm_globals.items) |global| { | 3607 | for (wasm.wasm_globals.items) |global| { |
| 3608 | try binary_writer.writeByte(std.wasm.valtype(global.global_type.valtype)); | 3608 | try binary_writer.writeByte(std.wasm.valtype(global.global_type.valtype)); |
| 3609 | try binary_writer.writeByte(@boolToInt(global.global_type.mutable)); | 3609 | try binary_writer.writeByte(@intFromBool(global.global_type.mutable)); |
| 3610 | try emitInit(binary_writer, global.init); | 3610 | try emitInit(binary_writer, global.init); |
| 3611 | } | 3611 | } |
| 3612 | 3612 | ||
| ... | @@ -3628,7 +3628,7 @@ fn writeToFile( | ... | @@ -3628,7 +3628,7 @@ fn writeToFile( |
| 3628 | const name = wasm.string_table.get(exp.name); | 3628 | const name = wasm.string_table.get(exp.name); |
| 3629 | try leb.writeULEB128(binary_writer, @intCast(u32, name.len)); | 3629 | try leb.writeULEB128(binary_writer, @intCast(u32, name.len)); |
| 3630 | try binary_writer.writeAll(name); | 3630 | try binary_writer.writeAll(name); |
| 3631 | try leb.writeULEB128(binary_writer, @enumToInt(exp.kind)); | 3631 | try leb.writeULEB128(binary_writer, @intFromEnum(exp.kind)); |
| 3632 | try leb.writeULEB128(binary_writer, exp.index); | 3632 | try leb.writeULEB128(binary_writer, exp.index); |
| 3633 | } | 3633 | } |
| 3634 | 3634 | ||
| ... | @@ -3644,7 +3644,7 @@ fn writeToFile( | ... | @@ -3644,7 +3644,7 @@ fn writeToFile( |
| 3644 | header_offset, | 3644 | header_offset, |
| 3645 | .@"export", | 3645 | .@"export", |
| 3646 | @intCast(u32, binary_bytes.items.len - header_offset - header_size), | 3646 | @intCast(u32, binary_bytes.items.len - header_offset - header_size), |
| 3647 | @intCast(u32, wasm.exports.items.len) + @boolToInt(!import_memory), | 3647 | @intCast(u32, wasm.exports.items.len) + @intFromBool(!import_memory), |
| 3648 | ); | 3648 | ); |
| 3649 | section_count += 1; | 3649 | section_count += 1; |
| 3650 | } | 3650 | } |
| ... | @@ -3682,7 +3682,7 @@ fn writeToFile( | ... | @@ -3682,7 +3682,7 @@ fn writeToFile( |
| 3682 | } | 3682 | } |
| 3683 | 3683 | ||
| 3684 | // When the shared-memory option is enabled, we *must* emit the 'data count' section. | 3684 | // When the shared-memory option is enabled, we *must* emit the 'data count' section. |
| 3685 | const data_segments_count = wasm.data_segments.count() - @boolToInt(wasm.data_segments.contains(".bss") and import_memory); | 3685 | const data_segments_count = wasm.data_segments.count() - @intFromBool(wasm.data_segments.contains(".bss") and import_memory); |
| 3686 | if (data_segments_count != 0 and wasm.base.options.shared_memory) { | 3686 | if (data_segments_count != 0 and wasm.base.options.shared_memory) { |
| 3687 | const header_offset = try reserveVecSectionHeader(&binary_bytes); | 3687 | const header_offset = try reserveVecSectionHeader(&binary_bytes); |
| 3688 | try writeVecSectionHeader( | 3688 | try writeVecSectionHeader( |
| ... | @@ -3760,7 +3760,7 @@ fn writeToFile( | ... | @@ -3760,7 +3760,7 @@ fn writeToFile( |
| 3760 | var atom_index = wasm.atoms.get(segment_index).?; | 3760 | var atom_index = wasm.atoms.get(segment_index).?; |
| 3761 | 3761 | ||
| 3762 | try leb.writeULEB128(binary_writer, segment.flags); | 3762 | try leb.writeULEB128(binary_writer, segment.flags); |
| 3763 | if (segment.flags & @enumToInt(Wasm.Segment.Flag.WASM_DATA_SEGMENT_HAS_MEMINDEX) != 0) { | 3763 | if (segment.flags & @intFromEnum(Wasm.Segment.Flag.WASM_DATA_SEGMENT_HAS_MEMINDEX) != 0) { |
| 3764 | try leb.writeULEB128(binary_writer, @as(u32, 0)); // memory is always index 0 as we only have 1 memory entry | 3764 | try leb.writeULEB128(binary_writer, @as(u32, 0)); // memory is always index 0 as we only have 1 memory entry |
| 3765 | } | 3765 | } |
| 3766 | // when a segment is passive, it's initialized during runtime. | 3766 | // when a segment is passive, it's initialized during runtime. |
| ... | @@ -4030,8 +4030,8 @@ fn emitFeaturesSection(binary_bytes: *std.ArrayList(u8), enabled_features: []con | ... | @@ -4030,8 +4030,8 @@ fn emitFeaturesSection(binary_bytes: *std.ArrayList(u8), enabled_features: []con |
| 4030 | try leb.writeULEB128(writer, features_count); | 4030 | try leb.writeULEB128(writer, features_count); |
| 4031 | for (enabled_features, 0..) |enabled, feature_index| { | 4031 | for (enabled_features, 0..) |enabled, feature_index| { |
| 4032 | if (enabled) { | 4032 | if (enabled) { |
| 4033 | const feature: types.Feature = .{ .prefix = .used, .tag = @intToEnum(types.Feature.Tag, feature_index) }; | 4033 | const feature: types.Feature = .{ .prefix = .used, .tag = @enumFromInt(types.Feature.Tag, feature_index) }; |
| 4034 | try leb.writeULEB128(writer, @enumToInt(feature.prefix)); | 4034 | try leb.writeULEB128(writer, @intFromEnum(feature.prefix)); |
| 4035 | var buf: [100]u8 = undefined; | 4035 | var buf: [100]u8 = undefined; |
| 4036 | const string = try std.fmt.bufPrint(&buf, "{}", .{feature.tag}); | 4036 | const string = try std.fmt.bufPrint(&buf, "{}", .{feature.tag}); |
| 4037 | try leb.writeULEB128(writer, @intCast(u32, string.len)); | 4037 | try leb.writeULEB128(writer, @intCast(u32, string.len)); |
| ... | @@ -4121,7 +4121,7 @@ fn emitNameSubsection(wasm: *Wasm, section_id: std.wasm.NameSubsection, names: a | ... | @@ -4121,7 +4121,7 @@ fn emitNameSubsection(wasm: *Wasm, section_id: std.wasm.NameSubsection, names: a |
| 4121 | } | 4121 | } |
| 4122 | 4122 | ||
| 4123 | // From now, write to the actual writer | 4123 | // From now, write to the actual writer |
| 4124 | try leb.writeULEB128(writer, @enumToInt(section_id)); | 4124 | try leb.writeULEB128(writer, @intFromEnum(section_id)); |
| 4125 | try leb.writeULEB128(writer, @intCast(u32, section_list.items.len)); | 4125 | try leb.writeULEB128(writer, @intCast(u32, section_list.items.len)); |
| 4126 | try writer.writeAll(section_list.items); | 4126 | try writer.writeAll(section_list.items); |
| 4127 | } | 4127 | } |
| ... | @@ -4169,12 +4169,12 @@ fn emitImport(wasm: *Wasm, writer: anytype, import: types.Import) !void { | ... | @@ -4169,12 +4169,12 @@ fn emitImport(wasm: *Wasm, writer: anytype, import: types.Import) !void { |
| 4169 | try leb.writeULEB128(writer, @intCast(u32, name.len)); | 4169 | try leb.writeULEB128(writer, @intCast(u32, name.len)); |
| 4170 | try writer.writeAll(name); | 4170 | try writer.writeAll(name); |
| 4171 | 4171 | ||
| 4172 | try writer.writeByte(@enumToInt(import.kind)); | 4172 | try writer.writeByte(@intFromEnum(import.kind)); |
| 4173 | switch (import.kind) { | 4173 | switch (import.kind) { |
| 4174 | .function => |type_index| try leb.writeULEB128(writer, type_index), | 4174 | .function => |type_index| try leb.writeULEB128(writer, type_index), |
| 4175 | .global => |global_type| { | 4175 | .global => |global_type| { |
| 4176 | try leb.writeULEB128(writer, std.wasm.valtype(global_type.valtype)); | 4176 | try leb.writeULEB128(writer, std.wasm.valtype(global_type.valtype)); |
| 4177 | try writer.writeByte(@boolToInt(global_type.mutable)); | 4177 | try writer.writeByte(@intFromBool(global_type.mutable)); |
| 4178 | }, | 4178 | }, |
| 4179 | .table => |table| { | 4179 | .table => |table| { |
| 4180 | try leb.writeULEB128(writer, std.wasm.reftype(table.reftype)); | 4180 | try leb.writeULEB128(writer, std.wasm.reftype(table.reftype)); |
| ... | @@ -4609,7 +4609,7 @@ fn reserveCustomSectionHeader(bytes: *std.ArrayList(u8)) !u32 { | ... | @@ -4609,7 +4609,7 @@ fn reserveCustomSectionHeader(bytes: *std.ArrayList(u8)) !u32 { |
| 4609 | 4609 | ||
| 4610 | fn writeVecSectionHeader(buffer: []u8, offset: u32, section: std.wasm.Section, size: u32, items: u32) !void { | 4610 | fn writeVecSectionHeader(buffer: []u8, offset: u32, section: std.wasm.Section, size: u32, items: u32) !void { |
| 4611 | var buf: [1 + 5 + 5]u8 = undefined; | 4611 | var buf: [1 + 5 + 5]u8 = undefined; |
| 4612 | buf[0] = @enumToInt(section); | 4612 | buf[0] = @intFromEnum(section); |
| 4613 | leb.writeUnsignedFixed(5, buf[1..6], size); | 4613 | leb.writeUnsignedFixed(5, buf[1..6], size); |
| 4614 | leb.writeUnsignedFixed(5, buf[6..], items); | 4614 | leb.writeUnsignedFixed(5, buf[6..], items); |
| 4615 | buffer[offset..][0..buf.len].* = buf; | 4615 | buffer[offset..][0..buf.len].* = buf; |
| ... | @@ -4645,7 +4645,7 @@ fn emitLinkSection(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: | ... | @@ -4645,7 +4645,7 @@ fn emitLinkSection(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: |
| 4645 | fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: *std.AutoArrayHashMap(SymbolLoc, u32)) !void { | 4645 | fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: *std.AutoArrayHashMap(SymbolLoc, u32)) !void { |
| 4646 | const writer = binary_bytes.writer(); | 4646 | const writer = binary_bytes.writer(); |
| 4647 | 4647 | ||
| 4648 | try leb.writeULEB128(writer, @enumToInt(types.SubsectionType.WASM_SYMBOL_TABLE)); | 4648 | try leb.writeULEB128(writer, @intFromEnum(types.SubsectionType.WASM_SYMBOL_TABLE)); |
| 4649 | const table_offset = binary_bytes.items.len; | 4649 | const table_offset = binary_bytes.items.len; |
| 4650 | 4650 | ||
| 4651 | var symbol_count: u32 = 0; | 4651 | var symbol_count: u32 = 0; |
| ... | @@ -4655,7 +4655,7 @@ fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: | ... | @@ -4655,7 +4655,7 @@ fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: |
| 4655 | try symbol_table.putNoClobber(sym_loc, symbol_count); | 4655 | try symbol_table.putNoClobber(sym_loc, symbol_count); |
| 4656 | symbol_count += 1; | 4656 | symbol_count += 1; |
| 4657 | log.debug("Emit symbol: {}", .{symbol}); | 4657 | log.debug("Emit symbol: {}", .{symbol}); |
| 4658 | try leb.writeULEB128(writer, @enumToInt(symbol.tag)); | 4658 | try leb.writeULEB128(writer, @intFromEnum(symbol.tag)); |
| 4659 | try leb.writeULEB128(writer, symbol.flags); | 4659 | try leb.writeULEB128(writer, symbol.flags); |
| 4660 | 4660 | ||
| 4661 | const sym_name = if (wasm.export_names.get(sym_loc)) |exp_name| wasm.string_table.get(exp_name) else sym_loc.getName(wasm); | 4661 | const sym_name = if (wasm.export_names.get(sym_loc)) |exp_name| wasm.string_table.get(exp_name) else sym_loc.getName(wasm); |
| ... | @@ -4693,7 +4693,7 @@ fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: | ... | @@ -4693,7 +4693,7 @@ fn emitSymbolTable(wasm: *Wasm, binary_bytes: *std.ArrayList(u8), symbol_table: |
| 4693 | 4693 | ||
| 4694 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void { | 4694 | fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void { |
| 4695 | const writer = binary_bytes.writer(); | 4695 | const writer = binary_bytes.writer(); |
| 4696 | try leb.writeULEB128(writer, @enumToInt(types.SubsectionType.WASM_SEGMENT_INFO)); | 4696 | try leb.writeULEB128(writer, @intFromEnum(types.SubsectionType.WASM_SEGMENT_INFO)); |
| 4697 | const segment_offset = binary_bytes.items.len; | 4697 | const segment_offset = binary_bytes.items.len; |
| 4698 | 4698 | ||
| 4699 | try leb.writeULEB128(writer, @intCast(u32, wasm.segment_info.count())); | 4699 | try leb.writeULEB128(writer, @intCast(u32, wasm.segment_info.count())); |
| ... | @@ -4754,7 +4754,7 @@ fn emitCodeRelocations( | ... | @@ -4754,7 +4754,7 @@ fn emitCodeRelocations( |
| 4754 | count += 1; | 4754 | count += 1; |
| 4755 | const sym_loc: SymbolLoc = .{ .file = atom.file, .index = relocation.index }; | 4755 | const sym_loc: SymbolLoc = .{ .file = atom.file, .index = relocation.index }; |
| 4756 | const symbol_index = symbol_table.get(sym_loc).?; | 4756 | const symbol_index = symbol_table.get(sym_loc).?; |
| 4757 | try leb.writeULEB128(writer, @enumToInt(relocation.relocation_type)); | 4757 | try leb.writeULEB128(writer, @intFromEnum(relocation.relocation_type)); |
| 4758 | const offset = atom.offset + relocation.offset + size_offset; | 4758 | const offset = atom.offset + relocation.offset + size_offset; |
| 4759 | try leb.writeULEB128(writer, offset); | 4759 | try leb.writeULEB128(writer, offset); |
| 4760 | try leb.writeULEB128(writer, symbol_index); | 4760 | try leb.writeULEB128(writer, symbol_index); |
| ... | @@ -4804,7 +4804,7 @@ fn emitDataRelocations( | ... | @@ -4804,7 +4804,7 @@ fn emitDataRelocations( |
| 4804 | .index = relocation.index, | 4804 | .index = relocation.index, |
| 4805 | }; | 4805 | }; |
| 4806 | const symbol_index = symbol_table.get(sym_loc).?; | 4806 | const symbol_index = symbol_table.get(sym_loc).?; |
| 4807 | try leb.writeULEB128(writer, @enumToInt(relocation.relocation_type)); | 4807 | try leb.writeULEB128(writer, @intFromEnum(relocation.relocation_type)); |
| 4808 | const offset = atom.offset + relocation.offset + size_offset; | 4808 | const offset = atom.offset + relocation.offset + size_offset; |
| 4809 | try leb.writeULEB128(writer, offset); | 4809 | try leb.writeULEB128(writer, offset); |
| 4810 | try leb.writeULEB128(writer, symbol_index); | 4810 | try leb.writeULEB128(writer, symbol_index); |
src/link/Wasm/Object.zig+8-8| ... | @@ -365,7 +365,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -365,7 +365,7 @@ fn Parser(comptime ReaderType: type) type { |
| 365 | const len = try readLeb(u32, parser.reader.reader()); | 365 | const len = try readLeb(u32, parser.reader.reader()); |
| 366 | var limited_reader = std.io.limitedReader(parser.reader.reader(), len); | 366 | var limited_reader = std.io.limitedReader(parser.reader.reader(), len); |
| 367 | const reader = limited_reader.reader(); | 367 | const reader = limited_reader.reader(); |
| 368 | switch (@intToEnum(std.wasm.Section, byte)) { | 368 | switch (@enumFromInt(std.wasm.Section, byte)) { |
| 369 | .custom => { | 369 | .custom => { |
| 370 | const name_len = try readLeb(u32, reader); | 370 | const name_len = try readLeb(u32, reader); |
| 371 | const name = try gpa.alloc(u8, name_len); | 371 | const name = try gpa.alloc(u8, name_len); |
| ... | @@ -645,7 +645,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -645,7 +645,7 @@ fn Parser(comptime ReaderType: type) type { |
| 645 | /// such as access to the `import` section to find the name of a symbol. | 645 | /// such as access to the `import` section to find the name of a symbol. |
| 646 | fn parseSubsection(parser: *ObjectParser, gpa: Allocator, reader: anytype) !void { | 646 | fn parseSubsection(parser: *ObjectParser, gpa: Allocator, reader: anytype) !void { |
| 647 | const sub_type = try leb.readULEB128(u8, reader); | 647 | const sub_type = try leb.readULEB128(u8, reader); |
| 648 | log.debug("Found subsection: {s}", .{@tagName(@intToEnum(types.SubsectionType, sub_type))}); | 648 | log.debug("Found subsection: {s}", .{@tagName(@enumFromInt(types.SubsectionType, sub_type))}); |
| 649 | const payload_len = try leb.readULEB128(u32, reader); | 649 | const payload_len = try leb.readULEB128(u32, reader); |
| 650 | if (payload_len == 0) return; | 650 | if (payload_len == 0) return; |
| 651 | 651 | ||
| ... | @@ -655,7 +655,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -655,7 +655,7 @@ fn Parser(comptime ReaderType: type) type { |
| 655 | // every subsection contains a 'count' field | 655 | // every subsection contains a 'count' field |
| 656 | const count = try leb.readULEB128(u32, limited_reader); | 656 | const count = try leb.readULEB128(u32, limited_reader); |
| 657 | 657 | ||
| 658 | switch (@intToEnum(types.SubsectionType, sub_type)) { | 658 | switch (@enumFromInt(types.SubsectionType, sub_type)) { |
| 659 | .WASM_SEGMENT_INFO => { | 659 | .WASM_SEGMENT_INFO => { |
| 660 | const segments = try gpa.alloc(types.Segment, count); | 660 | const segments = try gpa.alloc(types.Segment, count); |
| 661 | errdefer gpa.free(segments); | 661 | errdefer gpa.free(segments); |
| ... | @@ -678,7 +678,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -678,7 +678,7 @@ fn Parser(comptime ReaderType: type) type { |
| 678 | // support legacy object files that specified being TLS by the name instead of the TLS flag. | 678 | // support legacy object files that specified being TLS by the name instead of the TLS flag. |
| 679 | if (!segment.isTLS() and (std.mem.startsWith(u8, segment.name, ".tdata") or std.mem.startsWith(u8, segment.name, ".tbss"))) { | 679 | if (!segment.isTLS() and (std.mem.startsWith(u8, segment.name, ".tdata") or std.mem.startsWith(u8, segment.name, ".tbss"))) { |
| 680 | // set the flag so we can simply check for the flag in the rest of the linker. | 680 | // set the flag so we can simply check for the flag in the rest of the linker. |
| 681 | segment.flags |= @enumToInt(types.Segment.Flags.WASM_SEG_FLAG_TLS); | 681 | segment.flags |= @intFromEnum(types.Segment.Flags.WASM_SEG_FLAG_TLS); |
| 682 | } | 682 | } |
| 683 | } | 683 | } |
| 684 | parser.object.segment_info = segments; | 684 | parser.object.segment_info = segments; |
| ... | @@ -714,7 +714,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -714,7 +714,7 @@ fn Parser(comptime ReaderType: type) type { |
| 714 | errdefer gpa.free(symbols); | 714 | errdefer gpa.free(symbols); |
| 715 | for (symbols) |*symbol| { | 715 | for (symbols) |*symbol| { |
| 716 | symbol.* = .{ | 716 | symbol.* = .{ |
| 717 | .kind = @intToEnum(types.ComdatSym.Type, try leb.readULEB128(u8, reader)), | 717 | .kind = @enumFromInt(types.ComdatSym.Type, try leb.readULEB128(u8, reader)), |
| 718 | .index = try leb.readULEB128(u32, reader), | 718 | .index = try leb.readULEB128(u32, reader), |
| 719 | }; | 719 | }; |
| 720 | } | 720 | } |
| ... | @@ -758,7 +758,7 @@ fn Parser(comptime ReaderType: type) type { | ... | @@ -758,7 +758,7 @@ fn Parser(comptime ReaderType: type) type { |
| 758 | /// requires access to `Object` to find the name of a symbol when it's | 758 | /// requires access to `Object` to find the name of a symbol when it's |
| 759 | /// an import and flag `WASM_SYM_EXPLICIT_NAME` is not set. | 759 | /// an import and flag `WASM_SYM_EXPLICIT_NAME` is not set. |
| 760 | fn parseSymbol(parser: *ObjectParser, gpa: Allocator, reader: anytype) !Symbol { | 760 | fn parseSymbol(parser: *ObjectParser, gpa: Allocator, reader: anytype) !Symbol { |
| 761 | const tag = @intToEnum(Symbol.Tag, try leb.readULEB128(u8, reader)); | 761 | const tag = @enumFromInt(Symbol.Tag, try leb.readULEB128(u8, reader)); |
| 762 | const flags = try leb.readULEB128(u32, reader); | 762 | const flags = try leb.readULEB128(u32, reader); |
| 763 | var symbol: Symbol = .{ | 763 | var symbol: Symbol = .{ |
| 764 | .flags = flags, | 764 | .flags = flags, |
| ... | @@ -846,7 +846,7 @@ fn readLeb(comptime T: type, reader: anytype) !T { | ... | @@ -846,7 +846,7 @@ fn readLeb(comptime T: type, reader: anytype) !T { |
| 846 | /// Asserts `T` is an enum | 846 | /// Asserts `T` is an enum |
| 847 | fn readEnum(comptime T: type, reader: anytype) !T { | 847 | fn readEnum(comptime T: type, reader: anytype) !T { |
| 848 | switch (@typeInfo(T)) { | 848 | switch (@typeInfo(T)) { |
| 849 | .Enum => |enum_type| return @intToEnum(T, try readLeb(enum_type.tag_type, reader)), | 849 | .Enum => |enum_type| return @enumFromInt(T, try readLeb(enum_type.tag_type, reader)), |
| 850 | else => @compileError("T must be an enum. Instead was given type " ++ @typeName(T)), | 850 | else => @compileError("T must be an enum. Instead was given type " ++ @typeName(T)), |
| 851 | } | 851 | } |
| 852 | } | 852 | } |
| ... | @@ -867,7 +867,7 @@ fn readLimits(reader: anytype) !std.wasm.Limits { | ... | @@ -867,7 +867,7 @@ fn readLimits(reader: anytype) !std.wasm.Limits { |
| 867 | 867 | ||
| 868 | fn readInit(reader: anytype) !std.wasm.InitExpression { | 868 | fn readInit(reader: anytype) !std.wasm.InitExpression { |
| 869 | const opcode = try reader.readByte(); | 869 | const opcode = try reader.readByte(); |
| 870 | const init_expr: std.wasm.InitExpression = switch (@intToEnum(std.wasm.Opcode, opcode)) { | 870 | const init_expr: std.wasm.InitExpression = switch (@enumFromInt(std.wasm.Opcode, opcode)) { |
| 871 | .i32_const => .{ .i32_const = try readLeb(i32, reader) }, | 871 | .i32_const => .{ .i32_const = try readLeb(i32, reader) }, |
| 872 | .global_get => .{ .global_get = try readLeb(u32, reader) }, | 872 | .global_get => .{ .global_get = try readLeb(u32, reader) }, |
| 873 | else => @panic("TODO: initexpression for other opcodes"), | 873 | else => @panic("TODO: initexpression for other opcodes"), |
src/link/Wasm/Symbol.zig+12-12| ... | @@ -91,32 +91,32 @@ pub fn requiresImport(symbol: Symbol) bool { | ... | @@ -91,32 +91,32 @@ pub fn requiresImport(symbol: Symbol) bool { |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | pub fn isTLS(symbol: Symbol) bool { | 93 | pub fn isTLS(symbol: Symbol) bool { |
| 94 | return symbol.flags & @enumToInt(Flag.WASM_SYM_TLS) != 0; | 94 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_TLS) != 0; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | pub fn hasFlag(symbol: Symbol, flag: Flag) bool { | 97 | pub fn hasFlag(symbol: Symbol, flag: Flag) bool { |
| 98 | return symbol.flags & @enumToInt(flag) != 0; | 98 | return symbol.flags & @intFromEnum(flag) != 0; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | pub fn setFlag(symbol: *Symbol, flag: Flag) void { | 101 | pub fn setFlag(symbol: *Symbol, flag: Flag) void { |
| 102 | symbol.flags |= @enumToInt(flag); | 102 | symbol.flags |= @intFromEnum(flag); |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | pub fn isUndefined(symbol: Symbol) bool { | 105 | pub fn isUndefined(symbol: Symbol) bool { |
| 106 | return symbol.flags & @enumToInt(Flag.WASM_SYM_UNDEFINED) != 0; | 106 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_UNDEFINED) != 0; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | pub fn setUndefined(symbol: *Symbol, is_undefined: bool) void { | 109 | pub fn setUndefined(symbol: *Symbol, is_undefined: bool) void { |
| 110 | if (is_undefined) { | 110 | if (is_undefined) { |
| 111 | symbol.setFlag(.WASM_SYM_UNDEFINED); | 111 | symbol.setFlag(.WASM_SYM_UNDEFINED); |
| 112 | } else { | 112 | } else { |
| 113 | symbol.flags &= ~@enumToInt(Flag.WASM_SYM_UNDEFINED); | 113 | symbol.flags &= ~@intFromEnum(Flag.WASM_SYM_UNDEFINED); |
| 114 | } | 114 | } |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | pub fn setGlobal(symbol: *Symbol, is_global: bool) void { | 117 | pub fn setGlobal(symbol: *Symbol, is_global: bool) void { |
| 118 | if (is_global) { | 118 | if (is_global) { |
| 119 | symbol.flags &= ~@enumToInt(Flag.WASM_SYM_BINDING_LOCAL); | 119 | symbol.flags &= ~@intFromEnum(Flag.WASM_SYM_BINDING_LOCAL); |
| 120 | } else { | 120 | } else { |
| 121 | symbol.setFlag(.WASM_SYM_BINDING_LOCAL); | 121 | symbol.setFlag(.WASM_SYM_BINDING_LOCAL); |
| 122 | } | 122 | } |
| ... | @@ -127,23 +127,23 @@ pub fn isDefined(symbol: Symbol) bool { | ... | @@ -127,23 +127,23 @@ pub fn isDefined(symbol: Symbol) bool { |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | pub fn isVisible(symbol: Symbol) bool { | 129 | pub fn isVisible(symbol: Symbol) bool { |
| 130 | return symbol.flags & @enumToInt(Flag.WASM_SYM_VISIBILITY_HIDDEN) == 0; | 130 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_VISIBILITY_HIDDEN) == 0; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | pub fn isLocal(symbol: Symbol) bool { | 133 | pub fn isLocal(symbol: Symbol) bool { |
| 134 | return symbol.flags & @enumToInt(Flag.WASM_SYM_BINDING_LOCAL) != 0; | 134 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_BINDING_LOCAL) != 0; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | pub fn isGlobal(symbol: Symbol) bool { | 137 | pub fn isGlobal(symbol: Symbol) bool { |
| 138 | return symbol.flags & @enumToInt(Flag.WASM_SYM_BINDING_LOCAL) == 0; | 138 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_BINDING_LOCAL) == 0; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | pub fn isHidden(symbol: Symbol) bool { | 141 | pub fn isHidden(symbol: Symbol) bool { |
| 142 | return symbol.flags & @enumToInt(Flag.WASM_SYM_VISIBILITY_HIDDEN) != 0; | 142 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_VISIBILITY_HIDDEN) != 0; |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | pub fn isNoStrip(symbol: Symbol) bool { | 145 | pub fn isNoStrip(symbol: Symbol) bool { |
| 146 | return symbol.flags & @enumToInt(Flag.WASM_SYM_NO_STRIP) != 0; | 146 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_NO_STRIP) != 0; |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | pub fn isExported(symbol: Symbol, is_dynamic: bool) bool { | 149 | pub fn isExported(symbol: Symbol, is_dynamic: bool) bool { |
| ... | @@ -153,7 +153,7 @@ pub fn isExported(symbol: Symbol, is_dynamic: bool) bool { | ... | @@ -153,7 +153,7 @@ pub fn isExported(symbol: Symbol, is_dynamic: bool) bool { |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | pub fn isWeak(symbol: Symbol) bool { | 155 | pub fn isWeak(symbol: Symbol) bool { |
| 156 | return symbol.flags & @enumToInt(Flag.WASM_SYM_BINDING_WEAK) != 0; | 156 | return symbol.flags & @intFromEnum(Flag.WASM_SYM_BINDING_WEAK) != 0; |
| 157 | } | 157 | } |
| 158 | 158 | ||
| 159 | /// Formats the symbol into human-readable text | 159 | /// Formats the symbol into human-readable text |
src/link/Wasm/types.zig+2-2| ... | @@ -118,7 +118,7 @@ pub const Segment = struct { | ... | @@ -118,7 +118,7 @@ pub const Segment = struct { |
| 118 | flags: u32, | 118 | flags: u32, |
| 119 | 119 | ||
| 120 | pub fn isTLS(segment: Segment) bool { | 120 | pub fn isTLS(segment: Segment) bool { |
| 121 | return segment.flags & @enumToInt(Flags.WASM_SEG_FLAG_TLS) != 0; | 121 | return segment.flags & @intFromEnum(Flags.WASM_SEG_FLAG_TLS) != 0; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | /// Returns the name as how it will be output into the final object | 124 | /// Returns the name as how it will be output into the final object |
| ... | @@ -205,7 +205,7 @@ pub const Feature = struct { | ... | @@ -205,7 +205,7 @@ pub const Feature = struct { |
| 205 | 205 | ||
| 206 | /// From a given cpu feature, returns its linker feature | 206 | /// From a given cpu feature, returns its linker feature |
| 207 | pub fn fromCpuFeature(feature: std.Target.wasm.Feature) Tag { | 207 | pub fn fromCpuFeature(feature: std.Target.wasm.Feature) Tag { |
| 208 | return @intToEnum(Tag, @enumToInt(feature)); | 208 | return @enumFromInt(Tag, @intFromEnum(feature)); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | pub fn format(tag: Tag, comptime fmt: []const u8, opt: std.fmt.FormatOptions, writer: anytype) !void { | 211 | pub fn format(tag: Tag, comptime fmt: []const u8, opt: std.fmt.FormatOptions, writer: anytype) !void { |
src/main.zig+8-8| ... | @@ -140,8 +140,8 @@ pub fn log( | ... | @@ -140,8 +140,8 @@ pub fn log( |
| 140 | // Hide debug messages unless: | 140 | // Hide debug messages unless: |
| 141 | // * logging enabled with `-Dlog`. | 141 | // * logging enabled with `-Dlog`. |
| 142 | // * the --debug-log arg for the scope has been provided | 142 | // * the --debug-log arg for the scope has been provided |
| 143 | if (@enumToInt(level) > @enumToInt(std.options.log_level) or | 143 | if (@intFromEnum(level) > @intFromEnum(std.options.log_level) or |
| 144 | @enumToInt(level) > @enumToInt(std.log.Level.info)) | 144 | @intFromEnum(level) > @intFromEnum(std.log.Level.info)) |
| 145 | { | 145 | { |
| 146 | if (!build_options.enable_logging) return; | 146 | if (!build_options.enable_logging) return; |
| 147 | 147 | ||
| ... | @@ -2424,8 +2424,8 @@ fn buildOutputType( | ... | @@ -2424,8 +2424,8 @@ fn buildOutputType( |
| 2424 | fatal("shared memory is not allowed in object files", .{}); | 2424 | fatal("shared memory is not allowed in object files", .{}); |
| 2425 | } | 2425 | } |
| 2426 | 2426 | ||
| 2427 | if (!target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.atomics)) or | 2427 | if (!target_info.target.cpu.features.isEnabled(@intFromEnum(std.Target.wasm.Feature.atomics)) or |
| 2428 | !target_info.target.cpu.features.isEnabled(@enumToInt(std.Target.wasm.Feature.bulk_memory))) | 2428 | !target_info.target.cpu.features.isEnabled(@intFromEnum(std.Target.wasm.Feature.bulk_memory))) |
| 2429 | { | 2429 | { |
| 2430 | fatal("'atomics' and 'bulk-memory' features must be enabled to use shared memory", .{}); | 2430 | fatal("'atomics' and 'bulk-memory' features must be enabled to use shared memory", .{}); |
| 2431 | } | 2431 | } |
| ... | @@ -2640,7 +2640,7 @@ fn buildOutputType( | ... | @@ -2640,7 +2640,7 @@ fn buildOutputType( |
| 2640 | 2640 | ||
| 2641 | if (output_mode == .Obj and (object_format == .coff or object_format == .macho)) { | 2641 | if (output_mode == .Obj and (object_format == .coff or object_format == .macho)) { |
| 2642 | const total_obj_count = c_source_files.items.len + | 2642 | const total_obj_count = c_source_files.items.len + |
| 2643 | @boolToInt(root_src_file != null) + | 2643 | @intFromBool(root_src_file != null) + |
| 2644 | link_objects.items.len; | 2644 | link_objects.items.len; |
| 2645 | if (total_obj_count > 1) { | 2645 | if (total_obj_count > 1) { |
| 2646 | fatal("{s} does not support linking multiple objects into one", .{@tagName(object_format)}); | 2646 | fatal("{s} does not support linking multiple objects into one", .{@tagName(object_format)}); |
| ... | @@ -3466,7 +3466,7 @@ fn serve( | ... | @@ -3466,7 +3466,7 @@ fn serve( |
| 3466 | } | 3466 | } |
| 3467 | }, | 3467 | }, |
| 3468 | else => { | 3468 | else => { |
| 3469 | fatal("unrecognized message from client: 0x{x}", .{@enumToInt(hdr.tag)}); | 3469 | fatal("unrecognized message from client: 0x{x}", .{@intFromEnum(hdr.tag)}); |
| 3470 | }, | 3470 | }, |
| 3471 | } | 3471 | } |
| 3472 | } | 3472 | } |
| ... | @@ -4706,7 +4706,7 @@ pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void | ... | @@ -4706,7 +4706,7 @@ pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void |
| 4706 | defer gpa.free(formatted); | 4706 | defer gpa.free(formatted); |
| 4707 | 4707 | ||
| 4708 | if (check_flag) { | 4708 | if (check_flag) { |
| 4709 | const code: u8 = @boolToInt(mem.eql(u8, formatted, source_code)); | 4709 | const code: u8 = @intFromBool(mem.eql(u8, formatted, source_code)); |
| 4710 | process.exit(code); | 4710 | process.exit(code); |
| 4711 | } | 4711 | } |
| 4712 | 4712 | ||
| ... | @@ -5080,7 +5080,7 @@ pub fn lldMain( | ... | @@ -5080,7 +5080,7 @@ pub fn lldMain( |
| 5080 | unreachable; | 5080 | unreachable; |
| 5081 | } | 5081 | } |
| 5082 | }; | 5082 | }; |
| 5083 | return @boolToInt(!ok); | 5083 | return @intFromBool(!ok); |
| 5084 | } | 5084 | } |
| 5085 | 5085 | ||
| 5086 | const ArgIteratorResponseFile = process.ArgIteratorGeneral(.{ .comments = true, .single_quotes = true }); | 5086 | const ArgIteratorResponseFile = process.ArgIteratorGeneral(.{ .comments = true, .single_quotes = true }); |
src/objcopy.zig+2-2| ... | @@ -539,7 +539,7 @@ const HexWriter = struct { | ... | @@ -539,7 +539,7 @@ const HexWriter = struct { |
| 539 | const parts = addressParts(self.address); | 539 | const parts = addressParts(self.address); |
| 540 | sum +%= parts[0]; | 540 | sum +%= parts[0]; |
| 541 | sum +%= parts[1]; | 541 | sum +%= parts[1]; |
| 542 | sum +%= @enumToInt(self.payload); | 542 | sum +%= @intFromEnum(self.payload); |
| 543 | for (payload_bytes) |byte| { | 543 | for (payload_bytes) |byte| { |
| 544 | sum +%= byte; | 544 | sum +%= byte; |
| 545 | } | 545 | } |
| ... | @@ -557,7 +557,7 @@ const HexWriter = struct { | ... | @@ -557,7 +557,7 @@ const HexWriter = struct { |
| 557 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3s}{4X:0>2}" ++ linesep, .{ | 557 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3s}{4X:0>2}" ++ linesep, .{ |
| 558 | @intCast(u8, payload_bytes.len), | 558 | @intCast(u8, payload_bytes.len), |
| 559 | self.address, | 559 | self.address, |
| 560 | @enumToInt(self.payload), | 560 | @intFromEnum(self.payload), |
| 561 | std.fmt.fmtSliceHexUpper(payload_bytes), | 561 | std.fmt.fmtSliceHexUpper(payload_bytes), |
| 562 | self.checksum(), | 562 | self.checksum(), |
| 563 | }); | 563 | }); |
src/print_air.zig+1-1| ... | @@ -956,7 +956,7 @@ const Writer = struct { | ... | @@ -956,7 +956,7 @@ const Writer = struct { |
| 956 | operand: Air.Inst.Ref, | 956 | operand: Air.Inst.Ref, |
| 957 | dies: bool, | 957 | dies: bool, |
| 958 | ) @TypeOf(s).Error!void { | 958 | ) @TypeOf(s).Error!void { |
| 959 | const i = @enumToInt(operand); | 959 | const i = @intFromEnum(operand); |
| 960 | 960 | ||
| 961 | if (i < InternPool.static_len) { | 961 | if (i < InternPool.static_len) { |
| 962 | return s.print("@{}", .{operand}); | 962 | return s.print("@{}", .{operand}); |
src/print_zir.zig+36-36| ... | @@ -36,7 +36,7 @@ pub fn renderAsTextToFile( | ... | @@ -36,7 +36,7 @@ pub fn renderAsTextToFile( |
| 36 | try stream.print("%{d} ", .{main_struct_inst}); | 36 | try stream.print("%{d} ", .{main_struct_inst}); |
| 37 | try writer.writeInstToStream(stream, main_struct_inst); | 37 | try writer.writeInstToStream(stream, main_struct_inst); |
| 38 | try stream.writeAll("\n"); | 38 | try stream.writeAll("\n"); |
| 39 | const imports_index = scope_file.zir.extra[@enumToInt(Zir.ExtraIndex.imports)]; | 39 | const imports_index = scope_file.zir.extra[@intFromEnum(Zir.ExtraIndex.imports)]; |
| 40 | if (imports_index != 0) { | 40 | if (imports_index != 0) { |
| 41 | try stream.writeAll("Imports:\n"); | 41 | try stream.writeAll("Imports:\n"); |
| 42 | 42 | ||
| ... | @@ -559,7 +559,7 @@ const Writer = struct { | ... | @@ -559,7 +559,7 @@ const Writer = struct { |
| 559 | fn writeElemTypeIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { | 559 | fn writeElemTypeIndex(self: *Writer, stream: anytype, inst: Zir.Inst.Index) !void { |
| 560 | const inst_data = self.code.instructions.items(.data)[inst].bin; | 560 | const inst_data = self.code.instructions.items(.data)[inst].bin; |
| 561 | try self.writeInstRef(stream, inst_data.lhs); | 561 | try self.writeInstRef(stream, inst_data.lhs); |
| 562 | try stream.print(", {d})", .{@enumToInt(inst_data.rhs)}); | 562 | try stream.print(", {d})", .{@intFromEnum(inst_data.rhs)}); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | fn writeUnNode( | 565 | fn writeUnNode( |
| ... | @@ -632,25 +632,25 @@ const Writer = struct { | ... | @@ -632,25 +632,25 @@ const Writer = struct { |
| 632 | var extra_index = extra.end; | 632 | var extra_index = extra.end; |
| 633 | if (inst_data.flags.has_sentinel) { | 633 | if (inst_data.flags.has_sentinel) { |
| 634 | try stream.writeAll(", "); | 634 | try stream.writeAll(", "); |
| 635 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index])); | 635 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index])); |
| 636 | extra_index += 1; | 636 | extra_index += 1; |
| 637 | } | 637 | } |
| 638 | if (inst_data.flags.has_align) { | 638 | if (inst_data.flags.has_align) { |
| 639 | try stream.writeAll(", align("); | 639 | try stream.writeAll(", align("); |
| 640 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index])); | 640 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index])); |
| 641 | extra_index += 1; | 641 | extra_index += 1; |
| 642 | if (inst_data.flags.has_bit_range) { | 642 | if (inst_data.flags.has_bit_range) { |
| 643 | const bit_start = extra_index + @boolToInt(inst_data.flags.has_addrspace); | 643 | const bit_start = extra_index + @intFromBool(inst_data.flags.has_addrspace); |
| 644 | try stream.writeAll(":"); | 644 | try stream.writeAll(":"); |
| 645 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[bit_start])); | 645 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, self.code.extra[bit_start])); |
| 646 | try stream.writeAll(":"); | 646 | try stream.writeAll(":"); |
| 647 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[bit_start + 1])); | 647 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, self.code.extra[bit_start + 1])); |
| 648 | } | 648 | } |
| 649 | try stream.writeAll(")"); | 649 | try stream.writeAll(")"); |
| 650 | } | 650 | } |
| 651 | if (inst_data.flags.has_addrspace) { | 651 | if (inst_data.flags.has_addrspace) { |
| 652 | try stream.writeAll(", addrspace("); | 652 | try stream.writeAll(", addrspace("); |
| 653 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index])); | 653 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index])); |
| 654 | try stream.writeAll(")"); | 654 | try stream.writeAll(")"); |
| 655 | } | 655 | } |
| 656 | try stream.writeAll(") "); | 656 | try stream.writeAll(") "); |
| ... | @@ -1084,7 +1084,7 @@ const Writer = struct { | ... | @@ -1084,7 +1084,7 @@ const Writer = struct { |
| 1084 | 1084 | ||
| 1085 | try self.writeFlag(stream, "volatile, ", is_volatile); | 1085 | try self.writeFlag(stream, "volatile, ", is_volatile); |
| 1086 | if (tmpl_is_expr) { | 1086 | if (tmpl_is_expr) { |
| 1087 | try self.writeInstRef(stream, @intToEnum(Zir.Inst.Ref, extra.data.asm_source)); | 1087 | try self.writeInstRef(stream, @enumFromInt(Zir.Inst.Ref, extra.data.asm_source)); |
| 1088 | try stream.writeAll(", "); | 1088 | try stream.writeAll(", "); |
| 1089 | } else { | 1089 | } else { |
| 1090 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); | 1090 | const asm_source = self.code.nullTerminatedString(extra.data.asm_source); |
| ... | @@ -1179,7 +1179,7 @@ const Writer = struct { | ... | @@ -1179,7 +1179,7 @@ const Writer = struct { |
| 1179 | if (extra.data.flags.ensure_result_used) { | 1179 | if (extra.data.flags.ensure_result_used) { |
| 1180 | try stream.writeAll("nodiscard "); | 1180 | try stream.writeAll("nodiscard "); |
| 1181 | } | 1181 | } |
| 1182 | try stream.print(".{s}, ", .{@tagName(@intToEnum(std.builtin.CallModifier, extra.data.flags.packed_modifier))}); | 1182 | try stream.print(".{s}, ", .{@tagName(@enumFromInt(std.builtin.CallModifier, extra.data.flags.packed_modifier))}); |
| 1183 | switch (kind) { | 1183 | switch (kind) { |
| 1184 | .direct => try self.writeInstRef(stream, extra.data.callee), | 1184 | .direct => try self.writeInstRef(stream, extra.data.callee), |
| 1185 | .field => { | 1185 | .field => { |
| ... | @@ -1287,7 +1287,7 @@ const Writer = struct { | ... | @@ -1287,7 +1287,7 @@ const Writer = struct { |
| 1287 | extra_index += 1; | 1287 | extra_index += 1; |
| 1288 | try stream.writeAll("Packed("); | 1288 | try stream.writeAll("Packed("); |
| 1289 | if (backing_int_body_len == 0) { | 1289 | if (backing_int_body_len == 0) { |
| 1290 | const backing_int_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1290 | const backing_int_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1291 | extra_index += 1; | 1291 | extra_index += 1; |
| 1292 | try self.writeInstRef(stream, backing_int_ref); | 1292 | try self.writeInstRef(stream, backing_int_ref); |
| 1293 | } else { | 1293 | } else { |
| ... | @@ -1369,7 +1369,7 @@ const Writer = struct { | ... | @@ -1369,7 +1369,7 @@ const Writer = struct { |
| 1369 | if (has_type_body) { | 1369 | if (has_type_body) { |
| 1370 | fields[field_i].type_len = self.code.extra[extra_index]; | 1370 | fields[field_i].type_len = self.code.extra[extra_index]; |
| 1371 | } else { | 1371 | } else { |
| 1372 | fields[field_i].type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1372 | fields[field_i].type = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1373 | } | 1373 | } |
| 1374 | extra_index += 1; | 1374 | extra_index += 1; |
| 1375 | 1375 | ||
| ... | @@ -1454,7 +1454,7 @@ const Writer = struct { | ... | @@ -1454,7 +1454,7 @@ const Writer = struct { |
| 1454 | } else null; | 1454 | } else null; |
| 1455 | 1455 | ||
| 1456 | const tag_type_ref = if (small.has_tag_type) blk: { | 1456 | const tag_type_ref = if (small.has_tag_type) blk: { |
| 1457 | const tag_type_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1457 | const tag_type_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1458 | extra_index += 1; | 1458 | extra_index += 1; |
| 1459 | break :blk tag_type_ref; | 1459 | break :blk tag_type_ref; |
| 1460 | } else .none; | 1460 | } else .none; |
| ... | @@ -1552,14 +1552,14 @@ const Writer = struct { | ... | @@ -1552,14 +1552,14 @@ const Writer = struct { |
| 1552 | try stream.print("{}", .{std.zig.fmtId(field_name)}); | 1552 | try stream.print("{}", .{std.zig.fmtId(field_name)}); |
| 1553 | 1553 | ||
| 1554 | if (has_type) { | 1554 | if (has_type) { |
| 1555 | const field_type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1555 | const field_type = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1556 | extra_index += 1; | 1556 | extra_index += 1; |
| 1557 | 1557 | ||
| 1558 | try stream.writeAll(": "); | 1558 | try stream.writeAll(": "); |
| 1559 | try self.writeInstRef(stream, field_type); | 1559 | try self.writeInstRef(stream, field_type); |
| 1560 | } | 1560 | } |
| 1561 | if (has_align) { | 1561 | if (has_align) { |
| 1562 | const align_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1562 | const align_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1563 | extra_index += 1; | 1563 | extra_index += 1; |
| 1564 | 1564 | ||
| 1565 | try stream.writeAll(" align("); | 1565 | try stream.writeAll(" align("); |
| ... | @@ -1567,7 +1567,7 @@ const Writer = struct { | ... | @@ -1567,7 +1567,7 @@ const Writer = struct { |
| 1567 | try stream.writeAll(")"); | 1567 | try stream.writeAll(")"); |
| 1568 | } | 1568 | } |
| 1569 | if (has_value) { | 1569 | if (has_value) { |
| 1570 | const default_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1570 | const default_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1571 | extra_index += 1; | 1571 | extra_index += 1; |
| 1572 | 1572 | ||
| 1573 | try stream.writeAll(" = "); | 1573 | try stream.writeAll(" = "); |
| ... | @@ -1618,17 +1618,17 @@ const Writer = struct { | ... | @@ -1618,17 +1618,17 @@ const Writer = struct { |
| 1618 | extra_index += 1; | 1618 | extra_index += 1; |
| 1619 | 1619 | ||
| 1620 | const align_inst: Zir.Inst.Ref = if (!has_align) .none else inst: { | 1620 | const align_inst: Zir.Inst.Ref = if (!has_align) .none else inst: { |
| 1621 | const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1621 | const inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1622 | extra_index += 1; | 1622 | extra_index += 1; |
| 1623 | break :inst inst; | 1623 | break :inst inst; |
| 1624 | }; | 1624 | }; |
| 1625 | const section_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { | 1625 | const section_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { |
| 1626 | const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1626 | const inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1627 | extra_index += 1; | 1627 | extra_index += 1; |
| 1628 | break :inst inst; | 1628 | break :inst inst; |
| 1629 | }; | 1629 | }; |
| 1630 | const addrspace_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { | 1630 | const addrspace_inst: Zir.Inst.Ref = if (!has_section_or_addrspace) .none else inst: { |
| 1631 | const inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1631 | const inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1632 | extra_index += 1; | 1632 | extra_index += 1; |
| 1633 | break :inst inst; | 1633 | break :inst inst; |
| 1634 | }; | 1634 | }; |
| ... | @@ -1712,7 +1712,7 @@ const Writer = struct { | ... | @@ -1712,7 +1712,7 @@ const Writer = struct { |
| 1712 | } else null; | 1712 | } else null; |
| 1713 | 1713 | ||
| 1714 | const tag_type_ref = if (small.has_tag_type) blk: { | 1714 | const tag_type_ref = if (small.has_tag_type) blk: { |
| 1715 | const tag_type_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1715 | const tag_type_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1716 | extra_index += 1; | 1716 | extra_index += 1; |
| 1717 | break :blk tag_type_ref; | 1717 | break :blk tag_type_ref; |
| 1718 | } else .none; | 1718 | } else .none; |
| ... | @@ -1797,7 +1797,7 @@ const Writer = struct { | ... | @@ -1797,7 +1797,7 @@ const Writer = struct { |
| 1797 | try stream.print("{}", .{std.zig.fmtId(field_name)}); | 1797 | try stream.print("{}", .{std.zig.fmtId(field_name)}); |
| 1798 | 1798 | ||
| 1799 | if (has_tag_value) { | 1799 | if (has_tag_value) { |
| 1800 | const tag_value_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1800 | const tag_value_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1801 | extra_index += 1; | 1801 | extra_index += 1; |
| 1802 | 1802 | ||
| 1803 | try stream.writeAll(" = "); | 1803 | try stream.writeAll(" = "); |
| ... | @@ -1940,7 +1940,7 @@ const Writer = struct { | ... | @@ -1940,7 +1940,7 @@ const Writer = struct { |
| 1940 | const scalar_cases_len = extra.data.bits.scalar_cases_len; | 1940 | const scalar_cases_len = extra.data.bits.scalar_cases_len; |
| 1941 | var scalar_i: usize = 0; | 1941 | var scalar_i: usize = 0; |
| 1942 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { | 1942 | while (scalar_i < scalar_cases_len) : (scalar_i += 1) { |
| 1943 | const item_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1943 | const item_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1944 | extra_index += 1; | 1944 | extra_index += 1; |
| 1945 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, self.code.extra[extra_index]); | 1945 | const info = @bitCast(Zir.Inst.SwitchBlock.ProngInfo, self.code.extra[extra_index]); |
| 1946 | extra_index += 1; | 1946 | extra_index += 1; |
| ... | @@ -1988,9 +1988,9 @@ const Writer = struct { | ... | @@ -1988,9 +1988,9 @@ const Writer = struct { |
| 1988 | 1988 | ||
| 1989 | var range_i: usize = 0; | 1989 | var range_i: usize = 0; |
| 1990 | while (range_i < ranges_len) : (range_i += 1) { | 1990 | while (range_i < ranges_len) : (range_i += 1) { |
| 1991 | const item_first = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1991 | const item_first = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1992 | extra_index += 1; | 1992 | extra_index += 1; |
| 1993 | const item_last = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 1993 | const item_last = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 1994 | extra_index += 1; | 1994 | extra_index += 1; |
| 1995 | 1995 | ||
| 1996 | if (range_i != 0 or items.len != 0) { | 1996 | if (range_i != 0 or items.len != 0) { |
| ... | @@ -2091,7 +2091,7 @@ const Writer = struct { | ... | @@ -2091,7 +2091,7 @@ const Writer = struct { |
| 2091 | ret_ty_ref = .void_type; | 2091 | ret_ty_ref = .void_type; |
| 2092 | }, | 2092 | }, |
| 2093 | 1 => { | 2093 | 1 => { |
| 2094 | ret_ty_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2094 | ret_ty_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2095 | extra_index += 1; | 2095 | extra_index += 1; |
| 2096 | }, | 2096 | }, |
| 2097 | else => { | 2097 | else => { |
| ... | @@ -2162,7 +2162,7 @@ const Writer = struct { | ... | @@ -2162,7 +2162,7 @@ const Writer = struct { |
| 2162 | align_body = self.code.extra[extra_index..][0..body_len]; | 2162 | align_body = self.code.extra[extra_index..][0..body_len]; |
| 2163 | extra_index += align_body.len; | 2163 | extra_index += align_body.len; |
| 2164 | } else if (extra.data.bits.has_align_ref) { | 2164 | } else if (extra.data.bits.has_align_ref) { |
| 2165 | align_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2165 | align_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2166 | extra_index += 1; | 2166 | extra_index += 1; |
| 2167 | } | 2167 | } |
| 2168 | if (extra.data.bits.has_addrspace_body) { | 2168 | if (extra.data.bits.has_addrspace_body) { |
| ... | @@ -2171,7 +2171,7 @@ const Writer = struct { | ... | @@ -2171,7 +2171,7 @@ const Writer = struct { |
| 2171 | addrspace_body = self.code.extra[extra_index..][0..body_len]; | 2171 | addrspace_body = self.code.extra[extra_index..][0..body_len]; |
| 2172 | extra_index += addrspace_body.len; | 2172 | extra_index += addrspace_body.len; |
| 2173 | } else if (extra.data.bits.has_addrspace_ref) { | 2173 | } else if (extra.data.bits.has_addrspace_ref) { |
| 2174 | addrspace_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2174 | addrspace_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2175 | extra_index += 1; | 2175 | extra_index += 1; |
| 2176 | } | 2176 | } |
| 2177 | if (extra.data.bits.has_section_body) { | 2177 | if (extra.data.bits.has_section_body) { |
| ... | @@ -2180,7 +2180,7 @@ const Writer = struct { | ... | @@ -2180,7 +2180,7 @@ const Writer = struct { |
| 2180 | section_body = self.code.extra[extra_index..][0..body_len]; | 2180 | section_body = self.code.extra[extra_index..][0..body_len]; |
| 2181 | extra_index += section_body.len; | 2181 | extra_index += section_body.len; |
| 2182 | } else if (extra.data.bits.has_section_ref) { | 2182 | } else if (extra.data.bits.has_section_ref) { |
| 2183 | section_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2183 | section_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2184 | extra_index += 1; | 2184 | extra_index += 1; |
| 2185 | } | 2185 | } |
| 2186 | if (extra.data.bits.has_cc_body) { | 2186 | if (extra.data.bits.has_cc_body) { |
| ... | @@ -2189,7 +2189,7 @@ const Writer = struct { | ... | @@ -2189,7 +2189,7 @@ const Writer = struct { |
| 2189 | cc_body = self.code.extra[extra_index..][0..body_len]; | 2189 | cc_body = self.code.extra[extra_index..][0..body_len]; |
| 2190 | extra_index += cc_body.len; | 2190 | extra_index += cc_body.len; |
| 2191 | } else if (extra.data.bits.has_cc_ref) { | 2191 | } else if (extra.data.bits.has_cc_ref) { |
| 2192 | cc_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2192 | cc_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2193 | extra_index += 1; | 2193 | extra_index += 1; |
| 2194 | } | 2194 | } |
| 2195 | if (extra.data.bits.has_ret_ty_body) { | 2195 | if (extra.data.bits.has_ret_ty_body) { |
| ... | @@ -2198,7 +2198,7 @@ const Writer = struct { | ... | @@ -2198,7 +2198,7 @@ const Writer = struct { |
| 2198 | ret_ty_body = self.code.extra[extra_index..][0..body_len]; | 2198 | ret_ty_body = self.code.extra[extra_index..][0..body_len]; |
| 2199 | extra_index += ret_ty_body.len; | 2199 | extra_index += ret_ty_body.len; |
| 2200 | } else if (extra.data.bits.has_ret_ty_ref) { | 2200 | } else if (extra.data.bits.has_ret_ty_ref) { |
| 2201 | ret_ty_ref = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2201 | ret_ty_ref = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2202 | extra_index += 1; | 2202 | extra_index += 1; |
| 2203 | } | 2203 | } |
| 2204 | 2204 | ||
| ... | @@ -2251,12 +2251,12 @@ const Writer = struct { | ... | @@ -2251,12 +2251,12 @@ const Writer = struct { |
| 2251 | try stream.print(", lib_name=\"{}\"", .{std.zig.fmtEscapes(lib_name)}); | 2251 | try stream.print(", lib_name=\"{}\"", .{std.zig.fmtEscapes(lib_name)}); |
| 2252 | } | 2252 | } |
| 2253 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { | 2253 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { |
| 2254 | const align_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2254 | const align_inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2255 | extra_index += 1; | 2255 | extra_index += 1; |
| 2256 | break :blk align_inst; | 2256 | break :blk align_inst; |
| 2257 | }; | 2257 | }; |
| 2258 | const init_inst: Zir.Inst.Ref = if (!small.has_init) .none else blk: { | 2258 | const init_inst: Zir.Inst.Ref = if (!small.has_init) .none else blk: { |
| 2259 | const init_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2259 | const init_inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2260 | extra_index += 1; | 2260 | extra_index += 1; |
| 2261 | break :blk init_inst; | 2261 | break :blk init_inst; |
| 2262 | }; | 2262 | }; |
| ... | @@ -2274,12 +2274,12 @@ const Writer = struct { | ... | @@ -2274,12 +2274,12 @@ const Writer = struct { |
| 2274 | 2274 | ||
| 2275 | var extra_index: usize = extra.end; | 2275 | var extra_index: usize = extra.end; |
| 2276 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { | 2276 | const type_inst: Zir.Inst.Ref = if (!small.has_type) .none else blk: { |
| 2277 | const type_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2277 | const type_inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2278 | extra_index += 1; | 2278 | extra_index += 1; |
| 2279 | break :blk type_inst; | 2279 | break :blk type_inst; |
| 2280 | }; | 2280 | }; |
| 2281 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { | 2281 | const align_inst: Zir.Inst.Ref = if (!small.has_align) .none else blk: { |
| 2282 | const align_inst = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]); | 2282 | const align_inst = @enumFromInt(Zir.Inst.Ref, self.code.extra[extra_index]); |
| 2283 | extra_index += 1; | 2283 | extra_index += 1; |
| 2284 | break :blk align_inst; | 2284 | break :blk align_inst; |
| 2285 | }; | 2285 | }; |
| ... | @@ -2480,8 +2480,8 @@ const Writer = struct { | ... | @@ -2480,8 +2480,8 @@ const Writer = struct { |
| 2480 | } | 2480 | } |
| 2481 | 2481 | ||
| 2482 | fn writeInstRef(self: *Writer, stream: anytype, ref: Zir.Inst.Ref) !void { | 2482 | fn writeInstRef(self: *Writer, stream: anytype, ref: Zir.Inst.Ref) !void { |
| 2483 | const i = @enumToInt(ref); | 2483 | const i = @intFromEnum(ref); |
| 2484 | if (i < InternPool.static_len) return stream.print("@{}", .{@intToEnum(InternPool.Index, i)}); | 2484 | if (i < InternPool.static_len) return stream.print("@{}", .{@enumFromInt(InternPool.Index, i)}); |
| 2485 | return self.writeInstIndex(stream, i - InternPool.static_len); | 2485 | return self.writeInstIndex(stream, i - InternPool.static_len); |
| 2486 | } | 2486 | } |
| 2487 | 2487 |
src/register_manager.zig+6-6| ... | @@ -366,7 +366,7 @@ const MockRegister1 = enum(u2) { | ... | @@ -366,7 +366,7 @@ const MockRegister1 = enum(u2) { |
| 366 | r3, | 366 | r3, |
| 367 | 367 | ||
| 368 | pub fn id(reg: MockRegister1) u2 { | 368 | pub fn id(reg: MockRegister1) u2 { |
| 369 | return @enumToInt(reg); | 369 | return @intFromEnum(reg); |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | const allocatable_registers = [_]MockRegister1{ .r2, .r3 }; | 372 | const allocatable_registers = [_]MockRegister1{ .r2, .r3 }; |
| ... | @@ -394,7 +394,7 @@ const MockRegister2 = enum(u2) { | ... | @@ -394,7 +394,7 @@ const MockRegister2 = enum(u2) { |
| 394 | r3, | 394 | r3, |
| 395 | 395 | ||
| 396 | pub fn id(reg: MockRegister2) u2 { | 396 | pub fn id(reg: MockRegister2) u2 { |
| 397 | return @enumToInt(reg); | 397 | return @intFromEnum(reg); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | const allocatable_registers = [_]MockRegister2{ .r0, .r1, .r2, .r3 }; | 400 | const allocatable_registers = [_]MockRegister2{ .r0, .r1, .r2, .r3 }; |
| ... | @@ -426,14 +426,14 @@ const MockRegister3 = enum(u3) { | ... | @@ -426,14 +426,14 @@ const MockRegister3 = enum(u3) { |
| 426 | x3, | 426 | x3, |
| 427 | 427 | ||
| 428 | pub fn id(reg: MockRegister3) u3 { | 428 | pub fn id(reg: MockRegister3) u3 { |
| 429 | return switch (@enumToInt(reg)) { | 429 | return switch (@intFromEnum(reg)) { |
| 430 | 0...3 => @as(u3, @truncate(u2, @enumToInt(reg))), | 430 | 0...3 => @as(u3, @truncate(u2, @intFromEnum(reg))), |
| 431 | 4...7 => @enumToInt(reg), | 431 | 4...7 => @intFromEnum(reg), |
| 432 | }; | 432 | }; |
| 433 | } | 433 | } |
| 434 | 434 | ||
| 435 | pub fn enc(reg: MockRegister3) u2 { | 435 | pub fn enc(reg: MockRegister3) u2 { |
| 436 | return @truncate(u2, @enumToInt(reg)); | 436 | return @truncate(u2, @intFromEnum(reg)); |
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | const gp_regs = [_]MockRegister3{ .r0, .r1, .r2, .r3 }; | 439 | const gp_regs = [_]MockRegister3{ .r0, .r1, .r2, .r3 }; |
src/translate_c.zig+73-73| ... | @@ -110,7 +110,7 @@ const Scope = struct { | ... | @@ -110,7 +110,7 @@ const Scope = struct { |
| 110 | if (self.base.parent.?.id == .do_loop) { | 110 | if (self.base.parent.?.id == .do_loop) { |
| 111 | // We reserve 1 extra statement if the parent is a do_loop. This is in case of | 111 | // We reserve 1 extra statement if the parent is a do_loop. This is in case of |
| 112 | // do while, we want to put `if (cond) break;` at the end. | 112 | // do while, we want to put `if (cond) break;` at the end. |
| 113 | const alloc_len = self.statements.items.len + @boolToInt(self.base.parent.?.id == .do_loop); | 113 | const alloc_len = self.statements.items.len + @intFromBool(self.base.parent.?.id == .do_loop); |
| 114 | var stmts = try c.arena.alloc(Node, alloc_len); | 114 | var stmts = try c.arena.alloc(Node, alloc_len); |
| 115 | stmts.len = self.statements.items.len; | 115 | stmts.len = self.statements.items.len; |
| 116 | @memcpy(stmts[0..self.statements.items.len], self.statements.items); | 116 | @memcpy(stmts[0..self.statements.items.len], self.statements.items); |
| ... | @@ -507,14 +507,14 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { | ... | @@ -507,14 +507,14 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { |
| 507 | const enum_decl = enum_ty.getDecl(); | 507 | const enum_decl = enum_ty.getDecl(); |
| 508 | // check if this decl is unnamed | 508 | // check if this decl is unnamed |
| 509 | if (@ptrCast(*const clang.NamedDecl, enum_decl).getName_bytes_begin()[0] != 0) return; | 509 | if (@ptrCast(*const clang.NamedDecl, enum_decl).getName_bytes_begin()[0] != 0) return; |
| 510 | break @ptrToInt(enum_decl.getCanonicalDecl()); | 510 | break @intFromPtr(enum_decl.getCanonicalDecl()); |
| 511 | }, | 511 | }, |
| 512 | .Record => { | 512 | .Record => { |
| 513 | const record_ty = @ptrCast(*const clang.RecordType, child_ty); | 513 | const record_ty = @ptrCast(*const clang.RecordType, child_ty); |
| 514 | const record_decl = record_ty.getDecl(); | 514 | const record_decl = record_ty.getDecl(); |
| 515 | // check if this decl is unnamed | 515 | // check if this decl is unnamed |
| 516 | if (@ptrCast(*const clang.NamedDecl, record_decl).getName_bytes_begin()[0] != 0) return; | 516 | if (@ptrCast(*const clang.NamedDecl, record_decl).getName_bytes_begin()[0] != 0) return; |
| 517 | break @ptrToInt(record_decl.getCanonicalDecl()); | 517 | break @intFromPtr(record_decl.getCanonicalDecl()); |
| 518 | }, | 518 | }, |
| 519 | .Elaborated => { | 519 | .Elaborated => { |
| 520 | const elaborated_ty = @ptrCast(*const clang.ElaboratedType, child_ty); | 520 | const elaborated_ty = @ptrCast(*const clang.ElaboratedType, child_ty); |
| ... | @@ -543,7 +543,7 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { | ... | @@ -543,7 +543,7 @@ fn declVisitorNamesOnly(c: *Context, decl: *const clang.Decl) Error!void { |
| 543 | } | 543 | } |
| 544 | result.value_ptr.* = decl_name; | 544 | result.value_ptr.* = decl_name; |
| 545 | // Put this typedef in the decl_table to avoid redefinitions. | 545 | // Put this typedef in the decl_table to avoid redefinitions. |
| 546 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(typedef_decl.getCanonicalDecl()), decl_name); | 546 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(typedef_decl.getCanonicalDecl()), decl_name); |
| 547 | try c.typedefs.put(c.gpa, decl_name, {}); | 547 | try c.typedefs.put(c.gpa, decl_name, {}); |
| 548 | } | 548 | } |
| 549 | } | 549 | } |
| ... | @@ -913,7 +913,7 @@ const builtin_typedef_map = std.ComptimeStringMap([]const u8, .{ | ... | @@ -913,7 +913,7 @@ const builtin_typedef_map = std.ComptimeStringMap([]const u8, .{ |
| 913 | }); | 913 | }); |
| 914 | 914 | ||
| 915 | fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNameDecl) Error!void { | 915 | fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNameDecl) Error!void { |
| 916 | if (c.decl_table.get(@ptrToInt(typedef_decl.getCanonicalDecl()))) |_| | 916 | if (c.decl_table.get(@intFromPtr(typedef_decl.getCanonicalDecl()))) |_| |
| 917 | return; // Avoid processing this decl twice | 917 | return; // Avoid processing this decl twice |
| 918 | const toplevel = scope.id == .root; | 918 | const toplevel = scope.id == .root; |
| 919 | const bs: *Scope.Block = if (!toplevel) try scope.findBlockScope(c) else undefined; | 919 | const bs: *Scope.Block = if (!toplevel) try scope.findBlockScope(c) else undefined; |
| ... | @@ -922,10 +922,10 @@ fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNa | ... | @@ -922,10 +922,10 @@ fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNa |
| 922 | try c.typedefs.put(c.gpa, name, {}); | 922 | try c.typedefs.put(c.gpa, name, {}); |
| 923 | 923 | ||
| 924 | if (builtin_typedef_map.get(name)) |builtin| { | 924 | if (builtin_typedef_map.get(name)) |builtin| { |
| 925 | return c.decl_table.putNoClobber(c.gpa, @ptrToInt(typedef_decl.getCanonicalDecl()), builtin); | 925 | return c.decl_table.putNoClobber(c.gpa, @intFromPtr(typedef_decl.getCanonicalDecl()), builtin); |
| 926 | } | 926 | } |
| 927 | if (!toplevel) name = try bs.makeMangledName(c, name); | 927 | if (!toplevel) name = try bs.makeMangledName(c, name); |
| 928 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(typedef_decl.getCanonicalDecl()), name); | 928 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(typedef_decl.getCanonicalDecl()), name); |
| 929 | 929 | ||
| 930 | const child_qt = typedef_decl.getUnderlyingType(); | 930 | const child_qt = typedef_decl.getUnderlyingType(); |
| 931 | const typedef_loc = typedef_decl.getLocation(); | 931 | const typedef_loc = typedef_decl.getLocation(); |
| ... | @@ -938,7 +938,7 @@ fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNa | ... | @@ -938,7 +938,7 @@ fn transTypeDef(c: *Context, scope: *Scope, typedef_decl: *const clang.TypedefNa |
| 938 | 938 | ||
| 939 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); | 939 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); |
| 940 | payload.* = .{ | 940 | payload.* = .{ |
| 941 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@boolToInt(toplevel)] }, | 941 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@intFromBool(toplevel)] }, |
| 942 | .data = .{ | 942 | .data = .{ |
| 943 | .name = name, | 943 | .name = name, |
| 944 | .init = init_node, | 944 | .init = init_node, |
| ... | @@ -1063,7 +1063,7 @@ fn hasFlexibleArrayField(c: *Context, record_def: *const clang.RecordDecl) bool | ... | @@ -1063,7 +1063,7 @@ fn hasFlexibleArrayField(c: *Context, record_def: *const clang.RecordDecl) bool |
| 1063 | } | 1063 | } |
| 1064 | 1064 | ||
| 1065 | fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordDecl) Error!void { | 1065 | fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordDecl) Error!void { |
| 1066 | if (c.decl_table.get(@ptrToInt(record_decl.getCanonicalDecl()))) |_| | 1066 | if (c.decl_table.get(@intFromPtr(record_decl.getCanonicalDecl()))) |_| |
| 1067 | return; // Avoid processing this decl twice | 1067 | return; // Avoid processing this decl twice |
| 1068 | const record_loc = record_decl.getLocation(); | 1068 | const record_loc = record_decl.getLocation(); |
| 1069 | const toplevel = scope.id == .root; | 1069 | const toplevel = scope.id == .root; |
| ... | @@ -1079,13 +1079,13 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1079,13 +1079,13 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1079 | } else if (record_decl.isStruct()) { | 1079 | } else if (record_decl.isStruct()) { |
| 1080 | container_kind_name = "struct"; | 1080 | container_kind_name = "struct"; |
| 1081 | } else { | 1081 | } else { |
| 1082 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), bare_name); | 1082 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), bare_name); |
| 1083 | return failDecl(c, record_loc, bare_name, "record {s} is not a struct or union", .{bare_name}); | 1083 | return failDecl(c, record_loc, bare_name, "record {s} is not a struct or union", .{bare_name}); |
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | var is_unnamed = false; | 1086 | var is_unnamed = false; |
| 1087 | var name = bare_name; | 1087 | var name = bare_name; |
| 1088 | if (c.unnamed_typedefs.get(@ptrToInt(record_decl.getCanonicalDecl()))) |typedef_name| { | 1088 | if (c.unnamed_typedefs.get(@intFromPtr(record_decl.getCanonicalDecl()))) |typedef_name| { |
| 1089 | bare_name = typedef_name; | 1089 | bare_name = typedef_name; |
| 1090 | name = typedef_name; | 1090 | name = typedef_name; |
| 1091 | } else { | 1091 | } else { |
| ... | @@ -1098,12 +1098,12 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1098,12 +1098,12 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1098 | name = try std.fmt.allocPrint(c.arena, "{s}_{s}", .{ container_kind_name, bare_name }); | 1098 | name = try std.fmt.allocPrint(c.arena, "{s}_{s}", .{ container_kind_name, bare_name }); |
| 1099 | } | 1099 | } |
| 1100 | if (!toplevel) name = try bs.makeMangledName(c, name); | 1100 | if (!toplevel) name = try bs.makeMangledName(c, name); |
| 1101 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), name); | 1101 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), name); |
| 1102 | 1102 | ||
| 1103 | const is_pub = toplevel and !is_unnamed; | 1103 | const is_pub = toplevel and !is_unnamed; |
| 1104 | const init_node = blk: { | 1104 | const init_node = blk: { |
| 1105 | const record_def = record_decl.getDefinition() orelse { | 1105 | const record_def = record_decl.getDefinition() orelse { |
| 1106 | try c.opaque_demotes.put(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), {}); | 1106 | try c.opaque_demotes.put(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), {}); |
| 1107 | break :blk Tag.opaque_literal.init(); | 1107 | break :blk Tag.opaque_literal.init(); |
| 1108 | }; | 1108 | }; |
| 1109 | 1109 | ||
| ... | @@ -1126,7 +1126,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1126,7 +1126,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1126 | const field_qt = field_decl.getType(); | 1126 | const field_qt = field_decl.getType(); |
| 1127 | 1127 | ||
| 1128 | if (field_decl.isBitField()) { | 1128 | if (field_decl.isBitField()) { |
| 1129 | try c.opaque_demotes.put(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), {}); | 1129 | try c.opaque_demotes.put(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), {}); |
| 1130 | try warn(c, scope, field_loc, "{s} demoted to opaque type - has bitfield", .{container_kind_name}); | 1130 | try warn(c, scope, field_loc, "{s} demoted to opaque type - has bitfield", .{container_kind_name}); |
| 1131 | break :blk Tag.opaque_literal.init(); | 1131 | break :blk Tag.opaque_literal.init(); |
| 1132 | } | 1132 | } |
| ... | @@ -1142,7 +1142,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1142,7 +1142,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1142 | if (isFlexibleArrayFieldDecl(c, field_decl)) { | 1142 | if (isFlexibleArrayFieldDecl(c, field_decl)) { |
| 1143 | const flexible_array_fn = buildFlexibleArrayFn(c, scope, layout, field_name, field_decl) catch |err| switch (err) { | 1143 | const flexible_array_fn = buildFlexibleArrayFn(c, scope, layout, field_name, field_decl) catch |err| switch (err) { |
| 1144 | error.UnsupportedType => { | 1144 | error.UnsupportedType => { |
| 1145 | try c.opaque_demotes.put(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), {}); | 1145 | try c.opaque_demotes.put(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), {}); |
| 1146 | try warn(c, scope, record_loc, "{s} demoted to opaque type - unable to translate type of flexible array field {s}", .{ container_kind_name, field_name }); | 1146 | try warn(c, scope, record_loc, "{s} demoted to opaque type - unable to translate type of flexible array field {s}", .{ container_kind_name, field_name }); |
| 1147 | break :blk Tag.opaque_literal.init(); | 1147 | break :blk Tag.opaque_literal.init(); |
| 1148 | }, | 1148 | }, |
| ... | @@ -1153,7 +1153,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1153,7 +1153,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1153 | } | 1153 | } |
| 1154 | const field_type = transQualType(c, scope, field_qt, field_loc) catch |err| switch (err) { | 1154 | const field_type = transQualType(c, scope, field_qt, field_loc) catch |err| switch (err) { |
| 1155 | error.UnsupportedType => { | 1155 | error.UnsupportedType => { |
| 1156 | try c.opaque_demotes.put(c.gpa, @ptrToInt(record_decl.getCanonicalDecl()), {}); | 1156 | try c.opaque_demotes.put(c.gpa, @intFromPtr(record_decl.getCanonicalDecl()), {}); |
| 1157 | try warn(c, scope, record_loc, "{s} demoted to opaque type - unable to translate type of field {s}", .{ container_kind_name, field_name }); | 1157 | try warn(c, scope, record_loc, "{s} demoted to opaque type - unable to translate type of field {s}", .{ container_kind_name, field_name }); |
| 1158 | break :blk Tag.opaque_literal.init(); | 1158 | break :blk Tag.opaque_literal.init(); |
| 1159 | }, | 1159 | }, |
| ... | @@ -1166,7 +1166,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1166,7 +1166,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1166 | ClangAlignment.forField(c, field_decl, record_def).zigAlignment(); | 1166 | ClangAlignment.forField(c, field_decl, record_def).zigAlignment(); |
| 1167 | 1167 | ||
| 1168 | if (is_anon) { | 1168 | if (is_anon) { |
| 1169 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(field_decl.getCanonicalDecl()), field_name); | 1169 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(field_decl.getCanonicalDecl()), field_name); |
| 1170 | } | 1170 | } |
| 1171 | 1171 | ||
| 1172 | try fields.append(.{ | 1172 | try fields.append(.{ |
| ... | @@ -1178,7 +1178,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1178,7 +1178,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1178 | 1178 | ||
| 1179 | const record_payload = try c.arena.create(ast.Payload.Record); | 1179 | const record_payload = try c.arena.create(ast.Payload.Record); |
| 1180 | record_payload.* = .{ | 1180 | record_payload.* = .{ |
| 1181 | .base = .{ .tag = ([2]Tag{ .@"struct", .@"union" })[@boolToInt(is_union)] }, | 1181 | .base = .{ .tag = ([2]Tag{ .@"struct", .@"union" })[@intFromBool(is_union)] }, |
| 1182 | .data = .{ | 1182 | .data = .{ |
| 1183 | .layout = .@"extern", | 1183 | .layout = .@"extern", |
| 1184 | .fields = try c.arena.dupe(ast.Payload.Record.Field, fields.items), | 1184 | .fields = try c.arena.dupe(ast.Payload.Record.Field, fields.items), |
| ... | @@ -1191,7 +1191,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1191,7 +1191,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1191 | 1191 | ||
| 1192 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); | 1192 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); |
| 1193 | payload.* = .{ | 1193 | payload.* = .{ |
| 1194 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@boolToInt(is_pub)] }, | 1194 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@intFromBool(is_pub)] }, |
| 1195 | .data = .{ | 1195 | .data = .{ |
| 1196 | .name = name, | 1196 | .name = name, |
| 1197 | .init = init_node, | 1197 | .init = init_node, |
| ... | @@ -1211,7 +1211,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD | ... | @@ -1211,7 +1211,7 @@ fn transRecordDecl(c: *Context, scope: *Scope, record_decl: *const clang.RecordD |
| 1211 | } | 1211 | } |
| 1212 | 1212 | ||
| 1213 | fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) Error!void { | 1213 | fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) Error!void { |
| 1214 | if (c.decl_table.get(@ptrToInt(enum_decl.getCanonicalDecl()))) |_| | 1214 | if (c.decl_table.get(@intFromPtr(enum_decl.getCanonicalDecl()))) |_| |
| 1215 | return; // Avoid processing this decl twice | 1215 | return; // Avoid processing this decl twice |
| 1216 | const enum_loc = enum_decl.getLocation(); | 1216 | const enum_loc = enum_decl.getLocation(); |
| 1217 | const toplevel = scope.id == .root; | 1217 | const toplevel = scope.id == .root; |
| ... | @@ -1220,7 +1220,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E | ... | @@ -1220,7 +1220,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E |
| 1220 | var is_unnamed = false; | 1220 | var is_unnamed = false; |
| 1221 | var bare_name: []const u8 = try c.str(@ptrCast(*const clang.NamedDecl, enum_decl).getName_bytes_begin()); | 1221 | var bare_name: []const u8 = try c.str(@ptrCast(*const clang.NamedDecl, enum_decl).getName_bytes_begin()); |
| 1222 | var name = bare_name; | 1222 | var name = bare_name; |
| 1223 | if (c.unnamed_typedefs.get(@ptrToInt(enum_decl.getCanonicalDecl()))) |typedef_name| { | 1223 | if (c.unnamed_typedefs.get(@intFromPtr(enum_decl.getCanonicalDecl()))) |typedef_name| { |
| 1224 | bare_name = typedef_name; | 1224 | bare_name = typedef_name; |
| 1225 | name = typedef_name; | 1225 | name = typedef_name; |
| 1226 | } else { | 1226 | } else { |
| ... | @@ -1231,7 +1231,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E | ... | @@ -1231,7 +1231,7 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E |
| 1231 | name = try std.fmt.allocPrint(c.arena, "enum_{s}", .{bare_name}); | 1231 | name = try std.fmt.allocPrint(c.arena, "enum_{s}", .{bare_name}); |
| 1232 | } | 1232 | } |
| 1233 | if (!toplevel) name = try bs.makeMangledName(c, name); | 1233 | if (!toplevel) name = try bs.makeMangledName(c, name); |
| 1234 | try c.decl_table.putNoClobber(c.gpa, @ptrToInt(enum_decl.getCanonicalDecl()), name); | 1234 | try c.decl_table.putNoClobber(c.gpa, @intFromPtr(enum_decl.getCanonicalDecl()), name); |
| 1235 | 1235 | ||
| 1236 | const enum_type_node = if (enum_decl.getDefinition()) |enum_def| blk: { | 1236 | const enum_type_node = if (enum_decl.getDefinition()) |enum_def| blk: { |
| 1237 | var it = enum_def.enumerator_begin(); | 1237 | var it = enum_def.enumerator_begin(); |
| ... | @@ -1280,14 +1280,14 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E | ... | @@ -1280,14 +1280,14 @@ fn transEnumDecl(c: *Context, scope: *Scope, enum_decl: *const clang.EnumDecl) E |
| 1280 | else | 1280 | else |
| 1281 | try Tag.type.create(c.arena, "c_int"); | 1281 | try Tag.type.create(c.arena, "c_int"); |
| 1282 | } else blk: { | 1282 | } else blk: { |
| 1283 | try c.opaque_demotes.put(c.gpa, @ptrToInt(enum_decl.getCanonicalDecl()), {}); | 1283 | try c.opaque_demotes.put(c.gpa, @intFromPtr(enum_decl.getCanonicalDecl()), {}); |
| 1284 | break :blk Tag.opaque_literal.init(); | 1284 | break :blk Tag.opaque_literal.init(); |
| 1285 | }; | 1285 | }; |
| 1286 | 1286 | ||
| 1287 | const is_pub = toplevel and !is_unnamed; | 1287 | const is_pub = toplevel and !is_unnamed; |
| 1288 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); | 1288 | const payload = try c.arena.create(ast.Payload.SimpleVarDecl); |
| 1289 | payload.* = .{ | 1289 | payload.* = .{ |
| 1290 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@boolToInt(is_pub)] }, | 1290 | .base = .{ .tag = ([2]Tag{ .var_simple, .pub_var_simple })[@intFromBool(is_pub)] }, |
| 1291 | .data = .{ | 1291 | .data = .{ |
| 1292 | .init = enum_type_node, | 1292 | .init = enum_type_node, |
| 1293 | .name = name, | 1293 | .name = name, |
| ... | @@ -1536,7 +1536,7 @@ fn transSimpleOffsetOfExpr(c: *Context, expr: *const clang.OffsetOfExpr) TransEr | ... | @@ -1536,7 +1536,7 @@ fn transSimpleOffsetOfExpr(c: *Context, expr: *const clang.OffsetOfExpr) TransEr |
| 1536 | if (component.getKind() == .Field) { | 1536 | if (component.getKind() == .Field) { |
| 1537 | const field_decl = component.getField(); | 1537 | const field_decl = component.getField(); |
| 1538 | if (field_decl.getParent()) |record_decl| { | 1538 | if (field_decl.getParent()) |record_decl| { |
| 1539 | if (c.decl_table.get(@ptrToInt(record_decl.getCanonicalDecl()))) |type_name| { | 1539 | if (c.decl_table.get(@intFromPtr(record_decl.getCanonicalDecl()))) |type_name| { |
| 1540 | const type_node = try Tag.type.create(c.arena, type_name); | 1540 | const type_node = try Tag.type.create(c.arena, type_name); |
| 1541 | 1541 | ||
| 1542 | var raw_field_name = try c.str(@ptrCast(*const clang.NamedDecl, field_decl).getName_bytes_begin()); | 1542 | var raw_field_name = try c.str(@ptrCast(*const clang.NamedDecl, field_decl).getName_bytes_begin()); |
| ... | @@ -1768,7 +1768,7 @@ fn transBinaryOperator( | ... | @@ -1768,7 +1768,7 @@ fn transBinaryOperator( |
| 1768 | 1768 | ||
| 1769 | const infixOpNode = try transCreateNodeInfixOp(c, op_id, lhs, rhs, result_used); | 1769 | const infixOpNode = try transCreateNodeInfixOp(c, op_id, lhs, rhs, result_used); |
| 1770 | if (isPointerDiffExpr) { | 1770 | if (isPointerDiffExpr) { |
| 1771 | // @divExact(@bitCast(<platform-ptrdiff_t>, @ptrToInt(lhs) -% @ptrToInt(rhs)), @sizeOf(<lhs target type>)) | 1771 | // @divExact(@bitCast(<platform-ptrdiff_t>, @intFromPtr(lhs) -% @intFromPtr(rhs)), @sizeOf(<lhs target type>)) |
| 1772 | const ptrdiff_type = try transQualTypeIntWidthOf(c, qt, true); | 1772 | const ptrdiff_type = try transQualTypeIntWidthOf(c, qt, true); |
| 1773 | 1773 | ||
| 1774 | // C standard requires that pointer subtraction operands are of the same type, | 1774 | // C standard requires that pointer subtraction operands are of the same type, |
| ... | @@ -2138,7 +2138,7 @@ fn transBoolExpr( | ... | @@ -2138,7 +2138,7 @@ fn transBoolExpr( |
| 2138 | return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "invalid integer literal", .{}); | 2138 | return fail(c, error.UnsupportedTranslation, expr.getBeginLoc(), "invalid integer literal", .{}); |
| 2139 | } | 2139 | } |
| 2140 | const is_zero = signum == 0; | 2140 | const is_zero = signum == 0; |
| 2141 | return Node{ .tag_if_small_enough = @enumToInt(([2]Tag{ .true_literal, .false_literal })[@boolToInt(is_zero)]) }; | 2141 | return Node{ .tag_if_small_enough = @intFromEnum(([2]Tag{ .true_literal, .false_literal })[@intFromBool(is_zero)]) }; |
| 2142 | } | 2142 | } |
| 2143 | 2143 | ||
| 2144 | var res = try transExpr(c, scope, expr, used); | 2144 | var res = try transExpr(c, scope, expr, used); |
| ... | @@ -2599,7 +2599,7 @@ fn literalFitsInType(c: *Context, expr: *const clang.Expr, qt: clang.QualType) b | ... | @@ -2599,7 +2599,7 @@ fn literalFitsInType(c: *Context, expr: *const clang.Expr, qt: clang.QualType) b |
| 2599 | var width = qualTypeIntBitWidth(c, qt) catch 8; | 2599 | var width = qualTypeIntBitWidth(c, qt) catch 8; |
| 2600 | if (width == 0) width = 8; // Byte is the smallest type. | 2600 | if (width == 0) width = 8; // Byte is the smallest type. |
| 2601 | const is_signed = cIsSignedInteger(qt); | 2601 | const is_signed = cIsSignedInteger(qt); |
| 2602 | const width_max_int = (@as(u64, 1) << math.lossyCast(u6, width - @boolToInt(is_signed))) - 1; | 2602 | const width_max_int = (@as(u64, 1) << math.lossyCast(u6, width - @intFromBool(is_signed))) - 1; |
| 2603 | 2603 | ||
| 2604 | switch (@ptrCast(*const clang.Stmt, expr).getStmtClass()) { | 2604 | switch (@ptrCast(*const clang.Stmt, expr).getStmtClass()) { |
| 2605 | .CharacterLiteralClass => { | 2605 | .CharacterLiteralClass => { |
| ... | @@ -2664,7 +2664,7 @@ fn transInitListExprRecord( | ... | @@ -2664,7 +2664,7 @@ fn transInitListExprRecord( |
| 2664 | // .field_name = expr | 2664 | // .field_name = expr |
| 2665 | var raw_name = try c.str(@ptrCast(*const clang.NamedDecl, field_decl).getName_bytes_begin()); | 2665 | var raw_name = try c.str(@ptrCast(*const clang.NamedDecl, field_decl).getName_bytes_begin()); |
| 2666 | if (field_decl.isAnonymousStructOrUnion()) { | 2666 | if (field_decl.isAnonymousStructOrUnion()) { |
| 2667 | const name = c.decl_table.get(@ptrToInt(field_decl.getCanonicalDecl())).?; | 2667 | const name = c.decl_table.get(@intFromPtr(field_decl.getCanonicalDecl())).?; |
| 2668 | raw_name = try c.arena.dupe(u8, name); | 2668 | raw_name = try c.arena.dupe(u8, name); |
| 2669 | } | 2669 | } |
| 2670 | 2670 | ||
| ... | @@ -3442,7 +3442,7 @@ fn transMemberExpr(c: *Context, scope: *Scope, stmt: *const clang.MemberExpr, re | ... | @@ -3442,7 +3442,7 @@ fn transMemberExpr(c: *Context, scope: *Scope, stmt: *const clang.MemberExpr, re |
| 3442 | if (decl_kind == .Field) { | 3442 | if (decl_kind == .Field) { |
| 3443 | const field_decl = @ptrCast(*const clang.FieldDecl, member_decl); | 3443 | const field_decl = @ptrCast(*const clang.FieldDecl, member_decl); |
| 3444 | if (field_decl.isAnonymousStructOrUnion()) { | 3444 | if (field_decl.isAnonymousStructOrUnion()) { |
| 3445 | const name = c.decl_table.get(@ptrToInt(field_decl.getCanonicalDecl())).?; | 3445 | const name = c.decl_table.get(@intFromPtr(field_decl.getCanonicalDecl())).?; |
| 3446 | break :blk try c.arena.dupe(u8, name); | 3446 | break :blk try c.arena.dupe(u8, name); |
| 3447 | } | 3447 | } |
| 3448 | } | 3448 | } |
| ... | @@ -4026,7 +4026,7 @@ fn transCreateCompoundAssign( | ... | @@ -4026,7 +4026,7 @@ fn transCreateCompoundAssign( |
| 4026 | return block_scope.complete(c); | 4026 | return block_scope.complete(c); |
| 4027 | } | 4027 | } |
| 4028 | 4028 | ||
| 4029 | // Casting away const or volatile requires us to use @intToPtr | 4029 | // Casting away const or volatile requires us to use @ptrFromInt |
| 4030 | fn removeCVQualifiers(c: *Context, dst_type_node: Node, expr: Node) Error!Node { | 4030 | fn removeCVQualifiers(c: *Context, dst_type_node: Node, expr: Node) Error!Node { |
| 4031 | const int_from_ptr = try Tag.int_from_ptr.create(c.arena, expr); | 4031 | const int_from_ptr = try Tag.int_from_ptr.create(c.arena, expr); |
| 4032 | return Tag.ptr_from_int.create(c.arena, .{ .lhs = dst_type_node, .rhs = int_from_ptr }); | 4032 | return Tag.ptr_from_int.create(c.arena, .{ .lhs = dst_type_node, .rhs = int_from_ptr }); |
| ... | @@ -4835,7 +4835,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan | ... | @@ -4835,7 +4835,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan |
| 4835 | if (builtin_typedef_map.get(decl_name)) |builtin| return Tag.type.create(c.arena, builtin); | 4835 | if (builtin_typedef_map.get(decl_name)) |builtin| return Tag.type.create(c.arena, builtin); |
| 4836 | } | 4836 | } |
| 4837 | try transTypeDef(c, trans_scope, typedef_decl); | 4837 | try transTypeDef(c, trans_scope, typedef_decl); |
| 4838 | const name = c.decl_table.get(@ptrToInt(typedef_decl.getCanonicalDecl())).?; | 4838 | const name = c.decl_table.get(@intFromPtr(typedef_decl.getCanonicalDecl())).?; |
| 4839 | return Tag.identifier.create(c.arena, name); | 4839 | return Tag.identifier.create(c.arena, name); |
| 4840 | }, | 4840 | }, |
| 4841 | .Record => { | 4841 | .Record => { |
| ... | @@ -4848,7 +4848,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan | ... | @@ -4848,7 +4848,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan |
| 4848 | if (c.global_names.get(decl_name)) |_| trans_scope = &c.global_scope.base; | 4848 | if (c.global_names.get(decl_name)) |_| trans_scope = &c.global_scope.base; |
| 4849 | } | 4849 | } |
| 4850 | try transRecordDecl(c, trans_scope, record_decl); | 4850 | try transRecordDecl(c, trans_scope, record_decl); |
| 4851 | const name = c.decl_table.get(@ptrToInt(record_decl.getCanonicalDecl())).?; | 4851 | const name = c.decl_table.get(@intFromPtr(record_decl.getCanonicalDecl())).?; |
| 4852 | return Tag.identifier.create(c.arena, name); | 4852 | return Tag.identifier.create(c.arena, name); |
| 4853 | }, | 4853 | }, |
| 4854 | .Enum => { | 4854 | .Enum => { |
| ... | @@ -4861,7 +4861,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan | ... | @@ -4861,7 +4861,7 @@ fn transType(c: *Context, scope: *Scope, ty: *const clang.Type, source_loc: clan |
| 4861 | if (c.global_names.get(decl_name)) |_| trans_scope = &c.global_scope.base; | 4861 | if (c.global_names.get(decl_name)) |_| trans_scope = &c.global_scope.base; |
| 4862 | } | 4862 | } |
| 4863 | try transEnumDecl(c, trans_scope, enum_decl); | 4863 | try transEnumDecl(c, trans_scope, enum_decl); |
| 4864 | const name = c.decl_table.get(@ptrToInt(enum_decl.getCanonicalDecl())).?; | 4864 | const name = c.decl_table.get(@intFromPtr(enum_decl.getCanonicalDecl())).?; |
| 4865 | return Tag.identifier.create(c.arena, name); | 4865 | return Tag.identifier.create(c.arena, name); |
| 4866 | }, | 4866 | }, |
| 4867 | .Elaborated => { | 4867 | .Elaborated => { |
| ... | @@ -4928,7 +4928,7 @@ fn qualTypeWasDemotedToOpaque(c: *Context, qt: clang.QualType) bool { | ... | @@ -4928,7 +4928,7 @@ fn qualTypeWasDemotedToOpaque(c: *Context, qt: clang.QualType) bool { |
| 4928 | const record_ty = @ptrCast(*const clang.RecordType, ty); | 4928 | const record_ty = @ptrCast(*const clang.RecordType, ty); |
| 4929 | 4929 | ||
| 4930 | const record_decl = record_ty.getDecl(); | 4930 | const record_decl = record_ty.getDecl(); |
| 4931 | const canonical = @ptrToInt(record_decl.getCanonicalDecl()); | 4931 | const canonical = @intFromPtr(record_decl.getCanonicalDecl()); |
| 4932 | if (c.opaque_demotes.contains(canonical)) return true; | 4932 | if (c.opaque_demotes.contains(canonical)) return true; |
| 4933 | 4933 | ||
| 4934 | // check all childern for opaque types. | 4934 | // check all childern for opaque types. |
| ... | @@ -4944,7 +4944,7 @@ fn qualTypeWasDemotedToOpaque(c: *Context, qt: clang.QualType) bool { | ... | @@ -4944,7 +4944,7 @@ fn qualTypeWasDemotedToOpaque(c: *Context, qt: clang.QualType) bool { |
| 4944 | const enum_ty = @ptrCast(*const clang.EnumType, ty); | 4944 | const enum_ty = @ptrCast(*const clang.EnumType, ty); |
| 4945 | 4945 | ||
| 4946 | const enum_decl = enum_ty.getDecl(); | 4946 | const enum_decl = enum_ty.getDecl(); |
| 4947 | const canonical = @ptrToInt(enum_decl.getCanonicalDecl()); | 4947 | const canonical = @intFromPtr(enum_decl.getCanonicalDecl()); |
| 4948 | return c.opaque_demotes.contains(canonical); | 4948 | return c.opaque_demotes.contains(canonical); |
| 4949 | }, | 4949 | }, |
| 4950 | .Elaborated => { | 4950 | .Elaborated => { |
| ... | @@ -5533,7 +5533,7 @@ fn getMacroText(unit: *const clang.ASTUnit, c: *const Context, macro: *const cla | ... | @@ -5533,7 +5533,7 @@ fn getMacroText(unit: *const clang.ASTUnit, c: *const Context, macro: *const cla |
| 5533 | 5533 | ||
| 5534 | const begin_c = c.source_manager.getCharacterData(begin_loc); | 5534 | const begin_c = c.source_manager.getCharacterData(begin_loc); |
| 5535 | const end_c = c.source_manager.getCharacterData(end_loc); | 5535 | const end_c = c.source_manager.getCharacterData(end_loc); |
| 5536 | const slice_len = @ptrToInt(end_c) - @ptrToInt(begin_c); | 5536 | const slice_len = @intFromPtr(end_c) - @intFromPtr(begin_c); |
| 5537 | return begin_c[0..slice_len]; | 5537 | return begin_c[0..slice_len]; |
| 5538 | } | 5538 | } |
| 5539 | 5539 | ||
| ... | @@ -6087,7 +6087,7 @@ fn parseCPrimaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6087,7 +6087,7 @@ fn parseCPrimaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6087 | return node; | 6087 | return node; |
| 6088 | } | 6088 | } |
| 6089 | 6089 | ||
| 6090 | fn macroBoolToInt(c: *Context, node: Node) !Node { | 6090 | fn macroIntFromBool(c: *Context, node: Node) !Node { |
| 6091 | if (!isBoolRes(node)) { | 6091 | if (!isBoolRes(node)) { |
| 6092 | return node; | 6092 | return node; |
| 6093 | } | 6093 | } |
| ... | @@ -6141,8 +6141,8 @@ fn parseCAndExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6141,8 +6141,8 @@ fn parseCAndExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6141 | fn parseCBitOrExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | 6141 | fn parseCBitOrExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6142 | var node = try parseCBitXorExpr(c, m, scope); | 6142 | var node = try parseCBitXorExpr(c, m, scope); |
| 6143 | while (m.next().? == .Pipe) { | 6143 | while (m.next().? == .Pipe) { |
| 6144 | const lhs = try macroBoolToInt(c, node); | 6144 | const lhs = try macroIntFromBool(c, node); |
| 6145 | const rhs = try macroBoolToInt(c, try parseCBitXorExpr(c, m, scope)); | 6145 | const rhs = try macroIntFromBool(c, try parseCBitXorExpr(c, m, scope)); |
| 6146 | node = try Tag.bit_or.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6146 | node = try Tag.bit_or.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6147 | } | 6147 | } |
| 6148 | m.i -= 1; | 6148 | m.i -= 1; |
| ... | @@ -6152,8 +6152,8 @@ fn parseCBitOrExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6152,8 +6152,8 @@ fn parseCBitOrExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6152 | fn parseCBitXorExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | 6152 | fn parseCBitXorExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6153 | var node = try parseCBitAndExpr(c, m, scope); | 6153 | var node = try parseCBitAndExpr(c, m, scope); |
| 6154 | while (m.next().? == .Caret) { | 6154 | while (m.next().? == .Caret) { |
| 6155 | const lhs = try macroBoolToInt(c, node); | 6155 | const lhs = try macroIntFromBool(c, node); |
| 6156 | const rhs = try macroBoolToInt(c, try parseCBitAndExpr(c, m, scope)); | 6156 | const rhs = try macroIntFromBool(c, try parseCBitAndExpr(c, m, scope)); |
| 6157 | node = try Tag.bit_xor.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6157 | node = try Tag.bit_xor.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6158 | } | 6158 | } |
| 6159 | m.i -= 1; | 6159 | m.i -= 1; |
| ... | @@ -6163,8 +6163,8 @@ fn parseCBitXorExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6163,8 +6163,8 @@ fn parseCBitXorExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6163 | fn parseCBitAndExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | 6163 | fn parseCBitAndExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6164 | var node = try parseCEqExpr(c, m, scope); | 6164 | var node = try parseCEqExpr(c, m, scope); |
| 6165 | while (m.next().? == .Ampersand) { | 6165 | while (m.next().? == .Ampersand) { |
| 6166 | const lhs = try macroBoolToInt(c, node); | 6166 | const lhs = try macroIntFromBool(c, node); |
| 6167 | const rhs = try macroBoolToInt(c, try parseCEqExpr(c, m, scope)); | 6167 | const rhs = try macroIntFromBool(c, try parseCEqExpr(c, m, scope)); |
| 6168 | node = try Tag.bit_and.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6168 | node = try Tag.bit_and.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6169 | } | 6169 | } |
| 6170 | m.i -= 1; | 6170 | m.i -= 1; |
| ... | @@ -6177,14 +6177,14 @@ fn parseCEqExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6177,14 +6177,14 @@ fn parseCEqExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6177 | switch (m.peek().?) { | 6177 | switch (m.peek().?) { |
| 6178 | .BangEqual => { | 6178 | .BangEqual => { |
| 6179 | _ = m.next(); | 6179 | _ = m.next(); |
| 6180 | const lhs = try macroBoolToInt(c, node); | 6180 | const lhs = try macroIntFromBool(c, node); |
| 6181 | const rhs = try macroBoolToInt(c, try parseCRelExpr(c, m, scope)); | 6181 | const rhs = try macroIntFromBool(c, try parseCRelExpr(c, m, scope)); |
| 6182 | node = try Tag.not_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6182 | node = try Tag.not_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6183 | }, | 6183 | }, |
| 6184 | .EqualEqual => { | 6184 | .EqualEqual => { |
| 6185 | _ = m.next(); | 6185 | _ = m.next(); |
| 6186 | const lhs = try macroBoolToInt(c, node); | 6186 | const lhs = try macroIntFromBool(c, node); |
| 6187 | const rhs = try macroBoolToInt(c, try parseCRelExpr(c, m, scope)); | 6187 | const rhs = try macroIntFromBool(c, try parseCRelExpr(c, m, scope)); |
| 6188 | node = try Tag.equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6188 | node = try Tag.equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6189 | }, | 6189 | }, |
| 6190 | else => return node, | 6190 | else => return node, |
| ... | @@ -6198,26 +6198,26 @@ fn parseCRelExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6198,26 +6198,26 @@ fn parseCRelExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6198 | switch (m.peek().?) { | 6198 | switch (m.peek().?) { |
| 6199 | .AngleBracketRight => { | 6199 | .AngleBracketRight => { |
| 6200 | _ = m.next(); | 6200 | _ = m.next(); |
| 6201 | const lhs = try macroBoolToInt(c, node); | 6201 | const lhs = try macroIntFromBool(c, node); |
| 6202 | const rhs = try macroBoolToInt(c, try parseCShiftExpr(c, m, scope)); | 6202 | const rhs = try macroIntFromBool(c, try parseCShiftExpr(c, m, scope)); |
| 6203 | node = try Tag.greater_than.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6203 | node = try Tag.greater_than.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6204 | }, | 6204 | }, |
| 6205 | .AngleBracketRightEqual => { | 6205 | .AngleBracketRightEqual => { |
| 6206 | _ = m.next(); | 6206 | _ = m.next(); |
| 6207 | const lhs = try macroBoolToInt(c, node); | 6207 | const lhs = try macroIntFromBool(c, node); |
| 6208 | const rhs = try macroBoolToInt(c, try parseCShiftExpr(c, m, scope)); | 6208 | const rhs = try macroIntFromBool(c, try parseCShiftExpr(c, m, scope)); |
| 6209 | node = try Tag.greater_than_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6209 | node = try Tag.greater_than_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6210 | }, | 6210 | }, |
| 6211 | .AngleBracketLeft => { | 6211 | .AngleBracketLeft => { |
| 6212 | _ = m.next(); | 6212 | _ = m.next(); |
| 6213 | const lhs = try macroBoolToInt(c, node); | 6213 | const lhs = try macroIntFromBool(c, node); |
| 6214 | const rhs = try macroBoolToInt(c, try parseCShiftExpr(c, m, scope)); | 6214 | const rhs = try macroIntFromBool(c, try parseCShiftExpr(c, m, scope)); |
| 6215 | node = try Tag.less_than.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6215 | node = try Tag.less_than.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6216 | }, | 6216 | }, |
| 6217 | .AngleBracketLeftEqual => { | 6217 | .AngleBracketLeftEqual => { |
| 6218 | _ = m.next(); | 6218 | _ = m.next(); |
| 6219 | const lhs = try macroBoolToInt(c, node); | 6219 | const lhs = try macroIntFromBool(c, node); |
| 6220 | const rhs = try macroBoolToInt(c, try parseCShiftExpr(c, m, scope)); | 6220 | const rhs = try macroIntFromBool(c, try parseCShiftExpr(c, m, scope)); |
| 6221 | node = try Tag.less_than_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6221 | node = try Tag.less_than_equal.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6222 | }, | 6222 | }, |
| 6223 | else => return node, | 6223 | else => return node, |
| ... | @@ -6231,14 +6231,14 @@ fn parseCShiftExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6231,14 +6231,14 @@ fn parseCShiftExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6231 | switch (m.peek().?) { | 6231 | switch (m.peek().?) { |
| 6232 | .AngleBracketAngleBracketLeft => { | 6232 | .AngleBracketAngleBracketLeft => { |
| 6233 | _ = m.next(); | 6233 | _ = m.next(); |
| 6234 | const lhs = try macroBoolToInt(c, node); | 6234 | const lhs = try macroIntFromBool(c, node); |
| 6235 | const rhs = try macroBoolToInt(c, try parseCAddSubExpr(c, m, scope)); | 6235 | const rhs = try macroIntFromBool(c, try parseCAddSubExpr(c, m, scope)); |
| 6236 | node = try Tag.shl.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6236 | node = try Tag.shl.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6237 | }, | 6237 | }, |
| 6238 | .AngleBracketAngleBracketRight => { | 6238 | .AngleBracketAngleBracketRight => { |
| 6239 | _ = m.next(); | 6239 | _ = m.next(); |
| 6240 | const lhs = try macroBoolToInt(c, node); | 6240 | const lhs = try macroIntFromBool(c, node); |
| 6241 | const rhs = try macroBoolToInt(c, try parseCAddSubExpr(c, m, scope)); | 6241 | const rhs = try macroIntFromBool(c, try parseCAddSubExpr(c, m, scope)); |
| 6242 | node = try Tag.shr.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6242 | node = try Tag.shr.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6243 | }, | 6243 | }, |
| 6244 | else => return node, | 6244 | else => return node, |
| ... | @@ -6252,14 +6252,14 @@ fn parseCAddSubExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6252,14 +6252,14 @@ fn parseCAddSubExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6252 | switch (m.peek().?) { | 6252 | switch (m.peek().?) { |
| 6253 | .Plus => { | 6253 | .Plus => { |
| 6254 | _ = m.next(); | 6254 | _ = m.next(); |
| 6255 | const lhs = try macroBoolToInt(c, node); | 6255 | const lhs = try macroIntFromBool(c, node); |
| 6256 | const rhs = try macroBoolToInt(c, try parseCMulExpr(c, m, scope)); | 6256 | const rhs = try macroIntFromBool(c, try parseCMulExpr(c, m, scope)); |
| 6257 | node = try Tag.add.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6257 | node = try Tag.add.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6258 | }, | 6258 | }, |
| 6259 | .Minus => { | 6259 | .Minus => { |
| 6260 | _ = m.next(); | 6260 | _ = m.next(); |
| 6261 | const lhs = try macroBoolToInt(c, node); | 6261 | const lhs = try macroIntFromBool(c, node); |
| 6262 | const rhs = try macroBoolToInt(c, try parseCMulExpr(c, m, scope)); | 6262 | const rhs = try macroIntFromBool(c, try parseCMulExpr(c, m, scope)); |
| 6263 | node = try Tag.sub.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6263 | node = try Tag.sub.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6264 | }, | 6264 | }, |
| 6265 | else => return node, | 6265 | else => return node, |
| ... | @@ -6272,18 +6272,18 @@ fn parseCMulExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6272,18 +6272,18 @@ fn parseCMulExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6272 | while (true) { | 6272 | while (true) { |
| 6273 | switch (m.next().?) { | 6273 | switch (m.next().?) { |
| 6274 | .Asterisk => { | 6274 | .Asterisk => { |
| 6275 | const lhs = try macroBoolToInt(c, node); | 6275 | const lhs = try macroIntFromBool(c, node); |
| 6276 | const rhs = try macroBoolToInt(c, try parseCCastExpr(c, m, scope)); | 6276 | const rhs = try macroIntFromBool(c, try parseCCastExpr(c, m, scope)); |
| 6277 | node = try Tag.mul.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); | 6277 | node = try Tag.mul.create(c.arena, .{ .lhs = lhs, .rhs = rhs }); |
| 6278 | }, | 6278 | }, |
| 6279 | .Slash => { | 6279 | .Slash => { |
| 6280 | const lhs = try macroBoolToInt(c, node); | 6280 | const lhs = try macroIntFromBool(c, node); |
| 6281 | const rhs = try macroBoolToInt(c, try parseCCastExpr(c, m, scope)); | 6281 | const rhs = try macroIntFromBool(c, try parseCCastExpr(c, m, scope)); |
| 6282 | node = try Tag.macro_arithmetic.create(c.arena, .{ .op = .div, .lhs = lhs, .rhs = rhs }); | 6282 | node = try Tag.macro_arithmetic.create(c.arena, .{ .op = .div, .lhs = lhs, .rhs = rhs }); |
| 6283 | }, | 6283 | }, |
| 6284 | .Percent => { | 6284 | .Percent => { |
| 6285 | const lhs = try macroBoolToInt(c, node); | 6285 | const lhs = try macroIntFromBool(c, node); |
| 6286 | const rhs = try macroBoolToInt(c, try parseCCastExpr(c, m, scope)); | 6286 | const rhs = try macroIntFromBool(c, try parseCCastExpr(c, m, scope)); |
| 6287 | node = try Tag.macro_arithmetic.create(c.arena, .{ .op = .rem, .lhs = lhs, .rhs = rhs }); | 6287 | node = try Tag.macro_arithmetic.create(c.arena, .{ .op = .rem, .lhs = lhs, .rhs = rhs }); |
| 6288 | }, | 6288 | }, |
| 6289 | else => { | 6289 | else => { |
| ... | @@ -6512,7 +6512,7 @@ fn parseCPostfixExpr(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?Node) | ... | @@ -6512,7 +6512,7 @@ fn parseCPostfixExpr(c: *Context, m: *MacroCtx, scope: *Scope, type_name: ?Node) |
| 6512 | node = try Tag.field_access.create(c.arena, .{ .lhs = deref, .field_name = m.slice() }); | 6512 | node = try Tag.field_access.create(c.arena, .{ .lhs = deref, .field_name = m.slice() }); |
| 6513 | }, | 6513 | }, |
| 6514 | .LBracket => { | 6514 | .LBracket => { |
| 6515 | const index_val = try macroBoolToInt(c, try parseCExpr(c, m, scope)); | 6515 | const index_val = try macroIntFromBool(c, try parseCExpr(c, m, scope)); |
| 6516 | const index = try Tag.int_cast.create(c.arena, .{ | 6516 | const index = try Tag.int_cast.create(c.arena, .{ |
| 6517 | .lhs = try Tag.type.create(c.arena, "usize"), | 6517 | .lhs = try Tag.type.create(c.arena, "usize"), |
| 6518 | .rhs = index_val, | 6518 | .rhs = index_val, |
| ... | @@ -6610,12 +6610,12 @@ fn parseCUnaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { | ... | @@ -6610,12 +6610,12 @@ fn parseCUnaryExpr(c: *Context, m: *MacroCtx, scope: *Scope) ParseError!Node { |
| 6610 | return Tag.not.create(c.arena, operand); | 6610 | return Tag.not.create(c.arena, operand); |
| 6611 | }, | 6611 | }, |
| 6612 | .Minus => { | 6612 | .Minus => { |
| 6613 | const operand = try macroBoolToInt(c, try parseCCastExpr(c, m, scope)); | 6613 | const operand = try macroIntFromBool(c, try parseCCastExpr(c, m, scope)); |
| 6614 | return Tag.negate.create(c.arena, operand); | 6614 | return Tag.negate.create(c.arena, operand); |
| 6615 | }, | 6615 | }, |
| 6616 | .Plus => return try parseCCastExpr(c, m, scope), | 6616 | .Plus => return try parseCCastExpr(c, m, scope), |
| 6617 | .Tilde => { | 6617 | .Tilde => { |
| 6618 | const operand = try macroBoolToInt(c, try parseCCastExpr(c, m, scope)); | 6618 | const operand = try macroIntFromBool(c, try parseCCastExpr(c, m, scope)); |
| 6619 | return Tag.bit_not.create(c.arena, operand); | 6619 | return Tag.bit_not.create(c.arena, operand); |
| 6620 | }, | 6620 | }, |
| 6621 | .Asterisk => { | 6621 | .Asterisk => { |
src/translate_c/ast.zig+5-5| ... | @@ -228,7 +228,7 @@ pub const Node = extern union { | ... | @@ -228,7 +228,7 @@ pub const Node = extern union { |
| 228 | array_filler, | 228 | array_filler, |
| 229 | 229 | ||
| 230 | pub const last_no_payload_tag = Tag.@"break"; | 230 | pub const last_no_payload_tag = Tag.@"break"; |
| 231 | pub const no_payload_count = @enumToInt(last_no_payload_tag) + 1; | 231 | pub const no_payload_count = @intFromEnum(last_no_payload_tag) + 1; |
| 232 | 232 | ||
| 233 | pub fn Type(comptime t: Tag) type { | 233 | pub fn Type(comptime t: Tag) type { |
| 234 | return switch (t) { | 234 | return switch (t) { |
| ... | @@ -381,8 +381,8 @@ pub const Node = extern union { | ... | @@ -381,8 +381,8 @@ pub const Node = extern union { |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | pub fn init(comptime t: Tag) Node { | 383 | pub fn init(comptime t: Tag) Node { |
| 384 | comptime std.debug.assert(@enumToInt(t) < Tag.no_payload_count); | 384 | comptime std.debug.assert(@intFromEnum(t) < Tag.no_payload_count); |
| 385 | return .{ .tag_if_small_enough = @enumToInt(t) }; | 385 | return .{ .tag_if_small_enough = @intFromEnum(t) }; |
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | pub fn create(comptime t: Tag, ally: Allocator, data: Data(t)) error{OutOfMemory}!Node { | 388 | pub fn create(comptime t: Tag, ally: Allocator, data: Data(t)) error{OutOfMemory}!Node { |
| ... | @@ -401,7 +401,7 @@ pub const Node = extern union { | ... | @@ -401,7 +401,7 @@ pub const Node = extern union { |
| 401 | 401 | ||
| 402 | pub fn tag(self: Node) Tag { | 402 | pub fn tag(self: Node) Tag { |
| 403 | if (self.tag_if_small_enough < Tag.no_payload_count) { | 403 | if (self.tag_if_small_enough < Tag.no_payload_count) { |
| 404 | return @intToEnum(Tag, @intCast(std.meta.Tag(Tag), self.tag_if_small_enough)); | 404 | return @enumFromInt(Tag, @intCast(std.meta.Tag(Tag), self.tag_if_small_enough)); |
| 405 | } else { | 405 | } else { |
| 406 | return self.ptr_otherwise.tag; | 406 | return self.ptr_otherwise.tag; |
| 407 | } | 407 | } |
| ... | @@ -418,7 +418,7 @@ pub const Node = extern union { | ... | @@ -418,7 +418,7 @@ pub const Node = extern union { |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | pub fn initPayload(payload: *Payload) Node { | 420 | pub fn initPayload(payload: *Payload) Node { |
| 421 | std.debug.assert(@enumToInt(payload.tag) >= Tag.no_payload_count); | 421 | std.debug.assert(@intFromEnum(payload.tag) >= Tag.no_payload_count); |
| 422 | return .{ .ptr_otherwise = payload }; | 422 | return .{ .ptr_otherwise = payload }; |
| 423 | } | 423 | } |
| 424 | 424 |
src/type.zig+8-8| ... | @@ -130,7 +130,7 @@ pub const Type = struct { | ... | @@ -130,7 +130,7 @@ pub const Type = struct { |
| 130 | // The InternPool data structure hashes based on Key to make interned objects | 130 | // The InternPool data structure hashes based on Key to make interned objects |
| 131 | // unique. An Index can be treated simply as u32 value for the | 131 | // unique. An Index can be treated simply as u32 value for the |
| 132 | // purpose of Type/Value hashing and equality. | 132 | // purpose of Type/Value hashing and equality. |
| 133 | return std.hash.uint32(@enumToInt(ty.toIntern())); | 133 | return std.hash.uint32(@intFromEnum(ty.toIntern())); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | pub fn format(ty: Type, comptime unused_fmt_string: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { | 136 | pub fn format(ty: Type, comptime unused_fmt_string: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void { |
| ... | @@ -227,7 +227,7 @@ pub const Type = struct { | ... | @@ -227,7 +227,7 @@ pub const Type = struct { |
| 227 | if (info.vector_index == .runtime) { | 227 | if (info.vector_index == .runtime) { |
| 228 | try writer.writeAll(":?"); | 228 | try writer.writeAll(":?"); |
| 229 | } else if (info.vector_index != .none) { | 229 | } else if (info.vector_index != .none) { |
| 230 | try writer.print(":{d}", .{@enumToInt(info.vector_index)}); | 230 | try writer.print(":{d}", .{@intFromEnum(info.vector_index)}); |
| 231 | } | 231 | } |
| 232 | try writer.writeAll(") "); | 232 | try writer.writeAll(") "); |
| 233 | } | 233 | } |
| ... | @@ -1227,7 +1227,7 @@ pub const Type = struct { | ... | @@ -1227,7 +1227,7 @@ pub const Type = struct { |
| 1227 | if (have_tag) { | 1227 | if (have_tag) { |
| 1228 | return abiAlignmentAdvanced(union_obj.tag_ty, mod, strat); | 1228 | return abiAlignmentAdvanced(union_obj.tag_ty, mod, strat); |
| 1229 | } else { | 1229 | } else { |
| 1230 | return AbiAlignmentAdvanced{ .scalar = @boolToInt(union_obj.layout == .Extern) }; | 1230 | return AbiAlignmentAdvanced{ .scalar = @intFromBool(union_obj.layout == .Extern) }; |
| 1231 | } | 1231 | } |
| 1232 | } | 1232 | } |
| 1233 | 1233 | ||
| ... | @@ -1307,7 +1307,7 @@ pub const Type = struct { | ... | @@ -1307,7 +1307,7 @@ pub const Type = struct { |
| 1307 | .anyframe_type => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) }, | 1307 | .anyframe_type => return AbiSizeAdvanced{ .scalar = @divExact(target.ptrBitWidth(), 8) }, |
| 1308 | 1308 | ||
| 1309 | .array_type => |array_type| { | 1309 | .array_type => |array_type| { |
| 1310 | const len = array_type.len + @boolToInt(array_type.sentinel != .none); | 1310 | const len = array_type.len + @intFromBool(array_type.sentinel != .none); |
| 1311 | switch (try array_type.child.toType().abiSizeAdvanced(mod, strat)) { | 1311 | switch (try array_type.child.toType().abiSizeAdvanced(mod, strat)) { |
| 1312 | .scalar => |elem_size| return .{ .scalar = len * elem_size }, | 1312 | .scalar => |elem_size| return .{ .scalar = len * elem_size }, |
| 1313 | .val => switch (strat) { | 1313 | .val => switch (strat) { |
| ... | @@ -1630,7 +1630,7 @@ pub const Type = struct { | ... | @@ -1630,7 +1630,7 @@ pub const Type = struct { |
| 1630 | .anyframe_type => return target.ptrBitWidth(), | 1630 | .anyframe_type => return target.ptrBitWidth(), |
| 1631 | 1631 | ||
| 1632 | .array_type => |array_type| { | 1632 | .array_type => |array_type| { |
| 1633 | const len = array_type.len + @boolToInt(array_type.sentinel != .none); | 1633 | const len = array_type.len + @intFromBool(array_type.sentinel != .none); |
| 1634 | if (len == 0) return 0; | 1634 | if (len == 0) return 0; |
| 1635 | const elem_ty = array_type.child.toType(); | 1635 | const elem_ty = array_type.child.toType(); |
| 1636 | const elem_size = @max(elem_ty.abiAlignment(mod), elem_ty.abiSize(mod)); | 1636 | const elem_size = @max(elem_ty.abiAlignment(mod), elem_ty.abiSize(mod)); |
| ... | @@ -2182,7 +2182,7 @@ pub const Type = struct { | ... | @@ -2182,7 +2182,7 @@ pub const Type = struct { |
| 2182 | } | 2182 | } |
| 2183 | 2183 | ||
| 2184 | pub fn arrayLenIncludingSentinel(ty: Type, mod: *const Module) u64 { | 2184 | pub fn arrayLenIncludingSentinel(ty: Type, mod: *const Module) u64 { |
| 2185 | return ty.arrayLen(mod) + @boolToInt(ty.sentinel(mod) != null); | 2185 | return ty.arrayLen(mod) + @intFromBool(ty.sentinel(mod) != null); |
| 2186 | } | 2186 | } |
| 2187 | 2187 | ||
| 2188 | pub fn vectorLen(ty: Type, mod: *const Module) u32 { | 2188 | pub fn vectorLen(ty: Type, mod: *const Module) u32 { |
| ... | @@ -2477,7 +2477,7 @@ pub const Type = struct { | ... | @@ -2477,7 +2477,7 @@ pub const Type = struct { |
| 2477 | 2477 | ||
| 2478 | inline .array_type, .vector_type => |seq_type, seq_tag| { | 2478 | inline .array_type, .vector_type => |seq_type, seq_tag| { |
| 2479 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; | 2479 | const has_sentinel = seq_tag == .array_type and seq_type.sentinel != .none; |
| 2480 | if (seq_type.len + @boolToInt(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ | 2480 | if (seq_type.len + @intFromBool(has_sentinel) == 0) return (try mod.intern(.{ .aggregate = .{ |
| 2481 | .ty = ty.toIntern(), | 2481 | .ty = ty.toIntern(), |
| 2482 | .storage = .{ .elems = &.{} }, | 2482 | .storage = .{ .elems = &.{} }, |
| 2483 | } })).toValue(); | 2483 | } })).toValue(); |
| ... | @@ -3540,7 +3540,7 @@ pub const Type = struct { | ... | @@ -3540,7 +3540,7 @@ pub const Type = struct { |
| 3540 | if (max == 0) return 0; | 3540 | if (max == 0) return 0; |
| 3541 | const base = std.math.log2(max); | 3541 | const base = std.math.log2(max); |
| 3542 | const upper = (@as(u64, 1) << @intCast(u6, base)) - 1; | 3542 | const upper = (@as(u64, 1) << @intCast(u6, base)) - 1; |
| 3543 | return @intCast(u16, base + @boolToInt(upper < max)); | 3543 | return @intCast(u16, base + @intFromBool(upper < max)); |
| 3544 | } | 3544 | } |
| 3545 | 3545 | ||
| 3546 | /// This is only used for comptime asserts. Bump this number when you make a change | 3546 | /// This is only used for comptime asserts. Bump this number when you make a change |
src/value.zig+30-30| ... | @@ -112,7 +112,7 @@ pub const Value = struct { | ... | @@ -112,7 +112,7 @@ pub const Value = struct { |
| 112 | return self.castTag(T.base_tag); | 112 | return self.castTag(T.base_tag); |
| 113 | } | 113 | } |
| 114 | inline for (@typeInfo(Tag).Enum.fields) |field| { | 114 | inline for (@typeInfo(Tag).Enum.fields) |field| { |
| 115 | const t = @intToEnum(Tag, field.value); | 115 | const t = @enumFromInt(Tag, field.value); |
| 116 | if (self.legacy.ptr_otherwise.tag == t) { | 116 | if (self.legacy.ptr_otherwise.tag == t) { |
| 117 | if (T == t.Type()) { | 117 | if (T == t.Type()) { |
| 118 | return @fieldParentPtr(T, "base", self.legacy.ptr_otherwise); | 118 | return @fieldParentPtr(T, "base", self.legacy.ptr_otherwise); |
| ... | @@ -503,7 +503,7 @@ pub const Value = struct { | ... | @@ -503,7 +503,7 @@ pub const Value = struct { |
| 503 | return self.toIntern().toType(); | 503 | return self.toIntern().toType(); |
| 504 | } | 504 | } |
| 505 | 505 | ||
| 506 | pub fn enumToInt(val: Value, ty: Type, mod: *Module) Allocator.Error!Value { | 506 | pub fn intFromEnum(val: Value, ty: Type, mod: *Module) Allocator.Error!Value { |
| 507 | const ip = &mod.intern_pool; | 507 | const ip = &mod.intern_pool; |
| 508 | return switch (ip.indexToKey(ip.typeOf(val.toIntern()))) { | 508 | return switch (ip.indexToKey(ip.typeOf(val.toIntern()))) { |
| 509 | // Assume it is already an integer and return it directly. | 509 | // Assume it is already an integer and return it directly. |
| ... | @@ -703,7 +703,7 @@ pub const Value = struct { | ... | @@ -703,7 +703,7 @@ pub const Value = struct { |
| 703 | switch (ty.zigTypeTag(mod)) { | 703 | switch (ty.zigTypeTag(mod)) { |
| 704 | .Void => {}, | 704 | .Void => {}, |
| 705 | .Bool => { | 705 | .Bool => { |
| 706 | buffer[0] = @boolToInt(val.toBool()); | 706 | buffer[0] = @intFromBool(val.toBool()); |
| 707 | }, | 707 | }, |
| 708 | .Int, .Enum => { | 708 | .Int, .Enum => { |
| 709 | const int_info = ty.intInfo(mod); | 709 | const int_info = ty.intInfo(mod); |
| ... | @@ -836,7 +836,7 @@ pub const Value = struct { | ... | @@ -836,7 +836,7 @@ pub const Value = struct { |
| 836 | const bits = ty.intInfo(mod).bits; | 836 | const bits = ty.intInfo(mod).bits; |
| 837 | if (bits == 0) return; | 837 | if (bits == 0) return; |
| 838 | 838 | ||
| 839 | switch (mod.intern_pool.indexToKey((try val.enumToInt(ty, mod)).toIntern()).int.storage) { | 839 | switch (mod.intern_pool.indexToKey((try val.intFromEnum(ty, mod)).toIntern()).int.storage) { |
| 840 | inline .u64, .i64 => |int| std.mem.writeVarPackedInt(buffer, bit_offset, bits, int, endian), | 840 | inline .u64, .i64 => |int| std.mem.writeVarPackedInt(buffer, bit_offset, bits, int, endian), |
| 841 | .big_int => |bigint| bigint.writePackedTwosComplement(buffer, bit_offset, bits, endian), | 841 | .big_int => |bigint| bigint.writePackedTwosComplement(buffer, bit_offset, bits, endian), |
| 842 | else => unreachable, | 842 | else => unreachable, |
| ... | @@ -1170,10 +1170,10 @@ pub const Value = struct { | ... | @@ -1170,10 +1170,10 @@ pub const Value = struct { |
| 1170 | if (T == f80) { | 1170 | if (T == f80) { |
| 1171 | @panic("TODO we can't lower this properly on non-x86 llvm backend yet"); | 1171 | @panic("TODO we can't lower this properly on non-x86 llvm backend yet"); |
| 1172 | } | 1172 | } |
| 1173 | return @intToFloat(T, x); | 1173 | return @floatFromInt(T, x); |
| 1174 | }, | 1174 | }, |
| 1175 | .lazy_align => |ty| @intToFloat(T, ty.toType().abiAlignment(mod)), | 1175 | .lazy_align => |ty| @floatFromInt(T, ty.toType().abiAlignment(mod)), |
| 1176 | .lazy_size => |ty| @intToFloat(T, ty.toType().abiSize(mod)), | 1176 | .lazy_size => |ty| @floatFromInt(T, ty.toType().abiSize(mod)), |
| 1177 | }, | 1177 | }, |
| 1178 | .float => |float| switch (float.storage) { | 1178 | .float => |float| switch (float.storage) { |
| 1179 | inline else => |x| @floatCast(T, x), | 1179 | inline else => |x| @floatCast(T, x), |
| ... | @@ -1191,7 +1191,7 @@ pub const Value = struct { | ... | @@ -1191,7 +1191,7 @@ pub const Value = struct { |
| 1191 | var i: usize = limbs.len; | 1191 | var i: usize = limbs.len; |
| 1192 | while (i != 0) { | 1192 | while (i != 0) { |
| 1193 | i -= 1; | 1193 | i -= 1; |
| 1194 | const limb: f128 = @intToFloat(f128, limbs[i]); | 1194 | const limb: f128 = @floatFromInt(f128, limbs[i]); |
| 1195 | result = @mulAdd(f128, base, result, limb); | 1195 | result = @mulAdd(f128, base, result, limb); |
| 1196 | } | 1196 | } |
| 1197 | if (positive) { | 1197 | if (positive) { |
| ... | @@ -1593,8 +1593,8 @@ pub const Value = struct { | ... | @@ -1593,8 +1593,8 @@ pub const Value = struct { |
| 1593 | return a_type.eql(b_type, mod); | 1593 | return a_type.eql(b_type, mod); |
| 1594 | }, | 1594 | }, |
| 1595 | .Enum => { | 1595 | .Enum => { |
| 1596 | const a_val = try a.enumToInt(ty, mod); | 1596 | const a_val = try a.intFromEnum(ty, mod); |
| 1597 | const b_val = try b.enumToInt(ty, mod); | 1597 | const b_val = try b.intFromEnum(ty, mod); |
| 1598 | const int_ty = ty.intTagType(mod); | 1598 | const int_ty = ty.intTagType(mod); |
| 1599 | return eqlAdvanced(a_val, int_ty, b_val, int_ty, mod, opt_sema); | 1599 | return eqlAdvanced(a_val, int_ty, b_val, int_ty, mod, opt_sema); |
| 1600 | }, | 1600 | }, |
| ... | @@ -2124,30 +2124,30 @@ pub const Value = struct { | ... | @@ -2124,30 +2124,30 @@ pub const Value = struct { |
| 2124 | }; | 2124 | }; |
| 2125 | } | 2125 | } |
| 2126 | 2126 | ||
| 2127 | pub fn intToFloat(val: Value, arena: Allocator, int_ty: Type, float_ty: Type, mod: *Module) !Value { | 2127 | pub fn floatFromInt(val: Value, arena: Allocator, int_ty: Type, float_ty: Type, mod: *Module) !Value { |
| 2128 | return intToFloatAdvanced(val, arena, int_ty, float_ty, mod, null) catch |err| switch (err) { | 2128 | return floatFromIntAdvanced(val, arena, int_ty, float_ty, mod, null) catch |err| switch (err) { |
| 2129 | error.OutOfMemory => return error.OutOfMemory, | 2129 | error.OutOfMemory => return error.OutOfMemory, |
| 2130 | else => unreachable, | 2130 | else => unreachable, |
| 2131 | }; | 2131 | }; |
| 2132 | } | 2132 | } |
| 2133 | 2133 | ||
| 2134 | pub fn intToFloatAdvanced(val: Value, arena: Allocator, int_ty: Type, float_ty: Type, mod: *Module, opt_sema: ?*Sema) !Value { | 2134 | pub fn floatFromIntAdvanced(val: Value, arena: Allocator, int_ty: Type, float_ty: Type, mod: *Module, opt_sema: ?*Sema) !Value { |
| 2135 | if (int_ty.zigTypeTag(mod) == .Vector) { | 2135 | if (int_ty.zigTypeTag(mod) == .Vector) { |
| 2136 | const result_data = try arena.alloc(InternPool.Index, int_ty.vectorLen(mod)); | 2136 | const result_data = try arena.alloc(InternPool.Index, int_ty.vectorLen(mod)); |
| 2137 | const scalar_ty = float_ty.scalarType(mod); | 2137 | const scalar_ty = float_ty.scalarType(mod); |
| 2138 | for (result_data, 0..) |*scalar, i| { | 2138 | for (result_data, 0..) |*scalar, i| { |
| 2139 | const elem_val = try val.elemValue(mod, i); | 2139 | const elem_val = try val.elemValue(mod, i); |
| 2140 | scalar.* = try (try intToFloatScalar(elem_val, scalar_ty, mod, opt_sema)).intern(scalar_ty, mod); | 2140 | scalar.* = try (try floatFromIntScalar(elem_val, scalar_ty, mod, opt_sema)).intern(scalar_ty, mod); |
| 2141 | } | 2141 | } |
| 2142 | return (try mod.intern(.{ .aggregate = .{ | 2142 | return (try mod.intern(.{ .aggregate = .{ |
| 2143 | .ty = float_ty.toIntern(), | 2143 | .ty = float_ty.toIntern(), |
| 2144 | .storage = .{ .elems = result_data }, | 2144 | .storage = .{ .elems = result_data }, |
| 2145 | } })).toValue(); | 2145 | } })).toValue(); |
| 2146 | } | 2146 | } |
| 2147 | return intToFloatScalar(val, float_ty, mod, opt_sema); | 2147 | return floatFromIntScalar(val, float_ty, mod, opt_sema); |
| 2148 | } | 2148 | } |
| 2149 | 2149 | ||
| 2150 | pub fn intToFloatScalar(val: Value, float_ty: Type, mod: *Module, opt_sema: ?*Sema) !Value { | 2150 | pub fn floatFromIntScalar(val: Value, float_ty: Type, mod: *Module, opt_sema: ?*Sema) !Value { |
| 2151 | return switch (mod.intern_pool.indexToKey(val.toIntern())) { | 2151 | return switch (mod.intern_pool.indexToKey(val.toIntern())) { |
| 2152 | .undef => (try mod.intern(.{ .undef = float_ty.toIntern() })).toValue(), | 2152 | .undef => (try mod.intern(.{ .undef = float_ty.toIntern() })).toValue(), |
| 2153 | .int => |int| switch (int.storage) { | 2153 | .int => |int| switch (int.storage) { |
| ... | @@ -2155,30 +2155,30 @@ pub const Value = struct { | ... | @@ -2155,30 +2155,30 @@ pub const Value = struct { |
| 2155 | const float = bigIntToFloat(big_int.limbs, big_int.positive); | 2155 | const float = bigIntToFloat(big_int.limbs, big_int.positive); |
| 2156 | return mod.floatValue(float_ty, float); | 2156 | return mod.floatValue(float_ty, float); |
| 2157 | }, | 2157 | }, |
| 2158 | inline .u64, .i64 => |x| intToFloatInner(x, float_ty, mod), | 2158 | inline .u64, .i64 => |x| floatFromIntInner(x, float_ty, mod), |
| 2159 | .lazy_align => |ty| if (opt_sema) |sema| { | 2159 | .lazy_align => |ty| if (opt_sema) |sema| { |
| 2160 | return intToFloatInner((try ty.toType().abiAlignmentAdvanced(mod, .{ .sema = sema })).scalar, float_ty, mod); | 2160 | return floatFromIntInner((try ty.toType().abiAlignmentAdvanced(mod, .{ .sema = sema })).scalar, float_ty, mod); |
| 2161 | } else { | 2161 | } else { |
| 2162 | return intToFloatInner(ty.toType().abiAlignment(mod), float_ty, mod); | 2162 | return floatFromIntInner(ty.toType().abiAlignment(mod), float_ty, mod); |
| 2163 | }, | 2163 | }, |
| 2164 | .lazy_size => |ty| if (opt_sema) |sema| { | 2164 | .lazy_size => |ty| if (opt_sema) |sema| { |
| 2165 | return intToFloatInner((try ty.toType().abiSizeAdvanced(mod, .{ .sema = sema })).scalar, float_ty, mod); | 2165 | return floatFromIntInner((try ty.toType().abiSizeAdvanced(mod, .{ .sema = sema })).scalar, float_ty, mod); |
| 2166 | } else { | 2166 | } else { |
| 2167 | return intToFloatInner(ty.toType().abiSize(mod), float_ty, mod); | 2167 | return floatFromIntInner(ty.toType().abiSize(mod), float_ty, mod); |
| 2168 | }, | 2168 | }, |
| 2169 | }, | 2169 | }, |
| 2170 | else => unreachable, | 2170 | else => unreachable, |
| 2171 | }; | 2171 | }; |
| 2172 | } | 2172 | } |
| 2173 | 2173 | ||
| 2174 | fn intToFloatInner(x: anytype, dest_ty: Type, mod: *Module) !Value { | 2174 | fn floatFromIntInner(x: anytype, dest_ty: Type, mod: *Module) !Value { |
| 2175 | const target = mod.getTarget(); | 2175 | const target = mod.getTarget(); |
| 2176 | const storage: InternPool.Key.Float.Storage = switch (dest_ty.floatBits(target)) { | 2176 | const storage: InternPool.Key.Float.Storage = switch (dest_ty.floatBits(target)) { |
| 2177 | 16 => .{ .f16 = @intToFloat(f16, x) }, | 2177 | 16 => .{ .f16 = @floatFromInt(f16, x) }, |
| 2178 | 32 => .{ .f32 = @intToFloat(f32, x) }, | 2178 | 32 => .{ .f32 = @floatFromInt(f32, x) }, |
| 2179 | 64 => .{ .f64 = @intToFloat(f64, x) }, | 2179 | 64 => .{ .f64 = @floatFromInt(f64, x) }, |
| 2180 | 80 => .{ .f80 = @intToFloat(f80, x) }, | 2180 | 80 => .{ .f80 = @floatFromInt(f80, x) }, |
| 2181 | 128 => .{ .f128 = @intToFloat(f128, x) }, | 2181 | 128 => .{ .f128 = @floatFromInt(f128, x) }, |
| 2182 | else => unreachable, | 2182 | else => unreachable, |
| 2183 | }; | 2183 | }; |
| 2184 | return (try mod.intern(.{ .float = .{ | 2184 | return (try mod.intern(.{ .float = .{ |
| ... | @@ -2193,7 +2193,7 @@ pub const Value = struct { | ... | @@ -2193,7 +2193,7 @@ pub const Value = struct { |
| 2193 | } | 2193 | } |
| 2194 | 2194 | ||
| 2195 | const w_value = @fabs(scalar); | 2195 | const w_value = @fabs(scalar); |
| 2196 | return @divFloor(@floatToInt(std.math.big.Limb, std.math.log2(w_value)), @typeInfo(std.math.big.Limb).Int.bits) + 1; | 2196 | return @divFloor(@intFromFloat(std.math.big.Limb, std.math.log2(w_value)), @typeInfo(std.math.big.Limb).Int.bits) + 1; |
| 2197 | } | 2197 | } |
| 2198 | 2198 | ||
| 2199 | pub const OverflowArithmeticResult = struct { | 2199 | pub const OverflowArithmeticResult = struct { |
| ... | @@ -2364,7 +2364,7 @@ pub const Value = struct { | ... | @@ -2364,7 +2364,7 @@ pub const Value = struct { |
| 2364 | } | 2364 | } |
| 2365 | 2365 | ||
| 2366 | return OverflowArithmeticResult{ | 2366 | return OverflowArithmeticResult{ |
| 2367 | .overflow_bit = try mod.intValue(Type.u1, @boolToInt(overflowed)), | 2367 | .overflow_bit = try mod.intValue(Type.u1, @intFromBool(overflowed)), |
| 2368 | .wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()), | 2368 | .wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()), |
| 2369 | }; | 2369 | }; |
| 2370 | } | 2370 | } |
| ... | @@ -3177,7 +3177,7 @@ pub const Value = struct { | ... | @@ -3177,7 +3177,7 @@ pub const Value = struct { |
| 3177 | result_bigint.truncate(result_bigint.toConst(), info.signedness, info.bits); | 3177 | result_bigint.truncate(result_bigint.toConst(), info.signedness, info.bits); |
| 3178 | } | 3178 | } |
| 3179 | return OverflowArithmeticResult{ | 3179 | return OverflowArithmeticResult{ |
| 3180 | .overflow_bit = try mod.intValue(Type.u1, @boolToInt(overflowed)), | 3180 | .overflow_bit = try mod.intValue(Type.u1, @intFromBool(overflowed)), |
| 3181 | .wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()), | 3181 | .wrapped_result = try mod.intValue_big(ty, result_bigint.toConst()), |
| 3182 | }; | 3182 | }; |
| 3183 | } | 3183 | } |
test/behavior.zig+1-1| ... | @@ -174,7 +174,7 @@ test { | ... | @@ -174,7 +174,7 @@ test { |
| 174 | _ = @import("behavior/inline_switch.zig"); | 174 | _ = @import("behavior/inline_switch.zig"); |
| 175 | _ = @import("behavior/int128.zig"); | 175 | _ = @import("behavior/int128.zig"); |
| 176 | _ = @import("behavior/int_comparison_elision.zig"); | 176 | _ = @import("behavior/int_comparison_elision.zig"); |
| 177 | _ = @import("behavior/inttoptr.zig"); | 177 | _ = @import("behavior/ptrfromint.zig"); |
| 178 | _ = @import("behavior/ir_block_deps.zig"); | 178 | _ = @import("behavior/ir_block_deps.zig"); |
| 179 | _ = @import("behavior/lower_strlit_to_vector.zig"); | 179 | _ = @import("behavior/lower_strlit_to_vector.zig"); |
| 180 | _ = @import("behavior/math.zig"); | 180 | _ = @import("behavior/math.zig"); |
test/behavior/align.zig+7-7| ... | @@ -24,7 +24,7 @@ test "slicing array of length 1 can not assume runtime index is always zero" { | ... | @@ -24,7 +24,7 @@ test "slicing array of length 1 can not assume runtime index is always zero" { |
| 24 | const slice = @as(*align(4) [1]u8, &foo)[runtime_index..]; | 24 | const slice = @as(*align(4) [1]u8, &foo)[runtime_index..]; |
| 25 | try expect(@TypeOf(slice) == []u8); | 25 | try expect(@TypeOf(slice) == []u8); |
| 26 | try expect(slice.len == 0); | 26 | try expect(slice.len == 0); |
| 27 | try expect(@truncate(u2, @ptrToInt(slice.ptr) - 1) == 0); | 27 | try expect(@truncate(u2, @intFromPtr(slice.ptr) - 1) == 0); |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | test "default alignment allows unspecified in type syntax" { | 30 | test "default alignment allows unspecified in type syntax" { |
| ... | @@ -299,11 +299,11 @@ test "page aligned array on stack" { | ... | @@ -299,11 +299,11 @@ test "page aligned array on stack" { |
| 299 | var number1: u8 align(16) = 42; | 299 | var number1: u8 align(16) = 42; |
| 300 | var number2: u8 align(16) = 43; | 300 | var number2: u8 align(16) = 43; |
| 301 | 301 | ||
| 302 | try expect(@ptrToInt(&array[0]) & 0xFFF == 0); | 302 | try expect(@intFromPtr(&array[0]) & 0xFFF == 0); |
| 303 | try expect(array[3] == 4); | 303 | try expect(array[3] == 4); |
| 304 | 304 | ||
| 305 | try expect(@truncate(u4, @ptrToInt(&number1)) == 0); | 305 | try expect(@truncate(u4, @intFromPtr(&number1)) == 0); |
| 306 | try expect(@truncate(u4, @ptrToInt(&number2)) == 0); | 306 | try expect(@truncate(u4, @intFromPtr(&number2)) == 0); |
| 307 | try expect(number1 == 42); | 307 | try expect(number1 == 42); |
| 308 | try expect(number2 == 43); | 308 | try expect(number2 == 43); |
| 309 | } | 309 | } |
| ... | @@ -518,7 +518,7 @@ test "struct field explicit alignment" { | ... | @@ -518,7 +518,7 @@ test "struct field explicit alignment" { |
| 518 | node.massive_byte = 100; | 518 | node.massive_byte = 100; |
| 519 | try expect(node.massive_byte == 100); | 519 | try expect(node.massive_byte == 100); |
| 520 | try comptime expect(@TypeOf(&node.massive_byte) == *align(64) u8); | 520 | try comptime expect(@TypeOf(&node.massive_byte) == *align(64) u8); |
| 521 | try expect(@ptrToInt(&node.massive_byte) % 64 == 0); | 521 | try expect(@intFromPtr(&node.massive_byte) % 64 == 0); |
| 522 | } | 522 | } |
| 523 | 523 | ||
| 524 | test "align(@alignOf(T)) T does not force resolution of T" { | 524 | test "align(@alignOf(T)) T does not force resolution of T" { |
| ... | @@ -561,7 +561,7 @@ test "align(N) on functions" { | ... | @@ -561,7 +561,7 @@ test "align(N) on functions" { |
| 561 | if (native_arch == .wasm32 or native_arch == .wasm64) return error.SkipZigTest; | 561 | if (native_arch == .wasm32 or native_arch == .wasm64) return error.SkipZigTest; |
| 562 | if (native_arch == .thumb) return error.SkipZigTest; | 562 | if (native_arch == .thumb) return error.SkipZigTest; |
| 563 | 563 | ||
| 564 | try expect((@ptrToInt(&overaligned_fn) & (0x1000 - 1)) == 0); | 564 | try expect((@intFromPtr(&overaligned_fn) & (0x1000 - 1)) == 0); |
| 565 | } | 565 | } |
| 566 | fn overaligned_fn() align(0x1000) i32 { | 566 | fn overaligned_fn() align(0x1000) i32 { |
| 567 | return 42; | 567 | return 42; |
| ... | @@ -578,7 +578,7 @@ test "comptime alloc alignment" { | ... | @@ -578,7 +578,7 @@ test "comptime alloc alignment" { |
| 578 | _ = bytes1; | 578 | _ = bytes1; |
| 579 | 579 | ||
| 580 | comptime var bytes2 align(256) = [_]u8{0}; | 580 | comptime var bytes2 align(256) = [_]u8{0}; |
| 581 | var bytes2_addr = @ptrToInt(&bytes2); | 581 | var bytes2_addr = @intFromPtr(&bytes2); |
| 582 | try expect(bytes2_addr & 0xff == 0); | 582 | try expect(bytes2_addr & 0xff == 0); |
| 583 | } | 583 | } |
| 584 | 584 |
test/behavior/array.zig+2-2| ... | @@ -176,8 +176,8 @@ test "array with sentinels" { | ... | @@ -176,8 +176,8 @@ test "array with sentinels" { |
| 176 | var arr: [3:0x55]u8 = undefined; | 176 | var arr: [3:0x55]u8 = undefined; |
| 177 | // Make sure the sentinel pointer is pointing after the last element. | 177 | // Make sure the sentinel pointer is pointing after the last element. |
| 178 | if (!is_ct) { | 178 | if (!is_ct) { |
| 179 | const sentinel_ptr = @ptrToInt(&arr[3]); | 179 | const sentinel_ptr = @intFromPtr(&arr[3]); |
| 180 | const last_elem_ptr = @ptrToInt(&arr[2]); | 180 | const last_elem_ptr = @intFromPtr(&arr[2]); |
| 181 | try expect((sentinel_ptr - last_elem_ptr) == 1); | 181 | try expect((sentinel_ptr - last_elem_ptr) == 1); |
| 182 | } | 182 | } |
| 183 | // Make sure the sentinel is writeable. | 183 | // Make sure the sentinel is writeable. |
test/behavior/async_fn.zig+3-3| ... | @@ -829,7 +829,7 @@ test "alignment of local variables in async functions" { | ... | @@ -829,7 +829,7 @@ test "alignment of local variables in async functions" { |
| 829 | var y: u8 = 123; | 829 | var y: u8 = 123; |
| 830 | _ = y; | 830 | _ = y; |
| 831 | var x: u8 align(128) = 1; | 831 | var x: u8 align(128) = 1; |
| 832 | try expect(@ptrToInt(&x) % 128 == 0); | 832 | try expect(@intFromPtr(&x) % 128 == 0); |
| 833 | } | 833 | } |
| 834 | }; | 834 | }; |
| 835 | try S.doTheTest(); | 835 | try S.doTheTest(); |
| ... | @@ -1184,7 +1184,7 @@ test "using @TypeOf on a generic function call" { | ... | @@ -1184,7 +1184,7 @@ test "using @TypeOf on a generic function call" { |
| 1184 | global_frame = @frame(); | 1184 | global_frame = @frame(); |
| 1185 | } | 1185 | } |
| 1186 | const F = @TypeOf(async amain(x - 1)); | 1186 | const F = @TypeOf(async amain(x - 1)); |
| 1187 | const frame = @intToPtr(*F, @ptrToInt(&buf)); | 1187 | const frame = @ptrFromInt(*F, @intFromPtr(&buf)); |
| 1188 | return await @asyncCall(frame, {}, amain, .{x - 1}); | 1188 | return await @asyncCall(frame, {}, amain, .{x - 1}); |
| 1189 | } | 1189 | } |
| 1190 | }; | 1190 | }; |
| ... | @@ -1212,7 +1212,7 @@ test "recursive call of await @asyncCall with struct return type" { | ... | @@ -1212,7 +1212,7 @@ test "recursive call of await @asyncCall with struct return type" { |
| 1212 | global_frame = @frame(); | 1212 | global_frame = @frame(); |
| 1213 | } | 1213 | } |
| 1214 | const F = @TypeOf(async amain(x - 1)); | 1214 | const F = @TypeOf(async amain(x - 1)); |
| 1215 | const frame = @intToPtr(*F, @ptrToInt(&buf)); | 1215 | const frame = @ptrFromInt(*F, @intFromPtr(&buf)); |
| 1216 | return await @asyncCall(frame, {}, amain, .{x - 1}); | 1216 | return await @asyncCall(frame, {}, amain, .{x - 1}); |
| 1217 | } | 1217 | } |
| 1218 | 1218 |
test/behavior/bool.zig+14-14| ... | @@ -13,22 +13,22 @@ test "cast bool to int" { | ... | @@ -13,22 +13,22 @@ test "cast bool to int" { |
| 13 | 13 | ||
| 14 | const t = true; | 14 | const t = true; |
| 15 | const f = false; | 15 | const f = false; |
| 16 | try expectEqual(@as(u32, 1), @boolToInt(t)); | 16 | try expectEqual(@as(u32, 1), @intFromBool(t)); |
| 17 | try expectEqual(@as(u32, 0), @boolToInt(f)); | 17 | try expectEqual(@as(u32, 0), @intFromBool(f)); |
| 18 | try expectEqual(-1, @bitCast(i1, @boolToInt(t))); | 18 | try expectEqual(-1, @bitCast(i1, @intFromBool(t))); |
| 19 | try expectEqual(0, @bitCast(i1, @boolToInt(f))); | 19 | try expectEqual(0, @bitCast(i1, @intFromBool(f))); |
| 20 | try expectEqual(u1, @TypeOf(@boolToInt(t))); | 20 | try expectEqual(u1, @TypeOf(@intFromBool(t))); |
| 21 | try expectEqual(u1, @TypeOf(@boolToInt(f))); | 21 | try expectEqual(u1, @TypeOf(@intFromBool(f))); |
| 22 | try nonConstCastBoolToInt(t, f); | 22 | try nonConstCastIntFromBool(t, f); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | fn nonConstCastBoolToInt(t: bool, f: bool) !void { | 25 | fn nonConstCastIntFromBool(t: bool, f: bool) !void { |
| 26 | try expectEqual(@as(u32, 1), @boolToInt(t)); | 26 | try expectEqual(@as(u32, 1), @intFromBool(t)); |
| 27 | try expectEqual(@as(u32, 0), @boolToInt(f)); | 27 | try expectEqual(@as(u32, 0), @intFromBool(f)); |
| 28 | try expectEqual(@as(i1, -1), @bitCast(i1, @boolToInt(t))); | 28 | try expectEqual(@as(i1, -1), @bitCast(i1, @intFromBool(t))); |
| 29 | try expectEqual(@as(i1, 0), @bitCast(i1, @boolToInt(f))); | 29 | try expectEqual(@as(i1, 0), @bitCast(i1, @intFromBool(f))); |
| 30 | try expectEqual(u1, @TypeOf(@boolToInt(t))); | 30 | try expectEqual(u1, @TypeOf(@intFromBool(t))); |
| 31 | try expectEqual(u1, @TypeOf(@boolToInt(f))); | 31 | try expectEqual(u1, @TypeOf(@intFromBool(f))); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | test "bool cmp" { | 34 | test "bool cmp" { |
test/behavior/bugs/10138.zig+1-1| ... | @@ -17,7 +17,7 @@ fn open() usize { | ... | @@ -17,7 +17,7 @@ fn open() usize { |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | fn write(fd: usize, a: [*]const u8, len: usize) usize { | 19 | fn write(fd: usize, a: [*]const u8, len: usize) usize { |
| 20 | return syscall4(.WRITE, fd, @ptrToInt(a), len); | 20 | return syscall4(.WRITE, fd, @intFromPtr(a), len); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { | 23 | fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize { |
test/behavior/bugs/12142.zig+1-1| ... | @@ -15,7 +15,7 @@ const Letter = enum(u8) { | ... | @@ -15,7 +15,7 @@ const Letter = enum(u8) { |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
| 17 | fn letter(e: Letter) u8 { | 17 | fn letter(e: Letter) u8 { |
| 18 | return @enumToInt(e); | 18 | return @intFromEnum(e); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | test { | 21 | test { |
test/behavior/bugs/12450.zig+1-1| ... | @@ -18,6 +18,6 @@ test { | ... | @@ -18,6 +18,6 @@ test { |
| 18 | 18 | ||
| 19 | var f1: *align(16) Foo = @alignCast(16, @ptrCast(*align(1) Foo, &buffer[0])); | 19 | var f1: *align(16) Foo = @alignCast(16, @ptrCast(*align(1) Foo, &buffer[0])); |
| 20 | try expect(@typeInfo(@TypeOf(f1)).Pointer.alignment == 16); | 20 | try expect(@typeInfo(@TypeOf(f1)).Pointer.alignment == 16); |
| 21 | try expect(@ptrToInt(f1) == @ptrToInt(&f1.a)); | 21 | try expect(@intFromPtr(f1) == @intFromPtr(&f1.a)); |
| 22 | try expect(@typeInfo(@TypeOf(&f1.a)).Pointer.alignment == 16); | 22 | try expect(@typeInfo(@TypeOf(&f1.a)).Pointer.alignment == 16); |
| 23 | } | 23 | } |
test/behavior/bugs/12680_other_file.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | // export this function twice | 1 | // export this function twice |
| 2 | pub export fn testFunc() callconv(.C) usize { | 2 | pub export fn testFunc() callconv(.C) usize { |
| 3 | return @ptrToInt(&testFunc); | 3 | return @intFromPtr(&testFunc); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | comptime { | 6 | comptime { |
test/behavior/bugs/12723.zig+2-2| ... | @@ -3,6 +3,6 @@ const expect = @import("std").testing.expect; | ... | @@ -3,6 +3,6 @@ const expect = @import("std").testing.expect; |
| 3 | test "Non-exhaustive enum backed by comptime_int" { | 3 | test "Non-exhaustive enum backed by comptime_int" { |
| 4 | const E = enum(comptime_int) { a, b, c, _ }; | 4 | const E = enum(comptime_int) { a, b, c, _ }; |
| 5 | comptime var e: E = .a; | 5 | comptime var e: E = .a; |
| 6 | e = @intToEnum(E, 378089457309184723749); | 6 | e = @enumFromInt(E, 378089457309184723749); |
| 7 | try expect(@enumToInt(e) == 378089457309184723749); | 7 | try expect(@intFromEnum(e) == 378089457309184723749); |
| 8 | } | 8 | } |
test/behavior/bugs/1741.zig+1-1| ... | @@ -8,5 +8,5 @@ test "fixed" { | ... | @@ -8,5 +8,5 @@ test "fixed" { |
| 8 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 8 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 9 | 9 | ||
| 10 | const x: f32 align(128) = 12.34; | 10 | const x: f32 align(128) = 12.34; |
| 11 | try std.testing.expect(@ptrToInt(&x) % 128 == 0); | 11 | try std.testing.expect(@intFromPtr(&x) % 128 == 0); |
| 12 | } | 12 | } |
test/behavior/bugs/9584.zig+1-1| ... | @@ -35,7 +35,7 @@ pub fn a( | ... | @@ -35,7 +35,7 @@ pub fn a( |
| 35 | _ = flag_a; | 35 | _ = flag_a; |
| 36 | // With this bug present, `flag_b` would actually contain the value 17. | 36 | // With this bug present, `flag_b` would actually contain the value 17. |
| 37 | // Note: this bug only presents itself on debug mode. | 37 | // Note: this bug only presents itself on debug mode. |
| 38 | const flag_b_byte: u8 = @boolToInt(flag_b); | 38 | const flag_b_byte: u8 = @intFromBool(flag_b); |
| 39 | try std.testing.expect(flag_b_byte == 1); | 39 | try std.testing.expect(flag_b_byte == 1); |
| 40 | } | 40 | } |
| 41 | 41 |
test/behavior/builtin_functions_returning_void_or_noreturn.zig+2-2| ... | @@ -17,8 +17,8 @@ test { | ... | @@ -17,8 +17,8 @@ test { |
| 17 | try testing.expectEqual(void, @TypeOf(@breakpoint())); | 17 | try testing.expectEqual(void, @TypeOf(@breakpoint())); |
| 18 | try testing.expectEqual({}, @export(x, .{ .name = "x" })); | 18 | try testing.expectEqual({}, @export(x, .{ .name = "x" })); |
| 19 | try testing.expectEqual({}, @fence(.Acquire)); | 19 | try testing.expectEqual({}, @fence(.Acquire)); |
| 20 | try testing.expectEqual({}, @memcpy(@intToPtr([*]u8, 1)[0..0], @intToPtr([*]u8, 1)[0..0])); | 20 | try testing.expectEqual({}, @memcpy(@ptrFromInt([*]u8, 1)[0..0], @ptrFromInt([*]u8, 1)[0..0])); |
| 21 | try testing.expectEqual({}, @memset(@intToPtr([*]u8, 1)[0..0], undefined)); | 21 | try testing.expectEqual({}, @memset(@ptrFromInt([*]u8, 1)[0..0], undefined)); |
| 22 | try testing.expectEqual(noreturn, @TypeOf(if (true) @panic("") else {})); | 22 | try testing.expectEqual(noreturn, @TypeOf(if (true) @panic("") else {})); |
| 23 | try testing.expectEqual({}, @prefetch(&val, .{})); | 23 | try testing.expectEqual({}, @prefetch(&val, .{})); |
| 24 | try testing.expectEqual({}, @setAlignStack(16)); | 24 | try testing.expectEqual({}, @setAlignStack(16)); |
test/behavior/call.zig+2-2| ... | @@ -364,11 +364,11 @@ test "Enum constructed by @Type passed as generic argument" { | ... | @@ -364,11 +364,11 @@ test "Enum constructed by @Type passed as generic argument" { |
| 364 | alive: bool, | 364 | alive: bool, |
| 365 | }); | 365 | }); |
| 366 | fn foo(comptime a: E, b: u32) !void { | 366 | fn foo(comptime a: E, b: u32) !void { |
| 367 | try expect(@enumToInt(a) == b); | 367 | try expect(@intFromEnum(a) == b); |
| 368 | } | 368 | } |
| 369 | }; | 369 | }; |
| 370 | inline for (@typeInfo(S.E).Enum.fields, 0..) |_, i| { | 370 | inline for (@typeInfo(S.E).Enum.fields, 0..) |_, i| { |
| 371 | try S.foo(@intToEnum(S.E, i), i); | 371 | try S.foo(@enumFromInt(S.E, i), i); |
| 372 | } | 372 | } |
| 373 | } | 373 | } |
| 374 | 374 |
test/behavior/cast.zig+50-50| ... | @@ -10,14 +10,14 @@ const native_endian = builtin.target.cpu.arch.endian(); | ... | @@ -10,14 +10,14 @@ const native_endian = builtin.target.cpu.arch.endian(); |
| 10 | 10 | ||
| 11 | test "int to ptr cast" { | 11 | test "int to ptr cast" { |
| 12 | const x = @as(usize, 13); | 12 | const x = @as(usize, 13); |
| 13 | const y = @intToPtr(*u8, x); | 13 | const y = @ptrFromInt(*u8, x); |
| 14 | const z = @ptrToInt(y); | 14 | const z = @intFromPtr(y); |
| 15 | try expect(z == 13); | 15 | try expect(z == 13); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | test "integer literal to pointer cast" { | 18 | test "integer literal to pointer cast" { |
| 19 | const vga_mem = @intToPtr(*u16, 0xB8000); | 19 | const vga_mem = @ptrFromInt(*u16, 0xB8000); |
| 20 | try expect(@ptrToInt(vga_mem) == 0xB8000); | 20 | try expect(@intFromPtr(vga_mem) == 0xB8000); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | test "peer type resolution: ?T and T" { | 23 | test "peer type resolution: ?T and T" { |
| ... | @@ -66,37 +66,37 @@ test "implicit cast comptime_int to comptime_float" { | ... | @@ -66,37 +66,37 @@ test "implicit cast comptime_int to comptime_float" { |
| 66 | try expect(2 == 2.0); | 66 | try expect(2 == 2.0); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | test "comptime_int @intToFloat" { | 69 | test "comptime_int @floatFromInt" { |
| 70 | { | 70 | { |
| 71 | const result = @intToFloat(f16, 1234); | 71 | const result = @floatFromInt(f16, 1234); |
| 72 | try expect(@TypeOf(result) == f16); | 72 | try expect(@TypeOf(result) == f16); |
| 73 | try expect(result == 1234.0); | 73 | try expect(result == 1234.0); |
| 74 | } | 74 | } |
| 75 | { | 75 | { |
| 76 | const result = @intToFloat(f32, 1234); | 76 | const result = @floatFromInt(f32, 1234); |
| 77 | try expect(@TypeOf(result) == f32); | 77 | try expect(@TypeOf(result) == f32); |
| 78 | try expect(result == 1234.0); | 78 | try expect(result == 1234.0); |
| 79 | } | 79 | } |
| 80 | { | 80 | { |
| 81 | const result = @intToFloat(f64, 1234); | 81 | const result = @floatFromInt(f64, 1234); |
| 82 | try expect(@TypeOf(result) == f64); | 82 | try expect(@TypeOf(result) == f64); |
| 83 | try expect(result == 1234.0); | 83 | try expect(result == 1234.0); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | { | 86 | { |
| 87 | const result = @intToFloat(f128, 1234); | 87 | const result = @floatFromInt(f128, 1234); |
| 88 | try expect(@TypeOf(result) == f128); | 88 | try expect(@TypeOf(result) == f128); |
| 89 | try expect(result == 1234.0); | 89 | try expect(result == 1234.0); |
| 90 | } | 90 | } |
| 91 | // big comptime_int (> 64 bits) to f128 conversion | 91 | // big comptime_int (> 64 bits) to f128 conversion |
| 92 | { | 92 | { |
| 93 | const result = @intToFloat(f128, 0x1_0000_0000_0000_0000); | 93 | const result = @floatFromInt(f128, 0x1_0000_0000_0000_0000); |
| 94 | try expect(@TypeOf(result) == f128); | 94 | try expect(@TypeOf(result) == f128); |
| 95 | try expect(result == 0x1_0000_0000_0000_0000.0); | 95 | try expect(result == 0x1_0000_0000_0000_0000.0); |
| 96 | } | 96 | } |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | test "@intToFloat" { | 99 | test "@floatFromInt" { |
| 100 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 100 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 101 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 101 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 102 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 102 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | @@ -107,8 +107,8 @@ test "@intToFloat" { | ... | @@ -107,8 +107,8 @@ test "@intToFloat" { |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | fn testIntToFloat(k: i32) !void { | 109 | fn testIntToFloat(k: i32) !void { |
| 110 | const f = @intToFloat(f32, k); | 110 | const f = @floatFromInt(f32, k); |
| 111 | const i = @floatToInt(i32, f); | 111 | const i = @intFromFloat(i32, f); |
| 112 | try expect(i == k); | 112 | try expect(i == k); |
| 113 | } | 113 | } |
| 114 | }; | 114 | }; |
| ... | @@ -116,7 +116,7 @@ test "@intToFloat" { | ... | @@ -116,7 +116,7 @@ test "@intToFloat" { |
| 116 | try comptime S.doTheTest(); | 116 | try comptime S.doTheTest(); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | test "@intToFloat(f80)" { | 119 | test "@floatFromInt(f80)" { |
| 120 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 120 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 121 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 121 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 122 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 122 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| ... | @@ -131,8 +131,8 @@ test "@intToFloat(f80)" { | ... | @@ -131,8 +131,8 @@ test "@intToFloat(f80)" { |
| 131 | 131 | ||
| 132 | fn testIntToFloat(comptime Int: type, k: Int) !void { | 132 | fn testIntToFloat(comptime Int: type, k: Int) !void { |
| 133 | @setRuntimeSafety(false); // TODO | 133 | @setRuntimeSafety(false); // TODO |
| 134 | const f = @intToFloat(f80, k); | 134 | const f = @floatFromInt(f80, k); |
| 135 | const i = @floatToInt(Int, f); | 135 | const i = @intFromFloat(Int, f); |
| 136 | try expect(i == k); | 136 | try expect(i == k); |
| 137 | } | 137 | } |
| 138 | }; | 138 | }; |
| ... | @@ -152,28 +152,28 @@ test "@intToFloat(f80)" { | ... | @@ -152,28 +152,28 @@ test "@intToFloat(f80)" { |
| 152 | try comptime S.doTheTest(i256); | 152 | try comptime S.doTheTest(i256); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | test "@floatToInt" { | 155 | test "@intFromFloat" { |
| 156 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 156 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 157 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 157 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 158 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 158 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 159 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 159 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 160 | 160 | ||
| 161 | try testFloatToInts(); | 161 | try testIntFromFloats(); |
| 162 | try comptime testFloatToInts(); | 162 | try comptime testIntFromFloats(); |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | fn testFloatToInts() !void { | 165 | fn testIntFromFloats() !void { |
| 166 | const x = @as(i32, 1e4); | 166 | const x = @as(i32, 1e4); |
| 167 | try expect(x == 10000); | 167 | try expect(x == 10000); |
| 168 | const y = @floatToInt(i32, @as(f32, 1e4)); | 168 | const y = @intFromFloat(i32, @as(f32, 1e4)); |
| 169 | try expect(y == 10000); | 169 | try expect(y == 10000); |
| 170 | try expectFloatToInt(f32, 255.1, u8, 255); | 170 | try expectIntFromFloat(f32, 255.1, u8, 255); |
| 171 | try expectFloatToInt(f32, 127.2, i8, 127); | 171 | try expectIntFromFloat(f32, 127.2, i8, 127); |
| 172 | try expectFloatToInt(f32, -128.2, i8, -128); | 172 | try expectIntFromFloat(f32, -128.2, i8, -128); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | fn expectFloatToInt(comptime F: type, f: F, comptime I: type, i: I) !void { | 175 | fn expectIntFromFloat(comptime F: type, f: F, comptime I: type, i: I) !void { |
| 176 | try expect(@floatToInt(I, f) == i); | 176 | try expect(@intFromFloat(I, f) == i); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | test "implicitly cast indirect pointer to maybe-indirect pointer" { | 179 | test "implicitly cast indirect pointer to maybe-indirect pointer" { |
| ... | @@ -280,9 +280,9 @@ test "*usize to *void" { | ... | @@ -280,9 +280,9 @@ test "*usize to *void" { |
| 280 | v.* = {}; | 280 | v.* = {}; |
| 281 | } | 281 | } |
| 282 | 282 | ||
| 283 | test "@intToEnum passed a comptime_int to an enum with one item" { | 283 | test "@enumFromInt passed a comptime_int to an enum with one item" { |
| 284 | const E = enum { A }; | 284 | const E = enum { A }; |
| 285 | const x = @intToEnum(E, 0); | 285 | const x = @enumFromInt(E, 0); |
| 286 | try expect(x == E.A); | 286 | try expect(x == E.A); |
| 287 | } | 287 | } |
| 288 | 288 | ||
| ... | @@ -420,8 +420,8 @@ test "explicit cast from integer to error type" { | ... | @@ -420,8 +420,8 @@ test "explicit cast from integer to error type" { |
| 420 | try comptime testCastIntToErr(error.ItBroke); | 420 | try comptime testCastIntToErr(error.ItBroke); |
| 421 | } | 421 | } |
| 422 | fn testCastIntToErr(err: anyerror) !void { | 422 | fn testCastIntToErr(err: anyerror) !void { |
| 423 | const x = @errorToInt(err); | 423 | const x = @intFromError(err); |
| 424 | const y = @intToError(x); | 424 | const y = @errorFromInt(x); |
| 425 | try expect(error.ItBroke == y); | 425 | try expect(error.ItBroke == y); |
| 426 | } | 426 | } |
| 427 | 427 | ||
| ... | @@ -1093,15 +1093,15 @@ test "peer type resolve array pointer and unknown pointer" { | ... | @@ -1093,15 +1093,15 @@ test "peer type resolve array pointer and unknown pointer" { |
| 1093 | test "comptime float casts" { | 1093 | test "comptime float casts" { |
| 1094 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1094 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1095 | 1095 | ||
| 1096 | const a = @intToFloat(comptime_float, 1); | 1096 | const a = @floatFromInt(comptime_float, 1); |
| 1097 | try expect(a == 1); | 1097 | try expect(a == 1); |
| 1098 | try expect(@TypeOf(a) == comptime_float); | 1098 | try expect(@TypeOf(a) == comptime_float); |
| 1099 | const b = @floatToInt(comptime_int, 2); | 1099 | const b = @intFromFloat(comptime_int, 2); |
| 1100 | try expect(b == 2); | 1100 | try expect(b == 2); |
| 1101 | try expect(@TypeOf(b) == comptime_int); | 1101 | try expect(@TypeOf(b) == comptime_int); |
| 1102 | 1102 | ||
| 1103 | try expectFloatToInt(comptime_int, 1234, i16, 1234); | 1103 | try expectIntFromFloat(comptime_int, 1234, i16, 1234); |
| 1104 | try expectFloatToInt(comptime_float, 12.3, comptime_int, 12); | 1104 | try expectIntFromFloat(comptime_float, 12.3, comptime_int, 12); |
| 1105 | } | 1105 | } |
| 1106 | 1106 | ||
| 1107 | test "pointer reinterpret const float to int" { | 1107 | test "pointer reinterpret const float to int" { |
| ... | @@ -1146,11 +1146,11 @@ test "compile time int to ptr of function" { | ... | @@ -1146,11 +1146,11 @@ test "compile time int to ptr of function" { |
| 1146 | 1146 | ||
| 1147 | // On some architectures function pointers must be aligned. | 1147 | // On some architectures function pointers must be aligned. |
| 1148 | const hardcoded_fn_addr = maxInt(usize) & ~@as(usize, 0xf); | 1148 | const hardcoded_fn_addr = maxInt(usize) & ~@as(usize, 0xf); |
| 1149 | pub const FUNCTION_CONSTANT = @intToPtr(PFN_void, hardcoded_fn_addr); | 1149 | pub const FUNCTION_CONSTANT = @ptrFromInt(PFN_void, hardcoded_fn_addr); |
| 1150 | pub const PFN_void = *const fn (*anyopaque) callconv(.C) void; | 1150 | pub const PFN_void = *const fn (*anyopaque) callconv(.C) void; |
| 1151 | 1151 | ||
| 1152 | fn foobar(func: PFN_void) !void { | 1152 | fn foobar(func: PFN_void) !void { |
| 1153 | try std.testing.expect(@ptrToInt(func) == hardcoded_fn_addr); | 1153 | try std.testing.expect(@intFromPtr(func) == hardcoded_fn_addr); |
| 1154 | } | 1154 | } |
| 1155 | 1155 | ||
| 1156 | test "implicit ptr to *anyopaque" { | 1156 | test "implicit ptr to *anyopaque" { |
| ... | @@ -1285,11 +1285,11 @@ test "implicit cast *[0]T to E![]const u8" { | ... | @@ -1285,11 +1285,11 @@ test "implicit cast *[0]T to E![]const u8" { |
| 1285 | var global_array: [4]u8 = undefined; | 1285 | var global_array: [4]u8 = undefined; |
| 1286 | test "cast from array reference to fn: comptime fn ptr" { | 1286 | test "cast from array reference to fn: comptime fn ptr" { |
| 1287 | const f = @ptrCast(*align(1) const fn () callconv(.C) void, &global_array); | 1287 | const f = @ptrCast(*align(1) const fn () callconv(.C) void, &global_array); |
| 1288 | try expect(@ptrToInt(f) == @ptrToInt(&global_array)); | 1288 | try expect(@intFromPtr(f) == @intFromPtr(&global_array)); |
| 1289 | } | 1289 | } |
| 1290 | test "cast from array reference to fn: runtime fn ptr" { | 1290 | test "cast from array reference to fn: runtime fn ptr" { |
| 1291 | var f = @ptrCast(*align(1) const fn () callconv(.C) void, &global_array); | 1291 | var f = @ptrCast(*align(1) const fn () callconv(.C) void, &global_array); |
| 1292 | try expect(@ptrToInt(f) == @ptrToInt(&global_array)); | 1292 | try expect(@intFromPtr(f) == @intFromPtr(&global_array)); |
| 1293 | } | 1293 | } |
| 1294 | 1294 | ||
| 1295 | test "*const [N]null u8 to ?[]const u8" { | 1295 | test "*const [N]null u8 to ?[]const u8" { |
| ... | @@ -1500,19 +1500,19 @@ test "coerce between pointers of compatible differently-named floats" { | ... | @@ -1500,19 +1500,19 @@ test "coerce between pointers of compatible differently-named floats" { |
| 1500 | } | 1500 | } |
| 1501 | 1501 | ||
| 1502 | test "peer type resolution of const and non-const pointer to array" { | 1502 | test "peer type resolution of const and non-const pointer to array" { |
| 1503 | const a = @intToPtr(*[1024]u8, 42); | 1503 | const a = @ptrFromInt(*[1024]u8, 42); |
| 1504 | const b = @intToPtr(*const [1024]u8, 42); | 1504 | const b = @ptrFromInt(*const [1024]u8, 42); |
| 1505 | try std.testing.expect(@TypeOf(a, b) == *const [1024]u8); | 1505 | try std.testing.expect(@TypeOf(a, b) == *const [1024]u8); |
| 1506 | try std.testing.expect(a == b); | 1506 | try std.testing.expect(a == b); |
| 1507 | } | 1507 | } |
| 1508 | 1508 | ||
| 1509 | test "floatToInt to zero-bit int" { | 1509 | test "intFromFloat to zero-bit int" { |
| 1510 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 1510 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 1511 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 1511 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 1512 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 1512 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 1513 | 1513 | ||
| 1514 | const a: f32 = 0.0; | 1514 | const a: f32 = 0.0; |
| 1515 | try comptime std.testing.expect(@floatToInt(u0, a) == 0); | 1515 | try comptime std.testing.expect(@intFromFloat(u0, a) == 0); |
| 1516 | } | 1516 | } |
| 1517 | 1517 | ||
| 1518 | test "peer type resolution of function pointer and function body" { | 1518 | test "peer type resolution of function pointer and function body" { |
| ... | @@ -1560,9 +1560,9 @@ test "optional pointer coerced to optional allowzero pointer" { | ... | @@ -1560,9 +1560,9 @@ test "optional pointer coerced to optional allowzero pointer" { |
| 1560 | 1560 | ||
| 1561 | var p: ?*u32 = undefined; | 1561 | var p: ?*u32 = undefined; |
| 1562 | var q: ?*allowzero u32 = undefined; | 1562 | var q: ?*allowzero u32 = undefined; |
| 1563 | p = @intToPtr(*u32, 4); | 1563 | p = @ptrFromInt(*u32, 4); |
| 1564 | q = p; | 1564 | q = p; |
| 1565 | try expect(@ptrToInt(q.?) == 4); | 1565 | try expect(@intFromPtr(q.?) == 4); |
| 1566 | } | 1566 | } |
| 1567 | 1567 | ||
| 1568 | test "single item pointer to pointer to array to slice" { | 1568 | test "single item pointer to pointer to array to slice" { |
| ... | @@ -1623,8 +1623,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" | ... | @@ -1623,8 +1623,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" |
| 1623 | 1623 | ||
| 1624 | const S = struct { | 1624 | const S = struct { |
| 1625 | fn doTheTest(comptime T: type, comptime s: T) !void { | 1625 | fn doTheTest(comptime T: type, comptime s: T) !void { |
| 1626 | var a: [:s]const T = @intToPtr(*const [2:s]T, 0x1000); | 1626 | var a: [:s]const T = @ptrFromInt(*const [2:s]T, 0x1000); |
| 1627 | var b: []T = @intToPtr(*[3]T, 0x2000); | 1627 | var b: []T = @ptrFromInt(*[3]T, 0x2000); |
| 1628 | comptime assert(@TypeOf(a, b) == []const T); | 1628 | comptime assert(@TypeOf(a, b) == []const T); |
| 1629 | comptime assert(@TypeOf(b, a) == []const T); | 1629 | comptime assert(@TypeOf(b, a) == []const T); |
| 1630 | 1630 | ||
| ... | @@ -1634,8 +1634,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" | ... | @@ -1634,8 +1634,8 @@ test "peer type resolution: const sentinel slice and mutable non-sentinel slice" |
| 1634 | 1634 | ||
| 1635 | const R = @TypeOf(r1); | 1635 | const R = @TypeOf(r1); |
| 1636 | 1636 | ||
| 1637 | try expectEqual(@as(R, @intToPtr(*const [2:s]T, 0x1000)), r1); | 1637 | try expectEqual(@as(R, @ptrFromInt(*const [2:s]T, 0x1000)), r1); |
| 1638 | try expectEqual(@as(R, @intToPtr(*const [3]T, 0x2000)), r2); | 1638 | try expectEqual(@as(R, @ptrFromInt(*const [3]T, 0x2000)), r2); |
| 1639 | } | 1639 | } |
| 1640 | }; | 1640 | }; |
| 1641 | 1641 | ||
| ... | @@ -1815,7 +1815,7 @@ test "peer type resolution: three-way resolution combines error set and optional | ... | @@ -1815,7 +1815,7 @@ test "peer type resolution: three-way resolution combines error set and optional |
| 1815 | 1815 | ||
| 1816 | const E = error{Foo}; | 1816 | const E = error{Foo}; |
| 1817 | var a: E = error.Foo; | 1817 | var a: E = error.Foo; |
| 1818 | var b: *const [5:0]u8 = @intToPtr(*const [5:0]u8, 0x1000); | 1818 | var b: *const [5:0]u8 = @ptrFromInt(*const [5:0]u8, 0x1000); |
| 1819 | var c: ?[*:0]u8 = null; | 1819 | var c: ?[*:0]u8 = null; |
| 1820 | comptime assert(@TypeOf(a, b, c) == E!?[*:0]const u8); | 1820 | comptime assert(@TypeOf(a, b, c) == E!?[*:0]const u8); |
| 1821 | comptime assert(@TypeOf(a, c, b) == E!?[*:0]const u8); | 1821 | comptime assert(@TypeOf(a, c, b) == E!?[*:0]const u8); |
| ... | @@ -1844,7 +1844,7 @@ test "peer type resolution: three-way resolution combines error set and optional | ... | @@ -1844,7 +1844,7 @@ test "peer type resolution: three-way resolution combines error set and optional |
| 1844 | const T = @TypeOf(r1); | 1844 | const T = @TypeOf(r1); |
| 1845 | 1845 | ||
| 1846 | try expectEqual(@as(T, error.Foo), r1); | 1846 | try expectEqual(@as(T, error.Foo), r1); |
| 1847 | try expectEqual(@as(T, @intToPtr([*:0]u8, 0x1000)), r2); | 1847 | try expectEqual(@as(T, @ptrFromInt([*:0]u8, 0x1000)), r2); |
| 1848 | try expectEqual(@as(T, null), r3); | 1848 | try expectEqual(@as(T, null), r3); |
| 1849 | } | 1849 | } |
| 1850 | 1850 |
test/behavior/comptime_memory.zig+20-20| ... | @@ -192,9 +192,9 @@ test "basic pointer preservation" { | ... | @@ -192,9 +192,9 @@ test "basic pointer preservation" { |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | comptime { | 194 | comptime { |
| 195 | const lazy_address = @ptrToInt(&imports.global_u32); | 195 | const lazy_address = @intFromPtr(&imports.global_u32); |
| 196 | try testing.expectEqual(@ptrToInt(&imports.global_u32), lazy_address); | 196 | try testing.expectEqual(@intFromPtr(&imports.global_u32), lazy_address); |
| 197 | try testing.expectEqual(&imports.global_u32, @intToPtr(*u32, lazy_address)); | 197 | try testing.expectEqual(&imports.global_u32, @ptrFromInt(*u32, lazy_address)); |
| 198 | } | 198 | } |
| 199 | } | 199 | } |
| 200 | 200 | ||
| ... | @@ -251,7 +251,7 @@ test "shuffle chunks of linker value" { | ... | @@ -251,7 +251,7 @@ test "shuffle chunks of linker value" { |
| 251 | return error.SkipZigTest; | 251 | return error.SkipZigTest; |
| 252 | } | 252 | } |
| 253 | 253 | ||
| 254 | const lazy_address = @ptrToInt(&imports.global_u32); | 254 | const lazy_address = @intFromPtr(&imports.global_u32); |
| 255 | const shuffled1_rt = shuffle(lazy_address, Bits, ShuffledBits); | 255 | const shuffled1_rt = shuffle(lazy_address, Bits, ShuffledBits); |
| 256 | const unshuffled1_rt = shuffle(shuffled1_rt, ShuffledBits, Bits); | 256 | const unshuffled1_rt = shuffle(shuffled1_rt, ShuffledBits, Bits); |
| 257 | try testing.expectEqual(lazy_address, unshuffled1_rt); | 257 | try testing.expectEqual(lazy_address, unshuffled1_rt); |
| ... | @@ -271,8 +271,8 @@ test "dance on linker values" { | ... | @@ -271,8 +271,8 @@ test "dance on linker values" { |
| 271 | 271 | ||
| 272 | comptime { | 272 | comptime { |
| 273 | var arr: [2]usize = undefined; | 273 | var arr: [2]usize = undefined; |
| 274 | arr[0] = @ptrToInt(&imports.global_u32); | 274 | arr[0] = @intFromPtr(&imports.global_u32); |
| 275 | arr[1] = @ptrToInt(&imports.global_u32); | 275 | arr[1] = @intFromPtr(&imports.global_u32); |
| 276 | 276 | ||
| 277 | const weird_ptr = @ptrCast([*]Bits, @ptrCast([*]u8, &arr) + @sizeOf(usize) - 3); | 277 | const weird_ptr = @ptrCast([*]Bits, @ptrCast([*]u8, &arr) + @sizeOf(usize) - 3); |
| 278 | try doTypePunBitsTest(&weird_ptr[0]); | 278 | try doTypePunBitsTest(&weird_ptr[0]); |
| ... | @@ -290,7 +290,7 @@ test "dance on linker values" { | ... | @@ -290,7 +290,7 @@ test "dance on linker values" { |
| 290 | rebuilt_bytes[i] = arr_bytes[1][i]; | 290 | rebuilt_bytes[i] = arr_bytes[1][i]; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | try testing.expectEqual(&imports.global_u32, @intToPtr(*u32, @bitCast(usize, rebuilt_bytes))); | 293 | try testing.expectEqual(&imports.global_u32, @ptrFromInt(*u32, @bitCast(usize, rebuilt_bytes))); |
| 294 | } | 294 | } |
| 295 | } | 295 | } |
| 296 | 296 | ||
| ... | @@ -309,14 +309,14 @@ test "offset array ptr by element size" { | ... | @@ -309,14 +309,14 @@ test "offset array ptr by element size" { |
| 309 | .{ .x = bigToNativeEndian(u32, 0x03070b0f) }, | 309 | .{ .x = bigToNativeEndian(u32, 0x03070b0f) }, |
| 310 | }; | 310 | }; |
| 311 | 311 | ||
| 312 | const address = @ptrToInt(&arr); | 312 | const address = @intFromPtr(&arr); |
| 313 | try testing.expectEqual(@ptrToInt(&arr[0]), address); | 313 | try testing.expectEqual(@intFromPtr(&arr[0]), address); |
| 314 | try testing.expectEqual(@ptrToInt(&arr[0]) + 10, address + 10); | 314 | try testing.expectEqual(@intFromPtr(&arr[0]) + 10, address + 10); |
| 315 | try testing.expectEqual(@ptrToInt(&arr[1]), address + @sizeOf(VirtualStruct)); | 315 | try testing.expectEqual(@intFromPtr(&arr[1]), address + @sizeOf(VirtualStruct)); |
| 316 | try testing.expectEqual(@ptrToInt(&arr[2]), address + 2 * @sizeOf(VirtualStruct)); | 316 | try testing.expectEqual(@intFromPtr(&arr[2]), address + 2 * @sizeOf(VirtualStruct)); |
| 317 | try testing.expectEqual(@ptrToInt(&arr[3]), address + @sizeOf(VirtualStruct) * 3); | 317 | try testing.expectEqual(@intFromPtr(&arr[3]), address + @sizeOf(VirtualStruct) * 3); |
| 318 | 318 | ||
| 319 | const secondElement = @intToPtr(*VirtualStruct, @ptrToInt(&arr[0]) + 2 * @sizeOf(VirtualStruct)); | 319 | const secondElement = @ptrFromInt(*VirtualStruct, @intFromPtr(&arr[0]) + 2 * @sizeOf(VirtualStruct)); |
| 320 | try testing.expectEqual(bigToNativeEndian(u32, 0x02060a0e), secondElement.x); | 320 | try testing.expectEqual(bigToNativeEndian(u32, 0x02060a0e), secondElement.x); |
| 321 | } | 321 | } |
| 322 | } | 322 | } |
| ... | @@ -331,18 +331,18 @@ test "offset instance by field size" { | ... | @@ -331,18 +331,18 @@ test "offset instance by field size" { |
| 331 | const VirtualStruct = struct { x: u32, y: u32, z: u32, w: u32 }; | 331 | const VirtualStruct = struct { x: u32, y: u32, z: u32, w: u32 }; |
| 332 | var inst = VirtualStruct{ .x = 0, .y = 1, .z = 2, .w = 3 }; | 332 | var inst = VirtualStruct{ .x = 0, .y = 1, .z = 2, .w = 3 }; |
| 333 | 333 | ||
| 334 | var ptr = @ptrToInt(&inst); | 334 | var ptr = @intFromPtr(&inst); |
| 335 | ptr -= 4; | 335 | ptr -= 4; |
| 336 | ptr += @offsetOf(VirtualStruct, "x"); | 336 | ptr += @offsetOf(VirtualStruct, "x"); |
| 337 | try testing.expectEqual(@as(u32, 0), @intToPtr([*]u32, ptr)[1]); | 337 | try testing.expectEqual(@as(u32, 0), @ptrFromInt([*]u32, ptr)[1]); |
| 338 | ptr -= @offsetOf(VirtualStruct, "x"); | 338 | ptr -= @offsetOf(VirtualStruct, "x"); |
| 339 | ptr += @offsetOf(VirtualStruct, "y"); | 339 | ptr += @offsetOf(VirtualStruct, "y"); |
| 340 | try testing.expectEqual(@as(u32, 1), @intToPtr([*]u32, ptr)[1]); | 340 | try testing.expectEqual(@as(u32, 1), @ptrFromInt([*]u32, ptr)[1]); |
| 341 | ptr = ptr - @offsetOf(VirtualStruct, "y") + @offsetOf(VirtualStruct, "z"); | 341 | ptr = ptr - @offsetOf(VirtualStruct, "y") + @offsetOf(VirtualStruct, "z"); |
| 342 | try testing.expectEqual(@as(u32, 2), @intToPtr([*]u32, ptr)[1]); | 342 | try testing.expectEqual(@as(u32, 2), @ptrFromInt([*]u32, ptr)[1]); |
| 343 | ptr = @ptrToInt(&inst.z) - 4 - @offsetOf(VirtualStruct, "z"); | 343 | ptr = @intFromPtr(&inst.z) - 4 - @offsetOf(VirtualStruct, "z"); |
| 344 | ptr += @offsetOf(VirtualStruct, "w"); | 344 | ptr += @offsetOf(VirtualStruct, "w"); |
| 345 | try testing.expectEqual(@as(u32, 3), @intToPtr(*u32, ptr + 4).*); | 345 | try testing.expectEqual(@as(u32, 3), @ptrFromInt(*u32, ptr + 4).*); |
| 346 | } | 346 | } |
| 347 | } | 347 | } |
| 348 | 348 |
test/behavior/enum.zig+30-30| ... | @@ -8,7 +8,7 @@ const Tag = std.meta.Tag; | ... | @@ -8,7 +8,7 @@ const Tag = std.meta.Tag; |
| 8 | const Number = enum { Zero, One, Two, Three, Four }; | 8 | const Number = enum { Zero, One, Two, Three, Four }; |
| 9 | 9 | ||
| 10 | fn shouldEqual(n: Number, expected: u3) !void { | 10 | fn shouldEqual(n: Number, expected: u3) !void { |
| 11 | try expect(@enumToInt(n) == expected); | 11 | try expect(@intFromEnum(n) == expected); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | test "enum to int" { | 14 | test "enum to int" { |
| ... | @@ -20,7 +20,7 @@ test "enum to int" { | ... | @@ -20,7 +20,7 @@ test "enum to int" { |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | fn testIntToEnumEval(x: i32) !void { | 22 | fn testIntToEnumEval(x: i32) !void { |
| 23 | try expect(@intToEnum(IntToEnumNumber, x) == IntToEnumNumber.Three); | 23 | try expect(@enumFromInt(IntToEnumNumber, x) == IntToEnumNumber.Three); |
| 24 | } | 24 | } |
| 25 | const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; | 25 | const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; |
| 26 | 26 | ||
| ... | @@ -597,7 +597,7 @@ const MultipleChoice = enum(u32) { | ... | @@ -597,7 +597,7 @@ const MultipleChoice = enum(u32) { |
| 597 | }; | 597 | }; |
| 598 | 598 | ||
| 599 | fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { | 599 | fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { |
| 600 | try expect(@enumToInt(x) == 60); | 600 | try expect(@intFromEnum(x) == 60); |
| 601 | try expect(1234 == switch (x) { | 601 | try expect(1234 == switch (x) { |
| 602 | MultipleChoice.A => 1, | 602 | MultipleChoice.A => 1, |
| 603 | MultipleChoice.B => 2, | 603 | MultipleChoice.B => 2, |
| ... | @@ -629,7 +629,7 @@ test "non-exhaustive enum" { | ... | @@ -629,7 +629,7 @@ test "non-exhaustive enum" { |
| 629 | .b => true, | 629 | .b => true, |
| 630 | _ => false, | 630 | _ => false, |
| 631 | }); | 631 | }); |
| 632 | e = @intToEnum(E, 12); | 632 | e = @enumFromInt(E, 12); |
| 633 | try expect(switch (e) { | 633 | try expect(switch (e) { |
| 634 | .a => false, | 634 | .a => false, |
| 635 | .b => false, | 635 | .b => false, |
| ... | @@ -648,10 +648,10 @@ test "non-exhaustive enum" { | ... | @@ -648,10 +648,10 @@ test "non-exhaustive enum" { |
| 648 | }); | 648 | }); |
| 649 | 649 | ||
| 650 | try expect(@typeInfo(E).Enum.fields.len == 2); | 650 | try expect(@typeInfo(E).Enum.fields.len == 2); |
| 651 | e = @intToEnum(E, 12); | 651 | e = @enumFromInt(E, 12); |
| 652 | try expect(@enumToInt(e) == 12); | 652 | try expect(@intFromEnum(e) == 12); |
| 653 | e = @intToEnum(E, y); | 653 | e = @enumFromInt(E, y); |
| 654 | try expect(@enumToInt(e) == 52); | 654 | try expect(@intFromEnum(e) == 52); |
| 655 | try expect(@typeInfo(E).Enum.is_exhaustive == false); | 655 | try expect(@typeInfo(E).Enum.is_exhaustive == false); |
| 656 | } | 656 | } |
| 657 | }; | 657 | }; |
| ... | @@ -666,11 +666,11 @@ test "empty non-exhaustive enum" { | ... | @@ -666,11 +666,11 @@ test "empty non-exhaustive enum" { |
| 666 | const E = enum(u8) { _ }; | 666 | const E = enum(u8) { _ }; |
| 667 | 667 | ||
| 668 | fn doTheTest(y: u8) !void { | 668 | fn doTheTest(y: u8) !void { |
| 669 | var e = @intToEnum(E, y); | 669 | var e = @enumFromInt(E, y); |
| 670 | try expect(switch (e) { | 670 | try expect(switch (e) { |
| 671 | _ => true, | 671 | _ => true, |
| 672 | }); | 672 | }); |
| 673 | try expect(@enumToInt(e) == y); | 673 | try expect(@intFromEnum(e) == y); |
| 674 | 674 | ||
| 675 | try expect(@typeInfo(E).Enum.fields.len == 0); | 675 | try expect(@typeInfo(E).Enum.fields.len == 0); |
| 676 | try expect(@typeInfo(E).Enum.is_exhaustive == false); | 676 | try expect(@typeInfo(E).Enum.is_exhaustive == false); |
| ... | @@ -693,7 +693,7 @@ test "single field non-exhaustive enum" { | ... | @@ -693,7 +693,7 @@ test "single field non-exhaustive enum" { |
| 693 | .a => true, | 693 | .a => true, |
| 694 | _ => false, | 694 | _ => false, |
| 695 | }); | 695 | }); |
| 696 | e = @intToEnum(E, 12); | 696 | e = @enumFromInt(E, 12); |
| 697 | try expect(switch (e) { | 697 | try expect(switch (e) { |
| 698 | .a => false, | 698 | .a => false, |
| 699 | _ => true, | 699 | _ => true, |
| ... | @@ -709,7 +709,7 @@ test "single field non-exhaustive enum" { | ... | @@ -709,7 +709,7 @@ test "single field non-exhaustive enum" { |
| 709 | else => false, | 709 | else => false, |
| 710 | }); | 710 | }); |
| 711 | 711 | ||
| 712 | try expect(@enumToInt(@intToEnum(E, y)) == y); | 712 | try expect(@intFromEnum(@enumFromInt(E, y)) == y); |
| 713 | try expect(@typeInfo(E).Enum.fields.len == 1); | 713 | try expect(@typeInfo(E).Enum.fields.len == 1); |
| 714 | try expect(@typeInfo(E).Enum.is_exhaustive == false); | 714 | try expect(@typeInfo(E).Enum.is_exhaustive == false); |
| 715 | } | 715 | } |
| ... | @@ -725,7 +725,7 @@ const EnumWithTagValues = enum(u4) { | ... | @@ -725,7 +725,7 @@ const EnumWithTagValues = enum(u4) { |
| 725 | D = 1 << 3, | 725 | D = 1 << 3, |
| 726 | }; | 726 | }; |
| 727 | test "enum with tag values don't require parens" { | 727 | test "enum with tag values don't require parens" { |
| 728 | try expect(@enumToInt(EnumWithTagValues.C) == 0b0100); | 728 | try expect(@intFromEnum(EnumWithTagValues.C) == 0b0100); |
| 729 | } | 729 | } |
| 730 | 730 | ||
| 731 | const MultipleChoice2 = enum(u32) { | 731 | const MultipleChoice2 = enum(u32) { |
| ... | @@ -741,8 +741,8 @@ const MultipleChoice2 = enum(u32) { | ... | @@ -741,8 +741,8 @@ const MultipleChoice2 = enum(u32) { |
| 741 | }; | 741 | }; |
| 742 | 742 | ||
| 743 | test "cast integer literal to enum" { | 743 | test "cast integer literal to enum" { |
| 744 | try expect(@intToEnum(MultipleChoice2, 0) == MultipleChoice2.Unspecified1); | 744 | try expect(@enumFromInt(MultipleChoice2, 0) == MultipleChoice2.Unspecified1); |
| 745 | try expect(@intToEnum(MultipleChoice2, 40) == MultipleChoice2.B); | 745 | try expect(@enumFromInt(MultipleChoice2, 40) == MultipleChoice2.B); |
| 746 | } | 746 | } |
| 747 | 747 | ||
| 748 | test "enum with specified and unspecified tag values" { | 748 | test "enum with specified and unspecified tag values" { |
| ... | @@ -754,7 +754,7 @@ test "enum with specified and unspecified tag values" { | ... | @@ -754,7 +754,7 @@ test "enum with specified and unspecified tag values" { |
| 754 | } | 754 | } |
| 755 | 755 | ||
| 756 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { | 756 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 757 | try expect(@enumToInt(x) == 1000); | 757 | try expect(@intFromEnum(x) == 1000); |
| 758 | try expect(1234 == switch (x) { | 758 | try expect(1234 == switch (x) { |
| 759 | MultipleChoice2.A => 1, | 759 | MultipleChoice2.A => 1, |
| 760 | MultipleChoice2.B => 2, | 760 | MultipleChoice2.B => 2, |
| ... | @@ -790,7 +790,7 @@ test "casting enum to its tag type" { | ... | @@ -790,7 +790,7 @@ test "casting enum to its tag type" { |
| 790 | } | 790 | } |
| 791 | 791 | ||
| 792 | fn testCastEnumTag(value: Small2) !void { | 792 | fn testCastEnumTag(value: Small2) !void { |
| 793 | try expect(@enumToInt(value) == 1); | 793 | try expect(@intFromEnum(value) == 1); |
| 794 | } | 794 | } |
| 795 | 795 | ||
| 796 | test "enum with 1 field but explicit tag type should still have the tag type" { | 796 | test "enum with 1 field but explicit tag type should still have the tag type" { |
| ... | @@ -807,27 +807,27 @@ test "signed integer as enum tag" { | ... | @@ -807,27 +807,27 @@ test "signed integer as enum tag" { |
| 807 | A2 = 1, | 807 | A2 = 1, |
| 808 | }; | 808 | }; |
| 809 | 809 | ||
| 810 | try expect(@enumToInt(SignedEnum.A0) == -1); | 810 | try expect(@intFromEnum(SignedEnum.A0) == -1); |
| 811 | try expect(@enumToInt(SignedEnum.A1) == 0); | 811 | try expect(@intFromEnum(SignedEnum.A1) == 0); |
| 812 | try expect(@enumToInt(SignedEnum.A2) == 1); | 812 | try expect(@intFromEnum(SignedEnum.A2) == 1); |
| 813 | } | 813 | } |
| 814 | 814 | ||
| 815 | test "enum with one member and custom tag type" { | 815 | test "enum with one member and custom tag type" { |
| 816 | const E = enum(u2) { | 816 | const E = enum(u2) { |
| 817 | One, | 817 | One, |
| 818 | }; | 818 | }; |
| 819 | try expect(@enumToInt(E.One) == 0); | 819 | try expect(@intFromEnum(E.One) == 0); |
| 820 | const E2 = enum(u2) { | 820 | const E2 = enum(u2) { |
| 821 | One = 2, | 821 | One = 2, |
| 822 | }; | 822 | }; |
| 823 | try expect(@enumToInt(E2.One) == 2); | 823 | try expect(@intFromEnum(E2.One) == 2); |
| 824 | } | 824 | } |
| 825 | 825 | ||
| 826 | test "enum with one member and u1 tag type @enumToInt" { | 826 | test "enum with one member and u1 tag type @intFromEnum" { |
| 827 | const Enum = enum(u1) { | 827 | const Enum = enum(u1) { |
| 828 | Test, | 828 | Test, |
| 829 | }; | 829 | }; |
| 830 | try expect(@enumToInt(Enum.Test) == 0); | 830 | try expect(@intFromEnum(Enum.Test) == 0); |
| 831 | } | 831 | } |
| 832 | 832 | ||
| 833 | test "enum with comptime_int tag type" { | 833 | test "enum with comptime_int tag type" { |
| ... | @@ -901,9 +901,9 @@ test "enum value allocation" { | ... | @@ -901,9 +901,9 @@ test "enum value allocation" { |
| 901 | A2, | 901 | A2, |
| 902 | }; | 902 | }; |
| 903 | 903 | ||
| 904 | try expect(@enumToInt(LargeEnum.A0) == 0x80000000); | 904 | try expect(@intFromEnum(LargeEnum.A0) == 0x80000000); |
| 905 | try expect(@enumToInt(LargeEnum.A1) == 0x80000001); | 905 | try expect(@intFromEnum(LargeEnum.A1) == 0x80000001); |
| 906 | try expect(@enumToInt(LargeEnum.A2) == 0x80000002); | 906 | try expect(@intFromEnum(LargeEnum.A2) == 0x80000002); |
| 907 | } | 907 | } |
| 908 | 908 | ||
| 909 | test "enum literal casting to tagged union" { | 909 | test "enum literal casting to tagged union" { |
| ... | @@ -1183,7 +1183,7 @@ test "Non-exhaustive enum with nonstandard int size behaves correctly" { | ... | @@ -1183,7 +1183,7 @@ test "Non-exhaustive enum with nonstandard int size behaves correctly" { |
| 1183 | test "runtime int to enum with one possible value" { | 1183 | test "runtime int to enum with one possible value" { |
| 1184 | const E = enum { one }; | 1184 | const E = enum { one }; |
| 1185 | var runtime: usize = 0; | 1185 | var runtime: usize = 0; |
| 1186 | if (@intToEnum(E, runtime) != .one) { | 1186 | if (@enumFromInt(E, runtime) != .one) { |
| 1187 | @compileError("test failed"); | 1187 | @compileError("test failed"); |
| 1188 | } | 1188 | } |
| 1189 | } | 1189 | } |
| ... | @@ -1194,6 +1194,6 @@ test "enum tag from a local variable" { | ... | @@ -1194,6 +1194,6 @@ test "enum tag from a local variable" { |
| 1194 | return enum(Inner) { _ }; | 1194 | return enum(Inner) { _ }; |
| 1195 | } | 1195 | } |
| 1196 | }; | 1196 | }; |
| 1197 | const i = @intToEnum(S.Int(u32), 0); | 1197 | const i = @enumFromInt(S.Int(u32), 0); |
| 1198 | try std.testing.expect(@enumToInt(i) == 0); | 1198 | try std.testing.expect(@intFromEnum(i) == 0); |
| 1199 | } | 1199 | } |
test/behavior/error.zig+5-5| ... | @@ -16,8 +16,8 @@ fn expectError(expected_err: anyerror, observed_err_union: anytype) !void { | ... | @@ -16,8 +16,8 @@ fn expectError(expected_err: anyerror, observed_err_union: anytype) !void { |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | test "error values" { | 18 | test "error values" { |
| 19 | const a = @errorToInt(error.err1); | 19 | const a = @intFromError(error.err1); |
| 20 | const b = @errorToInt(error.err2); | 20 | const b = @intFromError(error.err2); |
| 21 | try expect(a != b); | 21 | try expect(a != b); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| ... | @@ -259,14 +259,14 @@ fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) !void { | ... | @@ -259,14 +259,14 @@ fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) !void { |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | test "comptime err to int of error set with only 1 possible value" { | 261 | test "comptime err to int of error set with only 1 possible value" { |
| 262 | testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A)); | 262 | testErrToIntWithOnePossibleValue(error.A, @intFromError(error.A)); |
| 263 | comptime testErrToIntWithOnePossibleValue(error.A, @errorToInt(error.A)); | 263 | comptime testErrToIntWithOnePossibleValue(error.A, @intFromError(error.A)); |
| 264 | } | 264 | } |
| 265 | fn testErrToIntWithOnePossibleValue( | 265 | fn testErrToIntWithOnePossibleValue( |
| 266 | x: error{A}, | 266 | x: error{A}, |
| 267 | comptime value: u32, | 267 | comptime value: u32, |
| 268 | ) void { | 268 | ) void { |
| 269 | if (@errorToInt(x) != value) { | 269 | if (@intFromError(x) != value) { |
| 270 | @compileError("bad"); | 270 | @compileError("bad"); |
| 271 | } | 271 | } |
| 272 | } | 272 | } |
test/behavior/eval.zig+1-1| ... | @@ -1372,7 +1372,7 @@ test "lazy value is resolved as slice operand" { | ... | @@ -1372,7 +1372,7 @@ test "lazy value is resolved as slice operand" { |
| 1372 | 1372 | ||
| 1373 | const ptr1 = a[0..@sizeOf(A)]; | 1373 | const ptr1 = a[0..@sizeOf(A)]; |
| 1374 | const ptr2 = @ptrCast([*]u8, &a)[0..@sizeOf(A)]; | 1374 | const ptr2 = @ptrCast([*]u8, &a)[0..@sizeOf(A)]; |
| 1375 | try expect(@ptrToInt(ptr1) == @ptrToInt(ptr2)); | 1375 | try expect(@intFromPtr(ptr1) == @intFromPtr(ptr2)); |
| 1376 | try expect(ptr1.len == ptr2.len); | 1376 | try expect(ptr1.len == ptr2.len); |
| 1377 | } | 1377 | } |
| 1378 | 1378 |
test/behavior/export.zig+1-1| ... | @@ -7,7 +7,7 @@ const builtin = @import("builtin"); | ... | @@ -7,7 +7,7 @@ const builtin = @import("builtin"); |
| 7 | 7 | ||
| 8 | // can't really run this test but we can make sure it has no compile error | 8 | // can't really run this test but we can make sure it has no compile error |
| 9 | // and generates code | 9 | // and generates code |
| 10 | const vram = @intToPtr([*]volatile u8, 0x20000000)[0..0x8000]; | 10 | const vram = @ptrFromInt([*]volatile u8, 0x20000000)[0..0x8000]; |
| 11 | export fn writeToVRam() void { | 11 | export fn writeToVRam() void { |
| 12 | vram[0] = 'X'; | 12 | vram[0] = 'X'; |
| 13 | } | 13 | } |
test/behavior/export_self_referential_type_info.zig+1-1| ... | @@ -1 +1 @@ | ... | @@ -1 +1 @@ |
| 1 | export const self_referential_type_info: c_int = @boolToInt(@typeInfo(@This()).Struct.is_tuple); | 1 | export const self_referential_type_info: c_int = @intFromBool(@typeInfo(@This()).Struct.is_tuple); |
test/behavior/floatop.zig+2-2| ... | @@ -89,12 +89,12 @@ fn testDifferentSizedFloatComparisons() !void { | ... | @@ -89,12 +89,12 @@ fn testDifferentSizedFloatComparisons() !void { |
| 89 | // } | 89 | // } |
| 90 | //} | 90 | //} |
| 91 | 91 | ||
| 92 | test "negative f128 floatToInt at compile-time" { | 92 | test "negative f128 intFromFloat at compile-time" { |
| 93 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 93 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 94 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 94 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 95 | 95 | ||
| 96 | const a: f128 = -2; | 96 | const a: f128 = -2; |
| 97 | var b = @floatToInt(i64, a); | 97 | var b = @intFromFloat(i64, a); |
| 98 | try expect(@as(i64, -2) == b); | 98 | try expect(@as(i64, -2) == b); |
| 99 | } | 99 | } |
| 100 | 100 |
test/behavior/fn_in_struct_in_comptime.zig+2-2| ... | @@ -5,7 +5,7 @@ fn get_foo() fn (*u8) usize { | ... | @@ -5,7 +5,7 @@ fn get_foo() fn (*u8) usize { |
| 5 | comptime { | 5 | comptime { |
| 6 | return struct { | 6 | return struct { |
| 7 | fn func(ptr: *u8) usize { | 7 | fn func(ptr: *u8) usize { |
| 8 | var u = @ptrToInt(ptr); | 8 | var u = @intFromPtr(ptr); |
| 9 | return u; | 9 | return u; |
| 10 | } | 10 | } |
| 11 | }.func; | 11 | }.func; |
| ... | @@ -14,5 +14,5 @@ fn get_foo() fn (*u8) usize { | ... | @@ -14,5 +14,5 @@ fn get_foo() fn (*u8) usize { |
| 14 | 14 | ||
| 15 | test "define a function in an anonymous struct in comptime" { | 15 | test "define a function in an anonymous struct in comptime" { |
| 16 | const foo = get_foo(); | 16 | const foo = get_foo(); |
| 17 | try expect(foo(@intToPtr(*u8, 12345)) == 12345); | 17 | try expect(foo(@ptrFromInt(*u8, 12345)) == 12345); |
| 18 | } | 18 | } |
test/behavior/generics.zig+3-3| ... | @@ -267,7 +267,7 @@ test "generic function instantiation turns into comptime call" { | ... | @@ -267,7 +267,7 @@ test "generic function instantiation turns into comptime call" { |
| 267 | .Enum => std.builtin.Type.EnumField, | 267 | .Enum => std.builtin.Type.EnumField, |
| 268 | else => void, | 268 | else => void, |
| 269 | } { | 269 | } { |
| 270 | return @typeInfo(T).Enum.fields[@enumToInt(field)]; | 270 | return @typeInfo(T).Enum.fields[@intFromEnum(field)]; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | pub fn FieldEnum(comptime T: type) type { | 273 | pub fn FieldEnum(comptime T: type) type { |
| ... | @@ -425,10 +425,10 @@ test "null sentinel pointer passed as generic argument" { | ... | @@ -425,10 +425,10 @@ test "null sentinel pointer passed as generic argument" { |
| 425 | 425 | ||
| 426 | const S = struct { | 426 | const S = struct { |
| 427 | fn doTheTest(a: anytype) !void { | 427 | fn doTheTest(a: anytype) !void { |
| 428 | try std.testing.expect(@ptrToInt(a) == 8); | 428 | try std.testing.expect(@intFromPtr(a) == 8); |
| 429 | } | 429 | } |
| 430 | }; | 430 | }; |
| 431 | try S.doTheTest((@intToPtr([*:null]const [*c]const u8, 8))); | 431 | try S.doTheTest((@ptrFromInt([*:null]const [*c]const u8, 8))); |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | test "generic function passed as comptime argument" { | 434 | test "generic function passed as comptime argument" { |
test/behavior/inline_switch.zig+1-1| ... | @@ -103,7 +103,7 @@ test "inline else enum" { | ... | @@ -103,7 +103,7 @@ test "inline else enum" { |
| 103 | var a: E2 = .a; | 103 | var a: E2 = .a; |
| 104 | switch (a) { | 104 | switch (a) { |
| 105 | .a, .b => {}, | 105 | .a, .b => {}, |
| 106 | inline else => |val| comptime if (@enumToInt(val) < 4) @compileError("bad"), | 106 | inline else => |val| comptime if (@intFromEnum(val) < 4) @compileError("bad"), |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 |
test/behavior/inttoptr.zig deleted-48| ... | @@ -1,48 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const expectEqual = std.testing.expectEqual; | ||
| 4 | |||
| 5 | test "casting integer address to function pointer" { | ||
| 6 | addressToFunction(); | ||
| 7 | comptime addressToFunction(); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn addressToFunction() void { | ||
| 11 | var addr: usize = 0xdeadbee0; | ||
| 12 | _ = @intToPtr(*const fn () void, addr); | ||
| 13 | } | ||
| 14 | |||
| 15 | test "mutate through ptr initialized with constant intToPtr value" { | ||
| 16 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 18 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 19 | |||
| 20 | forceCompilerAnalyzeBranchHardCodedPtrDereference(false); | ||
| 21 | } | ||
| 22 | |||
| 23 | fn forceCompilerAnalyzeBranchHardCodedPtrDereference(x: bool) void { | ||
| 24 | const hardCodedP = @intToPtr(*volatile u8, 0xdeadbeef); | ||
| 25 | if (x) { | ||
| 26 | hardCodedP.* = hardCodedP.* | 10; | ||
| 27 | } else { | ||
| 28 | return; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | test "@intToPtr creates null pointer" { | ||
| 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 35 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 36 | |||
| 37 | const ptr = @intToPtr(?*u32, 0); | ||
| 38 | try expectEqual(@as(?*u32, null), ptr); | ||
| 39 | } | ||
| 40 | |||
| 41 | test "@intToPtr creates allowzero zero pointer" { | ||
| 42 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 43 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 44 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 45 | |||
| 46 | const ptr = @intToPtr(*allowzero u32, 0); | ||
| 47 | try expectEqual(@as(usize, 0), @ptrToInt(ptr)); | ||
| 48 | } | ||
test/behavior/packed-struct.zig+2-2| ... | @@ -375,7 +375,7 @@ test "load pointer from packed struct" { | ... | @@ -375,7 +375,7 @@ test "load pointer from packed struct" { |
| 375 | } | 375 | } |
| 376 | } | 376 | } |
| 377 | 377 | ||
| 378 | test "@ptrToInt on a packed struct field" { | 378 | test "@intFromPtr on a packed struct field" { |
| 379 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 379 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 380 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 380 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 381 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 381 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| ... | @@ -394,7 +394,7 @@ test "@ptrToInt on a packed struct field" { | ... | @@ -394,7 +394,7 @@ test "@ptrToInt on a packed struct field" { |
| 394 | .z = 0, | 394 | .z = 0, |
| 395 | }; | 395 | }; |
| 396 | }; | 396 | }; |
| 397 | try expect(@ptrToInt(&S.p0.z) - @ptrToInt(&S.p0.x) == 2); | 397 | try expect(@intFromPtr(&S.p0.z) - @intFromPtr(&S.p0.x) == 2); |
| 398 | } | 398 | } |
| 399 | 399 | ||
| 400 | test "optional pointer in packed struct" { | 400 | test "optional pointer in packed struct" { |
test/behavior/pointers.zig+16-16| ... | @@ -184,8 +184,8 @@ test "implicit cast error unions with non-optional to optional pointer" { | ... | @@ -184,8 +184,8 @@ test "implicit cast error unions with non-optional to optional pointer" { |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | test "compare equality of optional and non-optional pointer" { | 186 | test "compare equality of optional and non-optional pointer" { |
| 187 | const a = @intToPtr(*const usize, 0x12345678); | 187 | const a = @ptrFromInt(*const usize, 0x12345678); |
| 188 | const b = @intToPtr(?*usize, 0x12345678); | 188 | const b = @ptrFromInt(?*usize, 0x12345678); |
| 189 | try expect(a == b); | 189 | try expect(a == b); |
| 190 | try expect(b == a); | 190 | try expect(b == a); |
| 191 | } | 191 | } |
| ... | @@ -197,14 +197,14 @@ test "allowzero pointer and slice" { | ... | @@ -197,14 +197,14 @@ test "allowzero pointer and slice" { |
| 197 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 197 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 198 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 198 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 199 | 199 | ||
| 200 | var ptr = @intToPtr([*]allowzero i32, 0); | 200 | var ptr = @ptrFromInt([*]allowzero i32, 0); |
| 201 | var opt_ptr: ?[*]allowzero i32 = ptr; | 201 | var opt_ptr: ?[*]allowzero i32 = ptr; |
| 202 | try expect(opt_ptr != null); | 202 | try expect(opt_ptr != null); |
| 203 | try expect(@ptrToInt(ptr) == 0); | 203 | try expect(@intFromPtr(ptr) == 0); |
| 204 | var runtime_zero: usize = 0; | 204 | var runtime_zero: usize = 0; |
| 205 | var slice = ptr[runtime_zero..10]; | 205 | var slice = ptr[runtime_zero..10]; |
| 206 | try comptime expect(@TypeOf(slice) == []allowzero i32); | 206 | try comptime expect(@TypeOf(slice) == []allowzero i32); |
| 207 | try expect(@ptrToInt(&slice[5]) == 20); | 207 | try expect(@intFromPtr(&slice[5]) == 20); |
| 208 | 208 | ||
| 209 | try comptime expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero); | 209 | try comptime expect(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero); |
| 210 | try comptime expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero); | 210 | try comptime expect(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero); |
| ... | @@ -367,10 +367,10 @@ test "pointer sentinel with +inf" { | ... | @@ -367,10 +367,10 @@ test "pointer sentinel with +inf" { |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | test "pointer to array at fixed address" { | 369 | test "pointer to array at fixed address" { |
| 370 | const array = @intToPtr(*volatile [2]u32, 0x10); | 370 | const array = @ptrFromInt(*volatile [2]u32, 0x10); |
| 371 | // Silly check just to reference `array` | 371 | // Silly check just to reference `array` |
| 372 | try expect(@ptrToInt(&array[0]) == 0x10); | 372 | try expect(@intFromPtr(&array[0]) == 0x10); |
| 373 | try expect(@ptrToInt(&array[1]) == 0x14); | 373 | try expect(@intFromPtr(&array[1]) == 0x14); |
| 374 | } | 374 | } |
| 375 | 375 | ||
| 376 | test "pointer arithmetic affects the alignment" { | 376 | test "pointer arithmetic affects the alignment" { |
| ... | @@ -404,16 +404,16 @@ test "pointer arithmetic affects the alignment" { | ... | @@ -404,16 +404,16 @@ test "pointer arithmetic affects the alignment" { |
| 404 | } | 404 | } |
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | test "@ptrToInt on null optional at comptime" { | 407 | test "@intFromPtr on null optional at comptime" { |
| 408 | { | 408 | { |
| 409 | const pointer = @intToPtr(?*u8, 0x000); | 409 | const pointer = @ptrFromInt(?*u8, 0x000); |
| 410 | const x = @ptrToInt(pointer); | 410 | const x = @intFromPtr(pointer); |
| 411 | _ = x; | 411 | _ = x; |
| 412 | try comptime expect(0 == @ptrToInt(pointer)); | 412 | try comptime expect(0 == @intFromPtr(pointer)); |
| 413 | } | 413 | } |
| 414 | { | 414 | { |
| 415 | const pointer = @intToPtr(?*u8, 0xf00); | 415 | const pointer = @ptrFromInt(?*u8, 0xf00); |
| 416 | try comptime expect(0xf00 == @ptrToInt(pointer)); | 416 | try comptime expect(0xf00 == @intFromPtr(pointer)); |
| 417 | } | 417 | } |
| 418 | } | 418 | } |
| 419 | 419 | ||
| ... | @@ -516,7 +516,7 @@ test "ptrCast comptime known slice to C pointer" { | ... | @@ -516,7 +516,7 @@ test "ptrCast comptime known slice to C pointer" { |
| 516 | try std.testing.expectEqualStrings(s, std.mem.sliceTo(p, 0)); | 516 | try std.testing.expectEqualStrings(s, std.mem.sliceTo(p, 0)); |
| 517 | } | 517 | } |
| 518 | 518 | ||
| 519 | test "ptrToInt on a generic function" { | 519 | test "intFromPtr on a generic function" { |
| 520 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 520 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 521 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 521 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 522 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 522 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| ... | @@ -527,7 +527,7 @@ test "ptrToInt on a generic function" { | ... | @@ -527,7 +527,7 @@ test "ptrToInt on a generic function" { |
| 527 | return i; | 527 | return i; |
| 528 | } | 528 | } |
| 529 | fn doTheTest(a: anytype) !void { | 529 | fn doTheTest(a: anytype) !void { |
| 530 | try expect(@ptrToInt(a) != 0); | 530 | try expect(@intFromPtr(a) != 0); |
| 531 | } | 531 | } |
| 532 | }; | 532 | }; |
| 533 | try S.doTheTest(&S.generic); | 533 | try S.doTheTest(&S.generic); |
test/behavior/ptrfromint.zig created+48| ... | @@ -0,0 +1,48 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const expectEqual = std.testing.expectEqual; | ||
| 4 | |||
| 5 | test "casting integer address to function pointer" { | ||
| 6 | addressToFunction(); | ||
| 7 | comptime addressToFunction(); | ||
| 8 | } | ||
| 9 | |||
| 10 | fn addressToFunction() void { | ||
| 11 | var addr: usize = 0xdeadbee0; | ||
| 12 | _ = @ptrFromInt(*const fn () void, addr); | ||
| 13 | } | ||
| 14 | |||
| 15 | test "mutate through ptr initialized with constant ptrFromInt value" { | ||
| 16 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 17 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 18 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 19 | |||
| 20 | forceCompilerAnalyzeBranchHardCodedPtrDereference(false); | ||
| 21 | } | ||
| 22 | |||
| 23 | fn forceCompilerAnalyzeBranchHardCodedPtrDereference(x: bool) void { | ||
| 24 | const hardCodedP = @ptrFromInt(*volatile u8, 0xdeadbeef); | ||
| 25 | if (x) { | ||
| 26 | hardCodedP.* = hardCodedP.* | 10; | ||
| 27 | } else { | ||
| 28 | return; | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | test "@ptrFromInt creates null pointer" { | ||
| 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 35 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 36 | |||
| 37 | const ptr = @ptrFromInt(?*u32, 0); | ||
| 38 | try expectEqual(@as(?*u32, null), ptr); | ||
| 39 | } | ||
| 40 | |||
| 41 | test "@ptrFromInt creates allowzero zero pointer" { | ||
| 42 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 43 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 44 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | ||
| 45 | |||
| 46 | const ptr = @ptrFromInt(*allowzero u32, 0); | ||
| 47 | try expectEqual(@as(usize, 0), @intFromPtr(ptr)); | ||
| 48 | } | ||
test/behavior/sizeof_and_typeof.zig+11-11| ... | @@ -92,15 +92,15 @@ test "@offsetOf" { | ... | @@ -92,15 +92,15 @@ test "@offsetOf" { |
| 92 | 92 | ||
| 93 | // // Normal struct fields can be moved/padded | 93 | // // Normal struct fields can be moved/padded |
| 94 | var a: A = undefined; | 94 | var a: A = undefined; |
| 95 | try expect(@ptrToInt(&a.a) - @ptrToInt(&a) == @offsetOf(A, "a")); | 95 | try expect(@intFromPtr(&a.a) - @intFromPtr(&a) == @offsetOf(A, "a")); |
| 96 | try expect(@ptrToInt(&a.b) - @ptrToInt(&a) == @offsetOf(A, "b")); | 96 | try expect(@intFromPtr(&a.b) - @intFromPtr(&a) == @offsetOf(A, "b")); |
| 97 | try expect(@ptrToInt(&a.c) - @ptrToInt(&a) == @offsetOf(A, "c")); | 97 | try expect(@intFromPtr(&a.c) - @intFromPtr(&a) == @offsetOf(A, "c")); |
| 98 | try expect(@ptrToInt(&a.d) - @ptrToInt(&a) == @offsetOf(A, "d")); | 98 | try expect(@intFromPtr(&a.d) - @intFromPtr(&a) == @offsetOf(A, "d")); |
| 99 | try expect(@ptrToInt(&a.e) - @ptrToInt(&a) == @offsetOf(A, "e")); | 99 | try expect(@intFromPtr(&a.e) - @intFromPtr(&a) == @offsetOf(A, "e")); |
| 100 | try expect(@ptrToInt(&a.f) - @ptrToInt(&a) == @offsetOf(A, "f")); | 100 | try expect(@intFromPtr(&a.f) - @intFromPtr(&a) == @offsetOf(A, "f")); |
| 101 | try expect(@ptrToInt(&a.g) - @ptrToInt(&a) == @offsetOf(A, "g")); | 101 | try expect(@intFromPtr(&a.g) - @intFromPtr(&a) == @offsetOf(A, "g")); |
| 102 | try expect(@ptrToInt(&a.h) - @ptrToInt(&a) == @offsetOf(A, "h")); | 102 | try expect(@intFromPtr(&a.h) - @intFromPtr(&a) == @offsetOf(A, "h")); |
| 103 | try expect(@ptrToInt(&a.i) - @ptrToInt(&a) == @offsetOf(A, "i")); | 103 | try expect(@intFromPtr(&a.i) - @intFromPtr(&a) == @offsetOf(A, "i")); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | test "@bitOffsetOf" { | 106 | test "@bitOffsetOf" { |
| ... | @@ -231,7 +231,7 @@ test "@sizeOf comparison against zero" { | ... | @@ -231,7 +231,7 @@ test "@sizeOf comparison against zero" { |
| 231 | 231 | ||
| 232 | test "hardcoded address in typeof expression" { | 232 | test "hardcoded address in typeof expression" { |
| 233 | const S = struct { | 233 | const S = struct { |
| 234 | fn func() @TypeOf(@intToPtr(*[]u8, 0x10).*[0]) { | 234 | fn func() @TypeOf(@ptrFromInt(*[]u8, 0x10).*[0]) { |
| 235 | return 0; | 235 | return 0; |
| 236 | } | 236 | } |
| 237 | }; | 237 | }; |
| ... | @@ -252,7 +252,7 @@ test "array access of generic param in typeof expression" { | ... | @@ -252,7 +252,7 @@ test "array access of generic param in typeof expression" { |
| 252 | test "lazy size cast to float" { | 252 | test "lazy size cast to float" { |
| 253 | { | 253 | { |
| 254 | const S = struct { a: u8 }; | 254 | const S = struct { a: u8 }; |
| 255 | try expect(@intToFloat(f32, @sizeOf(S)) == 1.0); | 255 | try expect(@floatFromInt(f32, @sizeOf(S)) == 1.0); |
| 256 | } | 256 | } |
| 257 | { | 257 | { |
| 258 | const S = struct { a: u8 }; | 258 | const S = struct { a: u8 }; |
test/behavior/slice.zig+7-7| ... | @@ -138,10 +138,10 @@ fn memFree(comptime T: type, memory: []T) void { | ... | @@ -138,10 +138,10 @@ fn memFree(comptime T: type, memory: []T) void { |
| 138 | test "slice of hardcoded address to pointer" { | 138 | test "slice of hardcoded address to pointer" { |
| 139 | const S = struct { | 139 | const S = struct { |
| 140 | fn doTheTest() !void { | 140 | fn doTheTest() !void { |
| 141 | const pointer = @intToPtr([*]u8, 0x04)[0..2]; | 141 | const pointer = @ptrFromInt([*]u8, 0x04)[0..2]; |
| 142 | try comptime expect(@TypeOf(pointer) == *[2]u8); | 142 | try comptime expect(@TypeOf(pointer) == *[2]u8); |
| 143 | const slice: []const u8 = pointer; | 143 | const slice: []const u8 = pointer; |
| 144 | try expect(@ptrToInt(slice.ptr) == 4); | 144 | try expect(@intFromPtr(slice.ptr) == 4); |
| 145 | try expect(slice.len == 2); | 145 | try expect(slice.len == 2); |
| 146 | } | 146 | } |
| 147 | }; | 147 | }; |
| ... | @@ -197,13 +197,13 @@ test "slicing pointer by length" { | ... | @@ -197,13 +197,13 @@ test "slicing pointer by length" { |
| 197 | } | 197 | } |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | const x = @intToPtr([*]i32, 0x1000)[0..0x500]; | 200 | const x = @ptrFromInt([*]i32, 0x1000)[0..0x500]; |
| 201 | const y = x[0x100..]; | 201 | const y = x[0x100..]; |
| 202 | test "compile time slice of pointer to hard coded address" { | 202 | test "compile time slice of pointer to hard coded address" { |
| 203 | try expect(@ptrToInt(x) == 0x1000); | 203 | try expect(@intFromPtr(x) == 0x1000); |
| 204 | try expect(x.len == 0x500); | 204 | try expect(x.len == 0x500); |
| 205 | 205 | ||
| 206 | try expect(@ptrToInt(y) == 0x1400); | 206 | try expect(@intFromPtr(y) == 0x1400); |
| 207 | try expect(y.len == 0x400); | 207 | try expect(y.len == 0x400); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| ... | @@ -838,13 +838,13 @@ test "empty slice ptr is non null" { | ... | @@ -838,13 +838,13 @@ test "empty slice ptr is non null" { |
| 838 | const empty_slice: []u8 = &[_]u8{}; | 838 | const empty_slice: []u8 = &[_]u8{}; |
| 839 | const p: [*]u8 = empty_slice.ptr + 0; | 839 | const p: [*]u8 = empty_slice.ptr + 0; |
| 840 | const t = @ptrCast([*]i8, p); | 840 | const t = @ptrCast([*]i8, p); |
| 841 | try expect(@ptrToInt(t) == @ptrToInt(empty_slice.ptr)); | 841 | try expect(@intFromPtr(t) == @intFromPtr(empty_slice.ptr)); |
| 842 | } | 842 | } |
| 843 | { | 843 | { |
| 844 | const empty_slice: []u8 = &.{}; | 844 | const empty_slice: []u8 = &.{}; |
| 845 | const p: [*]u8 = empty_slice.ptr + 0; | 845 | const p: [*]u8 = empty_slice.ptr + 0; |
| 846 | const t = @ptrCast([*]i8, p); | 846 | const t = @ptrCast([*]i8, p); |
| 847 | try expect(@ptrToInt(t) == @ptrToInt(empty_slice.ptr)); | 847 | try expect(@intFromPtr(t) == @intFromPtr(empty_slice.ptr)); |
| 848 | } | 848 | } |
| 849 | } | 849 | } |
| 850 | 850 |
test/behavior/struct.zig+1-1| ... | @@ -838,7 +838,7 @@ test "non-packed struct with u128 entry in union" { | ... | @@ -838,7 +838,7 @@ test "non-packed struct with u128 entry in union" { |
| 838 | 838 | ||
| 839 | var sx: S = undefined; | 839 | var sx: S = undefined; |
| 840 | var s = &sx; | 840 | var s = &sx; |
| 841 | try expect(@ptrToInt(&s.f2) - @ptrToInt(&s.f1) == @offsetOf(S, "f2")); | 841 | try expect(@intFromPtr(&s.f2) - @intFromPtr(&s.f1) == @offsetOf(S, "f2")); |
| 842 | var v2 = U{ .Num = 123 }; | 842 | var v2 = U{ .Num = 123 }; |
| 843 | s.f2 = v2; | 843 | s.f2 = v2; |
| 844 | try expect(s.f2.Num == 123); | 844 | try expect(s.f2.Num == 123); |
test/behavior/switch.zig+5-5| ... | @@ -590,9 +590,9 @@ test "switch on pointer type" { | ... | @@ -590,9 +590,9 @@ test "switch on pointer type" { |
| 590 | field: u32, | 590 | field: u32, |
| 591 | }; | 591 | }; |
| 592 | 592 | ||
| 593 | const P1 = @intToPtr(*X, 0x400); | 593 | const P1 = @ptrFromInt(*X, 0x400); |
| 594 | const P2 = @intToPtr(*X, 0x800); | 594 | const P2 = @ptrFromInt(*X, 0x800); |
| 595 | const P3 = @intToPtr(*X, 0xC00); | 595 | const P3 = @ptrFromInt(*X, 0xC00); |
| 596 | 596 | ||
| 597 | fn doTheTest(arg: *X) i32 { | 597 | fn doTheTest(arg: *X) i32 { |
| 598 | switch (arg) { | 598 | switch (arg) { |
| ... | @@ -682,9 +682,9 @@ test "enum value without tag name used as switch item" { | ... | @@ -682,9 +682,9 @@ test "enum value without tag name used as switch item" { |
| 682 | b = 2, | 682 | b = 2, |
| 683 | _, | 683 | _, |
| 684 | }; | 684 | }; |
| 685 | var e: E = @intToEnum(E, 0); | 685 | var e: E = @enumFromInt(E, 0); |
| 686 | switch (e) { | 686 | switch (e) { |
| 687 | @intToEnum(E, 0) => {}, | 687 | @enumFromInt(E, 0) => {}, |
| 688 | .a => return error.TestFailed, | 688 | .a => return error.TestFailed, |
| 689 | .b => return error.TestFailed, | 689 | .b => return error.TestFailed, |
| 690 | _ => return error.TestFailed, | 690 | _ => return error.TestFailed, |
test/behavior/translate_c_macros.zig+1-1| ... | @@ -60,7 +60,7 @@ test "cast negative integer to pointer" { | ... | @@ -60,7 +60,7 @@ test "cast negative integer to pointer" { |
| 60 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 60 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 61 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 61 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 62 | 62 | ||
| 63 | try expectEqual(@intToPtr(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED); | 63 | try expectEqual(@ptrFromInt(?*anyopaque, @bitCast(usize, @as(isize, -1))), h.MAP_FAILED); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | test "casting to union with a macro" { | 66 | test "casting to union with a macro" { |
test/behavior/type.zig+5-5| ... | @@ -363,8 +363,8 @@ test "Type.Enum" { | ... | @@ -363,8 +363,8 @@ test "Type.Enum" { |
| 363 | }, | 363 | }, |
| 364 | }); | 364 | }); |
| 365 | try testing.expectEqual(true, @typeInfo(Foo).Enum.is_exhaustive); | 365 | try testing.expectEqual(true, @typeInfo(Foo).Enum.is_exhaustive); |
| 366 | try testing.expectEqual(@as(u8, 1), @enumToInt(Foo.a)); | 366 | try testing.expectEqual(@as(u8, 1), @intFromEnum(Foo.a)); |
| 367 | try testing.expectEqual(@as(u8, 5), @enumToInt(Foo.b)); | 367 | try testing.expectEqual(@as(u8, 5), @intFromEnum(Foo.b)); |
| 368 | const Bar = @Type(.{ | 368 | const Bar = @Type(.{ |
| 369 | .Enum = .{ | 369 | .Enum = .{ |
| 370 | .tag_type = u32, | 370 | .tag_type = u32, |
| ... | @@ -377,9 +377,9 @@ test "Type.Enum" { | ... | @@ -377,9 +377,9 @@ test "Type.Enum" { |
| 377 | }, | 377 | }, |
| 378 | }); | 378 | }); |
| 379 | try testing.expectEqual(false, @typeInfo(Bar).Enum.is_exhaustive); | 379 | try testing.expectEqual(false, @typeInfo(Bar).Enum.is_exhaustive); |
| 380 | try testing.expectEqual(@as(u32, 1), @enumToInt(Bar.a)); | 380 | try testing.expectEqual(@as(u32, 1), @intFromEnum(Bar.a)); |
| 381 | try testing.expectEqual(@as(u32, 5), @enumToInt(Bar.b)); | 381 | try testing.expectEqual(@as(u32, 5), @intFromEnum(Bar.b)); |
| 382 | try testing.expectEqual(@as(u32, 6), @enumToInt(@intToEnum(Bar, 6))); | 382 | try testing.expectEqual(@as(u32, 6), @intFromEnum(@enumFromInt(Bar, 6))); |
| 383 | } | 383 | } |
| 384 | 384 | ||
| 385 | test "Type.Union" { | 385 | test "Type.Union" { |
test/behavior/union.zig+9-9| ... | @@ -364,7 +364,7 @@ test "simple union(enum(u32))" { | ... | @@ -364,7 +364,7 @@ test "simple union(enum(u32))" { |
| 364 | 364 | ||
| 365 | var x = MultipleChoice.C; | 365 | var x = MultipleChoice.C; |
| 366 | try expect(x == MultipleChoice.C); | 366 | try expect(x == MultipleChoice.C); |
| 367 | try expect(@enumToInt(@as(Tag(MultipleChoice), x)) == 60); | 367 | try expect(@intFromEnum(@as(Tag(MultipleChoice), x)) == 60); |
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | const PackedPtrOrInt = packed union { | 370 | const PackedPtrOrInt = packed union { |
| ... | @@ -655,7 +655,7 @@ const MultipleChoice2 = union(enum(u32)) { | ... | @@ -655,7 +655,7 @@ const MultipleChoice2 = union(enum(u32)) { |
| 655 | }; | 655 | }; |
| 656 | 656 | ||
| 657 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { | 657 | fn testEnumWithSpecifiedAndUnspecifiedTagValues(x: MultipleChoice2) !void { |
| 658 | try expect(@enumToInt(@as(Tag(MultipleChoice2), x)) == 60); | 658 | try expect(@intFromEnum(@as(Tag(MultipleChoice2), x)) == 60); |
| 659 | try expect(1123 == switch (x) { | 659 | try expect(1123 == switch (x) { |
| 660 | MultipleChoice2.A => 1, | 660 | MultipleChoice2.A => 1, |
| 661 | MultipleChoice2.B => 2, | 661 | MultipleChoice2.B => 2, |
| ... | @@ -721,11 +721,11 @@ test "union with only 1 field casted to its enum type which has enum value speci | ... | @@ -721,11 +721,11 @@ test "union with only 1 field casted to its enum type which has enum value speci |
| 721 | try comptime expect(Tag(ExprTag) == comptime_int); | 721 | try comptime expect(Tag(ExprTag) == comptime_int); |
| 722 | comptime var t = @as(ExprTag, e); | 722 | comptime var t = @as(ExprTag, e); |
| 723 | try expect(t == Expr.Literal); | 723 | try expect(t == Expr.Literal); |
| 724 | try expect(@enumToInt(t) == 33); | 724 | try expect(@intFromEnum(t) == 33); |
| 725 | try comptime expect(@enumToInt(t) == 33); | 725 | try comptime expect(@intFromEnum(t) == 33); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | test "@enumToInt works on unions" { | 728 | test "@intFromEnum works on unions" { |
| 729 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 729 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 730 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 730 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 731 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 731 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| ... | @@ -739,9 +739,9 @@ test "@enumToInt works on unions" { | ... | @@ -739,9 +739,9 @@ test "@enumToInt works on unions" { |
| 739 | const a = Bar{ .A = true }; | 739 | const a = Bar{ .A = true }; |
| 740 | var b = Bar{ .B = undefined }; | 740 | var b = Bar{ .B = undefined }; |
| 741 | var c = Bar.C; | 741 | var c = Bar.C; |
| 742 | try expect(@enumToInt(a) == 0); | 742 | try expect(@intFromEnum(a) == 0); |
| 743 | try expect(@enumToInt(b) == 1); | 743 | try expect(@intFromEnum(b) == 1); |
| 744 | try expect(@enumToInt(c) == 2); | 744 | try expect(@intFromEnum(c) == 2); |
| 745 | } | 745 | } |
| 746 | 746 | ||
| 747 | test "comptime union field value equality" { | 747 | test "comptime union field value equality" { |
| ... | @@ -1396,7 +1396,7 @@ test "@unionInit uses tag value instead of field index" { | ... | @@ -1396,7 +1396,7 @@ test "@unionInit uses tag value instead of field index" { |
| 1396 | var a = &u.b; | 1396 | var a = &u.b; |
| 1397 | try expect(a.* == i); | 1397 | try expect(a.* == i); |
| 1398 | } | 1398 | } |
| 1399 | try expect(@enumToInt(u) == 255); | 1399 | try expect(@intFromEnum(u) == 255); |
| 1400 | } | 1400 | } |
| 1401 | 1401 | ||
| 1402 | test "union field ptr - zero sized payload" { | 1402 | test "union field ptr - zero sized payload" { |
test/behavior/vector.zig+1-1| ... | @@ -1173,7 +1173,7 @@ test "byte vector initialized in inline function" { | ... | @@ -1173,7 +1173,7 @@ test "byte vector initialized in inline function" { |
| 1173 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | 1173 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; |
| 1174 | 1174 | ||
| 1175 | if (comptime builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and | 1175 | if (comptime builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .x86_64 and |
| 1176 | builtin.cpu.features.isEnabled(@enumToInt(std.Target.x86.Feature.avx512f))) | 1176 | builtin.cpu.features.isEnabled(@intFromEnum(std.Target.x86.Feature.avx512f))) |
| 1177 | { | 1177 | { |
| 1178 | // TODO https://github.com/ziglang/zig/issues/13279 | 1178 | // TODO https://github.com/ziglang/zig/issues/13279 |
| 1179 | return error.SkipZigTest; | 1179 | return error.SkipZigTest; |
test/c_abi/main.zig+5-5| ... | @@ -143,11 +143,11 @@ export fn zig_longdouble(x: c_longdouble) void { | ... | @@ -143,11 +143,11 @@ export fn zig_longdouble(x: c_longdouble) void { |
| 143 | extern fn c_ptr(*anyopaque) void; | 143 | extern fn c_ptr(*anyopaque) void; |
| 144 | 144 | ||
| 145 | test "C ABI pointer" { | 145 | test "C ABI pointer" { |
| 146 | c_ptr(@intToPtr(*anyopaque, 0xdeadbeef)); | 146 | c_ptr(@ptrFromInt(*anyopaque, 0xdeadbeef)); |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | export fn zig_ptr(x: *anyopaque) void { | 149 | export fn zig_ptr(x: *anyopaque) void { |
| 150 | expect(@ptrToInt(x) == 0xdeadbeef) catch @panic("test failure: zig_ptr"); | 150 | expect(@intFromPtr(x) == 0xdeadbeef) catch @panic("test failure: zig_ptr"); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | extern fn c_bool(bool) void; | 153 | extern fn c_bool(bool) void; |
| ... | @@ -1058,14 +1058,14 @@ test "C function that takes byval struct called via function pointer" { | ... | @@ -1058,14 +1058,14 @@ test "C function that takes byval struct called via function pointer" { |
| 1058 | 1058 | ||
| 1059 | var fn_ptr = &c_func_ptr_byval; | 1059 | var fn_ptr = &c_func_ptr_byval; |
| 1060 | fn_ptr( | 1060 | fn_ptr( |
| 1061 | @intToPtr(*anyopaque, 1), | 1061 | @ptrFromInt(*anyopaque, 1), |
| 1062 | @intToPtr(*anyopaque, 2), | 1062 | @ptrFromInt(*anyopaque, 2), |
| 1063 | ByVal{ | 1063 | ByVal{ |
| 1064 | .origin = .{ .x = 9, .y = 10, .z = 11 }, | 1064 | .origin = .{ .x = 9, .y = 10, .z = 11 }, |
| 1065 | .size = .{ .width = 12, .height = 13, .depth = 14 }, | 1065 | .size = .{ .width = 12, .height = 13, .depth = 14 }, |
| 1066 | }, | 1066 | }, |
| 1067 | @as(c_ulong, 3), | 1067 | @as(c_ulong, 3), |
| 1068 | @intToPtr(*anyopaque, 4), | 1068 | @ptrFromInt(*anyopaque, 4), |
| 1069 | @as(c_ulong, 5), | 1069 | @as(c_ulong, 5), |
| 1070 | ); | 1070 | ); |
| 1071 | } | 1071 | } |
test/cases/assert_function.18.zig+1-1| ... | @@ -7,7 +7,7 @@ pub fn main() void { | ... | @@ -7,7 +7,7 @@ pub fn main() void { |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | fn print() void { | 9 | fn print() void { |
| 10 | _ = write(1, @ptrToInt("hello\n"), 6); | 10 | _ = write(1, @intFromPtr("hello\n"), 6); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // run | 13 | // run |
test/cases/assert_function.7.zig+1-1| ... | @@ -7,7 +7,7 @@ pub fn main() void { | ... | @@ -7,7 +7,7 @@ pub fn main() void { |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | fn print() void { | 9 | fn print() void { |
| 10 | _ = write(1, @ptrToInt("hello\n"), 6); | 10 | _ = write(1, @intFromPtr("hello\n"), 6); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | pub fn assert(ok: bool) void { | 13 | pub fn assert(ok: bool) void { |
test/cases/assert_function.8.zig+1-1| ... | @@ -7,7 +7,7 @@ pub fn main() void { | ... | @@ -7,7 +7,7 @@ pub fn main() void { |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | fn print() void { | 9 | fn print() void { |
| 10 | _ = write(1, @ptrToInt("hello\n"), 6); | 10 | _ = write(1, @intFromPtr("hello\n"), 6); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | pub fn assert(ok: bool) void { | 13 | pub fn assert(ok: bool) void { |
test/cases/compile_errors/add_overflow_in_function_evaluation.zig+3-1| ... | @@ -3,7 +3,9 @@ fn add(a: u16, b: u16) u16 { | ... | @@ -3,7 +3,9 @@ fn add(a: u16, b: u16) u16 { |
| 3 | return a + b; | 3 | return a + b; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(y)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/addition_with_non_numbers.zig+5-3| ... | @@ -1,12 +1,14 @@ | ... | @@ -1,12 +1,14 @@ |
| 1 | const Foo = struct { | 1 | const Foo = struct { |
| 2 | field: i32, | 2 | field: i32, |
| 3 | }; | 3 | }; |
| 4 | const x = Foo {.field = 1} + Foo {.field = 2}; | 4 | const x = Foo{ .field = 1 } + Foo{ .field = 2 }; |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(x)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=llvm | 11 | // backend=llvm |
| 10 | // target=native | 12 | // target=native |
| 11 | // | 13 | // |
| 12 | // :4:28: error: invalid operands to binary expression: 'Struct' and 'Struct' | 14 | // :4:29: error: invalid operands to binary expression: 'Struct' and 'Struct' |
test/cases/compile_errors/address_of_number_literal.zig+8-4| ... | @@ -1,12 +1,16 @@ | ... | @@ -1,12 +1,16 @@ |
| 1 | const x = 3; | 1 | const x = 3; |
| 2 | const y = &x; | 2 | const y = &x; |
| 3 | fn foo() *const i32 { return y; } | 3 | fn foo() *const i32 { |
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 4 | return y; |
| 5 | } | ||
| 6 | export fn entry() usize { | ||
| 7 | return @sizeOf(@TypeOf(&foo)); | ||
| 8 | } | ||
| 5 | 9 | ||
| 6 | // error | 10 | // error |
| 7 | // backend=stage2 | 11 | // backend=stage2 |
| 8 | // target=native | 12 | // target=native |
| 9 | // | 13 | // |
| 10 | // :3:30: error: expected type '*const i32', found '*const comptime_int' | 14 | // :4:12: error: expected type '*const i32', found '*const comptime_int' |
| 11 | // :3:30: note: pointer type child 'comptime_int' cannot cast into pointer type child 'i32' | 15 | // :4:12: note: pointer type child 'comptime_int' cannot cast into pointer type child 'i32' |
| 12 | // :3:10: note: function return type declared here | 16 | // :3:10: note: function return type declared here |
test/cases/compile_errors/alignment_of_enum_field_specified.zig+4-1| ... | @@ -1,7 +1,10 @@ | ... | @@ -1,7 +1,10 @@ |
| 1 | // zig fmt: off | ||
| 1 | const Number = enum { | 2 | const Number = enum { |
| 2 | a, | 3 | a, |
| 3 | b align(i32), | 4 | b align(i32), |
| 4 | }; | 5 | }; |
| 6 | // zig fmt: on | ||
| 7 | |||
| 5 | export fn entry1() void { | 8 | export fn entry1() void { |
| 6 | var x: Number = undefined; | 9 | var x: Number = undefined; |
| 7 | _ = x; | 10 | _ = x; |
| ... | @@ -11,4 +14,4 @@ export fn entry1() void { | ... | @@ -11,4 +14,4 @@ export fn entry1() void { |
| 11 | // backend=stage2 | 14 | // backend=stage2 |
| 12 | // target=native | 15 | // target=native |
| 13 | // | 16 | // |
| 14 | // :3:13: error: enum fields cannot be aligned | 17 | // :4:13: error: enum fields cannot be aligned |
test/cases/compile_errors/array_concatenation_with_wrong_type.zig+3-1| ... | @@ -2,7 +2,9 @@ const src = "aoeu"; | ... | @@ -2,7 +2,9 @@ const src = "aoeu"; |
| 2 | const derp: usize = 1234; | 2 | const derp: usize = 1234; |
| 3 | const a = derp ++ "foo"; | 3 | const a = derp ++ "foo"; |
| 4 | 4 | ||
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 5 | export fn entry() usize { |
| 6 | return @sizeOf(@TypeOf(a)); | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | // error | 9 | // error |
| 8 | // backend=stage2 | 10 | // backend=stage2 |
test/cases/compile_errors/array_mult_with_number_type.zig+1-1| ... | @@ -7,4 +7,4 @@ export fn entry(base: f32, exponent: f32) f32 { | ... | @@ -7,4 +7,4 @@ export fn entry(base: f32, exponent: f32) f32 { |
| 7 | // target=native | 7 | // target=native |
| 8 | // | 8 | // |
| 9 | // :2:12: error: expected indexable; found 'f32' | 9 | // :2:12: error: expected indexable; found 'f32' |
| 10 | // :2:17: note: this operator multiplies arrays; use std.math.pow for exponentiation | ||
| \ No newline at end of file | |||
| 10 | // :2:17: note: this operator multiplies arrays; use std.math.pow for exponentiation | ||
test/cases/compile_errors/assign_inline_fn_to_non-comptime_var.zig+1-1| ... | @@ -2,7 +2,7 @@ export fn entry() void { | ... | @@ -2,7 +2,7 @@ export fn entry() void { |
| 2 | var a = &b; | 2 | var a = &b; |
| 3 | _ = a; | 3 | _ = a; |
| 4 | } | 4 | } |
| 5 | fn b() callconv(.Inline) void { } | 5 | inline fn b() void {} |
| 6 | 6 | ||
| 7 | // error | 7 | // error |
| 8 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/assign_null_to_non-optional_pointer.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const a: *u8 = null; | 1 | const a: *u8 = null; |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 3 | export fn entry() usize { |
| 4 | return @sizeOf(@TypeOf(a)); | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/assign_through_constant_pointer.zig+3-3| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | export fn f() void { | 1 | export fn f() void { |
| 2 | var cstr = "Hat"; | 2 | var cstr = "Hat"; |
| 3 | cstr[0] = 'W'; | 3 | cstr[0] = 'W'; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| 7 | // backend=stage2 | 7 | // backend=stage2 |
| 8 | // target=native | 8 | // target=native |
| 9 | // | 9 | // |
| 10 | // :3:7: error: cannot assign to constant | 10 | // :3:9: error: cannot assign to constant |
test/cases/compile_errors/assign_through_constant_slice.zig+3-3| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | export fn f() void { | 1 | export fn f() void { |
| 2 | var cstr: []const u8 = "Hat"; | 2 | var cstr: []const u8 = "Hat"; |
| 3 | cstr[0] = 'W'; | 3 | cstr[0] = 'W'; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| 7 | // backend=stage2 | 7 | // backend=stage2 |
| 8 | // target=native | 8 | // target=native |
| 9 | // | 9 | // |
| 10 | // :3:7: error: cannot assign to constant | 10 | // :3:9: error: cannot assign to constant |
test/cases/compile_errors/assign_to_constant_field.zig+4-2| ... | @@ -2,7 +2,9 @@ const Foo = struct { | ... | @@ -2,7 +2,9 @@ const Foo = struct { |
| 2 | field: i32, | 2 | field: i32, |
| 3 | }; | 3 | }; |
| 4 | export fn derp() void { | 4 | export fn derp() void { |
| 5 | const f = Foo {.field = 1234,}; | 5 | const f = Foo{ |
| 6 | .field = 1234, | ||
| 7 | }; | ||
| 6 | f.field = 0; | 8 | f.field = 0; |
| 7 | } | 9 | } |
| 8 | 10 | ||
| ... | @@ -10,4 +12,4 @@ export fn derp() void { | ... | @@ -10,4 +12,4 @@ export fn derp() void { |
| 10 | // backend=stage2 | 12 | // backend=stage2 |
| 11 | // target=native | 13 | // target=native |
| 12 | // | 14 | // |
| 13 | // :6:6: error: cannot assign to constant | 15 | // :8:6: error: cannot assign to constant |
test/cases/compile_errors/async/non_async_function_pointer_passed_to_asyncCall.zig+1-1| ... | @@ -3,7 +3,7 @@ export fn entry() void { | ... | @@ -3,7 +3,7 @@ export fn entry() void { |
| 3 | var bytes: [100]u8 align(16) = undefined; | 3 | var bytes: [100]u8 align(16) = undefined; |
| 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); | 4 | _ = @asyncCall(&bytes, {}, ptr, .{}); |
| 5 | } | 5 | } |
| 6 | fn afunc() void { } | 6 | fn afunc() void {} |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
| 9 | // backend=stage1 | 9 | // backend=stage1 |
test/cases/compile_errors/async/prevent_bad_implicit_casting_of_anyframe_types.zig+1-1| ... | @@ -21,4 +21,4 @@ fn func() void {} | ... | @@ -21,4 +21,4 @@ fn func() void {} |
| 21 | // | 21 | // |
| 22 | // :3:28: error: expected type 'anyframe->i32', found 'anyframe' | 22 | // :3:28: error: expected type 'anyframe->i32', found 'anyframe' |
| 23 | // :8:28: error: expected type 'anyframe->i32', found 'i32' | 23 | // :8:28: error: expected type 'anyframe->i32', found 'i32' |
| 24 | // tmp.zig:13:29: error: expected type 'anyframe->i32', found '*@Frame(func)' | ||
| \ No newline at end of file | |||
| 24 | // tmp.zig:13:29: error: expected type 'anyframe->i32', found '*@Frame(func)' | ||
test/cases/compile_errors/async/runtime-known_function_called_with_async_keyword.zig+1-1| ... | @@ -3,7 +3,7 @@ export fn entry() void { | ... | @@ -3,7 +3,7 @@ export fn entry() void { |
| 3 | _ = async ptr(); | 3 | _ = async ptr(); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | fn afunc() callconv(.Async) void { } | 6 | fn afunc() callconv(.Async) void {} |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
| 9 | // backend=stage1 | 9 | // backend=stage1 |
test/cases/compile_errors/bad_alignCast_at_comptime.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | const ptr = @intToPtr(*align(1) i32, 0x1); | 2 | const ptr = @ptrFromInt(*align(1) i32, 0x1); |
| 3 | const aligned = @alignCast(4, ptr); | 3 | const aligned = @alignCast(4, ptr); |
| 4 | _ = aligned; | 4 | _ = aligned; |
| 5 | } | 5 | } |
test/cases/compile_errors/bad_import.zig+3-1| ... | @@ -1,4 +1,6 @@ | ... | @@ -1,4 +1,6 @@ |
| 1 | const bogus = @import("bogus-does-not-exist.zig",); | 1 | const bogus = @import( |
| 2 | "bogus-does-not-exist.zig", | ||
| 3 | ); | ||
| 2 | 4 | ||
| 3 | // error | 5 | // error |
| 4 | // backend=stage2 | 6 | // backend=stage2 |
test/cases/compile_errors/binary_not_on_number_literal.zig+3-1| ... | @@ -2,7 +2,9 @@ const TINY_QUANTUM_SHIFT = 4; | ... | @@ -2,7 +2,9 @@ const TINY_QUANTUM_SHIFT = 4; |
| 2 | const TINY_QUANTUM_SIZE = 1 << TINY_QUANTUM_SHIFT; | 2 | const TINY_QUANTUM_SIZE = 1 << TINY_QUANTUM_SHIFT; |
| 3 | var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - 1); | 3 | var block_aligned_stuff: usize = (4 + TINY_QUANTUM_SIZE) & ~(TINY_QUANTUM_SIZE - 1); |
| 4 | 4 | ||
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(block_aligned_stuff)); } | 5 | export fn entry() usize { |
| 6 | return @sizeOf(@TypeOf(block_aligned_stuff)); | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | // error | 9 | // error |
| 8 | // backend=stage2 | 10 | // backend=stage2 |
test/cases/compile_errors/bitCast_to_enum_type.zig+1-1| ... | @@ -9,4 +9,4 @@ export fn entry() void { | ... | @@ -9,4 +9,4 @@ export fn entry() void { |
| 9 | // target=native | 9 | // target=native |
| 10 | // | 10 | // |
| 11 | // :3:24: error: cannot @bitCast to 'tmp.entry.E' | 11 | // :3:24: error: cannot @bitCast to 'tmp.entry.E' |
| 12 | // :3:24: note: use @intToEnum to cast from 'u32' | 12 | // :3:24: note: use @enumFromInt to cast from 'u32' |
test/cases/compile_errors/bogus_compile_var.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const x = @import("builtin").bogus; | 1 | const x = @import("builtin").bogus; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 2 | export fn entry() usize { |
| 3 | return @sizeOf(@TypeOf(x)); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/bogus_method_call_on_slice.zig+5-3| ... | @@ -2,7 +2,9 @@ var self = "aoeu"; | ... | @@ -2,7 +2,9 @@ var self = "aoeu"; |
| 2 | fn f(m: []const u8) void { | 2 | fn f(m: []const u8) void { |
| 3 | m.copy(u8, self[0..], m); | 3 | m.copy(u8, self[0..], m); |
| 4 | } | 4 | } |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(&f)); } | 5 | export fn entry() usize { |
| 6 | return @sizeOf(@TypeOf(&f)); | ||
| 7 | } | ||
| 6 | pub export fn entry1() void { | 8 | pub export fn entry1() void { |
| 7 | .{}.bar(); | 9 | .{}.bar(); |
| 8 | } | 10 | } |
| ... | @@ -14,6 +16,6 @@ pub export fn entry2() void { | ... | @@ -14,6 +16,6 @@ pub export fn entry2() void { |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
| 15 | // target=native | 17 | // target=native |
| 16 | // | 18 | // |
| 17 | // :7:8: error: no field or member function named 'bar' in '@TypeOf(.{})' | 19 | // :9:8: error: no field or member function named 'bar' in '@TypeOf(.{})' |
| 18 | // :10:18: error: no field or member function named 'bar' in 'struct{comptime foo: comptime_int = 1}' | 20 | // :12:18: error: no field or member function named 'bar' in 'struct{comptime foo: comptime_int = 1}' |
| 19 | // :3:6: error: no field or member function named 'copy' in '[]const u8' | 21 | // :3:6: error: no field or member function named 'copy' in '[]const u8' |
test/cases/compile_errors/branch_on_undefined_value.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const x = if (undefined) true else false; | 1 | const x = if (undefined) true else false; |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 3 | export fn entry() usize { |
| 4 | return @sizeOf(@TypeOf(x)); | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/calling_function_with_naked_calling_convention.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | foo(); | 2 | foo(); |
| 3 | } | 3 | } |
| 4 | fn foo() callconv(.Naked) void { } | 4 | fn foo() callconv(.Naked) void {} |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| 7 | // backend=llvm | 7 | // backend=llvm |
test/cases/compile_errors/calling_var_args_extern_function_passing_array_instead_of_pointer.zig+5-3| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | foo("hello".*,); | 2 | foo( |
| 3 | "hello".*, | ||
| 4 | ); | ||
| 3 | } | 5 | } |
| 4 | pub extern fn foo(format: *const u8, ...) void; | 6 | pub extern fn foo(format: *const u8, ...) void; |
| 5 | 7 | ||
| ... | @@ -7,5 +9,5 @@ pub extern fn foo(format: *const u8, ...) void; | ... | @@ -7,5 +9,5 @@ pub extern fn foo(format: *const u8, ...) void; |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
| 8 | // target=native | 10 | // target=native |
| 9 | // | 11 | // |
| 10 | // :2:16: error: expected type '*const u8', found '[5:0]u8' | 12 | // :3:16: error: expected type '*const u8', found '[5:0]u8' |
| 11 | // :4:27: note: parameter type declared here | 13 | // :6:27: note: parameter type declared here |
test/cases/compile_errors/cast_unreachable.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | fn f() i32 { | 1 | fn f() i32 { |
| 2 | return @as(i32, return 1); | 2 | return @as(i32, return 1); |
| 3 | } | 3 | } |
| 4 | export fn entry() void { _ = f(); } | 4 | export fn entry() void { |
| 5 | _ = f(); | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/casting_bit_offset_pointer_to_regular_pointer.zig+3-1| ... | @@ -12,7 +12,9 @@ fn bar(x: *const u3) u3 { | ... | @@ -12,7 +12,9 @@ fn bar(x: *const u3) u3 { |
| 12 | return x.*; | 12 | return x.*; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 15 | export fn entry() usize { |
| 16 | return @sizeOf(@TypeOf(&foo)); | ||
| 17 | } | ||
| 16 | 18 | ||
| 17 | // error | 19 | // error |
| 18 | // backend=stage2 | 20 | // backend=stage2 |
test/cases/compile_errors/colliding_invalid_top_level_functions.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn func() bogus {} | 1 | fn func() bogus {} |
| 2 | fn func() bogus {} | 2 | fn func() bogus {} |
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(func)); } | 3 | export fn entry() usize { |
| 4 | return @sizeOf(@TypeOf(func)); | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/compileError_shows_traceback_of_references_that_caused_it.zig+3-1| ... | @@ -1,4 +1,6 @@ | ... | @@ -1,4 +1,6 @@ |
| 1 | const foo = @compileError("aoeu",); | 1 | const foo = @compileError( |
| 2 | "aoeu", | ||
| 3 | ); | ||
| 2 | 4 | ||
| 3 | const bar = baz + foo; | 5 | const bar = baz + foo; |
| 4 | const baz = 1; | 6 | const baz = 1; |
test/cases/compile_errors/compile_log_statement_warning_deduplication_in_generic_fn.zig+5-3| ... | @@ -4,15 +4,17 @@ export fn entry() void { | ... | @@ -4,15 +4,17 @@ export fn entry() void { |
| 4 | } | 4 | } |
| 5 | fn inner(comptime n: usize) void { | 5 | fn inner(comptime n: usize) void { |
| 6 | comptime var i = 0; | 6 | comptime var i = 0; |
| 7 | inline while (i < n) : (i += 1) { @compileLog("!@#$"); } | 7 | inline while (i < n) : (i += 1) { |
| 8 | @compileLog("!@#$"); | ||
| 9 | } | ||
| 8 | } | 10 | } |
| 9 | 11 | ||
| 10 | // error | 12 | // error |
| 11 | // backend=llvm | 13 | // backend=llvm |
| 12 | // target=native | 14 | // target=native |
| 13 | // | 15 | // |
| 14 | // :7:39: error: found compile log statement | 16 | // :8:9: error: found compile log statement |
| 15 | // :7:39: note: also here | 17 | // :8:9: note: also here |
| 16 | // | 18 | // |
| 17 | // Compile Log Output: | 19 | // Compile Log Output: |
| 18 | // @as(*const [4:0]u8, "!@#$") | 20 | // @as(*const [4:0]u8, "!@#$") |
test/cases/compile_errors/compile_time_division_by_zero.zig+3-1| ... | @@ -3,7 +3,9 @@ fn foo(x: u32) u32 { | ... | @@ -3,7 +3,9 @@ fn foo(x: u32) u32 { |
| 3 | return 1 / x; | 3 | return 1 / x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(y)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(y)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=llvm | 11 | // backend=llvm |
test/cases/compile_errors/comptime_call_of_function_pointer.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | const fn_ptr = @intToPtr(*align(1) fn () void, 0xffd2); | 2 | const fn_ptr = @ptrFromInt(*align(1) fn () void, 0xffd2); |
| 3 | comptime fn_ptr(); | 3 | comptime fn_ptr(); |
| 4 | } | 4 | } |
| 5 | 5 |
test/cases/compile_errors/comptime_if_inside_runtime_for.zig+7-7| ... | @@ -1,14 +1,14 @@ | ... | @@ -1,14 +1,14 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | 	var x: u32 = 0; | 2 | var x: u32 = 0; |
| 3 | 	for(0..1, 1..2) |_, _| { | 3 | for (0..1, 1..2) |_, _| { |
| 4 | 		var y = x + if(x == 0) 1 else 0; | 4 | var y = x + if (x == 0) 1 else 0; |
| 5 | 		_ = y; | 5 | _ = y; |
| 6 | 	} | 6 | } |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // error | 9 | // error |
| 10 | // backend=stage2 | 10 | // backend=stage2 |
| 11 | // target=native | 11 | // target=native |
| 12 | // | 12 | // |
| 13 | // :4:15: error: value with comptime-only type 'comptime_int' depends on runtime control flow | 13 | // :4:21: error: value with comptime-only type 'comptime_int' depends on runtime control flow |
| 14 | // :3:6: note: runtime control flow here | 14 | // :3:10: note: runtime control flow here |
test/cases/compile_errors/constant_inside_comptime_function_has_compile_error.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const ContextAllocator = MemoryPool(usize); | 1 | const ContextAllocator = MemoryPool(usize); |
| 2 | 2 | ||
| 3 | pub fn MemoryPool(comptime T: type) type { | 3 | pub fn MemoryPool(comptime T: type) type { |
| 4 | const free_list_t = @compileError("aoeu",); | 4 | const free_list_t = @compileError( |
| 5 | "aoeu", | ||
| 6 | ); | ||
| 5 | _ = T; | 7 | _ = T; |
| 6 | 8 | ||
| 7 | return struct { | 9 | return struct { |
test/cases/compile_errors/container_init_with_non-type.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const zero: i32 = 0; | 1 | const zero: i32 = 0; |
| 2 | const a = zero{1}; | 2 | const a = zero{1}; |
| 3 | 3 | ||
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 4 | export fn entry() usize { |
| 5 | return @sizeOf(@TypeOf(a)); | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/control_flow_uses_comptime_var_at_runtime.zig+1-1| ... | @@ -5,7 +5,7 @@ export fn foo() void { | ... | @@ -5,7 +5,7 @@ export fn foo() void { |
| 5 | } | 5 | } |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | fn bar() void { } | 8 | fn bar() void {} |
| 9 | export fn baz() void { | 9 | export fn baz() void { |
| 10 | comptime var idx: u32 = 0; | 10 | comptime var idx: u32 = 0; |
| 11 | while (idx < 1) { | 11 | while (idx < 1) { |
test/cases/compile_errors/dereference_an_array.zig+3-1| ... | @@ -5,7 +5,9 @@ pub fn pass(in: []u8) []u8 { | ... | @@ -5,7 +5,9 @@ pub fn pass(in: []u8) []u8 { |
| 5 | return out.*[0..1]; | 5 | return out.*[0..1]; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(&pass)); } | 8 | export fn entry() usize { |
| 9 | return @sizeOf(@TypeOf(&pass)); | ||
| 10 | } | ||
| 9 | 11 | ||
| 10 | // error | 12 | // error |
| 11 | // backend=stage2 | 13 | // backend=stage2 |
test/cases/compile_errors/direct_struct_loop.zig+7-3| ... | @@ -1,9 +1,13 @@ | ... | @@ -1,9 +1,13 @@ |
| 1 | const A = struct { a : A, }; | 1 | const A = struct { |
| 2 | export fn entry() usize { return @sizeOf(A); } | 2 | a: A, |
| 3 | }; | ||
| 4 | export fn entry() usize { | ||
| 5 | return @sizeOf(A); | ||
| 6 | } | ||
| 3 | 7 | ||
| 4 | // error | 8 | // error |
| 5 | // backend=stage2 | 9 | // backend=stage2 |
| 6 | // target=native | 10 | // target=native |
| 7 | // | 11 | // |
| 8 | // :1:11: error: struct 'tmp.A' depends on itself | 12 | // :1:11: error: struct 'tmp.A' depends on itself |
| 9 | // :1:20: note: while checking this field | 13 | // :2:5: note: while checking this field |
test/cases/compile_errors/disallow_coercion_from_non-null-terminated_pointer_to_null-terminated_pointer.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | extern fn puts(s: [*:0]const u8) c_int; | 1 | extern fn puts(s: [*:0]const u8) c_int; |
| 2 | pub export fn entry() void { | 2 | pub export fn entry() void { |
| 3 | const no_zero_array = [_]u8{'h', 'e', 'l', 'l', 'o'}; | 3 | const no_zero_array = [_]u8{ 'h', 'e', 'l', 'l', 'o' }; |
| 4 | const no_zero_ptr: [*]const u8 = &no_zero_array; | 4 | const no_zero_ptr: [*]const u8 = &no_zero_array; |
| 5 | _ = puts(no_zero_ptr); | 5 | _ = puts(no_zero_ptr); |
| 6 | } | 6 | } |
test/cases/compile_errors/division_by_zero.zig+12-4| ... | @@ -3,10 +3,18 @@ const lit_float_x = 1.0 / 0.0; | ... | @@ -3,10 +3,18 @@ const lit_float_x = 1.0 / 0.0; |
| 3 | const int_x = @as(u32, 1) / @as(u32, 0); | 3 | const int_x = @as(u32, 1) / @as(u32, 0); |
| 4 | const float_x = @as(f32, 1.0) / @as(f32, 0.0); | 4 | const float_x = @as(f32, 1.0) / @as(f32, 0.0); |
| 5 | 5 | ||
| 6 | export fn entry1() usize { return @sizeOf(@TypeOf(lit_int_x)); } | 6 | export fn entry1() usize { |
| 7 | export fn entry2() usize { return @sizeOf(@TypeOf(lit_float_x)); } | 7 | return @sizeOf(@TypeOf(lit_int_x)); |
| 8 | export fn entry3() usize { return @sizeOf(@TypeOf(int_x)); } | 8 | } |
| 9 | export fn entry4() usize { return @sizeOf(@TypeOf(float_x)); } // no error on purpose | 9 | export fn entry2() usize { |
| 10 | return @sizeOf(@TypeOf(lit_float_x)); | ||
| 11 | } | ||
| 12 | export fn entry3() usize { | ||
| 13 | return @sizeOf(@TypeOf(int_x)); | ||
| 14 | } | ||
| 15 | export fn entry4() usize { | ||
| 16 | return @sizeOf(@TypeOf(float_x)); | ||
| 17 | } // no error on purpose | ||
| 10 | 18 | ||
| 11 | // error | 19 | // error |
| 12 | // backend=stage2 | 20 | // backend=stage2 |
test/cases/compile_errors/duplicate-unused_labels.zig+19-13| ... | @@ -1,31 +1,37 @@ | ... | @@ -1,31 +1,37 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | blk: { blk: while (false) {} } | 2 | blk: { |
| 3 | blk: while (false) {} | ||
| 4 | } | ||
| 3 | } | 5 | } |
| 4 | comptime { | 6 | comptime { |
| 5 | blk: while (false) { blk: for (@as([0]void, undefined)) |_| {} } | 7 | blk: while (false) { |
| 8 | blk: for (@as([0]void, undefined)) |_| {} | ||
| 9 | } | ||
| 6 | } | 10 | } |
| 7 | comptime { | 11 | comptime { |
| 8 | blk: for (@as([0]void, undefined)) |_| { blk: {} } | 12 | blk: for (@as([0]void, undefined)) |_| { |
| 13 | blk: {} | ||
| 14 | } | ||
| 9 | } | 15 | } |
| 10 | comptime { | 16 | comptime { |
| 11 | blk: {} | 17 | blk: {} |
| 12 | } | 18 | } |
| 13 | comptime { | 19 | comptime { |
| 14 | blk: while(false) {} | 20 | blk: while (false) {} |
| 15 | } | 21 | } |
| 16 | comptime { | 22 | comptime { |
| 17 | blk: for(@as([0]void, undefined)) |_| {} | 23 | blk: for (@as([0]void, undefined)) |_| {} |
| 18 | } | 24 | } |
| 19 | 25 | ||
| 20 | // error | 26 | // error |
| 21 | // target=native | 27 | // target=native |
| 22 | // | 28 | // |
| 23 | // :2:12: error: redefinition of label 'blk' | 29 | // :3:9: error: redefinition of label 'blk' |
| 24 | // :2:5: note: previous definition here | 30 | // :2:5: note: previous definition here |
| 25 | // :5:26: error: redefinition of label 'blk' | 31 | // :8:9: error: redefinition of label 'blk' |
| 26 | // :5:5: note: previous definition here | 32 | // :7:5: note: previous definition here |
| 27 | // :8:46: error: redefinition of label 'blk' | 33 | // :13:9: error: redefinition of label 'blk' |
| 28 | // :8:5: note: previous definition here | 34 | // :12:5: note: previous definition here |
| 29 | // :11:5: error: unused block label | 35 | // :17:5: error: unused block label |
| 30 | // :14:5: error: unused while loop label | 36 | // :20:5: error: unused while loop label |
| 31 | // :17:5: error: unused for loop label | 37 | // :23:5: error: unused for loop label |
test/cases/compile_errors/duplicate_error_value_in_error_set.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const Foo = error { | 1 | const Foo = error{ |
| 2 | Bar, | 2 | Bar, |
| 3 | Bar, | 3 | Bar, |
| 4 | }; | 4 | }; |
test/cases/compile_errors/duplicate_field_in_struct_value_expression.zig+4-4| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | const A = struct { | 1 | const A = struct { |
| 2 | x : i32, | 2 | x: i32, |
| 3 | y : i32, | 3 | y: i32, |
| 4 | z : i32, | 4 | z: i32, |
| 5 | }; | 5 | }; |
| 6 | export fn f() void { | 6 | export fn f() void { |
| 7 | const a = A { | 7 | const a = A{ |
| 8 | .z = 1, | 8 | .z = 1, |
| 9 | .y = 2, | 9 | .y = 2, |
| 10 | .x = 3, | 10 | .x = 3, |
test/cases/compile_errors/embedFile_with_bogus_file.zig+4-2| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | const resource = @embedFile("bogus.txt",); | 1 | const resource = @embedFile("bogus.txt"); |
| 2 | 2 | ||
| 3 | export fn entry() usize { return @sizeOf(@TypeOf(resource)); } | 3 | export fn entry() usize { |
| 4 | return @sizeOf(@TypeOf(resource)); | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/empty_switch_on_an_integer.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | var x: u32 = 0; | 2 | var x: u32 = 0; |
| 3 | switch(x) {} | 3 | switch (x) {} |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
test/cases/compile_errors/enumFromInt_on_non-exhaustive_enums_checks_int_in_range.zig created+11| ... | @@ -0,0 +1,11 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | const E = enum(u3) { a, b, c, _ }; | ||
| 3 | @compileLog(@enumFromInt(E, 100)); | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // target=native | ||
| 8 | // backend=stage2 | ||
| 9 | // | ||
| 10 | // :3:17: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E' | ||
| 11 | // :2:15: note: enum declared here | ||
test/cases/compile_errors/enum_in_field_count_range_but_not_matching_tag.zig+1-1| ... | @@ -3,7 +3,7 @@ const Foo = enum(u32) { | ... | @@ -3,7 +3,7 @@ const Foo = enum(u32) { |
| 3 | B = 11, | 3 | B = 11, |
| 4 | }; | 4 | }; |
| 5 | export fn entry() void { | 5 | export fn entry() void { |
| 6 | var x = @intToEnum(Foo, 0); | 6 | var x = @enumFromInt(Foo, 0); |
| 7 | _ = x; | 7 | _ = x; |
| 8 | } | 8 | } |
| 9 | 9 |
test/cases/compile_errors/enum_with_declarations_unavailable_for_reify_type.zig+4-1| ... | @@ -1,5 +1,8 @@ | ... | @@ -1,5 +1,8 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | _ = @Type(@typeInfo(enum { foo, const bar = 1; })); | 2 | _ = @Type(@typeInfo(enum { |
| 3 | foo, | ||
| 4 | const bar = 1; | ||
| 5 | })); | ||
| 3 | } | 6 | } |
| 4 | 7 | ||
| 5 | // error | 8 | // error |
test/cases/compile_errors/error_not_handled_in_switch.zig+3-3| ... | @@ -5,9 +5,9 @@ export fn entry() void { | ... | @@ -5,9 +5,9 @@ export fn entry() void { |
| 5 | } | 5 | } |
| 6 | fn foo(x: i32) !void { | 6 | fn foo(x: i32) !void { |
| 7 | switch (x) { | 7 | switch (x) { |
| 8 | 0 ... 10 => return error.Foo, | 8 | 0...10 => return error.Foo, |
| 9 | 11 ... 20 => return error.Bar, | 9 | 11...20 => return error.Bar, |
| 10 | 21 ... 30 => return error.Baz, | 10 | 21...30 => return error.Baz, |
| 11 | else => {}, | 11 | else => {}, |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
test/cases/compile_errors/error_note_for_function_parameter_incompatibility.zig+9-5| ... | @@ -1,5 +1,9 @@ | ... | @@ -1,5 +1,9 @@ |
| 1 | fn do_the_thing(func: *const fn (arg: i32) void) void { _ = func; } | 1 | fn do_the_thing(func: *const fn (arg: i32) void) void { |
| 2 | fn bar(arg: bool) void { _ = arg; } | 2 | _ = func; |
| 3 | } | ||
| 4 | fn bar(arg: bool) void { | ||
| 5 | _ = arg; | ||
| 6 | } | ||
| 3 | export fn entry() void { | 7 | export fn entry() void { |
| 4 | do_the_thing(bar); | 8 | do_the_thing(bar); |
| 5 | } | 9 | } |
| ... | @@ -8,6 +12,6 @@ export fn entry() void { | ... | @@ -8,6 +12,6 @@ export fn entry() void { |
| 8 | // backend=stage2 | 12 | // backend=stage2 |
| 9 | // target=native | 13 | // target=native |
| 10 | // | 14 | // |
| 11 | // :4:18: error: expected type '*const fn(i32) void', found '*const fn(bool) void' | 15 | // :8:18: error: expected type '*const fn(i32) void', found '*const fn(bool) void' |
| 12 | // :4:18: note: pointer type child 'fn(bool) void' cannot cast into pointer type child 'fn(i32) void' | 16 | // :8:18: note: pointer type child 'fn(bool) void' cannot cast into pointer type child 'fn(i32) void' |
| 13 | // :4:18: note: parameter 0 'bool' cannot cast into 'i32' | 17 | // :8:18: note: parameter 0 'bool' cannot cast into 'i32' |
test/cases/compile_errors/explicitly_casting_non_tag_type_to_enum.zig+2-2| ... | @@ -7,7 +7,7 @@ const Small = enum(u2) { | ... | @@ -7,7 +7,7 @@ const Small = enum(u2) { |
| 7 | 7 | ||
| 8 | export fn entry() void { | 8 | export fn entry() void { |
| 9 | var y = @as(f32, 3); | 9 | var y = @as(f32, 3); |
| 10 | var x = @intToEnum(Small, y); | 10 | var x = @enumFromInt(Small, y); |
| 11 | _ = x; | 11 | _ = x; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| ... | @@ -15,4 +15,4 @@ export fn entry() void { | ... | @@ -15,4 +15,4 @@ export fn entry() void { |
| 15 | // backend=stage2 | 15 | // backend=stage2 |
| 16 | // target=native | 16 | // target=native |
| 17 | // | 17 | // |
| 18 | // :10:31: error: expected integer type, found 'f32' | 18 | // :10:33: error: expected integer type, found 'f32' |
test/cases/compile_errors/export_function_with_comptime_parameter.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | export fn foo(comptime x: anytype, y: i32) i32{ | 1 | export fn foo(comptime x: anytype, y: i32) i32 { |
| 2 | return x + y; | 2 | return x + y; |
| 3 | } | 3 | } |
| 4 | 4 |
test/cases/compile_errors/export_with_empty_name_string.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | pub export fn entry() void { } | 1 | pub export fn entry() void {} |
| 2 | comptime { | 2 | comptime { |
| 3 | @export(entry, .{ .name = "" }); | 3 | @export(entry, .{ .name = "" }); |
| 4 | } | 4 | } |
test/cases/compile_errors/extern_function_pointer_mismatch.zig+15-7| ... | @@ -1,13 +1,21 @@ | ... | @@ -1,13 +1,21 @@ |
| 1 | const fns = [_](fn(i32)i32) { a, b, c }; | 1 | const fns = [_](fn (i32) i32){ a, b, c }; |
| 2 | pub fn a(x: i32) i32 {return x + 0;} | 2 | pub fn a(x: i32) i32 { |
| 3 | pub fn b(x: i32) i32 {return x + 1;} | 3 | return x + 0; |
| 4 | export fn c(x: i32) i32 {return x + 2;} | 4 | } |
| 5 | pub fn b(x: i32) i32 { | ||
| 6 | return x + 1; | ||
| 7 | } | ||
| 8 | export fn c(x: i32) i32 { | ||
| 9 | return x + 2; | ||
| 10 | } | ||
| 5 | 11 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } | 12 | export fn entry() usize { |
| 13 | return @sizeOf(@TypeOf(fns)); | ||
| 14 | } | ||
| 7 | 15 | ||
| 8 | // error | 16 | // error |
| 9 | // backend=stage2 | 17 | // backend=stage2 |
| 10 | // target=native | 18 | // target=native |
| 11 | // | 19 | // |
| 12 | // :1:37: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32' | 20 | // :1:38: error: expected type 'fn(i32) i32', found 'fn(i32) callconv(.C) i32' |
| 13 | // :1:37: note: calling convention 'C' cannot cast into calling convention 'Unspecified' | 21 | // :1:38: note: calling convention 'C' cannot cast into calling convention 'Unspecified' |
test/cases/compile_errors/extern_function_with_comptime_parameter.zig+9-3| ... | @@ -4,9 +4,15 @@ fn f() i32 { | ... | @@ -4,9 +4,15 @@ fn f() i32 { |
| 4 | } | 4 | } |
| 5 | pub extern fn entry1(b: u32, comptime a: [2]u8, c: i32) void; | 5 | pub extern fn entry1(b: u32, comptime a: [2]u8, c: i32) void; |
| 6 | pub extern fn entry2(b: u32, noalias a: anytype, i43) void; | 6 | pub extern fn entry2(b: u32, noalias a: anytype, i43) void; |
| 7 | comptime { _ = &f; } | 7 | comptime { |
| 8 | comptime { _ = &entry1; } | 8 | _ = &f; |
| 9 | comptime { _ = &entry2; } | 9 | } |
| 10 | comptime { | ||
| 11 | _ = &entry1; | ||
| 12 | } | ||
| 13 | comptime { | ||
| 14 | _ = &entry2; | ||
| 15 | } | ||
| 10 | 16 | ||
| 11 | // error | 17 | // error |
| 12 | // backend=stage2 | 18 | // backend=stage2 |
test/cases/compile_errors/extern_struct_with_extern-compatible_but_inferred_integer_tag_type.zig+6-4| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | // zig fmt: off | ||
| 1 | pub const E = enum { | 2 | pub const E = enum { |
| 2 | @"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", | 3 | @"0",@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9",@"10",@"11",@"12", |
| 3 | @"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23", | 4 | @"13",@"14",@"15",@"16",@"17",@"18",@"19",@"20",@"21",@"22",@"23", |
| ... | @@ -27,6 +28,7 @@ pub const E = enum { | ... | @@ -27,6 +28,7 @@ pub const E = enum { |
| 27 | @"245",@"246",@"247",@"248",@"249",@"250",@"251",@"252",@"253", | 28 | @"245",@"246",@"247",@"248",@"249",@"250",@"251",@"252",@"253", |
| 28 | @"254",@"255", @"256" | 29 | @"254",@"255", @"256" |
| 29 | }; | 30 | }; |
| 31 | // zig fmt: on | ||
| 30 | pub const S = extern struct { | 32 | pub const S = extern struct { |
| 31 | e: E, | 33 | e: E, |
| 32 | }; | 34 | }; |
| ... | @@ -39,7 +41,7 @@ export fn entry() void { | ... | @@ -39,7 +41,7 @@ export fn entry() void { |
| 39 | // backend=stage2 | 41 | // backend=stage2 |
| 40 | // target=native | 42 | // target=native |
| 41 | // | 43 | // |
| 42 | // :31:8: error: extern structs cannot contain fields of type 'tmp.E' | 44 | // :33:8: error: extern structs cannot contain fields of type 'tmp.E' |
| 43 | // :31:8: note: enum tag type 'u9' is not extern compatible | 45 | // :33:8: note: enum tag type 'u9' is not extern compatible |
| 44 | // :31:8: note: only integers with power of two bits are extern compatible | 46 | // :33:8: note: only integers with power of two bits are extern compatible |
| 45 | // :1:15: note: enum declared here | 47 | // :2:15: note: enum declared here |
test/cases/compile_errors/extern_union_field_missing_type.zig+1-1| ... | @@ -2,7 +2,7 @@ const Letter = extern union { | ... | @@ -2,7 +2,7 @@ const Letter = extern union { |
| 2 | A, | 2 | A, |
| 3 | }; | 3 | }; |
| 4 | export fn entry() void { | 4 | export fn entry() void { |
| 5 | var a = Letter { .A = {} }; | 5 | var a = Letter{ .A = {} }; |
| 6 | _ = a; | 6 | _ = a; |
| 7 | } | 7 | } |
| 8 | 8 |
test/cases/compile_errors/extern_union_given_enum_tag_type.zig+1-1| ... | @@ -9,7 +9,7 @@ const Payload = extern union(Letter) { | ... | @@ -9,7 +9,7 @@ const Payload = extern union(Letter) { |
| 9 | C: bool, | 9 | C: bool, |
| 10 | }; | 10 | }; |
| 11 | export fn entry() void { | 11 | export fn entry() void { |
| 12 | var a = Payload { .A = 1234 }; | 12 | var a = Payload{ .A = 1234 }; |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 |
test/cases/compile_errors/fieldParentPtr-comptime_field_ptr_not_based_on_struct.zig+6-3| ... | @@ -2,10 +2,13 @@ const Foo = struct { | ... | @@ -2,10 +2,13 @@ const Foo = struct { |
| 2 | a: i32, | 2 | a: i32, |
| 3 | b: i32, | 3 | b: i32, |
| 4 | }; | 4 | }; |
| 5 | const foo = Foo { .a = 1, .b = 2, }; | 5 | const foo = Foo{ |
| 6 | .a = 1, | ||
| 7 | .b = 2, | ||
| 8 | }; | ||
| 6 | 9 | ||
| 7 | comptime { | 10 | comptime { |
| 8 | const field_ptr = @intToPtr(*i32, 0x1234); | 11 | const field_ptr = @ptrFromInt(*i32, 0x1234); |
| 9 | const another_foo_ptr = @fieldParentPtr(Foo, "b", field_ptr); | 12 | const another_foo_ptr = @fieldParentPtr(Foo, "b", field_ptr); |
| 10 | _ = another_foo_ptr; | 13 | _ = another_foo_ptr; |
| 11 | } | 14 | } |
| ... | @@ -14,4 +17,4 @@ comptime { | ... | @@ -14,4 +17,4 @@ comptime { |
| 14 | // backend=stage2 | 17 | // backend=stage2 |
| 15 | // target=native | 18 | // target=native |
| 16 | // | 19 | // |
| 17 | // :9:55: error: pointer value not based on parent struct | 20 | // :12:55: error: pointer value not based on parent struct |
test/cases/compile_errors/fieldParentPtr-comptime_wrong_field_index.zig+5-2| ... | @@ -2,7 +2,10 @@ const Foo = struct { | ... | @@ -2,7 +2,10 @@ const Foo = struct { |
| 2 | a: i32, | 2 | a: i32, |
| 3 | b: i32, | 3 | b: i32, |
| 4 | }; | 4 | }; |
| 5 | const foo = Foo { .a = 1, .b = 2, }; | 5 | const foo = Foo{ |
| 6 | .a = 1, | ||
| 7 | .b = 2, | ||
| 8 | }; | ||
| 6 | 9 | ||
| 7 | comptime { | 10 | comptime { |
| 8 | const another_foo_ptr = @fieldParentPtr(Foo, "b", &foo.a); | 11 | const another_foo_ptr = @fieldParentPtr(Foo, "b", &foo.a); |
| ... | @@ -13,5 +16,5 @@ comptime { | ... | @@ -13,5 +16,5 @@ comptime { |
| 13 | // backend=stage2 | 16 | // backend=stage2 |
| 14 | // target=native | 17 | // target=native |
| 15 | // | 18 | // |
| 16 | // :8:29: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo' | 19 | // :11:29: error: field 'b' has index '1' but pointer value is index '0' of struct 'tmp.Foo' |
| 17 | // :1:13: note: struct declared here | 20 | // :1:13: note: struct declared here |
test/cases/compile_errors/floatToInt_comptime_safety.zig deleted-17| ... | @@ -1,17 +0,0 @@ | ||
| 1 | comptime { | ||
| 2 | _ = @floatToInt(i8, @as(f32, -129.1)); | ||
| 3 | } | ||
| 4 | comptime { | ||
| 5 | _ = @floatToInt(u8, @as(f32, -1.1)); | ||
| 6 | } | ||
| 7 | comptime { | ||
| 8 | _ = @floatToInt(u8, @as(f32, 256.1)); | ||
| 9 | } | ||
| 10 | |||
| 11 | // error | ||
| 12 | // backend=stage2 | ||
| 13 | // target=native | ||
| 14 | // | ||
| 15 | // :2:25: error: float value '-129.10000610351562' cannot be stored in integer type 'i8' | ||
| 16 | // :5:25: error: float value '-1.100000023841858' cannot be stored in integer type 'u8' | ||
| 17 | // :8:25: error: float value '256.1000061035156' cannot be stored in integer type 'u8' | ||
test/cases/compile_errors/for.zig+14-10| ... | @@ -1,13 +1,15 @@ | ... | @@ -1,13 +1,15 @@ |
| 1 | export fn a() void { | 1 | export fn a() void { |
| 2 | for (0..10, 10..21) |i, j| { | 2 | for (0..10, 10..21) |i, j| { |
| 3 | _ = i; _ = j; | 3 | _ = i; |
| 4 | _ = j; | ||
| 4 | } | 5 | } |
| 5 | } | 6 | } |
| 6 | export fn b() void { | 7 | export fn b() void { |
| 7 | const s1 = "hello"; | 8 | const s1 = "hello"; |
| 8 | const s2 = true; | 9 | const s2 = true; |
| 9 | for (s1, s2) |i, j| { | 10 | for (s1, s2) |i, j| { |
| 10 | _ = i; _ = j; | 11 | _ = i; |
| 12 | _ = j; | ||
| 11 | } | 13 | } |
| 12 | } | 14 | } |
| 13 | export fn c() void { | 15 | export fn c() void { |
| ... | @@ -20,7 +22,9 @@ export fn d() void { | ... | @@ -20,7 +22,9 @@ export fn d() void { |
| 20 | const x: [*]const u8 = "hello"; | 22 | const x: [*]const u8 = "hello"; |
| 21 | const y: [*]const u8 = "world"; | 23 | const y: [*]const u8 = "world"; |
| 22 | for (x, 0.., y) |x1, x2, x3| { | 24 | for (x, 0.., y) |x1, x2, x3| { |
| 23 | _ = x1; _ = x2; _ = x3; | 25 | _ = x1; |
| 26 | _ = x2; | ||
| 27 | _ = x3; | ||
| 24 | } | 28 | } |
| 25 | } | 29 | } |
| 26 | 30 | ||
| ... | @@ -31,10 +35,10 @@ export fn d() void { | ... | @@ -31,10 +35,10 @@ export fn d() void { |
| 31 | // :2:5: error: non-matching for loop lengths | 35 | // :2:5: error: non-matching for loop lengths |
| 32 | // :2:11: note: length 10 here | 36 | // :2:11: note: length 10 here |
| 33 | // :2:19: note: length 11 here | 37 | // :2:19: note: length 11 here |
| 34 | // :9:14: error: type 'bool' is not indexable and not a range | 38 | // :10:14: error: type 'bool' is not indexable and not a range |
| 35 | // :9:14: note: for loop operand must be a range, array, slice, tuple, or vector | 39 | // :10:14: note: for loop operand must be a range, array, slice, tuple, or vector |
| 36 | // :15:16: error: pointer capture of non pointer type '[10]u8' | 40 | // :17:16: error: pointer capture of non pointer type '[10]u8' |
| 37 | // :15:10: note: consider using '&' here | 41 | // :17:10: note: consider using '&' here |
| 38 | // :22:5: error: unbounded for loop | 42 | // :24:5: error: unbounded for loop |
| 39 | // :22:10: note: type '[*]const u8' has no upper bound | 43 | // :24:10: note: type '[*]const u8' has no upper bound |
| 40 | // :22:18: note: type '[*]const u8' has no upper bound | 44 | // :24:18: note: type '[*]const u8' has no upper bound |
test/cases/compile_errors/for_extra_capture.zig+6-3| ... | @@ -1,12 +1,15 @@ | ... | @@ -1,12 +1,15 @@ |
| 1 | // zig fmt: off | ||
| 1 | export fn b() void { | 2 | export fn b() void { |
| 2 | for (0..10) |i, j| { | 3 | for (0..10) |i, j| { |
| 3 | _ = i; _ = j; | 4 | _ = i; |
| 5 | _ = j; | ||
| 4 | } | 6 | } |
| 5 | } | 7 | } |
| 8 | // zig fmt: on | ||
| 6 | 9 | ||
| 7 | // error | 10 | // error |
| 8 | // backend=stage2 | 11 | // backend=stage2 |
| 9 | // target=native | 12 | // target=native |
| 10 | // | 13 | // |
| 11 | // :2:21: error: extra capture in for loop | 14 | // :3:21: error: extra capture in for loop |
| 12 | // :2:21: note: run 'zig fmt' to upgrade your code automatically | 15 | // :3:21: note: run 'zig fmt' to upgrade your code automatically |
test/cases/compile_errors/function_alignment_non_power_of_2.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | extern fn foo() align(3) void; | 1 | extern fn foo() align(3) void; |
| 2 | export fn entry() void { return foo(); } | 2 | export fn entry() void { |
| 3 | return foo(); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/function_call_assigned_to_incorrect_type.zig+1-1| ... | @@ -3,7 +3,7 @@ export fn entry() void { | ... | @@ -3,7 +3,7 @@ export fn entry() void { |
| 3 | arr = concat(); | 3 | arr = concat(); |
| 4 | } | 4 | } |
| 5 | fn concat() [16]f32 { | 5 | fn concat() [16]f32 { |
| 6 | return [1]f32{0}**16; | 6 | return [1]f32{0} ** 16; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | // error | 9 | // error |
test/cases/compile_errors/function_parameter_is_opaque.zig+7-3| ... | @@ -9,12 +9,16 @@ export fn entry2() void { | ... | @@ -9,12 +9,16 @@ export fn entry2() void { |
| 9 | _ = someFuncPtr; | 9 | _ = someFuncPtr; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | fn foo(p: FooType) void {_ = p;} | 12 | fn foo(p: FooType) void { |
| 13 | _ = p; | ||
| 14 | } | ||
| 13 | export fn entry3() void { | 15 | export fn entry3() void { |
| 14 | _ = foo; | 16 | _ = foo; |
| 15 | } | 17 | } |
| 16 | 18 | ||
| 17 | fn bar(p: @TypeOf(null)) void {_ = p;} | 19 | fn bar(p: @TypeOf(null)) void { |
| 20 | _ = p; | ||
| 21 | } | ||
| 18 | export fn entry4() void { | 22 | export fn entry4() void { |
| 19 | _ = bar; | 23 | _ = bar; |
| 20 | } | 24 | } |
| ... | @@ -28,4 +32,4 @@ export fn entry4() void { | ... | @@ -28,4 +32,4 @@ export fn entry4() void { |
| 28 | // :8:28: error: parameter of type '@TypeOf(null)' not allowed | 32 | // :8:28: error: parameter of type '@TypeOf(null)' not allowed |
| 29 | // :12:8: error: parameter of opaque type 'tmp.FooType' not allowed | 33 | // :12:8: error: parameter of opaque type 'tmp.FooType' not allowed |
| 30 | // :1:17: note: opaque declared here | 34 | // :1:17: note: opaque declared here |
| 31 | // :17:8: error: parameter of type '@TypeOf(null)' not allowed | 35 | // :19:8: error: parameter of type '@TypeOf(null)' not allowed |
test/cases/compile_errors/function_with_non-extern_non-packed_enum_parameter.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const Foo = enum { A, B, C }; | 1 | const Foo = enum { A, B, C }; |
| 2 | export fn entry(foo: Foo) void { _ = foo; } | 2 | export fn entry(foo: Foo) void { |
| 3 | _ = foo; | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/function_with_non-extern_non-packed_struct_parameter.zig+3-1| ... | @@ -3,7 +3,9 @@ const Foo = struct { | ... | @@ -3,7 +3,9 @@ const Foo = struct { |
| 3 | B: f32, | 3 | B: f32, |
| 4 | C: bool, | 4 | C: bool, |
| 5 | }; | 5 | }; |
| 6 | export fn entry(foo: Foo) void { _ = foo; } | 6 | export fn entry(foo: Foo) void { |
| 7 | _ = foo; | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/function_with_non-extern_non-packed_union_parameter.zig+3-1| ... | @@ -3,7 +3,9 @@ const Foo = union { | ... | @@ -3,7 +3,9 @@ const Foo = union { |
| 3 | B: f32, | 3 | B: f32, |
| 4 | C: bool, | 4 | C: bool, |
| 5 | }; | 5 | }; |
| 6 | export fn entry(foo: Foo) void { _ = foo; } | 6 | export fn entry(foo: Foo) void { |
| 7 | _ = foo; | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/generic_function_call_assigned_to_incorrect_type.zig+1-1| ... | @@ -2,7 +2,7 @@ pub export fn entry() void { | ... | @@ -2,7 +2,7 @@ pub export fn entry() void { |
| 2 | var res: []i32 = undefined; | 2 | var res: []i32 = undefined; |
| 3 | res = myAlloc(i32); | 3 | res = myAlloc(i32); |
| 4 | } | 4 | } |
| 5 | fn myAlloc(comptime arg: type) anyerror!arg{ | 5 | fn myAlloc(comptime arg: type) anyerror!arg { |
| 6 | unreachable; | 6 | unreachable; |
| 7 | } | 7 | } |
| 8 | 8 |
test/cases/compile_errors/generic_function_instance_with_non-constant_expression.zig+8-4| ... | @@ -1,13 +1,17 @@ | ... | @@ -1,13 +1,17 @@ |
| 1 | fn foo(comptime x: i32, y: i32) i32 { return x + y; } | 1 | fn foo(comptime x: i32, y: i32) i32 { |
| 2 | return x + y; | ||
| 3 | } | ||
| 2 | fn test1(a: i32, b: i32) i32 { | 4 | fn test1(a: i32, b: i32) i32 { |
| 3 | return foo(a, b); | 5 | return foo(a, b); |
| 4 | } | 6 | } |
| 5 | 7 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(&test1)); } | 8 | export fn entry() usize { |
| 9 | return @sizeOf(@TypeOf(&test1)); | ||
| 10 | } | ||
| 7 | 11 | ||
| 8 | // error | 12 | // error |
| 9 | // backend=stage2 | 13 | // backend=stage2 |
| 10 | // target=native | 14 | // target=native |
| 11 | // | 15 | // |
| 12 | // :3:16: error: unable to resolve comptime value | 16 | // :5:16: error: unable to resolve comptime value |
| 13 | // :3:16: note: parameter is comptime | 17 | // :5:16: note: parameter is comptime |
test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig-1| ... | @@ -6,7 +6,6 @@ pub export fn entry() void { | ... | @@ -6,7 +6,6 @@ pub export fn entry() void { |
| 6 | } | 6 | } |
| 7 | fn sliceAsBytes(slice: anytype) std.meta.trait.isPtrTo(.Array)(@TypeOf(slice)) {} | 7 | fn sliceAsBytes(slice: anytype) std.meta.trait.isPtrTo(.Array)(@TypeOf(slice)) {} |
| 8 | 8 | ||
| 9 | |||
| 10 | // error | 9 | // error |
| 11 | // backend=llvm | 10 | // backend=llvm |
| 12 | // target=native | 11 | // target=native |
test/cases/compile_errors/global_variable_alignment_non_power_of_2.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | const some_data: [100]u8 align(3) = undefined; | 1 | const some_data: [100]u8 align(3) = undefined; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(some_data)); } | 2 | export fn entry() usize { |
| 3 | return @sizeOf(@TypeOf(some_data)); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/global_variable_initializer_must_be_constant_expression.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | extern fn foo() i32; | 1 | extern fn foo() i32; |
| 2 | const x = foo(); | 2 | const x = foo(); |
| 3 | export fn entry() i32 { return x; } | 3 | export fn entry() i32 { |
| 4 | return x; | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/ignored_assert-err-ok_return_value.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | bar() catch unreachable; | 2 | bar() catch unreachable; |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 0; } | 4 | fn bar() anyerror!i32 { |
| 5 | return 0; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/ignored_comptime_statement_value.zig+6-4| ... | @@ -1,11 +1,13 @@ | ... | @@ -1,11 +1,13 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | comptime {1;} | 2 | comptime { |
| 3 | 1; | ||
| 4 | } | ||
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
| 7 | // target=native | 9 | // target=native |
| 8 | // | 10 | // |
| 9 | // :2:15: error: value of type 'comptime_int' ignored | 11 | // :3:9: error: value of type 'comptime_int' ignored |
| 10 | // :2:15: note: all non-void values must be used | 12 | // :3:9: note: all non-void values must be used |
| 11 | // :2:15: note: this error can be suppressed by assigning the value to '_' | 13 | // :3:9: note: this error can be suppressed by assigning the value to '_' |
test/cases/compile_errors/ignored_deferred_function_call.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | defer bar(); | 2 | defer bar(); |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 0; } | 4 | fn bar() anyerror!i32 { |
| 5 | return 0; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/ignored_deferred_statement_value.zig+6-4| ... | @@ -1,11 +1,13 @@ | ... | @@ -1,11 +1,13 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | defer {1;} | 2 | defer { |
| 3 | 1; | ||
| 4 | } | ||
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
| 7 | // target=native | 9 | // target=native |
| 8 | // | 10 | // |
| 9 | // :2:12: error: value of type 'comptime_int' ignored | 11 | // :3:9: error: value of type 'comptime_int' ignored |
| 10 | // :2:12: note: all non-void values must be used | 12 | // :3:9: note: all non-void values must be used |
| 11 | // :2:12: note: this error can be suppressed by assigning the value to '_' | 13 | // :3:9: note: this error can be suppressed by assigning the value to '_' |
test/cases/compile_errors/ignored_return_value.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | bar(); | 2 | bar(); |
| 3 | } | 3 | } |
| 4 | fn bar() i32 { return 0; } | 4 | fn bar() i32 { |
| 5 | return 0; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/illegal_comparison_of_types.zig+6-2| ... | @@ -9,8 +9,12 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { | ... | @@ -9,8 +9,12 @@ fn bad_eql_2(a: *const EnumWithData, b: *const EnumWithData) bool { |
| 9 | return a.* == b.*; | 9 | return a.* == b.*; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | export fn entry1() usize { return @sizeOf(@TypeOf(&bad_eql_1)); } | 12 | export fn entry1() usize { |
| 13 | export fn entry2() usize { return @sizeOf(@TypeOf(&bad_eql_2)); } | 13 | return @sizeOf(@TypeOf(&bad_eql_1)); |
| 14 | } | ||
| 15 | export fn entry2() usize { | ||
| 16 | return @sizeOf(@TypeOf(&bad_eql_2)); | ||
| 17 | } | ||
| 14 | 18 | ||
| 15 | // error | 19 | // error |
| 16 | // backend=stage2 | 20 | // backend=stage2 |
test/cases/compile_errors/implicit_cast_from_array_to_mutable_slice.zig+4-2| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | var global_array: [10]i32 = undefined; | 1 | var global_array: [10]i32 = undefined; |
| 2 | fn foo(param: []i32) void {_ = param;} | 2 | fn foo(param: []i32) void { |
| 3 | _ = param; | ||
| 4 | } | ||
| 3 | export fn entry() void { | 5 | export fn entry() void { |
| 4 | foo(global_array); | 6 | foo(global_array); |
| 5 | } | 7 | } |
| ... | @@ -8,4 +10,4 @@ export fn entry() void { | ... | @@ -8,4 +10,4 @@ export fn entry() void { |
| 8 | // backend=llvm | 10 | // backend=llvm |
| 9 | // target=native | 11 | // target=native |
| 10 | // | 12 | // |
| 11 | // :4:9: error: array literal requires address-of operator (&) to coerce to slice type '[]i32' | 13 | // :6:9: error: array literal requires address-of operator (&) to coerce to slice type '[]i32' |
test/cases/compile_errors/implicitly_increasing_pointer_alignment.zig+1-1| ... | @@ -4,7 +4,7 @@ const Foo = packed struct { | ... | @@ -4,7 +4,7 @@ const Foo = packed struct { |
| 4 | }; | 4 | }; |
| 5 | 5 | ||
| 6 | export fn entry() void { | 6 | export fn entry() void { |
| 7 | var foo = Foo { .a = 1, .b = 10 }; | 7 | var foo = Foo{ .a = 1, .b = 10 }; |
| 8 | bar(&foo.b); | 8 | bar(&foo.b); |
| 9 | } | 9 | } |
| 10 | 10 |
test/cases/compile_errors/implicitly_increasing_slice_alignment.zig+1-1| ... | @@ -4,7 +4,7 @@ const Foo = packed struct { | ... | @@ -4,7 +4,7 @@ const Foo = packed struct { |
| 4 | }; | 4 | }; |
| 5 | 5 | ||
| 6 | export fn entry() void { | 6 | export fn entry() void { |
| 7 | var foo = Foo { .a = 1, .b = 10 }; | 7 | var foo = Foo{ .a = 1, .b = 10 }; |
| 8 | foo.b += 1; | 8 | foo.b += 1; |
| 9 | bar(@as(*[1]u32, &foo.b)[0..]); | 9 | bar(@as(*[1]u32, &foo.b)[0..]); |
| 10 | } | 10 | } |
test/cases/compile_errors/import_outside_package_path.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | comptime{ | 1 | comptime { |
| 2 | _ = @import("../a.zig"); | 2 | _ = @import("../a.zig"); |
| 3 | } | 3 | } |
| 4 | 4 |
test/cases/compile_errors/incorrect_return_type.zig+19-19| ... | @@ -1,24 +1,24 @@ | ... | @@ -1,24 +1,24 @@ |
| 1 | pub export fn entry() void{ | 1 | pub export fn entry() void { |
| 2 | _ = foo(); | 2 | _ = foo(); |
| 3 | } | 3 | } |
| 4 | const A = struct { | 4 | const A = struct { |
| 5 | a: u32, | 5 | a: u32, |
| 6 | }; | 6 | }; |
| 7 | fn foo() A { | 7 | fn foo() A { |
| 8 | return bar(); | 8 | return bar(); |
| 9 | } | 9 | } |
| 10 | const B = struct { | 10 | const B = struct { |
| 11 | a: u32, | 11 | a: u32, |
| 12 | }; | 12 | }; |
| 13 | fn bar() B { | 13 | fn bar() B { |
| 14 | unreachable; | 14 | unreachable; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | // error | 17 | // error |
| 18 | // backend=stage2 | 18 | // backend=stage2 |
| 19 | // target=native | 19 | // target=native |
| 20 | // | 20 | // |
| 21 | // :8:16: error: expected type 'tmp.A', found 'tmp.B' | 21 | // :8:15: error: expected type 'tmp.A', found 'tmp.B' |
| 22 | // :10:12: note: struct declared here | 22 | // :10:11: note: struct declared here |
| 23 | // :4:12: note: struct declared here | 23 | // :4:11: note: struct declared here |
| 24 | // :7:11: note: function return type declared here | 24 | // :7:10: note: function return type declared here |
test/cases/compile_errors/increase_pointer_alignment_in_ptrCast.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() u32 { | 1 | export fn entry() u32 { |
| 2 | var bytes: [4]u8 = [_]u8{0x01, 0x02, 0x03, 0x04}; | 2 | var bytes: [4]u8 = [_]u8{ 0x01, 0x02, 0x03, 0x04 }; |
| 3 | const ptr = @ptrCast(*u32, &bytes[0]); | 3 | const ptr = @ptrCast(*u32, &bytes[0]); |
| 4 | return ptr.*; | 4 | return ptr.*; |
| 5 | } | 5 | } |
test/cases/compile_errors/indirect_struct_loop.zig+15-7| ... | @@ -1,13 +1,21 @@ | ... | @@ -1,13 +1,21 @@ |
| 1 | const A = struct { b : B, }; | 1 | const A = struct { |
| 2 | const B = struct { c : C, }; | 2 | b: B, |
| 3 | const C = struct { a : A, }; | 3 | }; |
| 4 | export fn entry() usize { return @sizeOf(A); } | 4 | const B = struct { |
| 5 | c: C, | ||
| 6 | }; | ||
| 7 | const C = struct { | ||
| 8 | a: A, | ||
| 9 | }; | ||
| 10 | export fn entry() usize { | ||
| 11 | return @sizeOf(A); | ||
| 12 | } | ||
| 5 | 13 | ||
| 6 | // error | 14 | // error |
| 7 | // backend=stage2 | 15 | // backend=stage2 |
| 8 | // target=native | 16 | // target=native |
| 9 | // | 17 | // |
| 10 | // :1:11: error: struct 'tmp.A' depends on itself | 18 | // :1:11: error: struct 'tmp.A' depends on itself |
| 11 | // :3:20: note: while checking this field | 19 | // :8:5: note: while checking this field |
| 12 | // :2:20: note: while checking this field | 20 | // :5:5: note: while checking this field |
| 13 | // :1:20: note: while checking this field | 21 | // :2:5: note: while checking this field |
test/cases/compile_errors/inferred_array_size_invalid_here.zig+1-1| ... | @@ -4,7 +4,7 @@ export fn entry() void { | ... | @@ -4,7 +4,7 @@ export fn entry() void { |
| 4 | } | 4 | } |
| 5 | export fn entry2() void { | 5 | export fn entry2() void { |
| 6 | const S = struct { a: *const [_]u8 }; | 6 | const S = struct { a: *const [_]u8 }; |
| 7 | var a = .{ S{} }; | 7 | var a = .{S{}}; |
| 8 | _ = a; | 8 | _ = a; |
| 9 | } | 9 | } |
| 10 | 10 |
test/cases/compile_errors/inferring_error_set_of_function_pointer.zig+2-2| ... | @@ -1,9 +1,9 @@ | ... | @@ -1,9 +1,9 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | const z: ?fn()!void = null; | 2 | const z: ?fn () !void = null; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
| 6 | // backend=stage2 | 6 | // backend=stage2 |
| 7 | // target=native | 7 | // target=native |
| 8 | // | 8 | // |
| 9 | // :2:19: error: function prototype may not have inferred error set | 9 | // :2:21: error: function prototype may not have inferred error set |
test/cases/compile_errors/int-float_conversion_to_comptime_int-float.zig+6-6| ... | @@ -1,17 +1,17 @@ | ... | @@ -1,17 +1,17 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | var a: f32 = 2; | 2 | var a: f32 = 2; |
| 3 | _ = @floatToInt(comptime_int, a); | 3 | _ = @intFromFloat(comptime_int, a); |
| 4 | } | 4 | } |
| 5 | export fn bar() void { | 5 | export fn bar() void { |
| 6 | var a: u32 = 2; | 6 | var a: u32 = 2; |
| 7 | _ = @intToFloat(comptime_float, a); | 7 | _ = @floatFromInt(comptime_float, a); |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // error | 10 | // error |
| 11 | // backend=stage2 | 11 | // backend=stage2 |
| 12 | // target=native | 12 | // target=native |
| 13 | // | 13 | // |
| 14 | // :3:35: error: unable to resolve comptime value | 14 | // :3:37: error: unable to resolve comptime value |
| 15 | // :3:35: note: value being casted to 'comptime_int' must be comptime-known | 15 | // :3:37: note: value being casted to 'comptime_int' must be comptime-known |
| 16 | // :7:37: error: unable to resolve comptime value | 16 | // :7:39: error: unable to resolve comptime value |
| 17 | // :7:37: note: value being casted to 'comptime_float' must be comptime-known | 17 | // :7:39: note: value being casted to 'comptime_float' must be comptime-known |
test/cases/compile_errors/intFromFloat_comptime_safety.zig created+17| ... | @@ -0,0 +1,17 @@ | ||
| 1 | comptime { | ||
| 2 | _ = @intFromFloat(i8, @as(f32, -129.1)); | ||
| 3 | } | ||
| 4 | comptime { | ||
| 5 | _ = @intFromFloat(u8, @as(f32, -1.1)); | ||
| 6 | } | ||
| 7 | comptime { | ||
| 8 | _ = @intFromFloat(u8, @as(f32, 256.1)); | ||
| 9 | } | ||
| 10 | |||
| 11 | // error | ||
| 12 | // backend=stage2 | ||
| 13 | // target=native | ||
| 14 | // | ||
| 15 | // :2:27: error: float value '-129.10000610351562' cannot be stored in integer type 'i8' | ||
| 16 | // :5:27: error: float value '-1.100000023841858' cannot be stored in integer type 'u8' | ||
| 17 | // :8:27: error: float value '256.1000061035156' cannot be stored in integer type 'u8' | ||
test/cases/compile_errors/intFromPtr_0_to_non_optional_pointer.zig created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | var b = @ptrFromInt(*i32, 0); | ||
| 3 | _ = b; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:31: error: pointer type '*i32' does not allow address zero | ||
test/cases/compile_errors/intToEnum_on_non-exhaustive_enums_checks_int_in_range.zig deleted-11| ... | @@ -1,11 +0,0 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | const E = enum(u3) { a, b, c, _ }; | ||
| 3 | @compileLog(@intToEnum(E, 100)); | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // target=native | ||
| 8 | // backend=stage2 | ||
| 9 | // | ||
| 10 | // :3:17: error: int value '100' out of range of non-exhaustive enum 'tmp.entry.E' | ||
| 11 | // :2:15: note: enum declared here | ||
test/cases/compile_errors/intToPtr_with_misaligned_address.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | var y = @intToPtr([*]align(4) u8, 5); | ||
| 3 | _ = y; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:39: error: pointer type '[*]align(4) u8' requires aligned address | ||
test/cases/compile_errors/int_to_err_global_invalid_number.zig+2-2| ... | @@ -4,7 +4,7 @@ const Set1 = error{ | ... | @@ -4,7 +4,7 @@ const Set1 = error{ |
| 4 | }; | 4 | }; |
| 5 | comptime { | 5 | comptime { |
| 6 | var x: u16 = 3; | 6 | var x: u16 = 3; |
| 7 | var y = @intToError(x); | 7 | var y = @errorFromInt(x); |
| 8 | _ = y; | 8 | _ = y; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| ... | @@ -12,4 +12,4 @@ comptime { | ... | @@ -12,4 +12,4 @@ comptime { |
| 12 | // backend=stage2 | 12 | // backend=stage2 |
| 13 | // target=native | 13 | // target=native |
| 14 | // | 14 | // |
| 15 | // :7:25: error: integer value '3' represents no error | 15 | // :7:27: error: integer value '3' represents no error |
test/cases/compile_errors/int_to_err_non_global_invalid_number.zig+2-2| ... | @@ -7,8 +7,8 @@ const Set2 = error{ | ... | @@ -7,8 +7,8 @@ const Set2 = error{ |
| 7 | C, | 7 | C, |
| 8 | }; | 8 | }; |
| 9 | comptime { | 9 | comptime { |
| 10 | var x = @errorToInt(Set1.B); | 10 | var x = @intFromError(Set1.B); |
| 11 | var y = @errSetCast(Set2, @intToError(x)); | 11 | var y = @errSetCast(Set2, @errorFromInt(x)); |
| 12 | _ = y; | 12 | _ = y; |
| 13 | } | 13 | } |
| 14 | 14 |
test/cases/compile_errors/integer_overflow_error.zig+5-3| ... | @@ -1,8 +1,10 @@ | ... | @@ -1,8 +1,10 @@ |
| 1 | const x : u8 = 300; | 1 | const x: u8 = 300; |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(x)); } | 2 | export fn entry() usize { |
| 3 | return @sizeOf(@TypeOf(x)); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
| 6 | // target=native | 8 | // target=native |
| 7 | // | 9 | // |
| 8 | // :1:16: error: type 'u8' cannot represent integer value '300' | 10 | // :1:15: error: type 'u8' cannot represent integer value '300' |
test/cases/compile_errors/integer_underflow_error.zig+2-2| ... | @@ -1,9 +1,9 @@ | ... | @@ -1,9 +1,9 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | _ = @intToPtr(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1); | 2 | _ = @ptrFromInt(*anyopaque, ~@as(usize, @import("std").math.maxInt(usize)) - 1); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
| 6 | // backend=stage2 | 6 | // backend=stage2 |
| 7 | // target=native | 7 | // target=native |
| 8 | // | 8 | // |
| 9 | // :2:78: error: overflow of integer type 'usize' with value '-1' | 9 | // :2:80: error: overflow of integer type 'usize' with value '-1' |
test/cases/compile_errors/inttoptr_non_ptr_type.zig deleted-15| ... | @@ -1,15 +0,0 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | _ = @intToPtr(i32, 10); | ||
| 3 | } | ||
| 4 | |||
| 5 | pub export fn entry2() void { | ||
| 6 | _ = @intToPtr([]u8, 20); | ||
| 7 | } | ||
| 8 | |||
| 9 | // error | ||
| 10 | // backend=stage2 | ||
| 11 | // target=native | ||
| 12 | // | ||
| 13 | // :2:19: error: expected pointer type, found 'i32' | ||
| 14 | // :6:19: error: integer cannot be converted to slice type '[]u8' | ||
| 15 | // :6:19: note: slice length cannot be inferred from address | ||
test/cases/compile_errors/invalid_builtin_fn.zig+3-2| ... | @@ -1,6 +1,7 @@ | ... | @@ -1,6 +1,7 @@ |
| 1 | fn f() @bogus(foo) { | 1 | fn f() @bogus(foo) {} |
| 2 | export fn entry() void { | ||
| 3 | _ = f(); | ||
| 2 | } | 4 | } |
| 3 | export fn entry() void { _ = f(); } | ||
| 4 | 5 | ||
| 5 | // error | 6 | // error |
| 6 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/invalid_capture_type.zig+6-4| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export fn f1() void { | 1 | export fn f1() void { |
| 2 | if (true) |x| { _ = x; } | 2 | if (true) |x| { |
| 3 | _ = x; | ||
| 4 | } | ||
| 3 | } | 5 | } |
| 4 | export fn f2() void { | 6 | export fn f2() void { |
| 5 | if (@as(usize, 5)) |_| {} | 7 | if (@as(usize, 5)) |_| {} |
| ... | @@ -19,6 +21,6 @@ export fn f5() void { | ... | @@ -19,6 +21,6 @@ export fn f5() void { |
| 19 | // target=native | 21 | // target=native |
| 20 | // | 22 | // |
| 21 | // :2:9: error: expected optional type, found 'bool' | 23 | // :2:9: error: expected optional type, found 'bool' |
| 22 | // :5:9: error: expected optional type, found 'usize' | 24 | // :7:9: error: expected optional type, found 'usize' |
| 23 | // :8:9: error: expected error union type, found 'usize' | 25 | // :10:9: error: expected error union type, found 'usize' |
| 24 | // :14:9: error: expected error union type, found 'error{Foo}' | 26 | // :16:9: error: expected error union type, found 'error{Foo}' |
test/cases/compile_errors/invalid_comparison_for_function_pointers.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | fn foo() void {} | 1 | fn foo() void {} |
| 2 | const invalid = foo > foo; | 2 | const invalid = foo > foo; |
| 3 | 3 | ||
| 4 | export fn entry() usize { return @sizeOf(@TypeOf(invalid)); } | 4 | export fn entry() usize { |
| 5 | return @sizeOf(@TypeOf(invalid)); | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/invalid_field_access_in_comptime.zig+5-2| ... | @@ -1,7 +1,10 @@ | ... | @@ -1,7 +1,10 @@ |
| 1 | comptime { var x = doesnt_exist.whatever; _ = x; } | 1 | comptime { |
| 2 | var x = doesnt_exist.whatever; | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 2 | 5 | ||
| 3 | // error | 6 | // error |
| 4 | // backend=stage2 | 7 | // backend=stage2 |
| 5 | // target=native | 8 | // target=native |
| 6 | // | 9 | // |
| 7 | // :1:20: error: use of undeclared identifier 'doesnt_exist' | 10 | // :2:13: error: use of undeclared identifier 'doesnt_exist' |
test/cases/compile_errors/invalid_field_in_struct_value_expression.zig+4-5| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | const A = struct { | 1 | const A = struct { |
| 2 | x : i32, | 2 | x: i32, |
| 3 | y : i32, | 3 | y: i32, |
| 4 | z : i32, | 4 | z: i32, |
| 5 | }; | 5 | }; |
| 6 | export fn f() void { | 6 | export fn f() void { |
| 7 | const a = A { | 7 | const a = A{ |
| 8 | .z = 4, | 8 | .z = 4, |
| 9 | .y = 2, | 9 | .y = 2, |
| 10 | .foo = 42, | 10 | .foo = 42, |
| ... | @@ -21,7 +21,6 @@ pub export fn entry() void { | ... | @@ -21,7 +21,6 @@ pub export fn entry() void { |
| 21 | dump(.{ .field_1 = 123, .field_3 = 456 }); | 21 | dump(.{ .field_1 = 123, .field_3 = 456 }); |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | |||
| 25 | // error | 24 | // error |
| 26 | // backend=stage2 | 25 | // backend=stage2 |
| 27 | // target=native | 26 | // target=native |
test/cases/compile_errors/invalid_float_casts.zig+4-4| ... | @@ -4,11 +4,11 @@ export fn foo() void { | ... | @@ -4,11 +4,11 @@ export fn foo() void { |
| 4 | } | 4 | } |
| 5 | export fn bar() void { | 5 | export fn bar() void { |
| 6 | var a: f32 = 2; | 6 | var a: f32 = 2; |
| 7 | _ = @floatToInt(f32, a); | 7 | _ = @intFromFloat(f32, a); |
| 8 | } | 8 | } |
| 9 | export fn baz() void { | 9 | export fn baz() void { |
| 10 | var a: f32 = 2; | 10 | var a: f32 = 2; |
| 11 | _ = @intToFloat(f32, a); | 11 | _ = @floatFromInt(f32, a); |
| 12 | } | 12 | } |
| 13 | export fn qux() void { | 13 | export fn qux() void { |
| 14 | var a: u32 = 2; | 14 | var a: u32 = 2; |
| ... | @@ -20,6 +20,6 @@ export fn qux() void { | ... | @@ -20,6 +20,6 @@ export fn qux() void { |
| 20 | // target=native | 20 | // target=native |
| 21 | // | 21 | // |
| 22 | // :3:36: error: unable to cast runtime value to 'comptime_float' | 22 | // :3:36: error: unable to cast runtime value to 'comptime_float' |
| 23 | // :7:21: error: expected integer type, found 'f32' | 23 | // :7:23: error: expected integer type, found 'f32' |
| 24 | // :11:26: error: expected integer type, found 'f32' | 24 | // :11:28: error: expected integer type, found 'f32' |
| 25 | // :15:25: error: expected float type, found 'u32' | 25 | // :15:25: error: expected float type, found 'u32' |
test/cases/compile_errors/invalid_int_casts.zig+4-4| ... | @@ -4,11 +4,11 @@ export fn foo() void { | ... | @@ -4,11 +4,11 @@ export fn foo() void { |
| 4 | } | 4 | } |
| 5 | export fn bar() void { | 5 | export fn bar() void { |
| 6 | var a: u32 = 2; | 6 | var a: u32 = 2; |
| 7 | _ = @intToFloat(u32, a); | 7 | _ = @floatFromInt(u32, a); |
| 8 | } | 8 | } |
| 9 | export fn baz() void { | 9 | export fn baz() void { |
| 10 | var a: u32 = 2; | 10 | var a: u32 = 2; |
| 11 | _ = @floatToInt(u32, a); | 11 | _ = @intFromFloat(u32, a); |
| 12 | } | 12 | } |
| 13 | export fn qux() void { | 13 | export fn qux() void { |
| 14 | var a: f32 = 2; | 14 | var a: f32 = 2; |
| ... | @@ -20,6 +20,6 @@ export fn qux() void { | ... | @@ -20,6 +20,6 @@ export fn qux() void { |
| 20 | // target=native | 20 | // target=native |
| 21 | // | 21 | // |
| 22 | // :3:32: error: unable to cast runtime value to 'comptime_int' | 22 | // :3:32: error: unable to cast runtime value to 'comptime_int' |
| 23 | // :7:21: error: expected float type, found 'u32' | 23 | // :7:23: error: expected float type, found 'u32' |
| 24 | // :11:26: error: expected float type, found 'u32' | 24 | // :11:28: error: expected float type, found 'u32' |
| 25 | // :15:23: error: expected integer or vector, found 'f32' | 25 | // :15:23: error: expected integer or vector, found 'f32' |
test/cases/compile_errors/invalid_non-exhaustive_enum_to_union.zig+3-3| ... | @@ -8,12 +8,12 @@ const U = union(E) { | ... | @@ -8,12 +8,12 @@ const U = union(E) { |
| 8 | b, | 8 | b, |
| 9 | }; | 9 | }; |
| 10 | export fn foo() void { | 10 | export fn foo() void { |
| 11 | var e = @intToEnum(E, 15); | 11 | var e = @enumFromInt(E, 15); |
| 12 | var u: U = e; | 12 | var u: U = e; |
| 13 | _ = u; | 13 | _ = u; |
| 14 | } | 14 | } |
| 15 | export fn bar() void { | 15 | export fn bar() void { |
| 16 | const e = @intToEnum(E, 15); | 16 | const e = @enumFromInt(E, 15); |
| 17 | var u: U = e; | 17 | var u: U = e; |
| 18 | _ = u; | 18 | _ = u; |
| 19 | } | 19 | } |
| ... | @@ -24,5 +24,5 @@ export fn bar() void { | ... | @@ -24,5 +24,5 @@ export fn bar() void { |
| 24 | // | 24 | // |
| 25 | // :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum | 25 | // :12:16: error: runtime coercion to union 'tmp.U' from non-exhaustive enum |
| 26 | // :1:11: note: enum declared here | 26 | // :1:11: note: enum declared here |
| 27 | // :17:16: error: union 'tmp.U' has no tag with value '@intToEnum(tmp.E, 15)' | 27 | // :17:16: error: union 'tmp.U' has no tag with value '@enumFromInt(tmp.E, 15)' |
| 28 | // :6:11: note: union declared here | 28 | // :6:11: note: union declared here |
test/cases/compile_errors/invalid_optional_type_in_extern_struct.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const stroo = extern struct { | 1 | const stroo = extern struct { |
| 2 | moo: ?[*c]u8, | 2 | moo: ?[*c]u8, |
| 3 | }; | 3 | }; |
| 4 | export fn testf(fluff: *stroo) void { _ = fluff; } | 4 | export fn testf(fluff: *stroo) void { |
| 5 | _ = fluff; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/invalid_pointer_with_reify_type.zig+1-1| ... | @@ -8,7 +8,7 @@ export fn entry() void { | ... | @@ -8,7 +8,7 @@ export fn entry() void { |
| 8 | .child = u8, | 8 | .child = u8, |
| 9 | .is_allowzero = false, | 9 | .is_allowzero = false, |
| 10 | .sentinel = &@as(u8, 0), | 10 | .sentinel = &@as(u8, 0), |
| 11 | }}); | 11 | } }); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // error | 14 | // error |
test/cases/compile_errors/invalid_shift_amount_error.zig+4-2| ... | @@ -1,8 +1,10 @@ | ... | @@ -1,8 +1,10 @@ |
| 1 | const x : u8 = 2; | 1 | const x: u8 = 2; |
| 2 | fn f() u16 { | 2 | fn f() u16 { |
| 3 | return x << 8; | 3 | return x << 8; |
| 4 | } | 4 | } |
| 5 | export fn entry() u16 { return f(); } | 5 | export fn entry() u16 { |
| 6 | return f(); | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | // error | 9 | // error |
| 8 | // backend=stage2 | 10 | // backend=stage2 |
test/cases/compile_errors/invalid_type.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | fn a() bogus {} | 1 | fn a() bogus {} |
| 2 | export fn entry() void { _ = a(); } | 2 | export fn entry() void { |
| 3 | _ = a(); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/invalid_type_in_builtin_extern.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const x = @extern(*comptime_int, .{.name="foo"}); | 1 | const x = @extern(*comptime_int, .{ .name = "foo" }); |
| 2 | pub export fn entry() void { | 2 | pub export fn entry() void { |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
test/cases/compile_errors/invalid_variadic_function.zig+6-2| ... | @@ -1,8 +1,12 @@ | ... | @@ -1,8 +1,12 @@ |
| 1 | fn foo(...) void {} | 1 | fn foo(...) void {} |
| 2 | fn bar(a: anytype, ...) callconv(a) void {} | 2 | fn bar(a: anytype, ...) callconv(a) void {} |
| 3 | 3 | ||
| 4 | comptime { _ = foo; } | 4 | comptime { |
| 5 | comptime { _ = bar; } | 5 | _ = foo; |
| 6 | } | ||
| 7 | comptime { | ||
| 8 | _ = bar; | ||
| 9 | } | ||
| 6 | 10 | ||
| 7 | // error | 11 | // error |
| 8 | // backend=stage2 | 12 | // backend=stage2 |
test/cases/compile_errors/issue_3818_bitcast_from_parray-slice_to_u16.zig+4-4| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | export fn foo1() void { | 1 | export fn foo1() void { |
| 2 | var bytes = [_]u8{1, 2}; | 2 | var bytes = [_]u8{ 1, 2 }; |
| 3 | const word: u16 = @bitCast(u16, bytes[0..]); | 3 | const word: u16 = @bitCast(u16, bytes[0..]); |
| 4 | _ = word; | 4 | _ = word; |
| 5 | } | 5 | } |
| 6 | export fn foo2() void { | 6 | export fn foo2() void { |
| 7 | var bytes: []const u8 = &[_]u8{1, 2}; | 7 | var bytes: []const u8 = &[_]u8{ 1, 2 }; |
| 8 | const word: u16 = @bitCast(u16, bytes); | 8 | const word: u16 = @bitCast(u16, bytes); |
| 9 | _ = word; | 9 | _ = word; |
| 10 | } | 10 | } |
| ... | @@ -14,6 +14,6 @@ export fn foo2() void { | ... | @@ -14,6 +14,6 @@ export fn foo2() void { |
| 14 | // target=native | 14 | // target=native |
| 15 | // | 15 | // |
| 16 | // :3:42: error: cannot @bitCast from '*[2]u8' | 16 | // :3:42: error: cannot @bitCast from '*[2]u8' |
| 17 | // :3:42: note: use @ptrToInt to cast to 'u16' | 17 | // :3:42: note: use @intFromPtr to cast to 'u16' |
| 18 | // :8:37: error: cannot @bitCast from '[]const u8' | 18 | // :8:37: error: cannot @bitCast from '[]const u8' |
| 19 | // :8:37: note: use @ptrToInt to cast to 'u16' | 19 | // :8:37: note: use @intFromPtr to cast to 'u16' |
test/cases/compile_errors/local_variable_redeclaration.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn f() void { | 1 | export fn f() void { |
| 2 | const a : i32 = 0; | 2 | const a: i32 = 0; |
| 3 | var a = 0; | 3 | var a = 0; |
| 4 | } | 4 | } |
| 5 | 5 |
test/cases/compile_errors/local_variable_redeclares_parameter.zig+4-2| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | fn f(a : i32) void { | 1 | fn f(a: i32) void { |
| 2 | const a = 0; | 2 | const a = 0; |
| 3 | } | 3 | } |
| 4 | export fn entry() void { f(1); } | 4 | export fn entry() void { |
| 5 | f(1); | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/local_variable_shadowing_global.zig+1-1| ... | @@ -2,7 +2,7 @@ const Foo = struct {}; | ... | @@ -2,7 +2,7 @@ const Foo = struct {}; |
| 2 | const Bar = struct {}; | 2 | const Bar = struct {}; |
| 3 | 3 | ||
| 4 | export fn entry() void { | 4 | export fn entry() void { |
| 5 | var Bar : i32 = undefined; | 5 | var Bar: i32 = undefined; |
| 6 | _ = Bar; | 6 | _ = Bar; |
| 7 | } | 7 | } |
| 8 | 8 |
test/cases/compile_errors/main_function_with_bogus_args_type.zig+3-1| ... | @@ -1,4 +1,6 @@ | ... | @@ -1,4 +1,6 @@ |
| 1 | pub fn main(args: [][]bogus) !void {_ = args;} | 1 | pub fn main(args: [][]bogus) !void { |
| 2 | _ = args; | ||
| 3 | } | ||
| 2 | 4 | ||
| 3 | // error | 5 | // error |
| 4 | // backend=stage2 | 6 | // backend=stage2 |
test/cases/compile_errors/missing_const_in_slice_with_nested_array_type.zig+1-1| ... | @@ -2,7 +2,7 @@ const Geo3DTex2D = struct { vertices: [][2]f32 }; | ... | @@ -2,7 +2,7 @@ const Geo3DTex2D = struct { vertices: [][2]f32 }; |
| 2 | pub fn getGeo3DTex2D() Geo3DTex2D { | 2 | pub fn getGeo3DTex2D() Geo3DTex2D { |
| 3 | return Geo3DTex2D{ | 3 | return Geo3DTex2D{ |
| 4 | .vertices = [_][2]f32{ | 4 | .vertices = [_][2]f32{ |
| 5 | [_]f32{ -0.5, -0.5}, | 5 | [_]f32{ -0.5, -0.5 }, |
| 6 | }, | 6 | }, |
| 7 | }; | 7 | }; |
| 8 | } | 8 | } |
test/cases/compile_errors/missing_else_clause.zig+13-9| ... | @@ -1,9 +1,13 @@ | ... | @@ -1,9 +1,13 @@ |
| 1 | fn f(b: bool) void { | 1 | fn f(b: bool) void { |
| 2 | const x : i32 = if (b) h: { break :h 1; }; | 2 | const x: i32 = if (b) h: { |
| 3 | break :h 1; | ||
| 4 | }; | ||
| 3 | _ = x; | 5 | _ = x; |
| 4 | } | 6 | } |
| 5 | fn g(b: bool) void { | 7 | fn g(b: bool) void { |
| 6 | const y = if (b) h: { break :h @as(i32, 1); }; | 8 | const y = if (b) h: { |
| 9 | break :h @as(i32, 1); | ||
| 10 | }; | ||
| 7 | _ = y; | 11 | _ = y; |
| 8 | } | 12 | } |
| 9 | fn h() void { | 13 | fn h() void { |
| ... | @@ -30,10 +34,10 @@ export fn entry() void { | ... | @@ -30,10 +34,10 @@ export fn entry() void { |
| 30 | // backend=stage2 | 34 | // backend=stage2 |
| 31 | // target=native | 35 | // target=native |
| 32 | // | 36 | // |
| 33 | // :2:21: error: incompatible types: 'i32' and 'void' | 37 | // :2:20: error: incompatible types: 'i32' and 'void' |
| 34 | // :2:31: note: type 'i32' here | 38 | // :2:30: note: type 'i32' here |
| 35 | // :6:15: error: incompatible types: 'i32' and 'void' | 39 | // :8:15: error: incompatible types: 'i32' and 'void' |
| 36 | // :6:25: note: type 'i32' here | 40 | // :8:25: note: type 'i32' here |
| 37 | // :12:16: error: expected type 'tmp.h.T', found 'void' | 41 | // :16:16: error: expected type 'tmp.h.T', found 'void' |
| 38 | // :11:15: note: struct declared here | 42 | // :15:15: note: struct declared here |
| 39 | // :18:9: error: incompatible types: 'void' and 'tmp.k.T' | 43 | // :22:9: error: incompatible types: 'void' and 'tmp.k.T' |
test/cases/compile_errors/missing_field_in_struct_value_expression.zig+5-5| ... | @@ -1,12 +1,12 @@ | ... | @@ -1,12 +1,12 @@ |
| 1 | const A = struct { | 1 | const A = struct { |
| 2 | x : i32, | 2 | x: i32, |
| 3 | y : i32, | 3 | y: i32, |
| 4 | z : i32, | 4 | z: i32, |
| 5 | }; | 5 | }; |
| 6 | export fn f() void { | 6 | export fn f() void { |
| 7 | // we want the error on the '{' not the 'A' because | 7 | // we want the error on the '{' not the 'A' because |
| 8 | // the A could be a complicated expression | 8 | // the A could be a complicated expression |
| 9 | const a = A { | 9 | const a = A{ |
| 10 | .z = 4, | 10 | .z = 4, |
| 11 | .y = 2, | 11 | .y = 2, |
| 12 | }; | 12 | }; |
| ... | @@ -17,5 +17,5 @@ export fn f() void { | ... | @@ -17,5 +17,5 @@ export fn f() void { |
| 17 | // backend=stage2 | 17 | // backend=stage2 |
| 18 | // target=native | 18 | // target=native |
| 19 | // | 19 | // |
| 20 | // :9:17: error: missing struct field: x | 20 | // :9:16: error: missing struct field: x |
| 21 | // :1:11: note: struct 'tmp.A' declared here | 21 | // :1:11: note: struct 'tmp.A' declared here |
test/cases/compile_errors/missing_main_fn_in_executable.zig-2| ... | @@ -1,5 +1,3 @@ | ... | @@ -1,5 +1,3 @@ |
| 1 | |||
| 2 | |||
| 3 | // error | 1 | // error |
| 4 | // backend=llvm | 2 | // backend=llvm |
| 5 | // target=x86_64-linux | 3 | // target=x86_64-linux |
test/cases/compile_errors/missing_param_name.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | fn f(i32) void {} | 1 | fn f(i32) void {} |
| 2 | export fn entry() usize { return @sizeOf(@TypeOf(f)); } | 2 | export fn entry() usize { |
| 3 | return @sizeOf(@TypeOf(f)); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/misspelled_type_with_pointer_only_reference.zig+4-2| ... | @@ -24,11 +24,13 @@ pub const JsonNode = struct { | ... | @@ -24,11 +24,13 @@ pub const JsonNode = struct { |
| 24 | fn foo() void { | 24 | fn foo() void { |
| 25 | var jll: JasonList = undefined; | 25 | var jll: JasonList = undefined; |
| 26 | jll.init(1234); | 26 | jll.init(1234); |
| 27 | var jd = JsonNode {.kind = JsonType.JSONArray , .jobject = JsonOA.JSONArray {jll} }; | 27 | var jd = JsonNode{ .kind = JsonType.JSONArray, .jobject = JsonOA.JSONArray{jll} }; |
| 28 | _ = jd; | 28 | _ = jd; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | export fn entry() usize { return @sizeOf(@TypeOf(foo)); } | 31 | export fn entry() usize { |
| 32 | return @sizeOf(@TypeOf(foo)); | ||
| 33 | } | ||
| 32 | 34 | ||
| 33 | // error | 35 | // error |
| 34 | // backend=stage2 | 36 | // backend=stage2 |
test/cases/compile_errors/mul_overflow_in_function_evaluation.zig+3-2| ... | @@ -3,7 +3,9 @@ fn mul(a: u16, b: u16) u16 { | ... | @@ -3,7 +3,9 @@ fn mul(a: u16, b: u16) u16 { |
| 3 | return a * b; | 3 | return a * b; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(&y)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(&y)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
| ... | @@ -11,4 +13,3 @@ export fn entry() usize { return @sizeOf(@TypeOf(&y)); } | ... | @@ -11,4 +13,3 @@ export fn entry() usize { return @sizeOf(@TypeOf(&y)); } |
| 11 | // | 13 | // |
| 12 | // :3:14: error: overflow of integer type 'u16' with value '1800000' | 14 | // :3:14: error: overflow of integer type 'u16' with value '1800000' |
| 13 | // :1:14: note: called from here | 15 | // :1:14: note: called from here |
| 14 |
test/cases/compile_errors/multiple_function_definitions.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | fn a() void {} | 1 | fn a() void {} |
| 2 | fn a() void {} | 2 | fn a() void {} |
| 3 | export fn entry() void { a(); } | 3 | export fn entry() void { |
| 4 | a(); | ||
| 5 | } | ||
| 4 | 6 | ||
| 5 | // error | 7 | // error |
| 6 | // backend=stage2 | 8 | // backend=stage2 |
test/cases/compile_errors/negation_overflow_in_function_evaluation.zig+3-1| ... | @@ -3,7 +3,9 @@ fn neg(x: i8) i8 { | ... | @@ -3,7 +3,9 @@ fn neg(x: i8) i8 { |
| 3 | return -x; | 3 | return -x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(&y)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(&y)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/nested_vectors.zig-1| ... | @@ -10,4 +10,3 @@ export fn entry() void { | ... | @@ -10,4 +10,3 @@ export fn entry() void { |
| 10 | // target=native | 10 | // target=native |
| 11 | // | 11 | // |
| 12 | // :3:16: error: expected integer, float, bool, or pointer for the vector element type; found '@Vector(4, u8)' | 12 | // :3:16: error: expected integer, float, bool, or pointer for the vector element type; found '@Vector(4, u8)' |
| 13 |
test/cases/compile_errors/noalias_on_non_pointer_param.zig+14-6| ... | @@ -1,11 +1,19 @@ | ... | @@ -1,11 +1,19 @@ |
| 1 | fn f(noalias x: i32) void { _ = x; } | 1 | fn f(noalias x: i32) void { |
| 2 | export fn entry() void { f(1234); } | 2 | _ = x; |
| 3 | } | ||
| 4 | export fn entry() void { | ||
| 5 | f(1234); | ||
| 6 | } | ||
| 3 | 7 | ||
| 4 | fn generic(comptime T: type, noalias _: [*]T, noalias _: [*]const T, _: usize) void {} | 8 | fn generic(comptime T: type, noalias _: [*]T, noalias _: [*]const T, _: usize) void {} |
| 5 | comptime { _ = &generic; } | 9 | comptime { |
| 10 | _ = &generic; | ||
| 11 | } | ||
| 6 | 12 | ||
| 7 | fn slice(noalias _: []u8) void {} | 13 | fn slice(noalias _: []u8) void {} |
| 8 | comptime { _ = &slice; } | 14 | comptime { |
| 15 | _ = &slice; | ||
| 16 | } | ||
| 9 | 17 | ||
| 10 | // error | 18 | // error |
| 11 | // backend=stage2 | 19 | // backend=stage2 |
test/cases/compile_errors/non-comptime-parameter-used-as-array-size.zig+1-2| ... | @@ -5,8 +5,7 @@ export fn entry() void { | ... | @@ -5,8 +5,7 @@ export fn entry() void { |
| 5 | _ = llamas2; | 5 | _ = llamas2; |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | fn makeLlamas(count: usize) [count]u8 { | 8 | fn makeLlamas(count: usize) [count]u8 {} |
| 9 | } | ||
| 10 | 9 | ||
| 11 | // error | 10 | // error |
| 12 | // target=native | 11 | // target=native |
test/cases/compile_errors/non-const_expression_function_call_with_struct_return_value_outside_function.zig+4-2| ... | @@ -4,11 +4,13 @@ const Foo = struct { | ... | @@ -4,11 +4,13 @@ const Foo = struct { |
| 4 | const a = get_it(); | 4 | const a = get_it(); |
| 5 | fn get_it() Foo { | 5 | fn get_it() Foo { |
| 6 | global_side_effect = true; | 6 | global_side_effect = true; |
| 7 | return Foo {.x = 13}; | 7 | return Foo{ .x = 13 }; |
| 8 | } | 8 | } |
| 9 | var global_side_effect = false; | 9 | var global_side_effect = false; |
| 10 | 10 | ||
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 11 | export fn entry() usize { |
| 12 | return @sizeOf(@TypeOf(a)); | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/non-const_expression_in_struct_literal_outside_function.zig+4-2| ... | @@ -1,10 +1,12 @@ | ... | @@ -1,10 +1,12 @@ |
| 1 | const Foo = struct { | 1 | const Foo = struct { |
| 2 | x: i32, | 2 | x: i32, |
| 3 | }; | 3 | }; |
| 4 | const a = Foo {.x = get_it()}; | 4 | const a = Foo{ .x = get_it() }; |
| 5 | extern fn get_it() i32; | 5 | extern fn get_it() i32; |
| 6 | 6 | ||
| 7 | export fn entry() usize { return @sizeOf(@TypeOf(a)); } | 7 | export fn entry() usize { |
| 8 | return @sizeOf(@TypeOf(a)); | ||
| 9 | } | ||
| 8 | 10 | ||
| 9 | // error | 11 | // error |
| 10 | // backend=stage2 | 12 | // backend=stage2 |
test/cases/compile_errors/non-const_variables_of_things_that_require_const_variables.zig+25-25| ... | @@ -1,30 +1,30 @@ | ... | @@ -1,30 +1,30 @@ |
| 1 | export fn entry1() void { | 1 | export fn entry1() void { |
| 2 | var m2 = &2; | 2 | var m2 = &2; |
| 3 | _ = m2; | 3 | _ = m2; |
| 4 | } | 4 | } |
| 5 | export fn entry2() void { | 5 | export fn entry2() void { |
| 6 | var a = undefined; | 6 | var a = undefined; |
| 7 | _ = a; | 7 | _ = a; |
| 8 | } | 8 | } |
| 9 | export fn entry3() void { | 9 | export fn entry3() void { |
| 10 | var b = 1; | 10 | var b = 1; |
| 11 | _ = b; | 11 | _ = b; |
| 12 | } | 12 | } |
| 13 | export fn entry4() void { | 13 | export fn entry4() void { |
| 14 | var c = 1.0; | 14 | var c = 1.0; |
| 15 | _ = c; | 15 | _ = c; |
| 16 | } | 16 | } |
| 17 | export fn entry5() void { | 17 | export fn entry5() void { |
| 18 | var d = null; | 18 | var d = null; |
| 19 | _ = d; | 19 | _ = d; |
| 20 | } | 20 | } |
| 21 | export fn entry6(opaque_: *Opaque) void { | 21 | export fn entry6(opaque_: *Opaque) void { |
| 22 | var e = opaque_.*; | 22 | var e = opaque_.*; |
| 23 | _ = e; | 23 | _ = e; |
| 24 | } | 24 | } |
| 25 | export fn entry7() void { | 25 | export fn entry7() void { |
| 26 | var f = i32; | 26 | var f = i32; |
| 27 | _ = f; | 27 | _ = f; |
| 28 | } | 28 | } |
| 29 | const Opaque = opaque {}; | 29 | const Opaque = opaque {}; |
| 30 | 30 | ||
| ... | @@ -32,14 +32,14 @@ const Opaque = opaque {}; | ... | @@ -32,14 +32,14 @@ const Opaque = opaque {}; |
| 32 | // backend=stage2 | 32 | // backend=stage2 |
| 33 | // target=native | 33 | // target=native |
| 34 | // | 34 | // |
| 35 | // :2:8: error: variable of type '*const comptime_int' must be const or comptime | 35 | // :2:9: error: variable of type '*const comptime_int' must be const or comptime |
| 36 | // :6:8: error: variable of type '@TypeOf(undefined)' must be const or comptime | 36 | // :6:9: error: variable of type '@TypeOf(undefined)' must be const or comptime |
| 37 | // :10:8: error: variable of type 'comptime_int' must be const or comptime | 37 | // :10:9: error: variable of type 'comptime_int' must be const or comptime |
| 38 | // :10:8: note: to modify this variable at runtime, it must be given an explicit fixed-size number type | 38 | // :10:9: note: to modify this variable at runtime, it must be given an explicit fixed-size number type |
| 39 | // :14:8: error: variable of type 'comptime_float' must be const or comptime | 39 | // :14:9: error: variable of type 'comptime_float' must be const or comptime |
| 40 | // :14:8: note: to modify this variable at runtime, it must be given an explicit fixed-size number type | 40 | // :14:9: note: to modify this variable at runtime, it must be given an explicit fixed-size number type |
| 41 | // :18:8: error: variable of type '@TypeOf(null)' must be const or comptime | 41 | // :18:9: error: variable of type '@TypeOf(null)' must be const or comptime |
| 42 | // :22:19: error: values of type 'tmp.Opaque' must be comptime-known, but operand value is runtime-known | 42 | // :22:20: error: values of type 'tmp.Opaque' must be comptime-known, but operand value is runtime-known |
| 43 | // :22:19: note: opaque type 'tmp.Opaque' has undefined size | 43 | // :22:20: note: opaque type 'tmp.Opaque' has undefined size |
| 44 | // :26:8: error: variable of type 'type' must be const or comptime | 44 | // :26:9: error: variable of type 'type' must be const or comptime |
| 45 | // :26:8: note: types are not available at runtime | 45 | // :26:9: note: types are not available at runtime |
test/cases/compile_errors/non-exhaustive_enum_marker_assigned_a_value.zig+4-1| ... | @@ -8,7 +8,10 @@ const B = enum { | ... | @@ -8,7 +8,10 @@ const B = enum { |
| 8 | b, | 8 | b, |
| 9 | _, | 9 | _, |
| 10 | }; | 10 | }; |
| 11 | comptime { _ = A; _ = B; } | 11 | comptime { |
| 12 | _ = A; | ||
| 13 | _ = B; | ||
| 14 | } | ||
| 12 | 15 | ||
| 13 | // error | 16 | // error |
| 14 | // backend=stage2 | 17 | // backend=stage2 |
test/cases/compile_errors/non-inline_for_loop_on_a_type_that_requires_comptime.zig+3-1| ... | @@ -4,7 +4,9 @@ const Foo = struct { | ... | @@ -4,7 +4,9 @@ const Foo = struct { |
| 4 | }; | 4 | }; |
| 5 | export fn entry() void { | 5 | export fn entry() void { |
| 6 | const xx: [2]Foo = .{ .{ .name = "", .T = u8 }, .{ .name = "", .T = u8 } }; | 6 | const xx: [2]Foo = .{ .{ .name = "", .T = u8 }, .{ .name = "", .T = u8 } }; |
| 7 | for (xx) |f| { _ = f;} | 7 | for (xx) |f| { |
| 8 | _ = f; | ||
| 9 | } | ||
| 8 | } | 10 | } |
| 9 | 11 | ||
| 10 | // error | 12 | // error |
test/cases/compile_errors/non_constant_expression_in_array_size.zig+8-4| ... | @@ -2,14 +2,18 @@ const Foo = struct { | ... | @@ -2,14 +2,18 @@ const Foo = struct { |
| 2 | y: [get()]u8, | 2 | y: [get()]u8, |
| 3 | }; | 3 | }; |
| 4 | var global_var: usize = 1; | 4 | var global_var: usize = 1; |
| 5 | fn get() usize { return global_var; } | 5 | fn get() usize { |
| 6 | return global_var; | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | export fn entry() usize { return @offsetOf(Foo, "y"); } | 9 | export fn entry() usize { |
| 10 | return @offsetOf(Foo, "y"); | ||
| 11 | } | ||
| 8 | 12 | ||
| 9 | // error | 13 | // error |
| 10 | // backend=stage2 | 14 | // backend=stage2 |
| 11 | // target=native | 15 | // target=native |
| 12 | // | 16 | // |
| 13 | // :5:18: error: unable to resolve comptime value | 17 | // :6:5: error: unable to resolve comptime value |
| 14 | // :5:18: note: value being returned at comptime must be comptime-known | 18 | // :6:5: note: value being returned at comptime must be comptime-known |
| 15 | // :2:12: note: called from here | 19 | // :2:12: note: called from here |
test/cases/compile_errors/non_float_passed_to_floatToInt.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @floatToInt(i32, @as(i32, 54)); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:32: error: expected float type, found 'i32' | ||
test/cases/compile_errors/non_float_passed_to_intFromFloat.zig created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @intFromFloat(i32, @as(i32, 54)); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:34: error: expected float type, found 'i32' | ||
test/cases/compile_errors/non_int_passed_to_floatFromInt.zig created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @floatFromInt(f32, 1.1); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:34: error: expected integer type, found 'comptime_float' | ||
test/cases/compile_errors/non_int_passed_to_intToFloat.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @intToFloat(f32, 1.1); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:32: error: expected integer type, found 'comptime_float' | ||
test/cases/compile_errors/non_pointer_given_to_intFromPtr.zig created+9| ... | @@ -0,0 +1,9 @@ | ||
| 1 | export fn entry(x: i32) usize { | ||
| 2 | return @intFromPtr(x); | ||
| 3 | } | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage2 | ||
| 7 | // target=native | ||
| 8 | // | ||
| 9 | // :2:24: error: expected pointer, found 'i32' | ||
test/cases/compile_errors/non_pointer_given_to_ptrToInt.zig deleted-9| ... | @@ -1,9 +0,0 @@ | ||
| 1 | export fn entry(x: i32) usize { | ||
| 2 | return @ptrToInt(x); | ||
| 3 | } | ||
| 4 | |||
| 5 | // error | ||
| 6 | // backend=stage2 | ||
| 7 | // target=native | ||
| 8 | // | ||
| 9 | // :2:22: error: expected pointer, found 'i32' | ||
test/cases/compile_errors/offsetOf-bad_field_name.zig+5-2| ... | @@ -2,12 +2,15 @@ const Foo = struct { | ... | @@ -2,12 +2,15 @@ const Foo = struct { |
| 2 | derp: i32, | 2 | derp: i32, |
| 3 | }; | 3 | }; |
| 4 | export fn foo() usize { | 4 | export fn foo() usize { |
| 5 | return @offsetOf(Foo, "a",); | 5 | return @offsetOf( |
| 6 | Foo, | ||
| 7 | "a", | ||
| 8 | ); | ||
| 6 | } | 9 | } |
| 7 | 10 | ||
| 8 | // error | 11 | // error |
| 9 | // backend=stage2 | 12 | // backend=stage2 |
| 10 | // target=native | 13 | // target=native |
| 11 | // | 14 | // |
| 12 | // :5:27: error: no field named 'a' in struct 'tmp.Foo' | 15 | // :7:9: error: no field named 'a' in struct 'tmp.Foo' |
| 13 | // :1:13: note: struct declared here | 16 | // :1:13: note: struct declared here |
test/cases/compile_errors/offsetOf-non_struct.zig+1-1| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | const Foo = i32; | 1 | const Foo = i32; |
| 2 | export fn foo() usize { | 2 | export fn foo() usize { |
| 3 | return @offsetOf(Foo, "a",); | 3 | return @offsetOf(Foo, "a"); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
test/cases/compile_errors/old_fn_ptr_in_extern_context.zig+1-1| ... | @@ -5,7 +5,7 @@ comptime { | ... | @@ -5,7 +5,7 @@ comptime { |
| 5 | _ = @sizeOf(S) == 1; | 5 | _ = @sizeOf(S) == 1; |
| 6 | } | 6 | } |
| 7 | comptime { | 7 | comptime { |
| 8 | _ = [*c][4]fn() callconv(.C) void; | 8 | _ = [*c][4]fn () callconv(.C) void; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
test/cases/compile_errors/out_of_int_range_comptime_float_passed_to_intFromFloat.zig created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @intFromFloat(i8, 200); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:33: error: float value '200' cannot be stored in integer type 'i8' | ||
test/cases/compile_errors/out_of_range_comptime_int_passed_to_floatToInt.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | const x = @floatToInt(i8, 200); | ||
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:31: error: float value '200' cannot be stored in integer type 'i8' | ||
test/cases/compile_errors/overflow_in_enum_value_allocation.zig+2-2| ... | @@ -3,8 +3,8 @@ const Moo = enum(u8) { | ... | @@ -3,8 +3,8 @@ const Moo = enum(u8) { |
| 3 | Over, | 3 | Over, |
| 4 | }; | 4 | }; |
| 5 | pub export fn entry() void { | 5 | pub export fn entry() void { |
| 6 | var y = Moo.Last; | 6 | var y = Moo.Last; |
| 7 | _ = y; | 7 | _ = y; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | // error | 10 | // error |
test/cases/compile_errors/packed_union_given_enum_tag_type.zig+1-1| ... | @@ -9,7 +9,7 @@ const Payload = packed union(Letter) { | ... | @@ -9,7 +9,7 @@ const Payload = packed union(Letter) { |
| 9 | C: bool, | 9 | C: bool, |
| 10 | }; | 10 | }; |
| 11 | export fn entry() void { | 11 | export fn entry() void { |
| 12 | var a = Payload { .A = 1234 }; | 12 | var a = Payload{ .A = 1234 }; |
| 13 | _ = a; | 13 | _ = a; |
| 14 | } | 14 | } |
| 15 | 15 |
test/cases/compile_errors/packed_union_with_automatic_layout_field.zig+1-1| ... | @@ -7,7 +7,7 @@ const Payload = packed union { | ... | @@ -7,7 +7,7 @@ const Payload = packed union { |
| 7 | B: bool, | 7 | B: bool, |
| 8 | }; | 8 | }; |
| 9 | export fn entry() void { | 9 | export fn entry() void { |
| 10 | var a = Payload { .B = true }; | 10 | var a = Payload{ .B = true }; |
| 11 | _ = a; | 11 | _ = a; |
| 12 | } | 12 | } |
| 13 | 13 |
test/cases/compile_errors/panic_called_at_compile_time.zig+3-1| ... | @@ -1,6 +1,8 @@ | ... | @@ -1,6 +1,8 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | comptime { | 2 | comptime { |
| 3 | @panic("aoeu",); | 3 | @panic( |
| 4 | "aoeu", | ||
| 5 | ); | ||
| 4 | } | 6 | } |
| 5 | } | 7 | } |
| 6 | 8 |
test/cases/compile_errors/parameter_redeclaration.zig+4-3| ... | @@ -1,10 +1,11 @@ | ... | @@ -1,10 +1,11 @@ |
| 1 | fn f(a : i32, a : i32) void { | 1 | fn f(a: i32, a: i32) void {} |
| 2 | export fn entry() void { | ||
| 3 | f(1, 2); | ||
| 2 | } | 4 | } |
| 3 | export fn entry() void { f(1, 2); } | ||
| 4 | 5 | ||
| 5 | // error | 6 | // error |
| 6 | // backend=stage2 | 7 | // backend=stage2 |
| 7 | // target=native | 8 | // target=native |
| 8 | // | 9 | // |
| 9 | // :1:15: error: redeclaration of function parameter 'a' | 10 | // :1:14: error: redeclaration of function parameter 'a' |
| 10 | // :1:6: note: previous declaration here | 11 | // :1:6: note: previous declaration here |
test/cases/compile_errors/pass_const_ptr_to_mutable_ptr_fn.zig+6-3| ... | @@ -1,14 +1,17 @@ | ... | @@ -1,14 +1,17 @@ |
| 1 | fn foo() bool { | 1 | fn foo() bool { |
| 2 | const a = @as([]const u8, "a",); | 2 | const a = @as([]const u8, "a"); |
| 3 | const b = &a; | 3 | const b = &a; |
| 4 | return ptrEql(b, b); | 4 | return ptrEql(b, b); |
| 5 | } | 5 | } |
| 6 | fn ptrEql(a: *[]const u8, b: *[]const u8) bool { | 6 | fn ptrEql(a: *[]const u8, b: *[]const u8) bool { |
| 7 | _ = a; _ = b; | 7 | _ = a; |
| 8 | _ = b; | ||
| 8 | return true; | 9 | return true; |
| 9 | } | 10 | } |
| 10 | 11 | ||
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 12 | export fn entry() usize { |
| 13 | return @sizeOf(@TypeOf(&foo)); | ||
| 14 | } | ||
| 12 | 15 | ||
| 13 | // error | 16 | // error |
| 14 | // backend=stage2 | 17 | // backend=stage2 |
test/cases/compile_errors/passing_an_under-aligned_function_pointer.zig+3-1| ... | @@ -4,7 +4,9 @@ export fn entry() void { | ... | @@ -4,7 +4,9 @@ export fn entry() void { |
| 4 | fn testImplicitlyDecreaseFnAlign(ptr: *const fn () align(8) i32, answer: i32) void { | 4 | fn testImplicitlyDecreaseFnAlign(ptr: *const fn () align(8) i32, answer: i32) void { |
| 5 | if (ptr() != answer) unreachable; | 5 | if (ptr() != answer) unreachable; |
| 6 | } | 6 | } |
| 7 | fn alignedSmall() align(4) i32 { return 1234; } | 7 | fn alignedSmall() align(4) i32 { |
| 8 | return 1234; | ||
| 9 | } | ||
| 8 | 10 | ||
| 9 | // error | 11 | // error |
| 10 | // backend=stage2 | 12 | // backend=stage2 |
test/cases/compile_errors/pointer_to_noreturn.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | fn a() *noreturn {} | 1 | fn a() *noreturn {} |
| 2 | export fn entry() void { _ = a(); } | 2 | export fn entry() void { |
| 3 | _ = a(); | ||
| 4 | } | ||
| 3 | 5 | ||
| 4 | // error | 6 | // error |
| 5 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/ptrFromInt_non_ptr_type.zig created+15| ... | @@ -0,0 +1,15 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | _ = @ptrFromInt(i32, 10); | ||
| 3 | } | ||
| 4 | |||
| 5 | pub export fn entry2() void { | ||
| 6 | _ = @ptrFromInt([]u8, 20); | ||
| 7 | } | ||
| 8 | |||
| 9 | // error | ||
| 10 | // backend=stage2 | ||
| 11 | // target=native | ||
| 12 | // | ||
| 13 | // :2:21: error: expected pointer type, found 'i32' | ||
| 14 | // :6:21: error: integer cannot be converted to slice type '[]u8' | ||
| 15 | // :6:21: note: slice length cannot be inferred from address | ||
test/cases/compile_errors/ptrFromInt_with_misaligned_address.zig created+10| ... | @@ -0,0 +1,10 @@ | ||
| 1 | pub export fn entry() void { | ||
| 2 | var y = @ptrFromInt([*]align(4) u8, 5); | ||
| 3 | _ = y; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:41: error: pointer type '[*]align(4) u8' requires aligned address | ||
test/cases/compile_errors/ptrToInt_0_to_non_optional_pointer.zig deleted-10| ... | @@ -1,10 +0,0 @@ | ||
| 1 | export fn entry() void { | ||
| 2 | var b = @intToPtr(*i32, 0); | ||
| 3 | _ = b; | ||
| 4 | } | ||
| 5 | |||
| 6 | // error | ||
| 7 | // backend=stage2 | ||
| 8 | // target=native | ||
| 9 | // | ||
| 10 | // :2:29: error: pointer type '*i32' does not allow address zero | ||
test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig+4-4| ... | @@ -1,13 +1,13 @@ | ... | @@ -1,13 +1,13 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | foo(452) catch |err| switch (err) { | 2 | foo(452) catch |err| switch (err) { |
| 3 | error.Foo ... error.Bar => {}, | 3 | error.Foo...error.Bar => {}, |
| 4 | else => {}, | 4 | else => {}, |
| 5 | }; | 5 | }; |
| 6 | } | 6 | } |
| 7 | fn foo(x: i32) !void { | 7 | fn foo(x: i32) !void { |
| 8 | switch (x) { | 8 | switch (x) { |
| 9 | 0 ... 10 => return error.Foo, | 9 | 0...10 => return error.Foo, |
| 10 | 11 ... 20 => return error.Bar, | 10 | 11...20 => return error.Bar, |
| 11 | else => {}, | 11 | else => {}, |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| ... | @@ -17,4 +17,4 @@ fn foo(x: i32) !void { | ... | @@ -17,4 +17,4 @@ fn foo(x: i32) !void { |
| 17 | // target=native | 17 | // target=native |
| 18 | // | 18 | // |
| 19 | // :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).Fn.return_type.?).ErrorUnion.error_set' | 19 | // :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).Fn.return_type.?).ErrorUnion.error_set' |
| 20 | // :3:19: note: range here | 20 | // :3:18: note: range here |
test/cases/compile_errors/reassign_to_array_parameter.zig+2-2| ... | @@ -1,8 +1,8 @@ | ... | @@ -1,8 +1,8 @@ |
| 1 | fn reassign(a: [3]f32) void { | 1 | fn reassign(a: [3]f32) void { |
| 2 | a = [3]f32{4, 5, 6}; | 2 | a = [3]f32{ 4, 5, 6 }; |
| 3 | } | 3 | } |
| 4 | export fn entry() void { | 4 | export fn entry() void { |
| 5 | reassign(.{1, 2, 3}); | 5 | reassign(.{ 1, 2, 3 }); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
test/cases/compile_errors/reassign_to_struct_parameter.zig+2-2| ... | @@ -2,10 +2,10 @@ const S = struct { | ... | @@ -2,10 +2,10 @@ const S = struct { |
| 2 | x: u32, | 2 | x: u32, |
| 3 | }; | 3 | }; |
| 4 | fn reassign(s: S) void { | 4 | fn reassign(s: S) void { |
| 5 | s = S{.x = 2}; | 5 | s = S{ .x = 2 }; |
| 6 | } | 6 | } |
| 7 | export fn entry() void { | 7 | export fn entry() void { |
| 8 | reassign(S{.x = 3}); | 8 | reassign(S{ .x = 3 }); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
test/cases/compile_errors/redefinition_of_enums.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const A = enum {x}; | 1 | const A = enum { x }; |
| 2 | const A = enum {x}; | 2 | const A = enum { x }; |
| 3 | 3 | ||
| 4 | // error | 4 | // error |
| 5 | // backend=stage2 | 5 | // backend=stage2 |
test/cases/compile_errors/redefinition_of_global_variables.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | var a : i32 = 1; | 1 | var a: i32 = 1; |
| 2 | var a : i32 = 2; | 2 | var a: i32 = 2; |
| 3 | 3 | ||
| 4 | // error | 4 | // error |
| 5 | // backend=stage2 | 5 | // backend=stage2 |
test/cases/compile_errors/redefinition_of_struct.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const A = struct { x : i32, }; | 1 | const A = struct { x: i32 }; |
| 2 | const A = struct { y : i32, }; | 2 | const A = struct { y: i32 }; |
| 3 | 3 | ||
| 4 | // error | 4 | // error |
| 5 | // backend=stage2 | 5 | // backend=stage2 |
test/cases/compile_errors/reference_to_const_data.zig+3-3| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | var ptr = &[_]u8{0,0,0,0}; | 2 | var ptr = &[_]u8{ 0, 0, 0, 0 }; |
| 3 | ptr[1] = 2; | 3 | ptr[1] = 2; |
| 4 | } | 4 | } |
| 5 | export fn bar() void { | 5 | export fn bar() void { |
| ... | @@ -11,11 +11,11 @@ export fn baz() void { | ... | @@ -11,11 +11,11 @@ export fn baz() void { |
| 11 | ptr.* = false; | 11 | ptr.* = false; |
| 12 | } | 12 | } |
| 13 | export fn qux() void { | 13 | export fn qux() void { |
| 14 | const S = struct{ | 14 | const S = struct { |
| 15 | x: usize, | 15 | x: usize, |
| 16 | y: usize, | 16 | y: usize, |
| 17 | }; | 17 | }; |
| 18 | var ptr = &S{.x=1,.y=2}; | 18 | var ptr = &S{ .x = 1, .y = 2 }; |
| 19 | ptr.x = 2; | 19 | ptr.x = 2; |
| 20 | } | 20 | } |
| 21 | export fn quux() void { | 21 | export fn quux() void { |
test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig+3-1| ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ | ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ |
| 8 | .params = &.{}, | 8 | .params = &.{}, |
| 9 | }, | 9 | }, |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { |
| 12 | _ = Foo; | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+3-1| ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ | ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ |
| 8 | .params = &.{}, | 8 | .params = &.{}, |
| 9 | }, | 9 | }, |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { |
| 12 | _ = Foo; | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig+3-1| ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ | ... | @@ -8,7 +8,9 @@ const Foo = @Type(.{ |
| 8 | .params = &.{}, | 8 | .params = &.{}, |
| 9 | }, | 9 | }, |
| 10 | }); | 10 | }); |
| 11 | comptime { _ = Foo; } | 11 | comptime { |
| 12 | _ = Foo; | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig+1-1| ... | @@ -7,7 +7,7 @@ const Tag = @Type(.{ | ... | @@ -7,7 +7,7 @@ const Tag = @Type(.{ |
| 7 | }, | 7 | }, |
| 8 | }); | 8 | }); |
| 9 | export fn entry() void { | 9 | export fn entry() void { |
| 10 | _ = @intToEnum(Tag, 0); | 10 | _ = @enumFromInt(Tag, 0); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // error | 13 | // error |
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig+1-1| ... | @@ -7,7 +7,7 @@ const Tag = @Type(.{ | ... | @@ -7,7 +7,7 @@ const Tag = @Type(.{ |
| 7 | }, | 7 | }, |
| 8 | }); | 8 | }); |
| 9 | export fn entry() void { | 9 | export fn entry() void { |
| 10 | _ = @intToEnum(Tag, 0); | 10 | _ = @enumFromInt(Tag, 0); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // error | 13 | // error |
test/cases/compile_errors/reify_type_union_payload_is_undefined.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | const Foo = @Type(.{ | 1 | const Foo = @Type(.{ |
| 2 | .Struct = undefined, | 2 | .Struct = undefined, |
| 3 | }); | 3 | }); |
| 4 | comptime { _ = Foo; } | 4 | comptime { |
| 5 | _ = Foo; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/return_from_defer_expression.zig+4-2| ... | @@ -6,13 +6,15 @@ pub fn testTrickyDefer() !void { | ... | @@ -6,13 +6,15 @@ pub fn testTrickyDefer() !void { |
| 6 | const a = maybeInt() orelse return; | 6 | const a = maybeInt() orelse return; |
| 7 | } | 7 | } |
| 8 | 8 | ||
| 9 | fn canFail() anyerror!void { } | 9 | fn canFail() anyerror!void {} |
| 10 | 10 | ||
| 11 | pub fn maybeInt() ?i32 { | 11 | pub fn maybeInt() ?i32 { |
| 12 | return 0; | 12 | return 0; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(testTrickyDefer)); } | 15 | export fn entry() usize { |
| 16 | return @sizeOf(@TypeOf(testTrickyDefer)); | ||
| 17 | } | ||
| 16 | 18 | ||
| 17 | // error | 19 | // error |
| 18 | // backend=stage2 | 20 | // backend=stage2 |
test/cases/compile_errors/runtime_assignment_to_comptime_struct_type.zig+3-3| ... | @@ -4,7 +4,7 @@ const Foo = struct { | ... | @@ -4,7 +4,7 @@ const Foo = struct { |
| 4 | }; | 4 | }; |
| 5 | export fn f() void { | 5 | export fn f() void { |
| 6 | var x: u8 = 0; | 6 | var x: u8 = 0; |
| 7 | const foo = Foo { .Bar = x, .Baz = u8 }; | 7 | const foo = Foo{ .Bar = x, .Baz = u8 }; |
| 8 | _ = foo; | 8 | _ = foo; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| ... | @@ -12,5 +12,5 @@ export fn f() void { | ... | @@ -12,5 +12,5 @@ export fn f() void { |
| 12 | // backend=stage2 | 12 | // backend=stage2 |
| 13 | // target=native | 13 | // target=native |
| 14 | // | 14 | // |
| 15 | // :7:30: error: unable to resolve comptime value | 15 | // :7:29: error: unable to resolve comptime value |
| 16 | // :7:30: note: initializer of comptime only struct must be comptime-known | 16 | // :7:29: note: initializer of comptime only struct must be comptime-known |
test/cases/compile_errors/runtime_assignment_to_comptime_union_type.zig+3-3| ... | @@ -4,7 +4,7 @@ const Foo = union { | ... | @@ -4,7 +4,7 @@ const Foo = union { |
| 4 | }; | 4 | }; |
| 5 | export fn f() void { | 5 | export fn f() void { |
| 6 | var x: u8 = 0; | 6 | var x: u8 = 0; |
| 7 | const foo = Foo { .Bar = x }; | 7 | const foo = Foo{ .Bar = x }; |
| 8 | _ = foo; | 8 | _ = foo; |
| 9 | } | 9 | } |
| 10 | 10 | ||
| ... | @@ -12,5 +12,5 @@ export fn f() void { | ... | @@ -12,5 +12,5 @@ export fn f() void { |
| 12 | // backend=stage2 | 12 | // backend=stage2 |
| 13 | // target=native | 13 | // target=native |
| 14 | // | 14 | // |
| 15 | // :7:30: error: unable to resolve comptime value | 15 | // :7:29: error: unable to resolve comptime value |
| 16 | // :7:30: note: initializer of comptime only union must be comptime-known | 16 | // :7:29: note: initializer of comptime only union must be comptime-known |
test/cases/compile_errors/runtime_to_comptime_num.zig+3-3| ... | @@ -2,16 +2,16 @@ pub export fn entry() void { | ... | @@ -2,16 +2,16 @@ pub export fn entry() void { |
| 2 | var a: u32 = 0; | 2 | var a: u32 = 0; |
| 3 | _ = @as(comptime_int, a); | 3 | _ = @as(comptime_int, a); |
| 4 | } | 4 | } |
| 5 | pub export fn entry2() void{ | 5 | pub export fn entry2() void { |
| 6 | var a: u32 = 0; | 6 | var a: u32 = 0; |
| 7 | _ = @as(comptime_float, a); | 7 | _ = @as(comptime_float, a); |
| 8 | } | 8 | } |
| 9 | pub export fn entry3() void{ | 9 | pub export fn entry3() void { |
| 10 | comptime var aa: comptime_float = 0.0; | 10 | comptime var aa: comptime_float = 0.0; |
| 11 | var a: f32 = 4; | 11 | var a: f32 = 4; |
| 12 | aa = a; | 12 | aa = a; |
| 13 | } | 13 | } |
| 14 | pub export fn entry4() void{ | 14 | pub export fn entry4() void { |
| 15 | comptime var aa: comptime_int = 0.0; | 15 | comptime var aa: comptime_int = 0.0; |
| 16 | var a: f32 = 4; | 16 | var a: f32 = 4; |
| 17 | aa = a; | 17 | aa = a; |
test/cases/compile_errors/saturating_shl_assign_does_not_allow_negative_rhs_at_comptime.zig+4-4| ... | @@ -1,12 +1,12 @@ | ... | @@ -1,12 +1,12 @@ |
| 1 | export fn a() void { | 1 | export fn a() void { |
| 2 | comptime { | 2 | comptime { |
| 3 | var x = @as(i32, 1); | 3 | var x = @as(i32, 1); |
| 4 | x <<|= @as(i32, -2); | 4 | x <<|= @as(i32, -2); |
| 5 | } | 5 | } |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | // error | 8 | // error |
| 9 | // backend=stage2 | 9 | // backend=stage2 |
| 10 | // target=native | 10 | // target=native |
| 11 | // | 11 | // |
| 12 | // :4:14: error: shift by negative amount '-2' | 12 | // :4:16: error: shift by negative amount '-2' |
test/cases/compile_errors/self_referential_struct_requires_comptime.zig-1| ... | @@ -7,7 +7,6 @@ pub export fn entry() void { | ... | @@ -7,7 +7,6 @@ pub export fn entry() void { |
| 7 | _ = s; | 7 | _ = s; |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | |||
| 11 | // error | 10 | // error |
| 12 | // backend=stage2 | 11 | // backend=stage2 |
| 13 | // target=native | 12 | // target=native |
test/cases/compile_errors/setAlignStack_in_inline_function.zig+1-2| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | foo(); | 2 | foo(); |
| 3 | } | 3 | } |
| 4 | fn foo() callconv(.Inline) void { | 4 | inline fn foo() void { |
| 5 | @setAlignStack(16); | 5 | @setAlignStack(16); |
| 6 | } | 6 | } |
| 7 | 7 | ||
| ... | @@ -12,7 +12,6 @@ fn bar() void { | ... | @@ -12,7 +12,6 @@ fn bar() void { |
| 12 | @setAlignStack(16); | 12 | @setAlignStack(16); |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | |||
| 16 | // error | 15 | // error |
| 17 | // backend=stage2 | 16 | // backend=stage2 |
| 18 | // target=native | 17 | // target=native |
test/cases/compile_errors/slice_passed_as_array_init_type_with_elems.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | const x = []u8{1, 2}; | 2 | const x = []u8{ 1, 2 }; |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 |
test/cases/compile_errors/slice_sentinel_mismatch-2.zig+3-1| ... | @@ -2,7 +2,9 @@ fn foo() [:0]u8 { | ... | @@ -2,7 +2,9 @@ fn foo() [:0]u8 { |
| 2 | var x: []u8 = undefined; | 2 | var x: []u8 = undefined; |
| 3 | return x; | 3 | return x; |
| 4 | } | 4 | } |
| 5 | comptime { _ = &foo; } | 5 | comptime { |
| 6 | _ = &foo; | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | // error | 9 | // error |
| 8 | // backend=stage2 | 10 | // backend=stage2 |
test/cases/compile_errors/slice_used_as_extern_fn_param.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | extern fn Text(str: []const u8, num: i32) callconv(.C) void; | 1 | extern fn Text(str: []const u8, num: i32) callconv(.C) void; |
| 2 | export fn entry() void { | 2 | export fn entry() void { |
| 3 | _ = Text; | 3 | _ = Text; |
| 4 | } | 4 | } |
test/cases/compile_errors/specify_enum_tag_type_that_is_too_small.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const Small = enum (u2) { | 1 | const Small = enum(u2) { |
| 2 | One, | 2 | One, |
| 3 | Two, | 3 | Two, |
| 4 | Three, | 4 | Three, |
test/cases/compile_errors/specify_non-integer_enum_tag_type.zig+2-2| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const Small = enum (f32) { | 1 | const Small = enum(f32) { |
| 2 | One, | 2 | One, |
| 3 | Two, | 3 | Two, |
| 4 | Three, | 4 | Three, |
| ... | @@ -13,4 +13,4 @@ export fn entry() void { | ... | @@ -13,4 +13,4 @@ export fn entry() void { |
| 13 | // backend=stage2 | 13 | // backend=stage2 |
| 14 | // target=native | 14 | // target=native |
| 15 | // | 15 | // |
| 16 | // :1:21: error: expected integer tag type, found 'f32' | 16 | // :1:20: error: expected integer tag type, found 'f32' |
test/cases/compile_errors/src_fields_runtime.zig+4-1| ... | @@ -4,7 +4,10 @@ pub export fn entry1() void { | ... | @@ -4,7 +4,10 @@ pub export fn entry1() void { |
| 4 | comptime var b: []const u8 = s.fn_name; | 4 | comptime var b: []const u8 = s.fn_name; |
| 5 | comptime var c: u32 = s.column; | 5 | comptime var c: u32 = s.column; |
| 6 | comptime var d: u32 = s.line; | 6 | comptime var d: u32 = s.line; |
| 7 | _ = a; _ = b; _ = c; _ = d; | 7 | _ = a; |
| 8 | _ = b; | ||
| 9 | _ = c; | ||
| 10 | _ = d; | ||
| 8 | } | 11 | } |
| 9 | 12 | ||
| 10 | // error | 13 | // error |
test/cases/compile_errors/stage1/obj/generic_function_where_return_type_is_self-referenced.zig+2-4| ... | @@ -1,10 +1,8 @@ | ... | @@ -1,10 +1,8 @@ |
| 1 | fn Foo(comptime T: type) Foo(T) { | 1 | fn Foo(comptime T: type) Foo(T) { |
| 2 | return struct{ x: T }; | 2 | return struct { x: T }; |
| 3 | } | 3 | } |
| 4 | export fn entry() void { | 4 | export fn entry() void { |
| 5 | const t = Foo(u32) { | 5 | const t = Foo(u32){ .x = 1 }; |
| 6 | .x = 1 | ||
| 7 | }; | ||
| 8 | _ = t; | 6 | _ = t; |
| 9 | } | 7 | } |
| 10 | 8 |
test/cases/compile_errors/stage1/obj/unsupported_modifier_at_start_of_asm_output_constraint.zig+5-1| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | var bar: u32 = 3; | 2 | var bar: u32 = 3; |
| 3 | asm volatile ("" : [baz]"+r"(bar) : : ""); | 3 | asm volatile ("" |
| 4 | : [baz] "+r" (bar), | ||
| 5 | : | ||
| 6 | : "" | ||
| 7 | ); | ||
| 4 | } | 8 | } |
| 5 | 9 | ||
| 6 | // error | 10 | // error |
test/cases/compile_errors/std.fmt_error_for_unused_arguments.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | @import("std").debug.print("{d} {d} {d} {d} {d}", .{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}); | 2 | @import("std").debug.print("{d} {d} {d} {d} {d}", .{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
test/cases/compile_errors/struct_type_mismatch_in_arg.zig+4-4| ... | @@ -1,18 +1,18 @@ | ... | @@ -1,18 +1,18 @@ |
| 1 | const Foo = struct { i: i32 }; | 1 | const Foo = struct { i: i32 }; |
| 2 | const Bar = struct { j: i32 }; | 2 | const Bar = struct { j: i32 }; |
| 3 | 3 | ||
| 4 | pub fn helper(_: Foo, _: Bar) void { } | 4 | pub fn helper(_: Foo, _: Bar) void {} |
| 5 | 5 | ||
| 6 | comptime { | 6 | comptime { |
| 7 | helper(Bar { .j = 10 }, Bar { .j = 10 }); | 7 | helper(Bar{ .j = 10 }, Bar{ .j = 10 }); |
| 8 | helper(Bar { .i = 10 }, Bar { .j = 10 }); | 8 | helper(Bar{ .i = 10 }, Bar{ .j = 10 }); |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | // error | 11 | // error |
| 12 | // backend=stage2 | 12 | // backend=stage2 |
| 13 | // target=native | 13 | // target=native |
| 14 | // | 14 | // |
| 15 | // :7:16: error: expected type 'tmp.Foo', found 'tmp.Bar' | 15 | // :7:15: error: expected type 'tmp.Foo', found 'tmp.Bar' |
| 16 | // :2:13: note: struct declared here | 16 | // :2:13: note: struct declared here |
| 17 | // :1:13: note: struct declared here | 17 | // :1:13: note: struct declared here |
| 18 | // :4:18: note: parameter type declared here | 18 | // :4:18: note: parameter type declared here |
test/cases/compile_errors/struct_type_returned_from_non-generic_function.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | pub export fn entry(param: usize) usize { | 1 | pub export fn entry(param: usize) usize { |
| 2 | return struct{ param }; | 2 | return struct { param }; |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
test/cases/compile_errors/struct_with_declarations_unavailable_for_reify_type.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | _ = @Type(@typeInfo(struct { const foo = 1; })); | 2 | _ = @Type(@typeInfo(struct { |
| 3 | const foo = 1; | ||
| 4 | })); | ||
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | // error | 7 | // error |
test/cases/compile_errors/struct_with_invalid_field.zig+5-5| ... | @@ -1,10 +1,10 @@ | ... | @@ -1,10 +1,10 @@ |
| 1 | const std = @import("std",); | 1 | const std = @import( |
| 2 | "std", | ||
| 3 | ); | ||
| 2 | const Allocator = std.mem.Allocator; | 4 | const Allocator = std.mem.Allocator; |
| 3 | const ArrayList = std.ArrayList; | 5 | const ArrayList = std.ArrayList; |
| 4 | 6 | ||
| 5 | const HeaderWeight = enum { | 7 | const HeaderWeight = enum { H1, H2, H3, H4, H5, H6 }; |
| 6 | H1, H2, H3, H4, H5, H6, | ||
| 7 | }; | ||
| 8 | 8 | ||
| 9 | const MdText = ArrayList(u8); | 9 | const MdText = ArrayList(u8); |
| 10 | 10 | ||
| ... | @@ -16,7 +16,7 @@ const MdNode = union(enum) { | ... | @@ -16,7 +16,7 @@ const MdNode = union(enum) { |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | export fn entry() void { | 18 | export fn entry() void { |
| 19 | const a = MdNode.Header { | 19 | const a = MdNode.Header{ |
| 20 | .text = MdText.init(std.testing.allocator), | 20 | .text = MdText.init(std.testing.allocator), |
| 21 | .weight = HeaderWeight.H1, | 21 | .weight = HeaderWeight.H1, |
| 22 | }; | 22 | }; |
test/cases/compile_errors/sub_overflow_in_function_evaluation.zig+3-1| ... | @@ -3,7 +3,9 @@ fn sub(a: u16, b: u16) u16 { | ... | @@ -3,7 +3,9 @@ fn sub(a: u16, b: u16) u16 { |
| 3 | return a - b; | 3 | return a - b; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(&y)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(&y)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/suspend_inside_suspend_block.zig+1-2| ... | @@ -3,8 +3,7 @@ export fn entry() void { | ... | @@ -3,8 +3,7 @@ export fn entry() void { |
| 3 | } | 3 | } |
| 4 | fn foo() void { | 4 | fn foo() void { |
| 5 | suspend { | 5 | suspend { |
| 6 | suspend { | 6 | suspend {} |
| 7 | } | ||
| 8 | } | 7 | } |
| 9 | } | 8 | } |
| 10 | 9 |
test/cases/compile_errors/switch_expression-duplicate_enumeration_prong.zig+3-1| ... | @@ -14,7 +14,9 @@ fn f(n: Number) i32 { | ... | @@ -14,7 +14,9 @@ fn f(n: Number) i32 { |
| 14 | } | 14 | } |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | export fn entry() usize { return @sizeOf(@TypeOf(&f)); } | 17 | export fn entry() usize { |
| 18 | return @sizeOf(@TypeOf(&f)); | ||
| 19 | } | ||
| 18 | 20 | ||
| 19 | // error | 21 | // error |
| 20 | // backend=stage2 | 22 | // backend=stage2 |
test/cases/compile_errors/switch_expression-duplicate_enumeration_prong_when_else_present.zig+3-1| ... | @@ -15,7 +15,9 @@ fn f(n: Number) i32 { | ... | @@ -15,7 +15,9 @@ fn f(n: Number) i32 { |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | export fn entry() usize { return @sizeOf(@TypeOf(&f)); } | 18 | export fn entry() usize { |
| 19 | return @sizeOf(@TypeOf(&f)); | ||
| 20 | } | ||
| 19 | 21 | ||
| 20 | // error | 22 | // error |
| 21 | // backend=stage2 | 23 | // backend=stage2 |
test/cases/compile_errors/switch_expression-duplicate_or_overlapping_integer_value.zig+9-7| ... | @@ -1,16 +1,18 @@ | ... | @@ -1,16 +1,18 @@ |
| 1 | fn foo(x: u8) u8 { | 1 | fn foo(x: u8) u8 { |
| 2 | return switch (x) { | 2 | return switch (x) { |
| 3 | 0 ... 100 => @as(u8, 0), | 3 | 0...100 => @as(u8, 0), |
| 4 | 101 ... 200 => 1, | 4 | 101...200 => 1, |
| 5 | 201, 203 ... 207 => 2, | 5 | 201, 203...207 => 2, |
| 6 | 206 ... 255 => 3, | 6 | 206...255 => 3, |
| 7 | }; | 7 | }; |
| 8 | } | 8 | } |
| 9 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 9 | export fn entry() usize { |
| 10 | return @sizeOf(@TypeOf(&foo)); | ||
| 11 | } | ||
| 10 | 12 | ||
| 11 | // error | 13 | // error |
| 12 | // backend=stage2 | 14 | // backend=stage2 |
| 13 | // target=native | 15 | // target=native |
| 14 | // | 16 | // |
| 15 | // :6:13: error: duplicate switch value | 17 | // :6:12: error: duplicate switch value |
| 16 | // :5:18: note: previous value here | 18 | // :5:17: note: previous value here |
test/cases/compile_errors/switch_expression-duplicate_type.zig+3-1| ... | @@ -7,7 +7,9 @@ fn foo(comptime T: type, x: T) u8 { | ... | @@ -7,7 +7,9 @@ fn foo(comptime T: type, x: T) u8 { |
| 7 | else => 3, | 7 | else => 3, |
| 8 | }; | 8 | }; |
| 9 | } | 9 | } |
| 10 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } | 10 | export fn entry() usize { |
| 11 | return @sizeOf(@TypeOf(foo(u32, 0))); | ||
| 12 | } | ||
| 11 | 13 | ||
| 12 | // error | 14 | // error |
| 13 | // backend=stage2 | 15 | // backend=stage2 |
test/cases/compile_errors/switch_expression-duplicate_type_struct_alias.zig+3-1| ... | @@ -11,7 +11,9 @@ fn foo(comptime T: type, x: T) u8 { | ... | @@ -11,7 +11,9 @@ fn foo(comptime T: type, x: T) u8 { |
| 11 | else => 3, | 11 | else => 3, |
| 12 | }; | 12 | }; |
| 13 | } | 13 | } |
| 14 | export fn entry() usize { return @sizeOf(@TypeOf(foo(u32, 0))); } | 14 | export fn entry() usize { |
| 15 | return @sizeOf(@TypeOf(foo(u32, 0))); | ||
| 16 | } | ||
| 15 | 17 | ||
| 16 | // error | 18 | // error |
| 17 | // backend=stage2 | 19 | // backend=stage2 |
test/cases/compile_errors/switch_expression-missing_enumeration_prong.zig+3-1| ... | @@ -12,7 +12,9 @@ fn f(n: Number) i32 { | ... | @@ -12,7 +12,9 @@ fn f(n: Number) i32 { |
| 12 | } | 12 | } |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | export fn entry() usize { return @sizeOf(@TypeOf(&f)); } | 15 | export fn entry() usize { |
| 16 | return @sizeOf(@TypeOf(&f)); | ||
| 17 | } | ||
| 16 | 18 | ||
| 17 | // error | 19 | // error |
| 18 | // backend=stage2 | 20 | // backend=stage2 |
test/cases/compile_errors/switch_expression-non_exhaustive_integer_prongs.zig+3-1| ... | @@ -3,7 +3,9 @@ fn foo(x: u8) void { | ... | @@ -3,7 +3,9 @@ fn foo(x: u8) void { |
| 3 | 0 => {}, | 3 | 0 => {}, |
| 4 | } | 4 | } |
| 5 | } | 5 | } |
| 6 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 6 | export fn entry() usize { |
| 7 | return @sizeOf(@TypeOf(&foo)); | ||
| 8 | } | ||
| 7 | 9 | ||
| 8 | // error | 10 | // error |
| 9 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/switch_expression-switch_on_pointer_type_with_no_else.zig+3-1| ... | @@ -4,7 +4,9 @@ fn foo(x: *u8) void { | ... | @@ -4,7 +4,9 @@ fn foo(x: *u8) void { |
| 4 | } | 4 | } |
| 5 | } | 5 | } |
| 6 | var y: u8 = 100; | 6 | var y: u8 = 100; |
| 7 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 7 | export fn entry() usize { |
| 8 | return @sizeOf(@TypeOf(&foo)); | ||
| 9 | } | ||
| 8 | 10 | ||
| 9 | // error | 11 | // error |
| 10 | // backend=stage2 | 12 | // backend=stage2 |
test/cases/compile_errors/switch_expression-unreachable_else_prong_bool.zig+3-1| ... | @@ -5,7 +5,9 @@ fn foo(x: bool) void { | ... | @@ -5,7 +5,9 @@ fn foo(x: bool) void { |
| 5 | else => {}, | 5 | else => {}, |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 8 | export fn entry() usize { |
| 9 | return @sizeOf(@TypeOf(&foo)); | ||
| 10 | } | ||
| 9 | 11 | ||
| 10 | // error | 12 | // error |
| 11 | // backend=stage2 | 13 | // backend=stage2 |
test/cases/compile_errors/switch_expression-unreachable_else_prong_enum.zig+4-2| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const TestEnum = enum{ T1, T2 }; | 1 | const TestEnum = enum { T1, T2 }; |
| 2 | 2 | ||
| 3 | fn err(x: u8) TestEnum { | 3 | fn err(x: u8) TestEnum { |
| 4 | switch (x) { | 4 | switch (x) { |
| ... | @@ -15,7 +15,9 @@ fn foo(x: u8) void { | ... | @@ -15,7 +15,9 @@ fn foo(x: u8) void { |
| 15 | } | 15 | } |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 18 | export fn entry() usize { |
| 19 | return @sizeOf(@TypeOf(&foo)); | ||
| 20 | } | ||
| 19 | 21 | ||
| 20 | // error | 22 | // error |
| 21 | // backend=llvm | 23 | // backend=llvm |
test/cases/compile_errors/switch_expression-unreachable_else_prong_range_i8.zig+3-1| ... | @@ -8,7 +8,9 @@ fn foo(x: i8) void { | ... | @@ -8,7 +8,9 @@ fn foo(x: i8) void { |
| 8 | else => {}, | 8 | else => {}, |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 11 | export fn entry() usize { |
| 12 | return @sizeOf(@TypeOf(&foo)); | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/switch_expression-unreachable_else_prong_range_u8.zig+3-1| ... | @@ -8,7 +8,9 @@ fn foo(x: u8) void { | ... | @@ -8,7 +8,9 @@ fn foo(x: u8) void { |
| 8 | else => {}, | 8 | else => {}, |
| 9 | } | 9 | } |
| 10 | } | 10 | } |
| 11 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 11 | export fn entry() usize { |
| 12 | return @sizeOf(@TypeOf(&foo)); | ||
| 13 | } | ||
| 12 | 14 | ||
| 13 | // error | 15 | // error |
| 14 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/switch_expression-unreachable_else_prong_u1.zig+3-1| ... | @@ -5,7 +5,9 @@ fn foo(x: u1) void { | ... | @@ -5,7 +5,9 @@ fn foo(x: u1) void { |
| 5 | else => {}, | 5 | else => {}, |
| 6 | } | 6 | } |
| 7 | } | 7 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 8 | export fn entry() usize { |
| 9 | return @sizeOf(@TypeOf(&foo)); | ||
| 10 | } | ||
| 9 | 11 | ||
| 10 | // error | 12 | // error |
| 11 | // backend=stage2 | 13 | // backend=stage2 |
test/cases/compile_errors/switch_expression-unreachable_else_prong_u2.zig+3-1| ... | @@ -7,7 +7,9 @@ fn foo(x: u2) void { | ... | @@ -7,7 +7,9 @@ fn foo(x: u2) void { |
| 7 | else => {}, | 7 | else => {}, |
| 8 | } | 8 | } |
| 9 | } | 9 | } |
| 10 | export fn entry() usize { return @sizeOf(@TypeOf(&foo)); } | 10 | export fn entry() usize { |
| 11 | return @sizeOf(@TypeOf(&foo)); | ||
| 12 | } | ||
| 11 | 13 | ||
| 12 | // error | 14 | // error |
| 13 | // backend=stage2 | 15 | // backend=stage2 |
test/cases/compile_errors/switching_with_exhaustive_enum_has___prong_.zig+1-1| ... | @@ -1,4 +1,4 @@ | ... | @@ -1,4 +1,4 @@ |
| 1 | const E = enum{ | 1 | const E = enum { |
| 2 | a, | 2 | a, |
| 3 | b, | 3 | b, |
| 4 | }; | 4 | }; |
test/cases/compile_errors/switching_with_non-exhaustive_enums.zig+1-1| ... | @@ -22,7 +22,7 @@ pub export fn entry2() void { | ... | @@ -22,7 +22,7 @@ pub export fn entry2() void { |
| 22 | } | 22 | } |
| 23 | } | 23 | } |
| 24 | pub export fn entry3() void { | 24 | pub export fn entry3() void { |
| 25 | var u = U{.a = 2}; | 25 | var u = U{ .a = 2 }; |
| 26 | switch (u) { // error: `_` prong not allowed when switching on tagged union | 26 | switch (u) { // error: `_` prong not allowed when switching on tagged union |
| 27 | .a => {}, | 27 | .a => {}, |
| 28 | .b => {}, | 28 | .b => {}, |
test/cases/compile_errors/tagName_on_invalid_value_of_non-exhaustive_enum.zig+2-2| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | test "enum" { | 1 | test "enum" { |
| 2 | const E = enum(u8) { A, B, _ }; | 2 | const E = enum(u8) { A, B, _ }; |
| 3 | _ = @tagName(@intToEnum(E, 5)); | 3 | _ = @tagName(@enumFromInt(E, 5)); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| ... | @@ -8,5 +8,5 @@ test "enum" { | ... | @@ -8,5 +8,5 @@ test "enum" { |
| 8 | // target=native | 8 | // target=native |
| 9 | // is_test=1 | 9 | // is_test=1 |
| 10 | // | 10 | // |
| 11 | // :3:9: error: no field with value '@intToEnum(tmp.test.enum.E, 5)' in enum 'test.enum.E' | 11 | // :3:9: error: no field with value '@enumFromInt(tmp.test.enum.E, 5)' in enum 'test.enum.E' |
| 12 | // :2:15: note: declared here | 12 | // :2:15: note: declared here |
test/cases/compile_errors/tagName_used_on_union_with_no_associated_enum_tag.zig+1-1| ... | @@ -3,7 +3,7 @@ const FloatInt = extern union { | ... | @@ -3,7 +3,7 @@ const FloatInt = extern union { |
| 3 | Int: i32, | 3 | Int: i32, |
| 4 | }; | 4 | }; |
| 5 | export fn entry() void { | 5 | export fn entry() void { |
| 6 | var fi = FloatInt{.Float = 123.45}; | 6 | var fi = FloatInt{ .Float = 123.45 }; |
| 7 | var tagName = @tagName(fi); | 7 | var tagName = @tagName(fi); |
| 8 | _ = tagName; | 8 | _ = tagName; |
| 9 | } | 9 | } |
test/cases/compile_errors/top_level_decl_dependency_loop.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | const a : @TypeOf(b) = 0; | 1 | const a: @TypeOf(b) = 0; |
| 2 | const b : @TypeOf(a) = 0; | 2 | const b: @TypeOf(a) = 0; |
| 3 | export fn entry() void { | 3 | export fn entry() void { |
| 4 | const c = a + b; | 4 | const c = a + b; |
| 5 | _ = c; | 5 | _ = c; |
test/cases/compile_errors/try_in_function_with_non_error_return_type.zig+1-1| ... | @@ -1,7 +1,7 @@ | ... | @@ -1,7 +1,7 @@ |
| 1 | export fn f() void { | 1 | export fn f() void { |
| 2 | try something(); | 2 | try something(); |
| 3 | } | 3 | } |
| 4 | fn something() anyerror!void { } | 4 | fn something() anyerror!void {} |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| 7 | // backend=stage2 | 7 | // backend=stage2 |
test/cases/compile_errors/tuple_init_edge_cases.zig+27-15| ... | @@ -1,44 +1,56 @@ | ... | @@ -1,44 +1,56 @@ |
| 1 | pub export fn entry1() void { | 1 | pub export fn entry1() void { |
| 2 | const T = @TypeOf(.{ 123, 3 }); | 2 | const T = @TypeOf(.{ 123, 3 }); |
| 3 | var b = T{ .@"1" = 3 }; _ = b; | 3 | var b = T{ .@"1" = 3 }; |
| 4 | var c = T{ 123, 3 }; _ = c; | 4 | _ = b; |
| 5 | var d = T{}; _ = d; | 5 | var c = T{ 123, 3 }; |
| 6 | _ = c; | ||
| 7 | var d = T{}; | ||
| 8 | _ = d; | ||
| 6 | } | 9 | } |
| 7 | pub export fn entry2() void { | 10 | pub export fn entry2() void { |
| 8 | var a: u32 = 2; | 11 | var a: u32 = 2; |
| 9 | const T = @TypeOf(.{ 123, a }); | 12 | const T = @TypeOf(.{ 123, a }); |
| 10 | var b = T{ .@"1" = 3 }; _ = b; | 13 | var b = T{ .@"1" = 3 }; |
| 11 | var c = T{ 123, 3 }; _ = c; | 14 | _ = b; |
| 12 | var d = T{}; _ = d; | 15 | var c = T{ 123, 3 }; |
| 16 | _ = c; | ||
| 17 | var d = T{}; | ||
| 18 | _ = d; | ||
| 13 | } | 19 | } |
| 14 | pub export fn entry3() void { | 20 | pub export fn entry3() void { |
| 15 | var a: u32 = 2; | 21 | var a: u32 = 2; |
| 16 | const T = @TypeOf(.{ 123, a }); | 22 | const T = @TypeOf(.{ 123, a }); |
| 17 | var b = T{ .@"0" = 123 }; _ = b; | 23 | var b = T{ .@"0" = 123 }; |
| 24 | _ = b; | ||
| 18 | } | 25 | } |
| 19 | comptime { | 26 | comptime { |
| 20 | var a: u32 = 2; | 27 | var a: u32 = 2; |
| 21 | const T = @TypeOf(.{ 123, a }); | 28 | const T = @TypeOf(.{ 123, a }); |
| 22 | var b = T{ .@"0" = 123 }; _ = b; | 29 | var b = T{ .@"0" = 123 }; |
| 23 | var c = T{ 123, 2 }; _ = c; | 30 | _ = b; |
| 24 | var d = T{}; _ = d; | 31 | var c = T{ 123, 2 }; |
| 32 | _ = c; | ||
| 33 | var d = T{}; | ||
| 34 | _ = d; | ||
| 25 | } | 35 | } |
| 26 | pub export fn entry4() void { | 36 | pub export fn entry4() void { |
| 27 | var a: u32 = 2; | 37 | var a: u32 = 2; |
| 28 | const T = @TypeOf(.{ 123, a }); | 38 | const T = @TypeOf(.{ 123, a }); |
| 29 | var b = T{ 123, 4, 5 }; _ = b; | 39 | var b = T{ 123, 4, 5 }; |
| 40 | _ = b; | ||
| 30 | } | 41 | } |
| 31 | pub export fn entry5() void { | 42 | pub export fn entry5() void { |
| 32 | var a: u32 = 2; | 43 | var a: u32 = 2; |
| 33 | const T = @TypeOf(.{ 123, a }); | 44 | const T = @TypeOf(.{ 123, a }); |
| 34 | var b = T{ .@"0" = 123, .@"2" = 123, .@"1" = 123 }; _ = b; | 45 | var b = T{ .@"0" = 123, .@"2" = 123, .@"1" = 123 }; |
| 46 | _ = b; | ||
| 35 | } | 47 | } |
| 36 | 48 | ||
| 37 | // error | 49 | // error |
| 38 | // backend=stage2 | 50 | // backend=stage2 |
| 39 | // target=native | 51 | // target=native |
| 40 | // | 52 | // |
| 41 | // :12:14: error: missing tuple field with index 1 | ||
| 42 | // :17:14: error: missing tuple field with index 1 | 53 | // :17:14: error: missing tuple field with index 1 |
| 43 | // :29:14: error: expected at most 2 tuple fields; found 3 | 54 | // :23:14: error: missing tuple field with index 1 |
| 44 | // :34:30: error: index '2' out of bounds of tuple 'struct{comptime comptime_int = 123, u32}' | 55 | // :39:14: error: expected at most 2 tuple fields; found 3 |
| 56 | // :45:30: error: index '2' out of bounds of tuple 'struct{comptime comptime_int = 123, u32}' |
test/cases/compile_errors/type_checking_function_pointers.zig+6-4| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | fn a(b: *const fn (*const u8) void) void { | 1 | fn a(b: *const fn (*const u8) void) void { |
| 2 | _ = b; | 2 | _ = b; |
| 3 | } | 3 | } |
| 4 | fn c(d: u8) void {_ = d;} | 4 | fn c(d: u8) void { |
| 5 | _ = d; | ||
| 6 | } | ||
| 5 | export fn entry() void { | 7 | export fn entry() void { |
| 6 | a(c); | 8 | a(c); |
| 7 | } | 9 | } |
| ... | @@ -10,6 +12,6 @@ export fn entry() void { | ... | @@ -10,6 +12,6 @@ export fn entry() void { |
| 10 | // backend=stage2 | 12 | // backend=stage2 |
| 11 | // target=native | 13 | // target=native |
| 12 | // | 14 | // |
| 13 | // :6:7: error: expected type '*const fn(*const u8) void', found '*const fn(u8) void' | 15 | // :8:7: error: expected type '*const fn(*const u8) void', found '*const fn(u8) void' |
| 14 | // :6:7: note: pointer type child 'fn(u8) void' cannot cast into pointer type child 'fn(*const u8) void' | 16 | // :8:7: note: pointer type child 'fn(u8) void' cannot cast into pointer type child 'fn(*const u8) void' |
| 15 | // :6:7: note: parameter 0 'u8' cannot cast into '*const u8' | 17 | // :8:7: note: parameter 0 'u8' cannot cast into '*const u8' |
test/cases/compile_errors/undeclared_identifier.zig+2-4| ... | @@ -1,11 +1,9 @@ | ... | @@ -1,11 +1,9 @@ |
| 1 | export fn a() void { | 1 | export fn a() void { |
| 2 | return | 2 | return b + c; |
| 3 | b + | ||
| 4 | c; | ||
| 5 | } | 3 | } |
| 6 | 4 | ||
| 7 | // error | 5 | // error |
| 8 | // backend=stage2 | 6 | // backend=stage2 |
| 9 | // target=native | 7 | // target=native |
| 10 | // | 8 | // |
| 11 | // :3:5: error: use of undeclared identifier 'b' | 9 | // :2:12: error: use of undeclared identifier 'b' |
test/cases/compile_errors/union_auto-enum_value_already_taken.zig+1-1| ... | @@ -6,7 +6,7 @@ const MultipleChoice = union(enum(u32)) { | ... | @@ -6,7 +6,7 @@ const MultipleChoice = union(enum(u32)) { |
| 6 | E = 60, | 6 | E = 60, |
| 7 | }; | 7 | }; |
| 8 | export fn entry() void { | 8 | export fn entry() void { |
| 9 | var x = MultipleChoice { .C = {} }; | 9 | var x = MultipleChoice{ .C = {} }; |
| 10 | _ = x; | 10 | _ = x; |
| 11 | } | 11 | } |
| 12 | 12 |
test/cases/compile_errors/union_enum_field_does_not_match_enum.zig+1-1| ... | @@ -10,7 +10,7 @@ const Payload = union(Letter) { | ... | @@ -10,7 +10,7 @@ const Payload = union(Letter) { |
| 10 | D: bool, | 10 | D: bool, |
| 11 | }; | 11 | }; |
| 12 | export fn entry() void { | 12 | export fn entry() void { |
| 13 | var a = Payload {.A = 1234}; | 13 | var a = Payload{ .A = 1234 }; |
| 14 | _ = a; | 14 | _ = a; |
| 15 | } | 15 | } |
| 16 | 16 |
test/cases/compile_errors/unreachable_parameter.zig+6-2| ... | @@ -1,5 +1,9 @@ | ... | @@ -1,5 +1,9 @@ |
| 1 | fn f(a: noreturn) void { _ = a; } | 1 | fn f(a: noreturn) void { |
| 2 | export fn entry() void { f(); } | 2 | _ = a; |
| 3 | } | ||
| 4 | export fn entry() void { | ||
| 5 | f(); | ||
| 6 | } | ||
| 3 | 7 | ||
| 4 | // error | 8 | // error |
| 5 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/unreachable_with_return.zig+7-3| ... | @@ -1,9 +1,13 @@ | ... | @@ -1,9 +1,13 @@ |
| 1 | fn a() noreturn {return;} | 1 | fn a() noreturn { |
| 2 | export fn entry() void { a(); } | 2 | return; |
| 3 | } | ||
| 4 | export fn entry() void { | ||
| 5 | a(); | ||
| 6 | } | ||
| 3 | 7 | ||
| 4 | // error | 8 | // error |
| 5 | // backend=stage2 | 9 | // backend=stage2 |
| 6 | // target=native | 10 | // target=native |
| 7 | // | 11 | // |
| 8 | // :1:18: error: function declared 'noreturn' returns | 12 | // :2:5: error: function declared 'noreturn' returns |
| 9 | // :1:8: note: 'noreturn' declared here | 13 | // :1:8: note: 'noreturn' declared here |
test/cases/compile_errors/while_expected_bool_got_error_union.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) {} | 2 | while (bar()) {} |
| 3 | } | 3 | } |
| 4 | fn bar() anyerror!i32 { return 1; } | 4 | fn bar() anyerror!i32 { |
| 5 | return 1; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/while_expected_bool_got_optional.zig+3-1| ... | @@ -1,7 +1,9 @@ | ... | @@ -1,7 +1,9 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) {} | 2 | while (bar()) {} |
| 3 | } | 3 | } |
| 4 | fn bar() ?i32 { return 1; } | 4 | fn bar() ?i32 { |
| 5 | return 1; | ||
| 6 | } | ||
| 5 | 7 | ||
| 6 | // error | 8 | // error |
| 7 | // backend=stage2 | 9 | // backend=stage2 |
test/cases/compile_errors/while_expected_error_union_got_bool.zig+8-2| ... | @@ -1,7 +1,13 @@ | ... | @@ -1,7 +1,13 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) |x| {_ = x;} else |err| {_ = err;} | 2 | while (bar()) |x| { |
| 3 | _ = x; | ||
| 4 | } else |err| { | ||
| 5 | _ = err; | ||
| 6 | } | ||
| 7 | } | ||
| 8 | fn bar() bool { | ||
| 9 | return true; | ||
| 3 | } | 10 | } |
| 4 | fn bar() bool { return true; } | ||
| 5 | 11 | ||
| 6 | // error | 12 | // error |
| 7 | // backend=stage2 | 13 | // backend=stage2 |
test/cases/compile_errors/while_expected_error_union_got_optional.zig+8-2| ... | @@ -1,7 +1,13 @@ | ... | @@ -1,7 +1,13 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) |x| {_ = x;} else |err| {_ = err;} | 2 | while (bar()) |x| { |
| 3 | _ = x; | ||
| 4 | } else |err| { | ||
| 5 | _ = err; | ||
| 6 | } | ||
| 7 | } | ||
| 8 | fn bar() ?i32 { | ||
| 9 | return 1; | ||
| 3 | } | 10 | } |
| 4 | fn bar() ?i32 { return 1; } | ||
| 5 | 11 | ||
| 6 | // error | 12 | // error |
| 7 | // backend=stage2 | 13 | // backend=stage2 |
test/cases/compile_errors/while_expected_optional_got_bool.zig+6-2| ... | @@ -1,7 +1,11 @@ | ... | @@ -1,7 +1,11 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) |x| {_ = x;} | 2 | while (bar()) |x| { |
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | } | ||
| 6 | fn bar() bool { | ||
| 7 | return true; | ||
| 3 | } | 8 | } |
| 4 | fn bar() bool { return true; } | ||
| 5 | 9 | ||
| 6 | // error | 10 | // error |
| 7 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/while_expected_optional_got_error_union.zig+6-2| ... | @@ -1,7 +1,11 @@ | ... | @@ -1,7 +1,11 @@ |
| 1 | export fn foo() void { | 1 | export fn foo() void { |
| 2 | while (bar()) |x| {_ = x;} | 2 | while (bar()) |x| { |
| 3 | _ = x; | ||
| 4 | } | ||
| 5 | } | ||
| 6 | fn bar() anyerror!i32 { | ||
| 7 | return 1; | ||
| 3 | } | 8 | } |
| 4 | fn bar() anyerror!i32 { return 1; } | ||
| 5 | 9 | ||
| 6 | // error | 10 | // error |
| 7 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/write_to_const_global_variable.zig+4-2| ... | @@ -1,8 +1,10 @@ | ... | @@ -1,8 +1,10 @@ |
| 1 | const x : i32 = 99; | 1 | const x: i32 = 99; |
| 2 | fn f() void { | 2 | fn f() void { |
| 3 | x = 1; | 3 | x = 1; |
| 4 | } | 4 | } |
| 5 | export fn entry() void { f(); } | 5 | export fn entry() void { |
| 6 | f(); | ||
| 7 | } | ||
| 6 | 8 | ||
| 7 | // error | 9 | // error |
| 8 | // backend=stage2 | 10 | // backend=stage2 |
test/cases/compile_errors/wrong_function_type.zig+13-5| ... | @@ -1,8 +1,16 @@ | ... | @@ -1,8 +1,16 @@ |
| 1 | const fns = [_]fn() void { a, b, c }; | 1 | const fns = [_]fn () void{ a, b, c }; |
| 2 | fn a() i32 {return 0;} | 2 | fn a() i32 { |
| 3 | fn b() i32 {return 1;} | 3 | return 0; |
| 4 | fn c() i32 {return 2;} | 4 | } |
| 5 | export fn entry() usize { return @sizeOf(@TypeOf(fns)); } | 5 | fn b() i32 { |
| 6 | return 1; | ||
| 7 | } | ||
| 8 | fn c() i32 { | ||
| 9 | return 2; | ||
| 10 | } | ||
| 11 | export fn entry() usize { | ||
| 12 | return @sizeOf(@TypeOf(fns)); | ||
| 13 | } | ||
| 6 | 14 | ||
| 7 | // error | 15 | // error |
| 8 | // backend=stage2 | 16 | // backend=stage2 |
test/cases/compile_errors/wrong_number_of_arguments.zig+5-1| ... | @@ -1,7 +1,11 @@ | ... | @@ -1,7 +1,11 @@ |
| 1 | export fn a() void { | 1 | export fn a() void { |
| 2 | c(1); | 2 | c(1); |
| 3 | } | 3 | } |
| 4 | fn c(d: i32, e: i32, f: i32) void { _ = d; _ = e; _ = f; } | 4 | fn c(d: i32, e: i32, f: i32) void { |
| 5 | _ = d; | ||
| 6 | _ = e; | ||
| 7 | _ = f; | ||
| 8 | } | ||
| 5 | 9 | ||
| 6 | // error | 10 | // error |
| 7 | // backend=stage2 | 11 | // backend=stage2 |
test/cases/compile_errors/wrong_number_of_arguments_for_method_fn_call.zig+8-4| ... | @@ -1,15 +1,19 @@ | ... | @@ -1,15 +1,19 @@ |
| 1 | const Foo = struct { | 1 | const Foo = struct { |
| 2 | fn method(self: *const Foo, a: i32) void {_ = self; _ = a;} | 2 | fn method(self: *const Foo, a: i32) void { |
| 3 | _ = self; | ||
| 4 | _ = a; | ||
| 5 | } | ||
| 3 | }; | 6 | }; |
| 4 | fn f(foo: *const Foo) void { | 7 | fn f(foo: *const Foo) void { |
| 5 | |||
| 6 | foo.method(1, 2); | 8 | foo.method(1, 2); |
| 7 | } | 9 | } |
| 8 | export fn entry() usize { return @sizeOf(@TypeOf(&f)); } | 10 | export fn entry() usize { |
| 11 | return @sizeOf(@TypeOf(&f)); | ||
| 12 | } | ||
| 9 | 13 | ||
| 10 | // error | 14 | // error |
| 11 | // backend=stage2 | 15 | // backend=stage2 |
| 12 | // target=native | 16 | // target=native |
| 13 | // | 17 | // |
| 14 | // :6:8: error: member function expected 1 argument(s), found 2 | 18 | // :8:8: error: member function expected 1 argument(s), found 2 |
| 15 | // :2:5: note: function declared here | 19 | // :2:5: note: function declared here |
test/cases/compile_errors/wrong_size_to_an_array_literal.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | const array = [2]u8{1, 2, 3}; | 2 | const array = [2]u8{ 1, 2, 3 }; |
| 3 | _ = array; | 3 | _ = array; |
| 4 | } | 4 | } |
| 5 | 5 |
test/cases/compile_errors/wrong_types_given_to_export.zig+3-3| ... | @@ -1,11 +1,11 @@ | ... | @@ -1,11 +1,11 @@ |
| 1 | fn entry() callconv(.C) void { } | 1 | fn entry() callconv(.C) void {} |
| 2 | comptime { | 2 | comptime { |
| 3 | @export(entry, .{.name = "entry", .linkage = @as(u32, 1234) }); | 3 | @export(entry, .{ .name = "entry", .linkage = @as(u32, 1234) }); |
| 4 | } | 4 | } |
| 5 | 5 | ||
| 6 | // error | 6 | // error |
| 7 | // backend=stage2 | 7 | // backend=stage2 |
| 8 | // target=native | 8 | // target=native |
| 9 | // | 9 | // |
| 10 | // :3:50: error: expected type 'builtin.GlobalLinkage', found 'u32' | 10 | // :3:51: error: expected type 'builtin.GlobalLinkage', found 'u32' |
| 11 | // :?:?: note: enum declared here | 11 | // :?:?: note: enum declared here |
test/cases/comptime_var.2.zig+1-1| ... | @@ -8,7 +8,7 @@ pub fn main() void { | ... | @@ -8,7 +8,7 @@ pub fn main() void { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn print(len: usize) void { | 10 | fn print(len: usize) void { |
| 11 | _ = write(1, @ptrToInt("Hello, World!\n"), len); | 11 | _ = write(1, @intFromPtr("Hello, World!\n"), len); |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | // run | 14 | // run |
test/cases/comptime_var.6.zig+1-1| ... | @@ -7,7 +7,7 @@ pub fn main() void { | ... | @@ -7,7 +7,7 @@ pub fn main() void { |
| 7 | } | 7 | } |
| 8 | } | 8 | } |
| 9 | fn print(len: usize) void { | 9 | fn print(len: usize) void { |
| 10 | _ = write(1, @ptrToInt("Hello"), len); | 10 | _ = write(1, @intFromPtr("Hello"), len); |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | // run | 13 | // run |
test/cases/conditional_branches.0.zig+1-1| ... | @@ -12,7 +12,7 @@ fn foo(x: u64) void { | ... | @@ -12,7 +12,7 @@ fn foo(x: u64) void { |
| 12 | 12 | ||
| 13 | fn print() void { | 13 | fn print() void { |
| 14 | const str = "Hello, World!\n"; | 14 | const str = "Hello, World!\n"; |
| 15 | _ = write(1, @ptrToInt(str.ptr), ptr.len); | 15 | _ = write(1, @intFromPtr(str.ptr), ptr.len); |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // run | 18 | // run |
test/cases/conditional_branches.1.zig+1-1| ... | @@ -15,7 +15,7 @@ fn foo(x: bool) void { | ... | @@ -15,7 +15,7 @@ fn foo(x: bool) void { |
| 15 | 15 | ||
| 16 | fn print() void { | 16 | fn print() void { |
| 17 | const str = "Hello, World!\n"; | 17 | const str = "Hello, World!\n"; |
| 18 | _ = write(1, @ptrToInt(str.ptr), ptr.len); | 18 | _ = write(1, @intFromPtr(str.ptr), ptr.len); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | // run | 21 | // run |
test/cases/decl_value_arena.zig+9-9| ... | @@ -1,20 +1,20 @@ | ... | @@ -1,20 +1,20 @@ |
| 1 | pub const Protocols: struct { | 1 | pub const Protocols: struct { |
| 2 | 	list: *const fn(*Connection) void = undefined, | 2 | list: *const fn (*Connection) void = undefined, |
| 3 | 	handShake: type = struct { | 3 | handShake: type = struct { |
| 4 | 		const stepStart: u8 = 0; | 4 | const stepStart: u8 = 0; |
| 5 | 	}, | 5 | }, |
| 6 | } = .{}; | 6 | } = .{}; |
| 7 | 7 | ||
| 8 | pub const Connection = struct { | 8 | pub const Connection = struct { |
| 9 | 	streamBuffer: [0]u8 = undefined, | 9 | streamBuffer: [0]u8 = undefined, |
| 10 | 	__lastReceivedPackets: [0]u8 = undefined, | 10 | __lastReceivedPackets: [0]u8 = undefined, |
| 11 | 11 | ||
| 12 | 	handShakeState: u8 = Protocols.handShake.stepStart, | 12 | handShakeState: u8 = Protocols.handShake.stepStart, |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | pub fn main() void { | 15 | pub fn main() void { |
| 16 | 	var conn: Connection = undefined; | 16 | var conn: Connection = undefined; |
| 17 | 	_ = conn; | 17 | _ = conn; |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | // run | 20 | // run |
test/cases/enum_values.0.zig+2-2| ... | @@ -7,8 +7,8 @@ pub fn main() void { | ... | @@ -7,8 +7,8 @@ pub fn main() void { |
| 7 | number1; | 7 | number1; |
| 8 | number2; | 8 | number2; |
| 9 | } | 9 | } |
| 10 | const number3 = @intToEnum(Number, 2); | 10 | const number3 = @enumFromInt(Number, 2); |
| 11 | if (@enumToInt(number3) != 2) { | 11 | if (@intFromEnum(number3) != 2) { |
| 12 | unreachable; | 12 | unreachable; |
| 13 | } | 13 | } |
| 14 | return; | 14 | return; |
test/cases/enum_values.1.zig+4-4| ... | @@ -3,12 +3,12 @@ const Number = enum { One, Two, Three }; | ... | @@ -3,12 +3,12 @@ const Number = enum { One, Two, Three }; |
| 3 | pub fn main() void { | 3 | pub fn main() void { |
| 4 | var number1 = Number.One; | 4 | var number1 = Number.One; |
| 5 | var number2: Number = .Two; | 5 | var number2: Number = .Two; |
| 6 | const number3 = @intToEnum(Number, 2); | 6 | const number3 = @enumFromInt(Number, 2); |
| 7 | assert(number1 != number2); | 7 | assert(number1 != number2); |
| 8 | assert(number2 != number3); | 8 | assert(number2 != number3); |
| 9 | assert(@enumToInt(number1) == 0); | 9 | assert(@intFromEnum(number1) == 0); |
| 10 | assert(@enumToInt(number2) == 1); | 10 | assert(@intFromEnum(number2) == 1); |
| 11 | assert(@enumToInt(number3) == 2); | 11 | assert(@intFromEnum(number3) == 2); |
| 12 | var x: Number = .Two; | 12 | var x: Number = .Two; |
| 13 | assert(number2 == x); | 13 | assert(number2 == x); |
| 14 | 14 |
test/cases/error_in_nested_declaration.zig+1-1| ... | @@ -5,7 +5,7 @@ const S = struct { | ... | @@ -5,7 +5,7 @@ const S = struct { |
| 5 | pub fn str(_: @This(), extra: []u32) []i32 { | 5 | pub fn str(_: @This(), extra: []u32) []i32 { |
| 6 | return @bitCast([]i32, extra); | 6 | return @bitCast([]i32, extra); |
| 7 | } | 7 | } |
| 8 | }, | 8 | }, |
| 9 | }; | 9 | }; |
| 10 | 10 | ||
| 11 | pub export fn entry() void { | 11 | pub export fn entry() void { |
test/cases/hello_world_with_updates.2.zig+1-1| ... | @@ -8,7 +8,7 @@ pub export fn main() noreturn { | ... | @@ -8,7 +8,7 @@ pub export fn main() noreturn { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn print() void { | 10 | fn print() void { |
| 11 | const msg = @ptrToInt("Hello, World!\n"); | 11 | const msg = @intFromPtr("Hello, World!\n"); |
| 12 | const len = 14; | 12 | const len = 14; |
| 13 | _ = write(1, msg, len); | 13 | _ = write(1, msg, len); |
| 14 | } | 14 | } |
test/cases/hello_world_with_updates.3.zig+1-1| ... | @@ -5,7 +5,7 @@ pub fn main() void { | ... | @@ -5,7 +5,7 @@ pub fn main() void { |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | fn print() void { | 7 | fn print() void { |
| 8 | const msg = @ptrToInt("Hello, World!\n"); | 8 | const msg = @intFromPtr("Hello, World!\n"); |
| 9 | const len = 14; | 9 | const len = 14; |
| 10 | _ = write(1, msg, len); | 10 | _ = write(1, msg, len); |
| 11 | } | 11 | } |
test/cases/hello_world_with_updates.4.zig+1-1| ... | @@ -8,7 +8,7 @@ pub fn main() void { | ... | @@ -8,7 +8,7 @@ pub fn main() void { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn print() void { | 10 | fn print() void { |
| 11 | const msg = @ptrToInt("Hello, World!\n"); | 11 | const msg = @intFromPtr("Hello, World!\n"); |
| 12 | const len = 14; | 12 | const len = 14; |
| 13 | _ = write(1, msg, len); | 13 | _ = write(1, msg, len); |
| 14 | } | 14 | } |
test/cases/hello_world_with_updates.5.zig+1-1| ... | @@ -5,7 +5,7 @@ pub fn main() void { | ... | @@ -5,7 +5,7 @@ pub fn main() void { |
| 5 | } | 5 | } |
| 6 | 6 | ||
| 7 | fn print() void { | 7 | fn print() void { |
| 8 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | 8 | const msg = @intFromPtr("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); |
| 9 | const len = 104; | 9 | const len = 104; |
| 10 | _ = write(1, msg, len); | 10 | _ = write(1, msg, len); |
| 11 | } | 11 | } |
test/cases/hello_world_with_updates.6.zig+1-1| ... | @@ -8,7 +8,7 @@ pub fn main() void { | ... | @@ -8,7 +8,7 @@ pub fn main() void { |
| 8 | } | 8 | } |
| 9 | 9 | ||
| 10 | fn print() void { | 10 | fn print() void { |
| 11 | const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); | 11 | const msg = @intFromPtr("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); |
| 12 | const len = 104; | 12 | const len = 104; |
| 13 | _ = write(1, msg, len); | 13 | _ = write(1, msg, len); |
| 14 | } | 14 | } |
test/cases/int_to_ptr.0.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | pub fn main() void { | 1 | pub fn main() void { |
| 2 | _ = @intToPtr(*u8, 0); | 2 | _ = @ptrFromInt(*u8, 0); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
test/cases/int_to_ptr.1.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | pub fn main() void { | 1 | pub fn main() void { |
| 2 | _ = @intToPtr(*u32, 2); | 2 | _ = @ptrFromInt(*u32, 2); |
| 3 | } | 3 | } |
| 4 | 4 | ||
| 5 | // error | 5 | // error |
test/cases/llvm/f_segment_address_space_reading_and_writing.zig+4-4| ... | @@ -20,7 +20,7 @@ fn getFs() c_ulong { | ... | @@ -20,7 +20,7 @@ fn getFs() c_ulong { |
| 20 | : | 20 | : |
| 21 | : [number] "{rax}" (158), | 21 | : [number] "{rax}" (158), |
| 22 | [code] "{rdi}" (0x1003), | 22 | [code] "{rdi}" (0x1003), |
| 23 | [ptr] "{rsi}" (@ptrToInt(&result)), | 23 | [ptr] "{rsi}" (@intFromPtr(&result)), |
| 24 | : "rcx", "r11", "memory" | 24 | : "rcx", "r11", "memory" |
| 25 | ); | 25 | ); |
| 26 | return result; | 26 | return result; |
| ... | @@ -31,10 +31,10 @@ var test_value: u64 = 12345; | ... | @@ -31,10 +31,10 @@ var test_value: u64 = 12345; |
| 31 | pub fn main() void { | 31 | pub fn main() void { |
| 32 | const orig_fs = getFs(); | 32 | const orig_fs = getFs(); |
| 33 | 33 | ||
| 34 | setFs(@ptrToInt(&test_value)); | 34 | setFs(@intFromPtr(&test_value)); |
| 35 | assert(getFs() == @ptrToInt(&test_value)); | 35 | assert(getFs() == @intFromPtr(&test_value)); |
| 36 | 36 | ||
| 37 | var test_ptr = @intToPtr(*allowzero addrspace(.fs) u64, 0); | 37 | var test_ptr = @ptrFromInt(*allowzero addrspace(.fs) u64, 0); |
| 38 | assert(test_ptr.* == 12345); | 38 | assert(test_ptr.* == 12345); |
| 39 | test_ptr.* = 98765; | 39 | test_ptr.* = 98765; |
| 40 | assert(test_value == 98765); | 40 | assert(test_value == 98765); |
test/cases/safety/@alignCast misaligned.zig	+1-1| ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub fn main() !void { | 11 | pub fn main() !void { |
| 12 | var array align(4) = [_]u32{0x11111111, 0x11111111}; | 12 | var array align(4) = [_]u32{ 0x11111111, 0x11111111 }; |
| 13 | const bytes = std.mem.sliceAsBytes(array[0..]); | 13 | const bytes = std.mem.sliceAsBytes(array[0..]); |
| 14 | if (foo(bytes) != 0x11111111) return error.Wrong; | 14 | if (foo(bytes) != 0x11111111) return error.Wrong; |
| 15 | return error.TestFailed; | 15 | return error.TestFailed; |
test/cases/safety/@enumFromInt - no matching tag value.zig	 created+26| ... | @@ -0,0 +1,26 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "invalid enum value")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | const Foo = enum { | ||
| 11 | A, | ||
| 12 | B, | ||
| 13 | C, | ||
| 14 | }; | ||
| 15 | pub fn main() !void { | ||
| 16 | baz(bar(3)); | ||
| 17 | return error.TestFailed; | ||
| 18 | } | ||
| 19 | fn bar(a: u2) Foo { | ||
| 20 | return @enumFromInt(Foo, a); | ||
| 21 | } | ||
| 22 | fn baz(_: Foo) void {} | ||
| 23 | |||
| 24 | // run | ||
| 25 | // backend=llvm | ||
| 26 | // target=native | ||
test/cases/safety/@errSetCast error not present in destination.zig	+2-2| ... | @@ -7,8 +7,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -7,8 +7,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 7 | } | 7 | } |
| 8 | std.process.exit(1); | 8 | std.process.exit(1); |
| 9 | } | 9 | } |
| 10 | const Set1 = error{A, B}; | 10 | const Set1 = error{ A, B }; |
| 11 | const Set2 = error{A, C}; | 11 | const Set2 = error{ A, C }; |
| 12 | pub fn main() !void { | 12 | pub fn main() !void { |
| 13 | foo(Set1.B) catch {}; | 13 | foo(Set1.B) catch {}; |
| 14 | return error.TestFailed; | 14 | return error.TestFailed; |
test/cases/safety/@floatToInt cannot fit - negative out of range.zig	 deleted-20| ... | @@ -1,20 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(-129.1)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) i8 { | ||
| 15 | return @floatToInt(i8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: i8) void { } | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@floatToInt cannot fit - negative to unsigned.zig	 deleted-20| ... | @@ -1,20 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(-1.1)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) u8 { | ||
| 15 | return @floatToInt(u8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: u8) void { } | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@floatToInt cannot fit - positive out of range.zig	 deleted-20| ... | @@ -1,20 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(256.2)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) u8 { | ||
| 15 | return @floatToInt(u8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: u8) void { } | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@intFromFloat cannot fit - negative out of range.zig	 created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(-129.1)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) i8 { | ||
| 15 | return @intFromFloat(i8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: i8) void {} | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@intFromFloat cannot fit - negative to unsigned.zig	 created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(-1.1)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) u8 { | ||
| 15 | return @intFromFloat(u8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: u8) void {} | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@intFromFloat cannot fit - positive out of range.zig	 created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "integer part of floating point value out of bounds")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | baz(bar(256.2)); | ||
| 12 | return error.TestFailed; | ||
| 13 | } | ||
| 14 | fn bar(a: f32) u8 { | ||
| 15 | return @intFromFloat(u8, a); | ||
| 16 | } | ||
| 17 | fn baz(_: u8) void {} | ||
| 18 | // run | ||
| 19 | // backend=llvm | ||
| 20 | // target=native | ||
test/cases/safety/@intToEnum - no matching tag value.zig	 deleted-26| ... | @@ -1,26 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "invalid enum value")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | const Foo = enum { | ||
| 11 | A, | ||
| 12 | B, | ||
| 13 | C, | ||
| 14 | }; | ||
| 15 | pub fn main() !void { | ||
| 16 | baz(bar(3)); | ||
| 17 | return error.TestFailed; | ||
| 18 | } | ||
| 19 | fn bar(a: u2) Foo { | ||
| 20 | return @intToEnum(Foo, a); | ||
| 21 | } | ||
| 22 | fn baz(_: Foo) void {} | ||
| 23 | |||
| 24 | // run | ||
| 25 | // backend=llvm | ||
| 26 | // target=native | ||
test/cases/safety/@intToPtr address zero to non-optional byte-aligned pointer.zig	 deleted-18| ... | @@ -1,18 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "cast causes pointer to be null")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var zero: usize = 0; | ||
| 12 | var b = @intToPtr(*u8, zero); | ||
| 13 | _ = b; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/@intToPtr address zero to non-optional pointer.zig	 deleted-18| ... | @@ -1,18 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "cast causes pointer to be null")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var zero: usize = 0; | ||
| 12 | var b = @intToPtr(*i32, zero); | ||
| 13 | _ = b; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/@ptrFromInt address zero to non-optional byte-aligned pointer.zig	 created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "cast causes pointer to be null")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var zero: usize = 0; | ||
| 12 | var b = @ptrFromInt(*u8, zero); | ||
| 13 | _ = b; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/@ptrFromInt address zero to non-optional pointer.zig	 created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "cast causes pointer to be null")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var zero: usize = 0; | ||
| 12 | var b = @ptrFromInt(*i32, zero); | ||
| 13 | _ = b; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/@ptrFromInt with misaligned address.zig	 created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "incorrect alignment")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var x: usize = 5; | ||
| 12 | var y = @ptrFromInt([*]align(4) u8, x); | ||
| 13 | _ = y; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/bad union field access.zig	+1-1| ... | @@ -14,7 +14,7 @@ const Foo = union { | ... | @@ -14,7 +14,7 @@ const Foo = union { |
| 14 | }; | 14 | }; |
| 15 | 15 | ||
| 16 | pub fn main() !void { | 16 | pub fn main() !void { |
| 17 | var f = Foo { .int = 42 }; | 17 | var f = Foo{ .int = 42 }; |
| 18 | bar(&f); | 18 | bar(&f); |
| 19 | return error.TestFailed; | 19 | return error.TestFailed; |
| 20 | } | 20 | } |
test/cases/safety/cast []u8 to bigger slice of wrong size.zig	+1-1| ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub fn main() !void { | 11 | pub fn main() !void { |
| 12 | const x = widenSlice(&[_]u8{1, 2, 3, 4, 5}); | 12 | const x = widenSlice(&[_]u8{ 1, 2, 3, 4, 5 }); |
| 13 | if (x.len == 0) return error.Whatever; | 13 | if (x.len == 0) return error.Whatever; |
| 14 | return error.TestFailed; | 14 | return error.TestFailed; |
| 15 | } | 15 | } |
test/cases/safety/cast integer to global error and no code matches.zig	+1-1| ... | @@ -12,7 +12,7 @@ pub fn main() !void { | ... | @@ -12,7 +12,7 @@ pub fn main() !void { |
| 12 | return error.TestFailed; | 12 | return error.TestFailed; |
| 13 | } | 13 | } |
| 14 | fn bar(x: u16) anyerror { | 14 | fn bar(x: u16) anyerror { |
| 15 | return @intToError(x); | 15 | return @errorFromInt(x); |
| 16 | } | 16 | } |
| 17 | // run | 17 | // run |
| 18 | // backend=llvm | 18 | // backend=llvm |
test/cases/safety/error return trace across suspend points.zig	+1-2| ... | @@ -1,6 +1,5 @@ | ... | @@ -1,6 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | 2 | ||
| 3 | |||
| 4 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { |
| 5 | _ = message; | 4 | _ = message; |
| 6 | _ = stack_trace; | 5 | _ = stack_trace; |
| ... | @@ -36,4 +35,4 @@ fn printTrace(p: anyframe->anyerror!void) void { | ... | @@ -36,4 +35,4 @@ fn printTrace(p: anyframe->anyerror!void) void { |
| 36 | } | 35 | } |
| 37 | // run | 36 | // run |
| 38 | // backend=stage1 | 37 | // backend=stage1 |
| 39 | // target=native | ||
| \ No newline at end of file | |||
| 38 | // target=native | ||
test/cases/safety/exact division failure - vectors.zig	+2-2| ... | @@ -9,8 +9,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -9,8 +9,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub fn main() !void { | 11 | pub fn main() !void { |
| 12 | var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444}; | 12 | var a: @Vector(4, i32) = [4]i32{ 111, 222, 333, 444 }; |
| 13 | var b: @Vector(4, i32) = [4]i32{111, 222, 333, 441}; | 13 | var b: @Vector(4, i32) = [4]i32{ 111, 222, 333, 441 }; |
| 14 | const x = divExact(a, b); | 14 | const x = divExact(a, b); |
| 15 | _ = x; | 15 | _ = x; |
| 16 | return error.TestFailed; | 16 | return error.TestFailed; |
test/cases/safety/for_len_mismatch_three.zig-1| ... | @@ -21,4 +21,3 @@ pub fn main() !void { | ... | @@ -21,4 +21,3 @@ pub fn main() !void { |
| 21 | // run | 21 | // run |
| 22 | // backend=llvm | 22 | // backend=llvm |
| 23 | // target=native | 23 | // target=native |
| 24 |
test/cases/safety/intToPtr with misaligned address.zig	 deleted-18| ... | @@ -1,18 +0,0 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | |||
| 3 | pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usize) noreturn { | ||
| 4 | _ = stack_trace; | ||
| 5 | if (std.mem.eql(u8, message, "incorrect alignment")) { | ||
| 6 | std.process.exit(0); | ||
| 7 | } | ||
| 8 | std.process.exit(1); | ||
| 9 | } | ||
| 10 | pub fn main() !void { | ||
| 11 | var x: usize = 5; | ||
| 12 | var y = @intToPtr([*]align(4) u8, x); | ||
| 13 | _ = y; | ||
| 14 | return error.TestFailed; | ||
| 15 | } | ||
| 16 | // run | ||
| 17 | // backend=llvm | ||
| 18 | // target=native | ||
test/cases/safety/integer division by zero - vectors.zig	+2-2| ... | @@ -8,8 +8,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -8,8 +8,8 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 8 | std.process.exit(1); | 8 | std.process.exit(1); |
| 9 | } | 9 | } |
| 10 | pub fn main() !void { | 10 | pub fn main() !void { |
| 11 | var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444}; | 11 | var a: @Vector(4, i32) = [4]i32{ 111, 222, 333, 444 }; |
| 12 | var b: @Vector(4, i32) = [4]i32{111, 0, 333, 444}; | 12 | var b: @Vector(4, i32) = [4]i32{ 111, 0, 333, 444 }; |
| 13 | const x = div0(a, b); | 13 | const x = div0(a, b); |
| 14 | _ = x; | 14 | _ = x; |
| 15 | return error.TestFailed; | 15 | return error.TestFailed; |
test/cases/safety/pointer casting to null function pointer.zig	+1-1| ... | @@ -13,7 +13,7 @@ fn getNullPtr() ?*const anyopaque { | ... | @@ -13,7 +13,7 @@ fn getNullPtr() ?*const anyopaque { |
| 13 | } | 13 | } |
| 14 | pub fn main() !void { | 14 | pub fn main() !void { |
| 15 | const null_ptr: ?*const anyopaque = getNullPtr(); | 15 | const null_ptr: ?*const anyopaque = getNullPtr(); |
| 16 | const required_ptr: *align(1) const fn() void = @ptrCast(*align(1) const fn() void, null_ptr); | 16 | const required_ptr: *align(1) const fn () void = @ptrCast(*align(1) const fn () void, null_ptr); |
| 17 | _ = required_ptr; | 17 | _ = required_ptr; |
| 18 | return error.TestFailed; | 18 | return error.TestFailed; |
| 19 | } | 19 | } |
test/cases/safety/slice sentinel mismatch - optional pointers.zig	+1-1| ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi | ... | @@ -9,7 +9,7 @@ pub fn panic(message: []const u8, stack_trace: ?*std.builtin.StackTrace, _: ?usi |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | pub fn main() !void { | 11 | pub fn main() !void { |
| 12 | var buf: [4]?*i32 = .{ @intToPtr(*i32, 4), @intToPtr(*i32, 8), @intToPtr(*i32, 12), @intToPtr(*i32, 16) }; | 12 | var buf: [4]?*i32 = .{ @ptrFromInt(*i32, 4), @ptrFromInt(*i32, 8), @ptrFromInt(*i32, 12), @ptrFromInt(*i32, 16) }; |
| 13 | const slice = buf[0..3 :null]; | 13 | const slice = buf[0..3 :null]; |
| 14 | _ = slice; | 14 | _ = slice; |
| 15 | return error.TestFailed; | 15 | return error.TestFailed; |
test/cases/safety/zero casted to error.zig	+1-1| ... | @@ -12,7 +12,7 @@ pub fn main() !void { | ... | @@ -12,7 +12,7 @@ pub fn main() !void { |
| 12 | return error.TestFailed; | 12 | return error.TestFailed; |
| 13 | } | 13 | } |
| 14 | fn bar(x: u16) anyerror { | 14 | fn bar(x: u16) anyerror { |
| 15 | return @intToError(x); | 15 | return @errorFromInt(x); |
| 16 | } | 16 | } |
| 17 | // run | 17 | // run |
| 18 | // backend=llvm | 18 | // backend=llvm |
test/cases/unused_labels.3.zig+3-1| ... | @@ -1,5 +1,7 @@ | ... | @@ -1,5 +1,7 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | blk: {blk: {}} | 2 | blk: { |
| 3 | blk: {} | ||
| 4 | } | ||
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | // error | 7 | // error |
test/cases/variable_shadowing.3.zig+1-2| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | pub fn main() void { | 1 | pub fn main() void { |
| 2 | var i = 0; | 2 | var i = 0; |
| 3 | for ("n", 0..) |_, i| { | 3 | for ("n", 0..) |_, i| {} |
| 4 | } | ||
| 5 | } | 4 | } |
| 6 | 5 | ||
| 7 | // error | 6 | // error |
test/cases/variable_shadowing.4.zig+1-2| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | pub fn main() void { | 1 | pub fn main() void { |
| 2 | var i = 0; | 2 | var i = 0; |
| 3 | for ("n") |i| { | 3 | for ("n") |i| {} |
| 4 | } | ||
| 5 | } | 4 | } |
| 6 | 5 | ||
| 7 | // error | 6 | // error |
test/cases/variable_shadowing.5.zig+1-2| ... | @@ -1,7 +1,6 @@ | ... | @@ -1,7 +1,6 @@ |
| 1 | pub fn main() void { | 1 | pub fn main() void { |
| 2 | var i = 0; | 2 | var i = 0; |
| 3 | while ("n") |i| { | 3 | while ("n") |i| {} |
| 4 | } | ||
| 5 | } | 4 | } |
| 6 | 5 | ||
| 7 | // error | 6 | // error |
test/cases/variable_shadowing.6.zig+1-3| ... | @@ -2,9 +2,7 @@ pub fn main() void { | ... | @@ -2,9 +2,7 @@ pub fn main() void { |
| 2 | var i = 0; | 2 | var i = 0; |
| 3 | while ("n") |bruh| { | 3 | while ("n") |bruh| { |
| 4 | _ = bruh; | 4 | _ = bruh; |
| 5 | } else |i| { | 5 | } else |i| {} |
| 6 | |||
| 7 | } | ||
| 8 | } | 6 | } |
| 9 | 7 | ||
| 10 | // error | 8 | // error |
test/cases/x86_64-linux/inline_assembly.2.zig+1-1| ... | @@ -2,7 +2,7 @@ pub fn main() void { | ... | @@ -2,7 +2,7 @@ pub fn main() void { |
| 2 | var bruh: u32 = 1; | 2 | var bruh: u32 = 1; |
| 3 | asm ("" | 3 | asm ("" |
| 4 | : | 4 | : |
| 5 | : [bruh] "{rax}" (4) | 5 | : [bruh] "{rax}" (4), |
| 6 | : "memory" | 6 | : "memory" |
| 7 | ); | 7 | ); |
| 8 | } | 8 | } |
test/cases/x86_64-linux/inline_assembly.3.zig+1-1| ... | @@ -2,7 +2,7 @@ pub fn main() void {} | ... | @@ -2,7 +2,7 @@ pub fn main() void {} |
| 2 | comptime { | 2 | comptime { |
| 3 | asm ("" | 3 | asm ("" |
| 4 | : | 4 | : |
| 5 | : [bruh] "{rax}" (4) | 5 | : [bruh] "{rax}" (4), |
| 6 | : "memory" | 6 | : "memory" |
| 7 | ); | 7 | ); |
| 8 | } | 8 | } |
test/cbe.zig+15-15| ... | @@ -71,22 +71,22 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -71,22 +71,22 @@ pub fn addCases(ctx: *Cases) !void { |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | { | 73 | { |
| 74 | var case = ctx.exeFromCompiledC("intToError", .{}); | 74 | var case = ctx.exeFromCompiledC("errorFromInt", .{}); |
| 75 | 75 | ||
| 76 | case.addCompareOutput( | 76 | case.addCompareOutput( |
| 77 | \\pub export fn main() c_int { | 77 | \\pub export fn main() c_int { |
| 78 | \\ // comptime checks | 78 | \\ // comptime checks |
| 79 | \\ const a = error.A; | 79 | \\ const a = error.A; |
| 80 | \\ const b = error.B; | 80 | \\ const b = error.B; |
| 81 | \\ const c = @intToError(2); | 81 | \\ const c = @errorFromInt(2); |
| 82 | \\ const d = @intToError(1); | 82 | \\ const d = @errorFromInt(1); |
| 83 | \\ if (!(c == b)) unreachable; | 83 | \\ if (!(c == b)) unreachable; |
| 84 | \\ if (!(a == d)) unreachable; | 84 | \\ if (!(a == d)) unreachable; |
| 85 | \\ // runtime checks | 85 | \\ // runtime checks |
| 86 | \\ var x = error.A; | 86 | \\ var x = error.A; |
| 87 | \\ var y = error.B; | 87 | \\ var y = error.B; |
| 88 | \\ var z = @intToError(2); | 88 | \\ var z = @errorFromInt(2); |
| 89 | \\ var f = @intToError(1); | 89 | \\ var f = @errorFromInt(1); |
| 90 | \\ if (!(y == z)) unreachable; | 90 | \\ if (!(y == z)) unreachable; |
| 91 | \\ if (!(x == f)) unreachable; | 91 | \\ if (!(x == f)) unreachable; |
| 92 | \\ return 0; | 92 | \\ return 0; |
| ... | @@ -94,13 +94,13 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -94,13 +94,13 @@ pub fn addCases(ctx: *Cases) !void { |
| 94 | , ""); | 94 | , ""); |
| 95 | case.addError( | 95 | case.addError( |
| 96 | \\pub export fn main() c_int { | 96 | \\pub export fn main() c_int { |
| 97 | \\ _ = @intToError(0); | 97 | \\ _ = @errorFromInt(0); |
| 98 | \\ return 0; | 98 | \\ return 0; |
| 99 | \\} | 99 | \\} |
| 100 | , &.{":2:21: error: integer value '0' represents no error"}); | 100 | , &.{":2:21: error: integer value '0' represents no error"}); |
| 101 | case.addError( | 101 | case.addError( |
| 102 | \\pub export fn main() c_int { | 102 | \\pub export fn main() c_int { |
| 103 | \\ _ = @intToError(3); | 103 | \\ _ = @errorFromInt(3); |
| 104 | \\ return 0; | 104 | \\ return 0; |
| 105 | \\} | 105 | \\} |
| 106 | , &.{":2:21: error: integer value '3' represents no error"}); | 106 | , &.{":2:21: error: integer value '3' represents no error"}); |
| ... | @@ -635,19 +635,19 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -635,19 +635,19 @@ pub fn addCases(ctx: *Cases) !void { |
| 635 | ":6:12: note: consider 'union(enum)' here to make it a tagged union", | 635 | ":6:12: note: consider 'union(enum)' here to make it a tagged union", |
| 636 | }); | 636 | }); |
| 637 | 637 | ||
| 638 | // @enumToInt, @intToEnum, enum literal coercion, field access syntax, comparison, switch | 638 | // @intFromEnum, @enumFromInt, enum literal coercion, field access syntax, comparison, switch |
| 639 | case.addCompareOutput( | 639 | case.addCompareOutput( |
| 640 | \\const Number = enum { One, Two, Three }; | 640 | \\const Number = enum { One, Two, Three }; |
| 641 | \\ | 641 | \\ |
| 642 | \\pub export fn main() c_int { | 642 | \\pub export fn main() c_int { |
| 643 | \\ var number1 = Number.One; | 643 | \\ var number1 = Number.One; |
| 644 | \\ var number2: Number = .Two; | 644 | \\ var number2: Number = .Two; |
| 645 | \\ const number3 = @intToEnum(Number, 2); | 645 | \\ const number3 = @enumFromInt(Number, 2); |
| 646 | \\ if (number1 == number2) return 1; | 646 | \\ if (number1 == number2) return 1; |
| 647 | \\ if (number2 == number3) return 1; | 647 | \\ if (number2 == number3) return 1; |
| 648 | \\ if (@enumToInt(number1) != 0) return 1; | 648 | \\ if (@intFromEnum(number1) != 0) return 1; |
| 649 | \\ if (@enumToInt(number2) != 1) return 1; | 649 | \\ if (@intFromEnum(number2) != 1) return 1; |
| 650 | \\ if (@enumToInt(number3) != 2) return 1; | 650 | \\ if (@intFromEnum(number3) != 2) return 1; |
| 651 | \\ var x: Number = .Two; | 651 | \\ var x: Number = .Two; |
| 652 | \\ if (number2 != x) return 1; | 652 | \\ if (number2 != x) return 1; |
| 653 | \\ switch (x) { | 653 | \\ switch (x) { |
| ... | @@ -728,7 +728,7 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -728,7 +728,7 @@ pub fn addCases(ctx: *Cases) !void { |
| 728 | case.addError( | 728 | case.addError( |
| 729 | \\pub export fn main() c_int { | 729 | \\pub export fn main() c_int { |
| 730 | \\ const a = true; | 730 | \\ const a = true; |
| 731 | \\ _ = @enumToInt(a); | 731 | \\ _ = @intFromEnum(a); |
| 732 | \\} | 732 | \\} |
| 733 | , &.{ | 733 | , &.{ |
| 734 | ":3:20: error: expected enum or tagged union, found 'bool'", | 734 | ":3:20: error: expected enum or tagged union, found 'bool'", |
| ... | @@ -737,7 +737,7 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -737,7 +737,7 @@ pub fn addCases(ctx: *Cases) !void { |
| 737 | case.addError( | 737 | case.addError( |
| 738 | \\pub export fn main() c_int { | 738 | \\pub export fn main() c_int { |
| 739 | \\ const a = 1; | 739 | \\ const a = 1; |
| 740 | \\ _ = @intToEnum(bool, a); | 740 | \\ _ = @enumFromInt(bool, a); |
| 741 | \\} | 741 | \\} |
| 742 | , &.{ | 742 | , &.{ |
| 743 | ":3:20: error: expected enum, found 'bool'", | 743 | ":3:20: error: expected enum, found 'bool'", |
| ... | @@ -746,7 +746,7 @@ pub fn addCases(ctx: *Cases) !void { | ... | @@ -746,7 +746,7 @@ pub fn addCases(ctx: *Cases) !void { |
| 746 | case.addError( | 746 | case.addError( |
| 747 | \\const E = enum { a, b, c }; | 747 | \\const E = enum { a, b, c }; |
| 748 | \\pub export fn main() c_int { | 748 | \\pub export fn main() c_int { |
| 749 | \\ _ = @intToEnum(E, 3); | 749 | \\ _ = @enumFromInt(E, 3); |
| 750 | \\} | 750 | \\} |
| 751 | , &.{ | 751 | , &.{ |
| 752 | ":3:9: error: enum 'tmp.E' has no tag with value '3'", | 752 | ":3:9: error: enum 'tmp.E' has no tag with value '3'", |
test/compare_output.zig+2-2| ... | @@ -229,8 +229,8 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { | ... | @@ -229,8 +229,8 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 229 | \\ } | 229 | \\ } |
| 230 | \\ const small: f32 = 3.25; | 230 | \\ const small: f32 = 3.25; |
| 231 | \\ const x: f64 = small; | 231 | \\ const x: f64 = small; |
| 232 | \\ const y = @floatToInt(i32, x); | 232 | \\ const y = @intFromFloat(i32, x); |
| 233 | \\ const z = @intToFloat(f64, y); | 233 | \\ const z = @floatFromInt(f64, y); |
| 234 | \\ _ = c.printf("%.2f\n%d\n%.2f\n%.2f\n", x, y, z, @as(f64, -0.4)); | 234 | \\ _ = c.printf("%.2f\n%d\n%.2f\n%.2f\n", x, y, z, @as(f64, -0.4)); |
| 235 | \\ return 0; | 235 | \\ return 0; |
| 236 | \\} | 236 | \\} |
test/gen_h.zig+1-1| ... | @@ -137,7 +137,7 @@ pub fn addCases(cases: *tests.GenHContext) void { | ... | @@ -137,7 +137,7 @@ pub fn addCases(cases: *tests.GenHContext) void { |
| 137 | \\}; | 137 | \\}; |
| 138 | \\ | 138 | \\ |
| 139 | \\export fn a(s: *E) u8 { | 139 | \\export fn a(s: *E) u8 { |
| 140 | \\ return @enumToInt(s.*); | 140 | \\ return @intFromEnum(s.*); |
| 141 | \\} | 141 | \\} |
| 142 | , &[_][]const u8{ | 142 | , &[_][]const u8{ |
| 143 | \\enum E; | 143 | \\enum E; |
test/link/common_symbols_alignment/main.zig+2-2| ... | @@ -4,6 +4,6 @@ extern var foo: i32; | ... | @@ -4,6 +4,6 @@ extern var foo: i32; |
| 4 | extern var bar: i32; | 4 | extern var bar: i32; |
| 5 | 5 | ||
| 6 | test { | 6 | test { |
| 7 | try std.testing.expect(@ptrToInt(&foo) % 4 == 0); | 7 | try std.testing.expect(@intFromPtr(&foo) % 4 == 0); |
| 8 | try std.testing.expect(@ptrToInt(&bar) % 4096 == 0); | 8 | try std.testing.expect(@intFromPtr(&bar) % 4096 == 0); |
| 9 | } | 9 | } |
test/standalone/pie/main.zig+1-1| ... | @@ -5,7 +5,7 @@ threadlocal var foo: u8 = 42; | ... | @@ -5,7 +5,7 @@ threadlocal var foo: u8 = 42; |
| 5 | 5 | ||
| 6 | test "Check ELF header" { | 6 | test "Check ELF header" { |
| 7 | // PIE executables are marked as ET_DYN, regular exes as ET_EXEC. | 7 | // PIE executables are marked as ET_DYN, regular exes as ET_EXEC. |
| 8 | const header = @intToPtr(*elf.Ehdr, std.process.getBaseAddress()); | 8 | const header = @ptrFromInt(*elf.Ehdr, std.process.getBaseAddress()); |
| 9 | try std.testing.expectEqual(elf.ET.DYN, header.e_type); | 9 | try std.testing.expectEqual(elf.ET.DYN, header.e_type); |
| 10 | } | 10 | } |
| 11 | 11 |
test/translate_c.zig+46-46| ... | @@ -300,7 +300,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -300,7 +300,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 300 | , &[_][]const u8{ | 300 | , &[_][]const u8{ |
| 301 | \\pub const FOO = (foo + @as(c_int, 2)).*; | 301 | \\pub const FOO = (foo + @as(c_int, 2)).*; |
| 302 | , | 302 | , |
| 303 | \\pub const VALUE = ((((@as(c_int, 1) + (@as(c_int, 2) * @as(c_int, 3))) + (@as(c_int, 4) * @as(c_int, 5))) + @as(c_int, 6)) << @as(c_int, 7)) | @boolToInt(@as(c_int, 8) == @as(c_int, 9)); | 303 | \\pub const VALUE = ((((@as(c_int, 1) + (@as(c_int, 2) * @as(c_int, 3))) + (@as(c_int, 4) * @as(c_int, 5))) + @as(c_int, 6)) << @as(c_int, 7)) | @intFromBool(@as(c_int, 8) == @as(c_int, 9)); |
| 304 | , | 304 | , |
| 305 | \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf((@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16))) { | 305 | \\pub inline fn _AL_READ3BYTES(p: anytype) @TypeOf((@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16))) { |
| 306 | \\ return (@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16)); | 306 | \\ return (@import("std").zig.c_translation.cast([*c]u8, p).* | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 1)).* << @as(c_int, 8))) | ((@import("std").zig.c_translation.cast([*c]u8, p) + @as(c_int, 2)).* << @as(c_int, 16)); |
| ... | @@ -439,8 +439,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -439,8 +439,8 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 439 | \\#define FOO(x) ((x >= 0) + (x >= 0)) | 439 | \\#define FOO(x) ((x >= 0) + (x >= 0)) |
| 440 | \\#define BAR 1 && 2 > 4 | 440 | \\#define BAR 1 && 2 > 4 |
| 441 | , &[_][]const u8{ | 441 | , &[_][]const u8{ |
| 442 | \\pub inline fn FOO(x: anytype) @TypeOf(@boolToInt(x >= @as(c_int, 0)) + @boolToInt(x >= @as(c_int, 0))) { | 442 | \\pub inline fn FOO(x: anytype) @TypeOf(@intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0))) { |
| 443 | \\ return @boolToInt(x >= @as(c_int, 0)) + @boolToInt(x >= @as(c_int, 0)); | 443 | \\ return @intFromBool(x >= @as(c_int, 0)) + @intFromBool(x >= @as(c_int, 0)); |
| 444 | \\} | 444 | \\} |
| 445 | , | 445 | , |
| 446 | \\pub const BAR = (@as(c_int, 1) != 0) and (@as(c_int, 2) > @as(c_int, 4)); | 446 | \\pub const BAR = (@as(c_int, 1) != 0) and (@as(c_int, 2) > @as(c_int, 4)); |
| ... | @@ -905,7 +905,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -905,7 +905,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 905 | \\pub extern fn foo() void; | 905 | \\pub extern fn foo() void; |
| 906 | \\pub export fn bar() void { | 906 | \\pub export fn bar() void { |
| 907 | \\ var func_ptr: ?*anyopaque = @ptrCast(?*anyopaque, &foo); | 907 | \\ var func_ptr: ?*anyopaque = @ptrCast(?*anyopaque, &foo); |
| 908 | \\ var typed_func_ptr: ?*const fn () callconv(.C) void = @intToPtr(?*const fn () callconv(.C) void, @intCast(c_ulong, @ptrToInt(func_ptr))); | 908 | \\ var typed_func_ptr: ?*const fn () callconv(.C) void = @ptrFromInt(?*const fn () callconv(.C) void, @intCast(c_ulong, @intFromPtr(func_ptr))); |
| 909 | \\ _ = @TypeOf(typed_func_ptr); | 909 | \\ _ = @TypeOf(typed_func_ptr); |
| 910 | \\} | 910 | \\} |
| 911 | }); | 911 | }); |
| ... | @@ -1719,10 +1719,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1719,10 +1719,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1719 | \\ var a: c_int = undefined; | 1719 | \\ var a: c_int = undefined; |
| 1720 | \\ var b: f32 = undefined; | 1720 | \\ var b: f32 = undefined; |
| 1721 | \\ var c: ?*anyopaque = undefined; | 1721 | \\ var c: ?*anyopaque = undefined; |
| 1722 | \\ return @boolToInt(!(a == @as(c_int, 0))); | 1722 | \\ return @intFromBool(!(a == @as(c_int, 0))); |
| 1723 | \\ return @boolToInt(!(a != 0)); | 1723 | \\ return @intFromBool(!(a != 0)); |
| 1724 | \\ return @boolToInt(!(b != 0)); | 1724 | \\ return @intFromBool(!(b != 0)); |
| 1725 | \\ return @boolToInt(!(c != null)); | 1725 | \\ return @intFromBool(!(c != null)); |
| 1726 | \\} | 1726 | \\} |
| 1727 | }); | 1727 | }); |
| 1728 | 1728 | ||
| ... | @@ -2238,7 +2238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2238,7 +2238,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2238 | , &[_][]const u8{ | 2238 | , &[_][]const u8{ |
| 2239 | \\pub export var a: f32 = @floatCast(f32, 3.1415); | 2239 | \\pub export var a: f32 = @floatCast(f32, 3.1415); |
| 2240 | \\pub export var b: f64 = 3.1415; | 2240 | \\pub export var b: f64 = 3.1415; |
| 2241 | \\pub export var c: c_int = @floatToInt(c_int, 3.1415); | 2241 | \\pub export var c: c_int = @intFromFloat(c_int, 3.1415); |
| 2242 | \\pub export var d: f64 = 3; | 2242 | \\pub export var d: f64 = 3; |
| 2243 | }); | 2243 | }); |
| 2244 | 2244 | ||
| ... | @@ -2417,13 +2417,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2417,13 +2417,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2417 | }); | 2417 | }); |
| 2418 | 2418 | ||
| 2419 | cases.add("c style cast", | 2419 | cases.add("c style cast", |
| 2420 | \\int float_to_int(float a) { | 2420 | \\int int_from_float(float a) { |
| 2421 | \\ return (int)a; | 2421 | \\ return (int)a; |
| 2422 | \\} | 2422 | \\} |
| 2423 | , &[_][]const u8{ | 2423 | , &[_][]const u8{ |
| 2424 | \\pub export fn float_to_int(arg_a: f32) c_int { | 2424 | \\pub export fn int_from_float(arg_a: f32) c_int { |
| 2425 | \\ var a = arg_a; | 2425 | \\ var a = arg_a; |
| 2426 | \\ return @floatToInt(c_int, a); | 2426 | \\ return @intFromFloat(c_int, a); |
| 2427 | \\} | 2427 | \\} |
| 2428 | }); | 2428 | }); |
| 2429 | 2429 | ||
| ... | @@ -2534,18 +2534,18 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2534,18 +2534,18 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2534 | \\ var b = arg_b; | 2534 | \\ var b = arg_b; |
| 2535 | \\ var c = arg_c; | 2535 | \\ var c = arg_c; |
| 2536 | \\ var d: enum_Foo = @bitCast(c_uint, FooA); | 2536 | \\ var d: enum_Foo = @bitCast(c_uint, FooA); |
| 2537 | \\ var e: c_int = @boolToInt((a != 0) and (b != 0)); | 2537 | \\ var e: c_int = @intFromBool((a != 0) and (b != 0)); |
| 2538 | \\ var f: c_int = @boolToInt((b != 0) and (c != null)); | 2538 | \\ var f: c_int = @intFromBool((b != 0) and (c != null)); |
| 2539 | \\ var g: c_int = @boolToInt((a != 0) and (c != null)); | 2539 | \\ var g: c_int = @intFromBool((a != 0) and (c != null)); |
| 2540 | \\ var h: c_int = @boolToInt((a != 0) or (b != 0)); | 2540 | \\ var h: c_int = @intFromBool((a != 0) or (b != 0)); |
| 2541 | \\ var i: c_int = @boolToInt((b != 0) or (c != null)); | 2541 | \\ var i: c_int = @intFromBool((b != 0) or (c != null)); |
| 2542 | \\ var j: c_int = @boolToInt((a != 0) or (c != null)); | 2542 | \\ var j: c_int = @intFromBool((a != 0) or (c != null)); |
| 2543 | \\ var k: c_int = @boolToInt((a != 0) or (@bitCast(c_int, d) != 0)); | 2543 | \\ var k: c_int = @intFromBool((a != 0) or (@bitCast(c_int, d) != 0)); |
| 2544 | \\ var l: c_int = @boolToInt((@bitCast(c_int, d) != 0) and (b != 0)); | 2544 | \\ var l: c_int = @intFromBool((@bitCast(c_int, d) != 0) and (b != 0)); |
| 2545 | \\ var m: c_int = @boolToInt((c != null) or (d != 0)); | 2545 | \\ var m: c_int = @intFromBool((c != null) or (d != 0)); |
| 2546 | \\ var td: SomeTypedef = 44; | 2546 | \\ var td: SomeTypedef = 44; |
| 2547 | \\ var o: c_int = @boolToInt((td != 0) or (b != 0)); | 2547 | \\ var o: c_int = @intFromBool((td != 0) or (b != 0)); |
| 2548 | \\ var p: c_int = @boolToInt((c != null) and (td != 0)); | 2548 | \\ var p: c_int = @intFromBool((c != null) and (td != 0)); |
| 2549 | \\ return (((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p; | 2549 | \\ return (((((((((e + f) + g) + h) + i) + j) + k) + l) + m) + o) + p; |
| 2550 | \\} | 2550 | \\} |
| 2551 | , | 2551 | , |
| ... | @@ -2605,13 +2605,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -2605,13 +2605,13 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 2605 | \\pub export fn test_comparisons(arg_a: c_int, arg_b: c_int) c_int { | 2605 | \\pub export fn test_comparisons(arg_a: c_int, arg_b: c_int) c_int { |
| 2606 | \\ var a = arg_a; | 2606 | \\ var a = arg_a; |
| 2607 | \\ var b = arg_b; | 2607 | \\ var b = arg_b; |
| 2608 | \\ var c: c_int = @boolToInt(a < b); | 2608 | \\ var c: c_int = @intFromBool(a < b); |
| 2609 | \\ var d: c_int = @boolToInt(a > b); | 2609 | \\ var d: c_int = @intFromBool(a > b); |
| 2610 | \\ var e: c_int = @boolToInt(a <= b); | 2610 | \\ var e: c_int = @intFromBool(a <= b); |
| 2611 | \\ var f: c_int = @boolToInt(a >= b); | 2611 | \\ var f: c_int = @intFromBool(a >= b); |
| 2612 | \\ var g: c_int = @boolToInt(c < d); | 2612 | \\ var g: c_int = @intFromBool(c < d); |
| 2613 | \\ var h: c_int = @boolToInt(e < f); | 2613 | \\ var h: c_int = @intFromBool(e < f); |
| 2614 | \\ var i: c_int = @boolToInt(g < h); | 2614 | \\ var i: c_int = @intFromBool(g < h); |
| 2615 | \\ return i; | 2615 | \\ return i; |
| 2616 | \\} | 2616 | \\} |
| 2617 | }); | 2617 | }); |
| ... | @@ -3258,11 +3258,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3258,11 +3258,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3258 | \\pub extern fn fn_bool(x: bool) void; | 3258 | \\pub extern fn fn_bool(x: bool) void; |
| 3259 | \\pub extern fn fn_ptr(x: ?*anyopaque) void; | 3259 | \\pub extern fn fn_ptr(x: ?*anyopaque) void; |
| 3260 | \\pub export fn call() void { | 3260 | \\pub export fn call() void { |
| 3261 | \\ fn_int(@floatToInt(c_int, 3.0)); | 3261 | \\ fn_int(@intFromFloat(c_int, 3.0)); |
| 3262 | \\ fn_int(@floatToInt(c_int, 3.0)); | 3262 | \\ fn_int(@intFromFloat(c_int, 3.0)); |
| 3263 | \\ fn_int(@as(c_int, 1094861636)); | 3263 | \\ fn_int(@as(c_int, 1094861636)); |
| 3264 | \\ fn_f32(@intToFloat(f32, @as(c_int, 3))); | 3264 | \\ fn_f32(@floatFromInt(f32, @as(c_int, 3))); |
| 3265 | \\ fn_f64(@intToFloat(f64, @as(c_int, 3))); | 3265 | \\ fn_f64(@floatFromInt(f64, @as(c_int, 3))); |
| 3266 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '3')))); | 3266 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '3')))); |
| 3267 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '\x01')))); | 3267 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, '\x01')))); |
| 3268 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, 0)))); | 3268 | \\ fn_char(@bitCast(u8, @truncate(i8, @as(c_int, 0)))); |
| ... | @@ -3270,9 +3270,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3270,9 +3270,9 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3270 | \\ fn_f64(3.0); | 3270 | \\ fn_f64(3.0); |
| 3271 | \\ fn_bool(@as(c_int, 123) != 0); | 3271 | \\ fn_bool(@as(c_int, 123) != 0); |
| 3272 | \\ fn_bool(@as(c_int, 0) != 0); | 3272 | \\ fn_bool(@as(c_int, 0) != 0); |
| 3273 | \\ fn_bool(@ptrToInt(&fn_int) != 0); | 3273 | \\ fn_bool(@intFromPtr(&fn_int) != 0); |
| 3274 | \\ fn_int(@intCast(c_int, @ptrToInt(&fn_int))); | 3274 | \\ fn_int(@intCast(c_int, @intFromPtr(&fn_int))); |
| 3275 | \\ fn_ptr(@intToPtr(?*anyopaque, @as(c_int, 42))); | 3275 | \\ fn_ptr(@ptrFromInt(?*anyopaque, @as(c_int, 42))); |
| 3276 | \\} | 3276 | \\} |
| 3277 | }); | 3277 | }); |
| 3278 | 3278 | ||
| ... | @@ -3473,11 +3473,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3473,11 +3473,11 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3473 | \\} | 3473 | \\} |
| 3474 | \\pub export fn bar(arg_a: [*c]const c_int) void { | 3474 | \\pub export fn bar(arg_a: [*c]const c_int) void { |
| 3475 | \\ var a = arg_a; | 3475 | \\ var a = arg_a; |
| 3476 | \\ foo(@intToPtr([*c]c_int, @ptrToInt(a))); | 3476 | \\ foo(@ptrFromInt([*c]c_int, @intFromPtr(a))); |
| 3477 | \\} | 3477 | \\} |
| 3478 | \\pub export fn baz(arg_a: [*c]volatile c_int) void { | 3478 | \\pub export fn baz(arg_a: [*c]volatile c_int) void { |
| 3479 | \\ var a = arg_a; | 3479 | \\ var a = arg_a; |
| 3480 | \\ foo(@intToPtr([*c]c_int, @ptrToInt(a))); | 3480 | \\ foo(@ptrFromInt([*c]c_int, @intFromPtr(a))); |
| 3481 | \\} | 3481 | \\} |
| 3482 | }); | 3482 | }); |
| 3483 | 3483 | ||
| ... | @@ -3491,10 +3491,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3491,10 +3491,10 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3491 | , &[_][]const u8{ | 3491 | , &[_][]const u8{ |
| 3492 | \\pub export fn foo(arg_x: bool) bool { | 3492 | \\pub export fn foo(arg_x: bool) bool { |
| 3493 | \\ var x = arg_x; | 3493 | \\ var x = arg_x; |
| 3494 | \\ var a: bool = @as(c_int, @boolToInt(x)) != @as(c_int, 1); | 3494 | \\ var a: bool = @as(c_int, @intFromBool(x)) != @as(c_int, 1); |
| 3495 | \\ var b: bool = @as(c_int, @boolToInt(a)) != @as(c_int, 0); | 3495 | \\ var b: bool = @as(c_int, @intFromBool(a)) != @as(c_int, 0); |
| 3496 | \\ var c: bool = @ptrToInt(&foo) != 0; | 3496 | \\ var c: bool = @intFromPtr(&foo) != 0; |
| 3497 | \\ return foo(@as(c_int, @boolToInt(c)) != @as(c_int, @boolToInt(b))); | 3497 | \\ return foo(@as(c_int, @intFromBool(c)) != @as(c_int, @intFromBool(b))); |
| 3498 | \\} | 3498 | \\} |
| 3499 | }); | 3499 | }); |
| 3500 | 3500 | ||
| ... | @@ -3910,7 +3910,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3910,7 +3910,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3910 | \\pub export fn foo() void { | 3910 | \\pub export fn foo() void { |
| 3911 | \\ var a: c_int = undefined; | 3911 | \\ var a: c_int = undefined; |
| 3912 | \\ if ((blk: { | 3912 | \\ if ((blk: { |
| 3913 | \\ const tmp = @boolToInt(@as(c_int, 1) > @as(c_int, 0)); | 3913 | \\ const tmp = @intFromBool(@as(c_int, 1) > @as(c_int, 0)); |
| 3914 | \\ a = tmp; | 3914 | \\ a = tmp; |
| 3915 | \\ break :blk tmp; | 3915 | \\ break :blk tmp; |
| 3916 | \\ }) != 0) {} | 3916 | \\ }) != 0) {} |
| ... | @@ -3928,7 +3928,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3928,7 +3928,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3928 | \\pub export fn foo() void { | 3928 | \\pub export fn foo() void { |
| 3929 | \\ var a: S = undefined; | 3929 | \\ var a: S = undefined; |
| 3930 | \\ var b: S = undefined; | 3930 | \\ var b: S = undefined; |
| 3931 | \\ var c: c_longlong = @divExact(@bitCast(c_longlong, @ptrToInt(a) -% @ptrToInt(b)), @sizeOf(u8)); | 3931 | \\ var c: c_longlong = @divExact(@bitCast(c_longlong, @intFromPtr(a) -% @intFromPtr(b)), @sizeOf(u8)); |
| 3932 | \\ _ = @TypeOf(c); | 3932 | \\ _ = @TypeOf(c); |
| 3933 | \\} | 3933 | \\} |
| 3934 | }); | 3934 | }); |
| ... | @@ -3943,7 +3943,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -3943,7 +3943,7 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 3943 | \\pub export fn foo() void { | 3943 | \\pub export fn foo() void { |
| 3944 | \\ var a: S = undefined; | 3944 | \\ var a: S = undefined; |
| 3945 | \\ var b: S = undefined; | 3945 | \\ var b: S = undefined; |
| 3946 | \\ var c: c_long = @divExact(@bitCast(c_long, @ptrToInt(a) -% @ptrToInt(b)), @sizeOf(u8)); | 3946 | \\ var c: c_long = @divExact(@bitCast(c_long, @intFromPtr(a) -% @intFromPtr(b)), @sizeOf(u8)); |
| 3947 | \\ _ = @TypeOf(c); | 3947 | \\ _ = @TypeOf(c); |
| 3948 | \\} | 3948 | \\} |
| 3949 | }); | 3949 | }); |
tools/gen_outline_atomics.zig+4-4| ... | @@ -31,7 +31,7 @@ pub fn main() !void { | ... | @@ -31,7 +31,7 @@ pub fn main() !void { |
| 31 | \\/// It is intentionally not exported in order to make the machine code that | 31 | \\/// It is intentionally not exported in order to make the machine code that |
| 32 | \\/// uses it a statically predicted direct branch rather than using the PLT, | 32 | \\/// uses it a statically predicted direct branch rather than using the PLT, |
| 33 | \\/// which ARM is concerned would have too much overhead. | 33 | \\/// which ARM is concerned would have too much overhead. |
| 34 | \\var __aarch64_have_lse_atomics: u8 = @boolToInt(always_has_lse); | 34 | \\var __aarch64_have_lse_atomics: u8 = @intFromBool(always_has_lse); |
| 35 | \\ | 35 | \\ |
| 36 | \\ | 36 | \\ |
| 37 | ); | 37 | ); |
| ... | @@ -144,11 +144,11 @@ const N = enum(u8) { | ... | @@ -144,11 +144,11 @@ const N = enum(u8) { |
| 144 | } | 144 | } |
| 145 | 145 | ||
| 146 | fn register(n: N) []const u8 { | 146 | fn register(n: N) []const u8 { |
| 147 | return if (@enumToInt(n) < 8) "w" else "x"; | 147 | return if (@intFromEnum(n) < 8) "w" else "x"; |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | fn toBytes(n: N) u8 { | 150 | fn toBytes(n: N) u8 { |
| 151 | return @enumToInt(n); | 151 | return @intFromEnum(n); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | fn toBits(n: N) u8 { | 154 | fn toBits(n: N) u8 { |
| ... | @@ -212,7 +212,7 @@ fn generateCas(arena: Allocator, n: N, order: Ordering) ![]const u8 { | ... | @@ -212,7 +212,7 @@ fn generateCas(arena: Allocator, n: N, order: Ordering) ![]const u8 { |
| 212 | 212 | ||
| 213 | const reg = n.register(); | 213 | const reg = n.register(); |
| 214 | 214 | ||
| 215 | if (@enumToInt(n) < 16) { | 215 | if (@intFromEnum(n) < 16) { |
| 216 | const cas = try std.fmt.allocPrint(arena, ".inst 0x08a07c41 + {s} + {s}", .{ s_def.b, o_def.m }); | 216 | const cas = try std.fmt.allocPrint(arena, ".inst 0x08a07c41 + {s} + {s}", .{ s_def.b, o_def.m }); |
| 217 | const ldxr = try std.fmt.allocPrint(arena, "ld{s}xr{s}", .{ o_def.a, s_def.s }); | 217 | const ldxr = try std.fmt.allocPrint(arena, "ld{s}xr{s}", .{ o_def.a, s_def.s }); |
| 218 | const stxr = try std.fmt.allocPrint(arena, "st{s}xr{s}", .{ o_def.l, s_def.s }); | 218 | const stxr = try std.fmt.allocPrint(arena, "st{s}xr{s}", .{ o_def.l, s_def.s }); |
tools/gen_stubs.zig+1-1| ... | @@ -444,7 +444,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian) | ... | @@ -444,7 +444,7 @@ fn parseElf(parse: Parse, comptime is_64: bool, comptime endian: builtin.Endian) |
| 444 | const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); | 444 | const name = try arena.dupe(u8, mem.sliceTo(dynstr[s(sym.st_name)..], 0)); |
| 445 | const ty = @truncate(u4, sym.st_info); | 445 | const ty = @truncate(u4, sym.st_info); |
| 446 | const binding = @truncate(u4, sym.st_info >> 4); | 446 | const binding = @truncate(u4, sym.st_info >> 4); |
| 447 | const visib = @intToEnum(elf.STV, @truncate(u2, sym.st_other)); | 447 | const visib = @enumFromInt(elf.STV, @truncate(u2, sym.st_other)); |
| 448 | const size = s(sym.st_size); | 448 | const size = s(sym.st_size); |
| 449 | 449 | ||
| 450 | if (parse.blacklist.contains(name)) continue; | 450 | if (parse.blacklist.contains(name)) continue; |
tools/process_headers.zig+5-5| ... | @@ -32,7 +32,7 @@ const MultiArch = union(enum) { | ... | @@ -32,7 +32,7 @@ const MultiArch = union(enum) { |
| 32 | specific: Arch, | 32 | specific: Arch, |
| 33 | 33 | ||
| 34 | fn eql(a: MultiArch, b: MultiArch) bool { | 34 | fn eql(a: MultiArch, b: MultiArch) bool { |
| 35 | if (@enumToInt(a) != @enumToInt(b)) | 35 | if (@intFromEnum(a) != @intFromEnum(b)) |
| 36 | return false; | 36 | return false; |
| 37 | if (a != .specific) | 37 | if (a != .specific) |
| 38 | return true; | 38 | return true; |
| ... | @@ -45,7 +45,7 @@ const MultiAbi = union(enum) { | ... | @@ -45,7 +45,7 @@ const MultiAbi = union(enum) { |
| 45 | specific: Abi, | 45 | specific: Abi, |
| 46 | 46 | ||
| 47 | fn eql(a: MultiAbi, b: MultiAbi) bool { | 47 | fn eql(a: MultiAbi, b: MultiAbi) bool { |
| 48 | if (@enumToInt(a) != @enumToInt(b)) | 48 | if (@intFromEnum(a) != @intFromEnum(b)) |
| 49 | return false; | 49 | return false; |
| 50 | if (std.meta.Tag(MultiAbi)(a) != .specific) | 50 | if (std.meta.Tag(MultiAbi)(a) != .specific) |
| 51 | return true; | 51 | return true; |
| ... | @@ -262,9 +262,9 @@ const DestTarget = struct { | ... | @@ -262,9 +262,9 @@ const DestTarget = struct { |
| 262 | const HashContext = struct { | 262 | const HashContext = struct { |
| 263 | pub fn hash(self: @This(), a: DestTarget) u32 { | 263 | pub fn hash(self: @This(), a: DestTarget) u32 { |
| 264 | _ = self; | 264 | _ = self; |
| 265 | return @enumToInt(a.arch) +% | 265 | return @intFromEnum(a.arch) +% |
| 266 | (@enumToInt(a.os) *% @as(u32, 4202347608)) +% | 266 | (@intFromEnum(a.os) *% @as(u32, 4202347608)) +% |
| 267 | (@enumToInt(a.abi) *% @as(u32, 4082223418)); | 267 | (@intFromEnum(a.abi) *% @as(u32, 4082223418)); |
| 268 | } | 268 | } |
| 269 | 269 | ||
| 270 | pub fn eql(self: @This(), a: DestTarget, b: DestTarget, b_index: usize) bool { | 270 | pub fn eql(self: @This(), a: DestTarget, b: DestTarget, b_index: usize) bool { |
tools/update-linux-headers.zig+1-1| ... | @@ -37,7 +37,7 @@ const MultiArch = union(enum) { | ... | @@ -37,7 +37,7 @@ const MultiArch = union(enum) { |
| 37 | specific: Arch, | 37 | specific: Arch, |
| 38 | 38 | ||
| 39 | fn eql(a: MultiArch, b: MultiArch) bool { | 39 | fn eql(a: MultiArch, b: MultiArch) bool { |
| 40 | if (@enumToInt(a) != @enumToInt(b)) | 40 | if (@intFromEnum(a) != @intFromEnum(b)) |
| 41 | return false; | 41 | return false; |
| 42 | if (a != .specific) | 42 | if (a != .specific) |
| 43 | return true; | 43 | return true; |
tools/update_clang_options.zig+1-1| ... | @@ -591,7 +591,7 @@ pub fn main() anyerror!void { | ... | @@ -591,7 +591,7 @@ pub fn main() anyerror!void { |
| 591 | 591 | ||
| 592 | for (all_features, 0..) |feat, i| { | 592 | for (all_features, 0..) |feat, i| { |
| 593 | const llvm_name = feat.llvm_name orelse continue; | 593 | const llvm_name = feat.llvm_name orelse continue; |
| 594 | const zig_feat = @intToEnum(Feature, i); | 594 | const zig_feat = @enumFromInt(Feature, i); |
| 595 | const zig_name = @tagName(zig_feat); | 595 | const zig_name = @tagName(zig_feat); |
| 596 | try llvm_to_zig_cpu_features.put(llvm_name, zig_name); | 596 | try llvm_to_zig_cpu_features.put(llvm_name, zig_name); |
| 597 | } | 597 | } |
tools/update_cpu_features.zig+2-2| ... | @@ -1247,7 +1247,7 @@ fn processOneTarget(job: Job) anyerror!void { | ... | @@ -1247,7 +1247,7 @@ fn processOneTarget(job: Job) anyerror!void { |
| 1247 | for (all_features.items) |feature| { | 1247 | for (all_features.items) |feature| { |
| 1248 | if (feature.llvm_name) |llvm_name| { | 1248 | if (feature.llvm_name) |llvm_name| { |
| 1249 | try w.print( | 1249 | try w.print( |
| 1250 | \\ result[@enumToInt(Feature.{})] = .{{ | 1250 | \\ result[@intFromEnum(Feature.{})] = .{{ |
| 1251 | \\ .llvm_name = "{}", | 1251 | \\ .llvm_name = "{}", |
| 1252 | \\ .description = "{}", | 1252 | \\ .description = "{}", |
| 1253 | \\ .dependencies = featureSet(&[_]Feature{{ | 1253 | \\ .dependencies = featureSet(&[_]Feature{{ |
| ... | @@ -1260,7 +1260,7 @@ fn processOneTarget(job: Job) anyerror!void { | ... | @@ -1260,7 +1260,7 @@ fn processOneTarget(job: Job) anyerror!void { |
| 1260 | ); | 1260 | ); |
| 1261 | } else { | 1261 | } else { |
| 1262 | try w.print( | 1262 | try w.print( |
| 1263 | \\ result[@enumToInt(Feature.{})] = .{{ | 1263 | \\ result[@intFromEnum(Feature.{})] = .{{ |
| 1264 | \\ .llvm_name = null, | 1264 | \\ .llvm_name = null, |
| 1265 | \\ .description = "{}", | 1265 | \\ .description = "{}", |
| 1266 | \\ .dependencies = featureSet(&[_]Feature{{ | 1266 | \\ .dependencies = featureSet(&[_]Feature{{ |
tools/update_spirv_features.zig+3-3| ... | @@ -137,7 +137,7 @@ pub fn main() !void { | ... | @@ -137,7 +137,7 @@ pub fn main() !void { |
| 137 | 137 | ||
| 138 | for (versions, 0..) |ver, i| { | 138 | for (versions, 0..) |ver, i| { |
| 139 | try w.print( | 139 | try w.print( |
| 140 | \\ result[@enumToInt(Feature.v{0}_{1})] = .{{ | 140 | \\ result[@intFromEnum(Feature.v{0}_{1})] = .{{ |
| 141 | \\ .llvm_name = null, | 141 | \\ .llvm_name = null, |
| 142 | \\ .description = "SPIR-V version {0}.{1}", | 142 | \\ .description = "SPIR-V version {0}.{1}", |
| 143 | \\ | 143 | \\ |
| ... | @@ -163,7 +163,7 @@ pub fn main() !void { | ... | @@ -163,7 +163,7 @@ pub fn main() !void { |
| 163 | // TODO: Extension dependencies. | 163 | // TODO: Extension dependencies. |
| 164 | for (extensions) |ext| { | 164 | for (extensions) |ext| { |
| 165 | try w.print( | 165 | try w.print( |
| 166 | \\ result[@enumToInt(Feature.{s})] = .{{ | 166 | \\ result[@intFromEnum(Feature.{s})] = .{{ |
| 167 | \\ .llvm_name = null, | 167 | \\ .llvm_name = null, |
| 168 | \\ .description = "SPIR-V extension {s}", | 168 | \\ .description = "SPIR-V extension {s}", |
| 169 | \\ .dependencies = featureSet(&[_]Feature{{}}), | 169 | \\ .dependencies = featureSet(&[_]Feature{{}}), |
| ... | @@ -178,7 +178,7 @@ pub fn main() !void { | ... | @@ -178,7 +178,7 @@ pub fn main() !void { |
| 178 | // TODO: Capability extension dependencies. | 178 | // TODO: Capability extension dependencies. |
| 179 | for (capabilities) |cap| { | 179 | for (capabilities) |cap| { |
| 180 | try w.print( | 180 | try w.print( |
| 181 | \\ result[@enumToInt(Feature.{s})] = .{{ | 181 | \\ result[@intFromEnum(Feature.{s})] = .{{ |
| 182 | \\ .llvm_name = null, | 182 | \\ .llvm_name = null, |
| 183 | \\ .description = "Enable SPIR-V capability {s}", | 183 | \\ .description = "Enable SPIR-V capability {s}", |
| 184 | \\ .dependencies = featureSet(&[_]Feature{{ | 184 | \\ .dependencies = featureSet(&[_]Feature{{ |