| author | |
| committer | |
| log | b120c819dbd15b23cf5392a5d5bdd8d8af18ead0 |
| tree | 87346d128a1cb6f2e5bc6983d9407676d1429f22 |
| parent | 4962f36b0fe81a6cec7f2d2200f64255f37dbecd |
| parent | 71e0ab4ec7949432cd4d0281f67479d222084507 |
| signature |
all: rename `@maximum` to `@max` and `@minimum` to `@min`34 files changed, 307 insertions(+), 299 deletions(-)
doc/langref.html.in+6-6| ... | @@ -8977,15 +8977,15 @@ test "integer cast panic" { | ... | @@ -8977,15 +8977,15 @@ test "integer cast panic" { |
| 8977 | </p> | 8977 | </p> |
| 8978 | {#header_close#} | 8978 | {#header_close#} |
| 8979 | 8979 | ||
| 8980 | {#header_open|@maximum#} | 8980 | {#header_open|@max#} |
| 8981 | <pre>{#syntax#}@maximum(a: T, b: T) T{#endsyntax#}</pre> | 8981 | <pre>{#syntax#}@max(a: T, b: T) T{#endsyntax#}</pre> |
| 8982 | <p> | 8982 | <p> |
| 8983 | Returns the maximum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise. | 8983 | Returns the maximum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise. |
| 8984 | </p> | 8984 | </p> |
| 8985 | <p> | 8985 | <p> |
| 8986 | NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned. | 8986 | NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned. |
| 8987 | </p> | 8987 | </p> |
| 8988 | {#see_also|@minimum|Vectors#} | 8988 | {#see_also|@min|Vectors#} |
| 8989 | {#header_close#} | 8989 | {#header_close#} |
| 8990 | 8990 | ||
| 8991 | {#header_open|@memcpy#} | 8991 | {#header_open|@memcpy#} |
| ... | @@ -9025,15 +9025,15 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre> | ... | @@ -9025,15 +9025,15 @@ mem.copy(u8, dest[0..byte_count], source[0..byte_count]);{#endsyntax#}</pre> |
| 9025 | mem.set(u8, dest, c);{#endsyntax#}</pre> | 9025 | mem.set(u8, dest, c);{#endsyntax#}</pre> |
| 9026 | {#header_close#} | 9026 | {#header_close#} |
| 9027 | 9027 | ||
| 9028 | {#header_open|@minimum#} | 9028 | {#header_open|@min#} |
| 9029 | <pre>{#syntax#}@minimum(a: T, b: T) T{#endsyntax#}</pre> | 9029 | <pre>{#syntax#}@min(a: T, b: T) T{#endsyntax#}</pre> |
| 9030 | <p> | 9030 | <p> |
| 9031 | Returns the minimum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise. | 9031 | Returns the minimum value of {#syntax#}a{#endsyntax#} and {#syntax#}b{#endsyntax#}. This builtin accepts integers, floats, and vectors of either. In the latter case, the operation is performed element wise. |
| 9032 | </p> | 9032 | </p> |
| 9033 | <p> | 9033 | <p> |
| 9034 | NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned. | 9034 | NaNs are handled as follows: if one of the operands of a (pairwise) operation is NaN, the other operand is returned. If both operands are NaN, NaN is returned. |
| 9035 | </p> | 9035 | </p> |
| 9036 | {#see_also|@maximum|Vectors#} | 9036 | {#see_also|@max|Vectors#} |
| 9037 | {#header_close#} | 9037 | {#header_close#} |
| 9038 | 9038 | ||
| 9039 | {#header_open|@wasmMemorySize#} | 9039 | {#header_open|@wasmMemorySize#} |
lib/compiler_rt/float_to_int.zig+2-2| ... | @@ -29,9 +29,9 @@ pub inline fn floatToInt(comptime I: type, a: anytype) I { | ... | @@ -29,9 +29,9 @@ pub inline fn floatToInt(comptime I: type, a: anytype) I { |
| 29 | switch (@typeInfo(I).Int.signedness) { | 29 | switch (@typeInfo(I).Int.signedness) { |
| 30 | .unsigned => { | 30 | .unsigned => { |
| 31 | if (negative) return 0; | 31 | if (negative) return 0; |
| 32 | if (@intCast(c_uint, exponent) >= @minimum(int_bits, max_exp)) return math.maxInt(I); | 32 | if (@intCast(c_uint, exponent) >= @min(int_bits, max_exp)) return math.maxInt(I); |
| 33 | }, | 33 | }, |
| 34 | .signed => if (@intCast(c_uint, exponent) >= @minimum(int_bits - 1, max_exp)) { | 34 | .signed => if (@intCast(c_uint, exponent) >= @min(int_bits - 1, max_exp)) { |
| 35 | return if (negative) math.minInt(I) else math.maxInt(I); | 35 | return if (negative) math.minInt(I) else math.maxInt(I); |
| 36 | }, | 36 | }, |
| 37 | } | 37 | } |
lib/docs/main.js+150-150| ... | @@ -456,9 +456,9 @@ var zigAnalysis; | ... | @@ -456,9 +456,9 @@ var zigAnalysis; |
| 456 | let lastIsDecl = isDecl(last); | 456 | let lastIsDecl = isDecl(last); |
| 457 | let lastIsType = isType(last); | 457 | let lastIsType = isType(last); |
| 458 | let lastIsContainerType = isContainerType(last); | 458 | let lastIsContainerType = isContainerType(last); |
| 459 | 459 | ||
| 460 | if (lastIsDecl){ | 460 | if (lastIsDecl) { |
| 461 | renderDocTest(last); | 461 | renderDocTest(last); |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | if (lastIsContainerType) { | 464 | if (lastIsContainerType) { |
| ... | @@ -487,9 +487,9 @@ var zigAnalysis; | ... | @@ -487,9 +487,9 @@ var zigAnalysis; |
| 487 | } | 487 | } |
| 488 | return renderValue(last); | 488 | return renderValue(last); |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | } | 491 | } |
| 492 | 492 | ||
| 493 | function renderDocTest(decl) { | 493 | function renderDocTest(decl) { |
| 494 | if (!decl.decltest) return; | 494 | if (!decl.decltest) return; |
| 495 | const astNode = getAstNode(decl.decltest); | 495 | const astNode = getAstNode(decl.decltest); |
| ... | @@ -1172,12 +1172,12 @@ var zigAnalysis; | ... | @@ -1172,12 +1172,12 @@ var zigAnalysis; |
| 1172 | payloadHtml += "intToError"; | 1172 | payloadHtml += "intToError"; |
| 1173 | break; | 1173 | break; |
| 1174 | } | 1174 | } |
| 1175 | case "maximum": { | 1175 | case "max": { |
| 1176 | payloadHtml += "maximum"; | 1176 | payloadHtml += "max"; |
| 1177 | break; | 1177 | break; |
| 1178 | } | 1178 | } |
| 1179 | case "minimum": { | 1179 | case "min": { |
| 1180 | payloadHtml += "minimum"; | 1180 | payloadHtml += "min"; |
| 1181 | break; | 1181 | break; |
| 1182 | } | 1182 | } |
| 1183 | case "bit_not": { | 1183 | case "bit_not": { |
| ... | @@ -2070,7 +2070,7 @@ var zigAnalysis; | ... | @@ -2070,7 +2070,7 @@ var zigAnalysis; |
| 2070 | if ( | 2070 | if ( |
| 2071 | rootIsStd && | 2071 | rootIsStd && |
| 2072 | typeObj === | 2072 | typeObj === |
| 2073 | getType(zigAnalysis.packages[zigAnalysis.rootPkg].main) | 2073 | getType(zigAnalysis.packages[zigAnalysis.rootPkg].main) |
| 2074 | ) { | 2074 | ) { |
| 2075 | name = "std"; | 2075 | name = "std"; |
| 2076 | } else { | 2076 | } else { |
| ... | @@ -2329,7 +2329,7 @@ var zigAnalysis; | ... | @@ -2329,7 +2329,7 @@ var zigAnalysis; |
| 2329 | function renderSourceFileLink(decl) { | 2329 | function renderSourceFileLink(decl) { |
| 2330 | let srcNode = getAstNode(decl.src); | 2330 | let srcNode = getAstNode(decl.src); |
| 2331 | 2331 | ||
| 2332 | return "<a style=\"float: right;\" href=\"" + | 2332 | return "<a style=\"float: right;\" href=\"" + |
| 2333 | sourceFileUrlTemplate.replace("{{file}}", | 2333 | sourceFileUrlTemplate.replace("{{file}}", |
| 2334 | zigAnalysis.files[srcNode.file]).replace("{{line}}", srcNode.line + 1) + "\">[src]</a>"; | 2334 | zigAnalysis.files[srcNode.file]).replace("{{line}}", srcNode.line + 1) + "\">[src]</a>"; |
| 2335 | } | 2335 | } |
| ... | @@ -2889,12 +2889,12 @@ var zigAnalysis; | ... | @@ -2889,12 +2889,12 @@ var zigAnalysis; |
| 2889 | let cut = false; | 2889 | let cut = false; |
| 2890 | 2890 | ||
| 2891 | if (index < 0 || index > 80) { | 2891 | if (index < 0 || index > 80) { |
| 2892 | if (trimmed_docs.length > 80) { | 2892 | if (trimmed_docs.length > 80) { |
| 2893 | index = 80; | 2893 | index = 80; |
| 2894 | cut = true; | 2894 | cut = true; |
| 2895 | } else { | 2895 | } else { |
| 2896 | index = trimmed_docs.length; | 2896 | index = trimmed_docs.length; |
| 2897 | } | 2897 | } |
| 2898 | } | 2898 | } |
| 2899 | 2899 | ||
| 2900 | let slice = trimmed_docs.slice(0, index); | 2900 | let slice = trimmed_docs.slice(0, index); |
| ... | @@ -3528,7 +3528,7 @@ var zigAnalysis; | ... | @@ -3528,7 +3528,7 @@ var zigAnalysis; |
| 3528 | decltest: decl[4], | 3528 | decltest: decl[4], |
| 3529 | }; | 3529 | }; |
| 3530 | } | 3530 | } |
| 3531 | 3531 | ||
| 3532 | function getAstNode(idx) { | 3532 | function getAstNode(idx) { |
| 3533 | const ast = zigAnalysis.astNodes[idx]; | 3533 | const ast = zigAnalysis.astNodes[idx]; |
| 3534 | return { | 3534 | return { |
| ... | @@ -3542,141 +3542,141 @@ var zigAnalysis; | ... | @@ -3542,141 +3542,141 @@ var zigAnalysis; |
| 3542 | comptime: ast[7], | 3542 | comptime: ast[7], |
| 3543 | }; | 3543 | }; |
| 3544 | } | 3544 | } |
| 3545 | 3545 | ||
| 3546 | function getType(idx){ | 3546 | function getType(idx) { |
| 3547 | const ty = zigAnalysis.types[idx]; | 3547 | const ty = zigAnalysis.types[idx]; |
| 3548 | switch(ty[0]) { | 3548 | switch (ty[0]) { |
| 3549 | default: | 3549 | default: |
| 3550 | throw "unhandled type kind!"; | 3550 | throw "unhandled type kind!"; |
| 3551 | case 0: // Unanalyzed | 3551 | case 0: // Unanalyzed |
| 3552 | throw "unanalyzed type!"; | 3552 | throw "unanalyzed type!"; |
| 3553 | case 1: // Type | 3553 | case 1: // Type |
| 3554 | case 2: // Void | 3554 | case 2: // Void |
| 3555 | case 3: // Bool | 3555 | case 3: // Bool |
| 3556 | case 4: // NoReturn | 3556 | case 4: // NoReturn |
| 3557 | case 5: // Int | 3557 | case 5: // Int |
| 3558 | case 6: // Float | 3558 | case 6: // Float |
| 3559 | return { kind: ty[0], name: ty[1]}; | 3559 | return { kind: ty[0], name: ty[1] }; |
| 3560 | case 7: // Pointer | 3560 | case 7: // Pointer |
| 3561 | return { | 3561 | return { |
| 3562 | kind: ty[0], | 3562 | kind: ty[0], |
| 3563 | size: ty[1], | 3563 | size: ty[1], |
| 3564 | child: ty[2], | 3564 | child: ty[2], |
| 3565 | sentinel: ty[3], | 3565 | sentinel: ty[3], |
| 3566 | align: ty[4], | 3566 | align: ty[4], |
| 3567 | address_space: ty[5], | 3567 | address_space: ty[5], |
| 3568 | bit_start: ty[6], | 3568 | bit_start: ty[6], |
| 3569 | host_size: ty[7], | 3569 | host_size: ty[7], |
| 3570 | is_ref: ty[8], | 3570 | is_ref: ty[8], |
| 3571 | is_allowzero: ty[9], | 3571 | is_allowzero: ty[9], |
| 3572 | is_mutable: ty[10], | 3572 | is_mutable: ty[10], |
| 3573 | is_volatile: ty[11], | 3573 | is_volatile: ty[11], |
| 3574 | has_sentinel: ty[12], | 3574 | has_sentinel: ty[12], |
| 3575 | has_align: ty[13], | 3575 | has_align: ty[13], |
| 3576 | has_addrspace: ty[14], | 3576 | has_addrspace: ty[14], |
| 3577 | has_bit_range: ty[15], | 3577 | has_bit_range: ty[15], |
| 3578 | }; | 3578 | }; |
| 3579 | case 8: // Array | 3579 | case 8: // Array |
| 3580 | return { | 3580 | return { |
| 3581 | kind: ty[0], | 3581 | kind: ty[0], |
| 3582 | len: ty[1], | 3582 | len: ty[1], |
| 3583 | child: ty[2], | 3583 | child: ty[2], |
| 3584 | sentinel: ty[3], | 3584 | sentinel: ty[3], |
| 3585 | }; | 3585 | }; |
| 3586 | case 9: // Struct | 3586 | case 9: // Struct |
| 3587 | return { | 3587 | return { |
| 3588 | kind: ty[0], | 3588 | kind: ty[0], |
| 3589 | name: ty[1], | 3589 | name: ty[1], |
| 3590 | src: ty[2], | 3590 | src: ty[2], |
| 3591 | privDecls: ty[3], | 3591 | privDecls: ty[3], |
| 3592 | pubDecls: ty[4], | 3592 | pubDecls: ty[4], |
| 3593 | fields: ty[5], | 3593 | fields: ty[5], |
| 3594 | line_number: ty[6], | 3594 | line_number: ty[6], |
| 3595 | outer_decl: ty[7], | 3595 | outer_decl: ty[7], |
| 3596 | }; | 3596 | }; |
| 3597 | case 10: // ComptimeExpr | 3597 | case 10: // ComptimeExpr |
| 3598 | case 11: // ComptimeFloat | 3598 | case 11: // ComptimeFloat |
| 3599 | case 12: // ComptimeInt | 3599 | case 12: // ComptimeInt |
| 3600 | case 13: // Undefined | 3600 | case 13: // Undefined |
| 3601 | case 14: // Null | 3601 | case 14: // Null |
| 3602 | return { kind: ty[0], name: ty[1] }; | 3602 | return { kind: ty[0], name: ty[1] }; |
| 3603 | case 15: // Optional | 3603 | case 15: // Optional |
| 3604 | return { | 3604 | return { |
| 3605 | kind: ty[0], | 3605 | kind: ty[0], |
| 3606 | name: ty[1], | 3606 | name: ty[1], |
| 3607 | child: ty[2], | 3607 | child: ty[2], |
| 3608 | }; | 3608 | }; |
| 3609 | case 16: // ErrorUnion | 3609 | case 16: // ErrorUnion |
| 3610 | return { | 3610 | return { |
| 3611 | kind: ty[0], | 3611 | kind: ty[0], |
| 3612 | lhs: ty[1], | 3612 | lhs: ty[1], |
| 3613 | rhs: ty[2], | 3613 | rhs: ty[2], |
| 3614 | }; | 3614 | }; |
| 3615 | case 17: // InferredErrorUnion | 3615 | case 17: // InferredErrorUnion |
| 3616 | return { | 3616 | return { |
| 3617 | kind: ty[0], | 3617 | kind: ty[0], |
| 3618 | payload: ty[1], | 3618 | payload: ty[1], |
| 3619 | }; | 3619 | }; |
| 3620 | case 18: // ErrorSet | 3620 | case 18: // ErrorSet |
| 3621 | return { | 3621 | return { |
| 3622 | kind: ty[0], | 3622 | kind: ty[0], |
| 3623 | name: ty[1], | 3623 | name: ty[1], |
| 3624 | fields: ty[2], | 3624 | fields: ty[2], |
| 3625 | }; | 3625 | }; |
| 3626 | case 19: // Enum | 3626 | case 19: // Enum |
| 3627 | return { | 3627 | return { |
| 3628 | kind: ty[0], | 3628 | kind: ty[0], |
| 3629 | name: ty[1], | 3629 | name: ty[1], |
| 3630 | src: ty[2], | 3630 | src: ty[2], |
| 3631 | privDecls: ty[3], | 3631 | privDecls: ty[3], |
| 3632 | pubDecls: ty[4], | 3632 | pubDecls: ty[4], |
| 3633 | }; | 3633 | }; |
| 3634 | case 20: // Union | 3634 | case 20: // Union |
| 3635 | return { | 3635 | return { |
| 3636 | kind: ty[0], | 3636 | kind: ty[0], |
| 3637 | name: ty[1], | 3637 | name: ty[1], |
| 3638 | src: ty[2], | 3638 | src: ty[2], |
| 3639 | privDecls: ty[3], | 3639 | privDecls: ty[3], |
| 3640 | pubDecls: ty[4], | 3640 | pubDecls: ty[4], |
| 3641 | fields: ty[5], | 3641 | fields: ty[5], |
| 3642 | }; | 3642 | }; |
| 3643 | case 21: // Fn | 3643 | case 21: // Fn |
| 3644 | return { | 3644 | return { |
| 3645 | kind: ty[0], | 3645 | kind: ty[0], |
| 3646 | name: ty[1], | 3646 | name: ty[1], |
| 3647 | src: ty[2], | 3647 | src: ty[2], |
| 3648 | ret: ty[3], | 3648 | ret: ty[3], |
| 3649 | generic_ret: ty[4], | 3649 | generic_ret: ty[4], |
| 3650 | params: ty[5], | 3650 | params: ty[5], |
| 3651 | lib_name: ty[6], | 3651 | lib_name: ty[6], |
| 3652 | is_var_args: ty[7], | 3652 | is_var_args: ty[7], |
| 3653 | is_inferred_error: ty[8], | 3653 | is_inferred_error: ty[8], |
| 3654 | has_lib_name: ty[9], | 3654 | has_lib_name: ty[9], |
| 3655 | has_cc: ty[10], | 3655 | has_cc: ty[10], |
| 3656 | cc: ty[11], | 3656 | cc: ty[11], |
| 3657 | align: ty[12], | 3657 | align: ty[12], |
| 3658 | has_align: ty[13], | 3658 | has_align: ty[13], |
| 3659 | is_test: ty[14], | 3659 | is_test: ty[14], |
| 3660 | is_extern: ty[15], | 3660 | is_extern: ty[15], |
| 3661 | }; | 3661 | }; |
| 3662 | case 22: // BoundFn | 3662 | case 22: // BoundFn |
| 3663 | return { kind: ty[0], name: ty[1] }; | 3663 | return { kind: ty[0], name: ty[1] }; |
| 3664 | case 23: // Opaque | 3664 | case 23: // Opaque |
| 3665 | return { | 3665 | return { |
| 3666 | kind: ty[0], | 3666 | kind: ty[0], |
| 3667 | name: ty[1], | 3667 | name: ty[1], |
| 3668 | src: ty[2], | 3668 | src: ty[2], |
| 3669 | privDecls: ty[3], | 3669 | privDecls: ty[3], |
| 3670 | pubDecls: ty[4], | 3670 | pubDecls: ty[4], |
| 3671 | }; | 3671 | }; |
| 3672 | case 24: // Frame | 3672 | case 24: // Frame |
| 3673 | case 25: // AnyFrame | 3673 | case 25: // AnyFrame |
| 3674 | case 26: // Vector | 3674 | case 26: // Vector |
| 3675 | case 27: // EnumLiteral | 3675 | case 27: // EnumLiteral |
| 3676 | return { kind: ty[0], name: ty[1] }; | 3676 | return { kind: ty[0], name: ty[1] }; |
| 3677 | } | 3677 | } |
| 3678 | } | 3678 | } |
| 3679 | 3679 | ||
| 3680 | })(); | 3680 | })(); |
| 3681 | 3681 | ||
| 3682 | 3682 |
lib/std/Progress.zig+1-1| ... | @@ -357,7 +357,7 @@ fn refreshWithHeldLock(self: *Progress) void { | ... | @@ -357,7 +357,7 @@ fn refreshWithHeldLock(self: *Progress) void { |
| 357 | // we possibly wrote previously don't affect whether we truncate the line in `bufWrite`. | 357 | // we possibly wrote previously don't affect whether we truncate the line in `bufWrite`. |
| 358 | const unprintables = end; | 358 | const unprintables = end; |
| 359 | end = 0; | 359 | end = 0; |
| 360 | self.output_buffer_slice = self.output_buffer[unprintables..@minimum(self.output_buffer.len, unprintables + self.max_width.?)]; | 360 | self.output_buffer_slice = self.output_buffer[unprintables..@min(self.output_buffer.len, unprintables + self.max_width.?)]; |
| 361 | 361 | ||
| 362 | if (!self.done) { | 362 | if (!self.done) { |
| 363 | var need_ellipsis = false; | 363 | var need_ellipsis = false; |
lib/std/build/InstallRawStep.zig+1-1| ... | @@ -301,7 +301,7 @@ const HexWriter = struct { | ... | @@ -301,7 +301,7 @@ const HexWriter = struct { |
| 301 | const row_address = @intCast(u32, segment.physicalAddress + bytes_read); | 301 | const row_address = @intCast(u32, segment.physicalAddress + bytes_read); |
| 302 | 302 | ||
| 303 | const remaining = segment.fileSize - bytes_read; | 303 | const remaining = segment.fileSize - bytes_read; |
| 304 | const to_read = @minimum(remaining, MAX_PAYLOAD_LEN); | 304 | const to_read = @min(remaining, MAX_PAYLOAD_LEN); |
| 305 | const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read); | 305 | const did_read = try elf_file.preadAll(buf[0..to_read], segment.elfOffset + bytes_read); |
| 306 | if (did_read < to_read) return error.UnexpectedEOF; | 306 | if (did_read < to_read) return error.UnexpectedEOF; |
| 307 | 307 |
lib/std/compress/deflate/decompressor.zig+2-2| ... | @@ -99,8 +99,8 @@ const HuffmanDecoder = struct { | ... | @@ -99,8 +99,8 @@ const HuffmanDecoder = struct { |
| 99 | if (min == 0) { | 99 | if (min == 0) { |
| 100 | min = n; | 100 | min = n; |
| 101 | } | 101 | } |
| 102 | min = @minimum(n, min); | 102 | min = @min(n, min); |
| 103 | max = @maximum(n, max); | 103 | max = @max(n, max); |
| 104 | count[n] += 1; | 104 | count[n] += 1; |
| 105 | } | 105 | } |
| 106 | 106 |
lib/std/compress/deflate/huffman_code.zig+1-1| ... | @@ -134,7 +134,7 @@ pub const HuffmanEncoder = struct { | ... | @@ -134,7 +134,7 @@ pub const HuffmanEncoder = struct { |
| 134 | 134 | ||
| 135 | // The tree can't have greater depth than n - 1, no matter what. This | 135 | // The tree can't have greater depth than n - 1, no matter what. This |
| 136 | // saves a little bit of work in some small cases | 136 | // saves a little bit of work in some small cases |
| 137 | max_bits = @minimum(max_bits, n - 1); | 137 | max_bits = @min(max_bits, n - 1); |
| 138 | 138 | ||
| 139 | // Create information about each of the levels. | 139 | // Create information about each of the levels. |
| 140 | // A bogus "Level 0" whose sole purpose is so that | 140 | // A bogus "Level 0" whose sole purpose is so that |
lib/std/debug.zig+1-1| ... | @@ -2087,7 +2087,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize | ... | @@ -2087,7 +2087,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize |
| 2087 | 2087 | ||
| 2088 | const tty_config = detectTTYConfig(); | 2088 | const tty_config = detectTTYConfig(); |
| 2089 | const stderr = io.getStdErr().writer(); | 2089 | const stderr = io.getStdErr().writer(); |
| 2090 | const end = @minimum(t.index, size); | 2090 | const end = @min(t.index, size); |
| 2091 | const debug_info = getSelfDebugInfo() catch |err| { | 2091 | const debug_info = getSelfDebugInfo() catch |err| { |
| 2092 | stderr.print( | 2092 | stderr.print( |
| 2093 | "Unable to dump stack trace: Unable to open debug info: {s}\n", | 2093 | "Unable to dump stack trace: Unable to open debug info: {s}\n", |
lib/std/heap.zig+2-2| ... | @@ -315,7 +315,7 @@ const PageAllocator = struct { | ... | @@ -315,7 +315,7 @@ const PageAllocator = struct { |
| 315 | } | 315 | } |
| 316 | } | 316 | } |
| 317 | 317 | ||
| 318 | const max_drop_len = alignment - @minimum(alignment, mem.page_size); | 318 | const max_drop_len = alignment - @min(alignment, mem.page_size); |
| 319 | const alloc_len = if (max_drop_len <= aligned_len - n) | 319 | const alloc_len = if (max_drop_len <= aligned_len - n) |
| 320 | aligned_len | 320 | aligned_len |
| 321 | else | 321 | else |
| ... | @@ -554,7 +554,7 @@ const WasmPageAllocator = struct { | ... | @@ -554,7 +554,7 @@ const WasmPageAllocator = struct { |
| 554 | 554 | ||
| 555 | fn freePages(start: usize, end: usize) void { | 555 | fn freePages(start: usize, end: usize) void { |
| 556 | if (start < extendedOffset()) { | 556 | if (start < extendedOffset()) { |
| 557 | conventional.recycle(start, @minimum(extendedOffset(), end) - start); | 557 | conventional.recycle(start, @min(extendedOffset(), end) - start); |
| 558 | } | 558 | } |
| 559 | if (end > extendedOffset()) { | 559 | if (end > extendedOffset()) { |
| 560 | var new_end = end; | 560 | var new_end = end; |
lib/std/os.zig+13-13| ... | @@ -642,7 +642,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { | ... | @@ -642,7 +642,7 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize { |
| 642 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), | 642 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), |
| 643 | else => math.maxInt(isize), | 643 | else => math.maxInt(isize), |
| 644 | }; | 644 | }; |
| 645 | const adjusted_len = @minimum(max_count, buf.len); | 645 | const adjusted_len = @min(max_count, buf.len); |
| 646 | 646 | ||
| 647 | while (true) { | 647 | while (true) { |
| 648 | const rc = system.read(fd, buf.ptr, adjusted_len); | 648 | const rc = system.read(fd, buf.ptr, adjusted_len); |
| ... | @@ -771,7 +771,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { | ... | @@ -771,7 +771,7 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize { |
| 771 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), | 771 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), |
| 772 | else => math.maxInt(isize), | 772 | else => math.maxInt(isize), |
| 773 | }; | 773 | }; |
| 774 | const adjusted_len = @minimum(max_count, buf.len); | 774 | const adjusted_len = @min(max_count, buf.len); |
| 775 | 775 | ||
| 776 | const pread_sym = if (builtin.os.tag == .linux and builtin.link_libc) | 776 | const pread_sym = if (builtin.os.tag == .linux and builtin.link_libc) |
| 777 | system.pread64 | 777 | system.pread64 |
| ... | @@ -1027,7 +1027,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { | ... | @@ -1027,7 +1027,7 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize { |
| 1027 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), | 1027 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), |
| 1028 | else => math.maxInt(isize), | 1028 | else => math.maxInt(isize), |
| 1029 | }; | 1029 | }; |
| 1030 | const adjusted_len = @minimum(max_count, bytes.len); | 1030 | const adjusted_len = @min(max_count, bytes.len); |
| 1031 | 1031 | ||
| 1032 | while (true) { | 1032 | while (true) { |
| 1033 | const rc = system.write(fd, bytes.ptr, adjusted_len); | 1033 | const rc = system.write(fd, bytes.ptr, adjusted_len); |
| ... | @@ -1183,7 +1183,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { | ... | @@ -1183,7 +1183,7 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize { |
| 1183 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), | 1183 | .macos, .ios, .watchos, .tvos => math.maxInt(i32), |
| 1184 | else => math.maxInt(isize), | 1184 | else => math.maxInt(isize), |
| 1185 | }; | 1185 | }; |
| 1186 | const adjusted_len = @minimum(max_count, bytes.len); | 1186 | const adjusted_len = @min(max_count, bytes.len); |
| 1187 | 1187 | ||
| 1188 | const pwrite_sym = if (builtin.os.tag == .linux and builtin.link_libc) | 1188 | const pwrite_sym = if (builtin.os.tag == .linux and builtin.link_libc) |
| 1189 | system.pwrite64 | 1189 | system.pwrite64 |
| ... | @@ -6006,8 +6006,8 @@ pub fn sendfile( | ... | @@ -6006,8 +6006,8 @@ pub fn sendfile( |
| 6006 | } | 6006 | } |
| 6007 | 6007 | ||
| 6008 | // Here we match BSD behavior, making a zero count value send as many bytes as possible. | 6008 | // Here we match BSD behavior, making a zero count value send as many bytes as possible. |
| 6009 | const adjusted_count_tmp = if (in_len == 0) max_count else @minimum(in_len, @as(size_t, max_count)); | 6009 | const adjusted_count_tmp = if (in_len == 0) max_count else @min(in_len, @as(size_t, max_count)); |
| 6010 | // TODO we should not need this cast; improve return type of @minimum | 6010 | // TODO we should not need this cast; improve return type of @min |
| 6011 | const adjusted_count = @intCast(usize, adjusted_count_tmp); | 6011 | const adjusted_count = @intCast(usize, adjusted_count_tmp); |
| 6012 | 6012 | ||
| 6013 | const sendfile_sym = if (builtin.link_libc) | 6013 | const sendfile_sym = if (builtin.link_libc) |
| ... | @@ -6091,7 +6091,7 @@ pub fn sendfile( | ... | @@ -6091,7 +6091,7 @@ pub fn sendfile( |
| 6091 | hdtr = &hdtr_data; | 6091 | hdtr = &hdtr_data; |
| 6092 | } | 6092 | } |
| 6093 | 6093 | ||
| 6094 | const adjusted_count = @minimum(in_len, max_count); | 6094 | const adjusted_count = @min(in_len, max_count); |
| 6095 | 6095 | ||
| 6096 | while (true) { | 6096 | while (true) { |
| 6097 | var sbytes: off_t = undefined; | 6097 | var sbytes: off_t = undefined; |
| ... | @@ -6170,8 +6170,8 @@ pub fn sendfile( | ... | @@ -6170,8 +6170,8 @@ pub fn sendfile( |
| 6170 | hdtr = &hdtr_data; | 6170 | hdtr = &hdtr_data; |
| 6171 | } | 6171 | } |
| 6172 | 6172 | ||
| 6173 | const adjusted_count_temporary = @minimum(in_len, @as(u63, max_count)); | 6173 | const adjusted_count_temporary = @min(in_len, @as(u63, max_count)); |
| 6174 | // TODO we should not need this int cast; improve the return type of `@minimum` | 6174 | // TODO we should not need this int cast; improve the return type of `@min` |
| 6175 | const adjusted_count = @intCast(u63, adjusted_count_temporary); | 6175 | const adjusted_count = @intCast(u63, adjusted_count_temporary); |
| 6176 | 6176 | ||
| 6177 | while (true) { | 6177 | while (true) { |
| ... | @@ -6226,8 +6226,8 @@ pub fn sendfile( | ... | @@ -6226,8 +6226,8 @@ pub fn sendfile( |
| 6226 | rw: { | 6226 | rw: { |
| 6227 | var buf: [8 * 4096]u8 = undefined; | 6227 | var buf: [8 * 4096]u8 = undefined; |
| 6228 | // Here we match BSD behavior, making a zero count value send as many bytes as possible. | 6228 | // Here we match BSD behavior, making a zero count value send as many bytes as possible. |
| 6229 | const adjusted_count_tmp = if (in_len == 0) buf.len else @minimum(buf.len, in_len); | 6229 | const adjusted_count_tmp = if (in_len == 0) buf.len else @min(buf.len, in_len); |
| 6230 | // TODO we should not need this cast; improve return type of @minimum | 6230 | // TODO we should not need this cast; improve return type of @min |
| 6231 | const adjusted_count = @intCast(usize, adjusted_count_tmp); | 6231 | const adjusted_count = @intCast(usize, adjusted_count_tmp); |
| 6232 | const amt_read = try pread(in_fd, buf[0..adjusted_count], in_offset); | 6232 | const amt_read = try pread(in_fd, buf[0..adjusted_count], in_offset); |
| 6233 | if (amt_read == 0) { | 6233 | if (amt_read == 0) { |
| ... | @@ -6329,7 +6329,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len | ... | @@ -6329,7 +6329,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len |
| 6329 | } | 6329 | } |
| 6330 | 6330 | ||
| 6331 | var buf: [8 * 4096]u8 = undefined; | 6331 | var buf: [8 * 4096]u8 = undefined; |
| 6332 | const adjusted_count = @minimum(buf.len, len); | 6332 | const adjusted_count = @min(buf.len, len); |
| 6333 | const amt_read = try pread(fd_in, buf[0..adjusted_count], off_in); | 6333 | const amt_read = try pread(fd_in, buf[0..adjusted_count], off_in); |
| 6334 | // TODO without @as the line below fails to compile for wasm32-wasi: | 6334 | // TODO without @as the line below fails to compile for wasm32-wasi: |
| 6335 | // error: integer value 0 cannot be coerced to type 'os.PWriteError!usize' | 6335 | // error: integer value 0 cannot be coerced to type 'os.PWriteError!usize' |
| ... | @@ -6493,7 +6493,7 @@ pub fn dn_expand( | ... | @@ -6493,7 +6493,7 @@ pub fn dn_expand( |
| 6493 | const end = msg.ptr + msg.len; | 6493 | const end = msg.ptr + msg.len; |
| 6494 | if (p == end or exp_dn.len == 0) return error.InvalidDnsPacket; | 6494 | if (p == end or exp_dn.len == 0) return error.InvalidDnsPacket; |
| 6495 | var dest = exp_dn.ptr; | 6495 | var dest = exp_dn.ptr; |
| 6496 | const dend = dest + @minimum(exp_dn.len, 254); | 6496 | const dend = dest + @min(exp_dn.len, 254); |
| 6497 | // detect reference loop using an iteration counter | 6497 | // detect reference loop using an iteration counter |
| 6498 | var i: usize = 0; | 6498 | var i: usize = 0; |
| 6499 | while (i < msg.len) : (i += 2) { | 6499 | while (i < msg.len) : (i += 2) { |
lib/std/simd.zig+3-3| ... | @@ -9,7 +9,7 @@ const builtin = @import("builtin"); | ... | @@ -9,7 +9,7 @@ const builtin = @import("builtin"); |
| 9 | pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?usize { | 9 | pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?usize { |
| 10 | // This is guesswork, if you have better suggestions can add it or edit the current here | 10 | // This is guesswork, if you have better suggestions can add it or edit the current here |
| 11 | // This can run in comptime only, but stage 1 fails at it, stage 2 can understand it | 11 | // This can run in comptime only, but stage 1 fails at it, stage 2 can understand it |
| 12 | const element_bit_size = @maximum(8, std.math.ceilPowerOfTwo(u16, @bitSizeOf(T)) catch unreachable); | 12 | const element_bit_size = @max(8, std.math.ceilPowerOfTwo(u16, @bitSizeOf(T)) catch unreachable); |
| 13 | const vector_bit_size: u16 = blk: { | 13 | const vector_bit_size: u16 = blk: { |
| 14 | if (cpu.arch.isX86()) { | 14 | if (cpu.arch.isX86()) { |
| 15 | if (T == bool and std.Target.x86.featureSetHas(.prefer_mask_registers)) return 64; | 15 | if (T == bool and std.Target.x86.featureSetHas(.prefer_mask_registers)) return 64; |
| ... | @@ -405,8 +405,8 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a | ... | @@ -405,8 +405,8 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a |
| 405 | .Xor => a ^ b, | 405 | .Xor => a ^ b, |
| 406 | .Add => a + b, | 406 | .Add => a + b, |
| 407 | .Mul => a * b, | 407 | .Mul => a * b, |
| 408 | .Min => @minimum(a, b), | 408 | .Min => @min(a, b), |
| 409 | .Max => @maximum(a, b), | 409 | .Max => @max(a, b), |
| 410 | }; | 410 | }; |
| 411 | } | 411 | } |
| 412 | }; | 412 | }; |
lib/std/zig/render.zig+9-1| ... | @@ -1236,7 +1236,15 @@ fn renderBuiltinCall( | ... | @@ -1236,7 +1236,15 @@ fn renderBuiltinCall( |
| 1236 | ) Error!void { | 1236 | ) Error!void { |
| 1237 | const token_tags = tree.tokens.items(.tag); | 1237 | const token_tags = tree.tokens.items(.tag); |
| 1238 | 1238 | ||
| 1239 | try renderToken(ais, tree, builtin_token, .none); // @name | 1239 | // TODO remove before release of 0.11.0 |
| 1240 | const slice = tree.tokenSlice(builtin_token); | ||
| 1241 | if (mem.eql(u8, slice, "@maximum")) { | ||
| 1242 | try ais.writer().writeAll("@max"); | ||
| 1243 | } else if (mem.eql(u8, slice, "@minimum")) { | ||
| 1244 | try ais.writer().writeAll("@min"); | ||
| 1245 | } else { | ||
| 1246 | try renderToken(ais, tree, builtin_token, .none); // @name | ||
| 1247 | } | ||
| 1240 | 1248 | ||
| 1241 | if (params.len == 0) { | 1249 | if (params.len == 0) { |
| 1242 | try renderToken(ais, tree, builtin_token + 1, .none); // ( | 1250 | try renderToken(ais, tree, builtin_token + 1, .none); // ( |
src/AstGen.zig+6-6| ... | @@ -2451,8 +2451,8 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As | ... | @@ -2451,8 +2451,8 @@ fn addEnsureResult(gz: *GenZir, maybe_unused_result: Zir.Inst.Ref, statement: As |
| 2451 | .atomic_rmw, | 2451 | .atomic_rmw, |
| 2452 | .mul_add, | 2452 | .mul_add, |
| 2453 | .field_parent_ptr, | 2453 | .field_parent_ptr, |
| 2454 | .maximum, | 2454 | .max, |
| 2455 | .minimum, | 2455 | .min, |
| 2456 | .c_import, | 2456 | .c_import, |
| 2457 | .@"resume", | 2457 | .@"resume", |
| 2458 | .@"await", | 2458 | .@"await", |
| ... | @@ -7875,19 +7875,19 @@ fn builtinCall( | ... | @@ -7875,19 +7875,19 @@ fn builtinCall( |
| 7875 | return rvalue(gz, rl, result, node); | 7875 | return rvalue(gz, rl, result, node); |
| 7876 | }, | 7876 | }, |
| 7877 | 7877 | ||
| 7878 | .maximum => { | 7878 | .max => { |
| 7879 | const a = try expr(gz, scope, .none, params[0]); | 7879 | const a = try expr(gz, scope, .none, params[0]); |
| 7880 | const b = try expr(gz, scope, .none, params[1]); | 7880 | const b = try expr(gz, scope, .none, params[1]); |
| 7881 | const result = try gz.addPlNode(.maximum, node, Zir.Inst.Bin{ | 7881 | const result = try gz.addPlNode(.max, node, Zir.Inst.Bin{ |
| 7882 | .lhs = a, | 7882 | .lhs = a, |
| 7883 | .rhs = b, | 7883 | .rhs = b, |
| 7884 | }); | 7884 | }); |
| 7885 | return rvalue(gz, rl, result, node); | 7885 | return rvalue(gz, rl, result, node); |
| 7886 | }, | 7886 | }, |
| 7887 | .minimum => { | 7887 | .min => { |
| 7888 | const a = try expr(gz, scope, .none, params[0]); | 7888 | const a = try expr(gz, scope, .none, params[0]); |
| 7889 | const b = try expr(gz, scope, .none, params[1]); | 7889 | const b = try expr(gz, scope, .none, params[1]); |
| 7890 | const result = try gz.addPlNode(.minimum, node, Zir.Inst.Bin{ | 7890 | const result = try gz.addPlNode(.min, node, Zir.Inst.Bin{ |
| 7891 | .lhs = a, | 7891 | .lhs = a, |
| 7892 | .rhs = b, | 7892 | .rhs = b, |
| 7893 | }); | 7893 | }); |
src/Autodoc.zig+2-2| ... | @@ -1349,8 +1349,8 @@ fn walkInstruction( | ... | @@ -1349,8 +1349,8 @@ fn walkInstruction( |
| 1349 | .frame_type, | 1349 | .frame_type, |
| 1350 | .frame_size, | 1350 | .frame_size, |
| 1351 | .ptr_to_int, | 1351 | .ptr_to_int, |
| 1352 | .minimum, | 1352 | .min, |
| 1353 | .maximum, | 1353 | .max, |
| 1354 | .bit_not, | 1354 | .bit_not, |
| 1355 | // @check | 1355 | // @check |
| 1356 | .clz, | 1356 | .clz, |
src/BuiltinFn.zig+6-6| ... | @@ -58,10 +58,10 @@ pub const Tag = enum { | ... | @@ -58,10 +58,10 @@ pub const Tag = enum { |
| 58 | int_to_error, | 58 | int_to_error, |
| 59 | int_to_float, | 59 | int_to_float, |
| 60 | int_to_ptr, | 60 | int_to_ptr, |
| 61 | maximum, | 61 | max, |
| 62 | memcpy, | 62 | memcpy, |
| 63 | memset, | 63 | memset, |
| 64 | minimum, | 64 | min, |
| 65 | wasm_memory_size, | 65 | wasm_memory_size, |
| 66 | wasm_memory_grow, | 66 | wasm_memory_grow, |
| 67 | mod, | 67 | mod, |
| ... | @@ -556,9 +556,9 @@ pub const list = list: { | ... | @@ -556,9 +556,9 @@ pub const list = list: { |
| 556 | }, | 556 | }, |
| 557 | }, | 557 | }, |
| 558 | .{ | 558 | .{ |
| 559 | "@maximum", | 559 | "@max", |
| 560 | .{ | 560 | .{ |
| 561 | .tag = .maximum, | 561 | .tag = .max, |
| 562 | .param_count = 2, | 562 | .param_count = 2, |
| 563 | }, | 563 | }, |
| 564 | }, | 564 | }, |
| ... | @@ -577,9 +577,9 @@ pub const list = list: { | ... | @@ -577,9 +577,9 @@ pub const list = list: { |
| 577 | }, | 577 | }, |
| 578 | }, | 578 | }, |
| 579 | .{ | 579 | .{ |
| 580 | "@minimum", | 580 | "@min", |
| 581 | .{ | 581 | .{ |
| 582 | .tag = .minimum, | 582 | .tag = .min, |
| 583 | .param_count = 2, | 583 | .param_count = 2, |
| 584 | }, | 584 | }, |
| 585 | }, | 585 | }, |
src/Module.zig+6-6| ... | @@ -992,7 +992,7 @@ pub const Struct = struct { | ... | @@ -992,7 +992,7 @@ pub const Struct = struct { |
| 992 | if (field.ty.isAbiInt() and field.ty.intInfo(target).bits >= 128) { | 992 | if (field.ty.isAbiInt() and field.ty.intInfo(target).bits >= 128) { |
| 993 | // The C ABI requires 128 bit integer fields of structs | 993 | // The C ABI requires 128 bit integer fields of structs |
| 994 | // to be 16-bytes aligned. | 994 | // to be 16-bytes aligned. |
| 995 | return @maximum(ty_abi_align, 16); | 995 | return @max(ty_abi_align, 16); |
| 996 | } | 996 | } |
| 997 | 997 | ||
| 998 | return ty_abi_align; | 998 | return ty_abi_align; |
| ... | @@ -1326,7 +1326,7 @@ pub const Union = struct { | ... | @@ -1326,7 +1326,7 @@ pub const Union = struct { |
| 1326 | if (!field.ty.hasRuntimeBits()) continue; | 1326 | if (!field.ty.hasRuntimeBits()) continue; |
| 1327 | 1327 | ||
| 1328 | const field_align = field.normalAlignment(target); | 1328 | const field_align = field.normalAlignment(target); |
| 1329 | max_align = @maximum(max_align, field_align); | 1329 | max_align = @max(max_align, field_align); |
| 1330 | } | 1330 | } |
| 1331 | return max_align; | 1331 | return max_align; |
| 1332 | } | 1332 | } |
| ... | @@ -1391,7 +1391,7 @@ pub const Union = struct { | ... | @@ -1391,7 +1391,7 @@ pub const Union = struct { |
| 1391 | most_aligned_field_size = field_size; | 1391 | most_aligned_field_size = field_size; |
| 1392 | } | 1392 | } |
| 1393 | } | 1393 | } |
| 1394 | payload_align = @maximum(payload_align, 1); | 1394 | payload_align = @max(payload_align, 1); |
| 1395 | if (!have_tag or !u.tag_ty.hasRuntimeBits()) { | 1395 | if (!have_tag or !u.tag_ty.hasRuntimeBits()) { |
| 1396 | return .{ | 1396 | return .{ |
| 1397 | .abi_size = std.mem.alignForwardGeneric(u64, payload_size, payload_align), | 1397 | .abi_size = std.mem.alignForwardGeneric(u64, payload_size, payload_align), |
| ... | @@ -1409,7 +1409,7 @@ pub const Union = struct { | ... | @@ -1409,7 +1409,7 @@ pub const Union = struct { |
| 1409 | // Put the tag before or after the payload depending on which one's | 1409 | // Put the tag before or after the payload depending on which one's |
| 1410 | // alignment is greater. | 1410 | // alignment is greater. |
| 1411 | const tag_size = u.tag_ty.abiSize(target); | 1411 | const tag_size = u.tag_ty.abiSize(target); |
| 1412 | const tag_align = @maximum(1, u.tag_ty.abiAlignment(target)); | 1412 | const tag_align = @max(1, u.tag_ty.abiAlignment(target)); |
| 1413 | var size: u64 = 0; | 1413 | var size: u64 = 0; |
| 1414 | var padding: u32 = undefined; | 1414 | var padding: u32 = undefined; |
| 1415 | if (tag_align >= payload_align) { | 1415 | if (tag_align >= payload_align) { |
| ... | @@ -1431,7 +1431,7 @@ pub const Union = struct { | ... | @@ -1431,7 +1431,7 @@ pub const Union = struct { |
| 1431 | } | 1431 | } |
| 1432 | return .{ | 1432 | return .{ |
| 1433 | .abi_size = size, | 1433 | .abi_size = size, |
| 1434 | .abi_align = @maximum(tag_align, payload_align), | 1434 | .abi_align = @max(tag_align, payload_align), |
| 1435 | .most_aligned_field = most_aligned_field, | 1435 | .most_aligned_field = most_aligned_field, |
| 1436 | .most_aligned_field_size = most_aligned_field_size, | 1436 | .most_aligned_field_size = most_aligned_field_size, |
| 1437 | .biggest_field = biggest_field, | 1437 | .biggest_field = biggest_field, |
| ... | @@ -5492,7 +5492,7 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air { | ... | @@ -5492,7 +5492,7 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air { |
| 5492 | .func = func, | 5492 | .func = func, |
| 5493 | .fn_ret_ty = decl.ty.fnReturnType(), | 5493 | .fn_ret_ty = decl.ty.fnReturnType(), |
| 5494 | .owner_func = func, | 5494 | .owner_func = func, |
| 5495 | .branch_quota = @maximum(func.branch_quota, Sema.default_branch_quota), | 5495 | .branch_quota = @max(func.branch_quota, Sema.default_branch_quota), |
| 5496 | }; | 5496 | }; |
| 5497 | defer sema.deinit(); | 5497 | defer sema.deinit(); |
| 5498 | 5498 |
src/Sema.zig+10-10| ... | @@ -913,8 +913,8 @@ fn analyzeBodyInner( | ... | @@ -913,8 +913,8 @@ fn analyzeBodyInner( |
| 913 | .mod => try sema.zirMod(block, inst), | 913 | .mod => try sema.zirMod(block, inst), |
| 914 | .rem => try sema.zirRem(block, inst), | 914 | .rem => try sema.zirRem(block, inst), |
| 915 | 915 | ||
| 916 | .maximum => try sema.zirMinMax(block, inst, .max), | 916 | .max => try sema.zirMinMax(block, inst, .max), |
| 917 | .minimum => try sema.zirMinMax(block, inst, .min), | 917 | .min => try sema.zirMinMax(block, inst, .min), |
| 918 | 918 | ||
| 919 | .shl => try sema.zirShl(block, inst, .shl), | 919 | .shl => try sema.zirShl(block, inst, .shl), |
| 920 | .shl_exact => try sema.zirShl(block, inst, .shl_exact), | 920 | .shl_exact => try sema.zirShl(block, inst, .shl_exact), |
| ... | @@ -3886,9 +3886,9 @@ fn validateUnionInit( | ... | @@ -3886,9 +3886,9 @@ fn validateUnionInit( |
| 3886 | if (block_index > 0 and | 3886 | if (block_index > 0 and |
| 3887 | field_ptr_air_inst == block.instructions.items[block_index - 1]) | 3887 | field_ptr_air_inst == block.instructions.items[block_index - 1]) |
| 3888 | { | 3888 | { |
| 3889 | first_block_index = @minimum(first_block_index, block_index - 1); | 3889 | first_block_index = @min(first_block_index, block_index - 1); |
| 3890 | } else { | 3890 | } else { |
| 3891 | first_block_index = @minimum(first_block_index, block_index); | 3891 | first_block_index = @min(first_block_index, block_index); |
| 3892 | } | 3892 | } |
| 3893 | init_val = try sema.resolveMaybeUndefValAllowVariables(block, init_src, bin_op.rhs); | 3893 | init_val = try sema.resolveMaybeUndefValAllowVariables(block, init_src, bin_op.rhs); |
| 3894 | break; | 3894 | break; |
| ... | @@ -4097,9 +4097,9 @@ fn validateStructInit( | ... | @@ -4097,9 +4097,9 @@ fn validateStructInit( |
| 4097 | if (block_index > 0 and | 4097 | if (block_index > 0 and |
| 4098 | field_ptr_air_inst == block.instructions.items[block_index - 1]) | 4098 | field_ptr_air_inst == block.instructions.items[block_index - 1]) |
| 4099 | { | 4099 | { |
| 4100 | first_block_index = @minimum(first_block_index, block_index - 1); | 4100 | first_block_index = @min(first_block_index, block_index - 1); |
| 4101 | } else { | 4101 | } else { |
| 4102 | first_block_index = @minimum(first_block_index, block_index); | 4102 | first_block_index = @min(first_block_index, block_index); |
| 4103 | } | 4103 | } |
| 4104 | if (try sema.resolveMaybeUndefValAllowVariables(block, field_src, bin_op.rhs)) |val| { | 4104 | if (try sema.resolveMaybeUndefValAllowVariables(block, field_src, bin_op.rhs)) |val| { |
| 4105 | field_values[i] = val; | 4105 | field_values[i] = val; |
| ... | @@ -4278,7 +4278,7 @@ fn zirValidateArrayInit( | ... | @@ -4278,7 +4278,7 @@ fn zirValidateArrayInit( |
| 4278 | } | 4278 | } |
| 4279 | block_index -= 1; | 4279 | block_index -= 1; |
| 4280 | } | 4280 | } |
| 4281 | first_block_index = @minimum(first_block_index, block_index); | 4281 | first_block_index = @min(first_block_index, block_index); |
| 4282 | 4282 | ||
| 4283 | // If the next instructon is a store with a comptime operand, this element | 4283 | // If the next instructon is a store with a comptime operand, this element |
| 4284 | // is comptime. | 4284 | // is comptime. |
| ... | @@ -4606,7 +4606,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi | ... | @@ -4606,7 +4606,7 @@ fn zirSetEvalBranchQuota(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi |
| 4606 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; | 4606 | const inst_data = sema.code.instructions.items(.data)[inst].un_node; |
| 4607 | const src = inst_data.src(); | 4607 | const src = inst_data.src(); |
| 4608 | const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime-known")); | 4608 | const quota = @intCast(u32, try sema.resolveInt(block, src, inst_data.operand, Type.u32, "eval branch quota must be comptime-known")); |
| 4609 | sema.branch_quota = @maximum(sema.branch_quota, quota); | 4609 | sema.branch_quota = @max(sema.branch_quota, quota); |
| 4610 | } | 4610 | } |
| 4611 | 4611 | ||
| 4612 | fn zirStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { | 4612 | fn zirStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void { |
| ... | @@ -6887,7 +6887,7 @@ fn instantiateGenericCall( | ... | @@ -6887,7 +6887,7 @@ fn instantiateGenericCall( |
| 6887 | break :callee new_func; | 6887 | break :callee new_func; |
| 6888 | } else gop.key_ptr.*; | 6888 | } else gop.key_ptr.*; |
| 6889 | 6889 | ||
| 6890 | callee.branch_quota = @maximum(callee.branch_quota, sema.branch_quota); | 6890 | callee.branch_quota = @max(callee.branch_quota, sema.branch_quota); |
| 6891 | 6891 | ||
| 6892 | const callee_inst = try sema.analyzeDeclVal(block, func_src, callee.owner_decl); | 6892 | const callee_inst = try sema.analyzeDeclVal(block, func_src, callee.owner_decl); |
| 6893 | 6893 | ||
| ... | @@ -20396,7 +20396,7 @@ fn analyzeMinMax( | ... | @@ -20396,7 +20396,7 @@ fn analyzeMinMax( |
| 20396 | ) CompileError!Air.Inst.Ref { | 20396 | ) CompileError!Air.Inst.Ref { |
| 20397 | const simd_op = try sema.checkSimdBinOp(block, src, lhs, rhs, lhs_src, rhs_src); | 20397 | const simd_op = try sema.checkSimdBinOp(block, src, lhs, rhs, lhs_src, rhs_src); |
| 20398 | 20398 | ||
| 20399 | // TODO @maximum(max_int, undefined) should return max_int | 20399 | // TODO @max(max_int, undefined) should return max_int |
| 20400 | 20400 | ||
| 20401 | const runtime_src = if (simd_op.lhs_val) |lhs_val| rs: { | 20401 | const runtime_src = if (simd_op.lhs_val) |lhs_val| rs: { |
| 20402 | if (lhs_val.isUndef()) return sema.addConstUndef(simd_op.result_ty); | 20402 | if (lhs_val.isUndef()) return sema.addConstUndef(simd_op.result_ty); |
src/Zir.zig+10-10| ... | @@ -924,12 +924,12 @@ pub const Inst = struct { | ... | @@ -924,12 +924,12 @@ pub const Inst = struct { |
| 924 | /// Implements the `@memset` builtin. | 924 | /// Implements the `@memset` builtin. |
| 925 | /// Uses the `pl_node` union field with payload `Memset`. | 925 | /// Uses the `pl_node` union field with payload `Memset`. |
| 926 | memset, | 926 | memset, |
| 927 | /// Implements the `@minimum` builtin. | 927 | /// Implements the `@min` builtin. |
| 928 | /// Uses the `pl_node` union field with payload `Bin` | 928 | /// Uses the `pl_node` union field with payload `Bin` |
| 929 | minimum, | 929 | min, |
| 930 | /// Implements the `@maximum` builtin. | 930 | /// Implements the `@max` builtin. |
| 931 | /// Uses the `pl_node` union field with payload `Bin` | 931 | /// Uses the `pl_node` union field with payload `Bin` |
| 932 | maximum, | 932 | max, |
| 933 | /// Implements the `@cImport` builtin. | 933 | /// Implements the `@cImport` builtin. |
| 934 | /// Uses the `pl_node` union field with payload `Block`. | 934 | /// Uses the `pl_node` union field with payload `Block`. |
| 935 | c_import, | 935 | c_import, |
| ... | @@ -1217,10 +1217,10 @@ pub const Inst = struct { | ... | @@ -1217,10 +1217,10 @@ pub const Inst = struct { |
| 1217 | .mul_add, | 1217 | .mul_add, |
| 1218 | .builtin_call, | 1218 | .builtin_call, |
| 1219 | .field_parent_ptr, | 1219 | .field_parent_ptr, |
| 1220 | .maximum, | 1220 | .max, |
| 1221 | .memcpy, | 1221 | .memcpy, |
| 1222 | .memset, | 1222 | .memset, |
| 1223 | .minimum, | 1223 | .min, |
| 1224 | .c_import, | 1224 | .c_import, |
| 1225 | .@"resume", | 1225 | .@"resume", |
| 1226 | .@"await", | 1226 | .@"await", |
| ... | @@ -1502,8 +1502,8 @@ pub const Inst = struct { | ... | @@ -1502,8 +1502,8 @@ pub const Inst = struct { |
| 1502 | .mul_add, | 1502 | .mul_add, |
| 1503 | .builtin_call, | 1503 | .builtin_call, |
| 1504 | .field_parent_ptr, | 1504 | .field_parent_ptr, |
| 1505 | .maximum, | 1505 | .max, |
| 1506 | .minimum, | 1506 | .min, |
| 1507 | .c_import, | 1507 | .c_import, |
| 1508 | .@"resume", | 1508 | .@"resume", |
| 1509 | .@"await", | 1509 | .@"await", |
| ... | @@ -1785,10 +1785,10 @@ pub const Inst = struct { | ... | @@ -1785,10 +1785,10 @@ pub const Inst = struct { |
| 1785 | .mul_add = .pl_node, | 1785 | .mul_add = .pl_node, |
| 1786 | .builtin_call = .pl_node, | 1786 | .builtin_call = .pl_node, |
| 1787 | .field_parent_ptr = .pl_node, | 1787 | .field_parent_ptr = .pl_node, |
| 1788 | .maximum = .pl_node, | 1788 | .max = .pl_node, |
| 1789 | .memcpy = .pl_node, | 1789 | .memcpy = .pl_node, |
| 1790 | .memset = .pl_node, | 1790 | .memset = .pl_node, |
| 1791 | .minimum = .pl_node, | 1791 | .min = .pl_node, |
| 1792 | .c_import = .pl_node, | 1792 | .c_import = .pl_node, |
| 1793 | 1793 | ||
| 1794 | .alloc = .un_node, | 1794 | .alloc = .un_node, |
src/arch/aarch64/CodeGen.zig+3-3| ... | @@ -418,7 +418,7 @@ fn gen(self: *Self) !void { | ... | @@ -418,7 +418,7 @@ fn gen(self: *Self) !void { |
| 418 | 418 | ||
| 419 | const stack_offset = mem.alignForwardGeneric(u32, self.next_stack_offset, ptr_bytes) + ptr_bytes; | 419 | const stack_offset = mem.alignForwardGeneric(u32, self.next_stack_offset, ptr_bytes) + ptr_bytes; |
| 420 | self.next_stack_offset = stack_offset; | 420 | self.next_stack_offset = stack_offset; |
| 421 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 421 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 422 | 422 | ||
| 423 | try self.genSetStack(Type.usize, stack_offset, MCValue{ .register = ret_ptr_reg }); | 423 | try self.genSetStack(Type.usize, stack_offset, MCValue{ .register = ret_ptr_reg }); |
| 424 | self.ret_mcv = MCValue{ .stack_offset = stack_offset }; | 424 | self.ret_mcv = MCValue{ .stack_offset = stack_offset }; |
| ... | @@ -885,7 +885,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: u32) !u | ... | @@ -885,7 +885,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: u32) !u |
| 885 | // TODO find a free slot instead of always appending | 885 | // TODO find a free slot instead of always appending |
| 886 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; | 886 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; |
| 887 | self.next_stack_offset = offset; | 887 | self.next_stack_offset = offset; |
| 888 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 888 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 889 | try self.stack.putNoClobber(self.gpa, offset, .{ | 889 | try self.stack.putNoClobber(self.gpa, offset, .{ |
| 890 | .inst = inst, | 890 | .inst = inst, |
| 891 | .size = abi_size, | 891 | .size = abi_size, |
| ... | @@ -3643,7 +3643,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -3643,7 +3643,7 @@ fn airRetLoad(self: *Self, inst: Air.Inst.Index) !void { |
| 3643 | // TODO find a free slot instead of always appending | 3643 | // TODO find a free slot instead of always appending |
| 3644 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; | 3644 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; |
| 3645 | self.next_stack_offset = offset; | 3645 | self.next_stack_offset = offset; |
| 3646 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 3646 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 3647 | 3647 | ||
| 3648 | const tmp_mcv = MCValue{ .stack_offset = offset }; | 3648 | const tmp_mcv = MCValue{ .stack_offset = offset }; |
| 3649 | try self.load(tmp_mcv, ptr, ptr_ty); | 3649 | try self.load(tmp_mcv, ptr, ptr_ty); |
src/arch/arm/CodeGen.zig+1-1| ... | @@ -895,7 +895,7 @@ fn allocMem( | ... | @@ -895,7 +895,7 @@ fn allocMem( |
| 895 | // TODO find a free slot instead of always appending | 895 | // TODO find a free slot instead of always appending |
| 896 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; | 896 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset, abi_align) + abi_size; |
| 897 | self.next_stack_offset = offset; | 897 | self.next_stack_offset = offset; |
| 898 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 898 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 899 | 899 | ||
| 900 | if (maybe_inst) |inst| { | 900 | if (maybe_inst) |inst| { |
| 901 | try self.stack.putNoClobber(self.gpa, offset, .{ | 901 | try self.stack.putNoClobber(self.gpa, offset, .{ |
src/arch/x86_64/CodeGen.zig+2-2| ... | @@ -418,7 +418,7 @@ fn gen(self: *Self) InnerError!void { | ... | @@ -418,7 +418,7 @@ fn gen(self: *Self) InnerError!void { |
| 418 | // spill it to stack immediately. | 418 | // spill it to stack immediately. |
| 419 | const stack_offset = mem.alignForwardGeneric(u32, self.next_stack_offset + 8, 8); | 419 | const stack_offset = mem.alignForwardGeneric(u32, self.next_stack_offset + 8, 8); |
| 420 | self.next_stack_offset = stack_offset; | 420 | self.next_stack_offset = stack_offset; |
| 421 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 421 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 422 | 422 | ||
| 423 | const ret_reg = abi.getCAbiIntParamRegs(self.target.*)[0]; | 423 | const ret_reg = abi.getCAbiIntParamRegs(self.target.*)[0]; |
| 424 | try self.genSetStack(Type.usize, @intCast(i32, stack_offset), MCValue{ .register = ret_reg }, .{}); | 424 | try self.genSetStack(Type.usize, @intCast(i32, stack_offset), MCValue{ .register = ret_reg }, .{}); |
| ... | @@ -884,7 +884,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: u32) !u | ... | @@ -884,7 +884,7 @@ fn allocMem(self: *Self, inst: Air.Inst.Index, abi_size: u32, abi_align: u32) !u |
| 884 | // TODO find a free slot instead of always appending | 884 | // TODO find a free slot instead of always appending |
| 885 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset + abi_size, abi_align); | 885 | const offset = mem.alignForwardGeneric(u32, self.next_stack_offset + abi_size, abi_align); |
| 886 | self.next_stack_offset = offset; | 886 | self.next_stack_offset = offset; |
| 887 | self.max_end_stack = @maximum(self.max_end_stack, self.next_stack_offset); | 887 | self.max_end_stack = @max(self.max_end_stack, self.next_stack_offset); |
| 888 | try self.stack.putNoClobber(self.gpa, offset, .{ | 888 | try self.stack.putNoClobber(self.gpa, offset, .{ |
| 889 | .inst = inst, | 889 | .inst = inst, |
| 890 | .size = abi_size, | 890 | .size = abi_size, |
src/codegen/llvm.zig+13-13| ... | @@ -996,7 +996,7 @@ pub const Object = struct { | ... | @@ -996,7 +996,7 @@ pub const Object = struct { |
| 996 | const abi_size = @intCast(c_uint, param_ty.abiSize(target)); | 996 | const abi_size = @intCast(c_uint, param_ty.abiSize(target)); |
| 997 | const int_llvm_ty = dg.context.intType(abi_size * 8); | 997 | const int_llvm_ty = dg.context.intType(abi_size * 8); |
| 998 | const int_ptr_llvm_ty = int_llvm_ty.pointerType(0); | 998 | const int_ptr_llvm_ty = int_llvm_ty.pointerType(0); |
| 999 | const alignment = @maximum( | 999 | const alignment = @max( |
| 1000 | param_ty.abiAlignment(target), | 1000 | param_ty.abiAlignment(target), |
| 1001 | dg.object.target_data.abiAlignmentOfType(int_llvm_ty), | 1001 | dg.object.target_data.abiAlignmentOfType(int_llvm_ty), |
| 1002 | ); | 1002 | ); |
| ... | @@ -1032,7 +1032,7 @@ pub const Object = struct { | ... | @@ -1032,7 +1032,7 @@ pub const Object = struct { |
| 1032 | if (ptr_info.@"align" != 0) { | 1032 | if (ptr_info.@"align" != 0) { |
| 1033 | dg.addArgAttrInt(llvm_func, llvm_arg_i, "align", ptr_info.@"align"); | 1033 | dg.addArgAttrInt(llvm_func, llvm_arg_i, "align", ptr_info.@"align"); |
| 1034 | } else { | 1034 | } else { |
| 1035 | const elem_align = @maximum(ptr_info.pointee_type.abiAlignment(target), 1); | 1035 | const elem_align = @max(ptr_info.pointee_type.abiAlignment(target), 1); |
| 1036 | dg.addArgAttrInt(llvm_func, llvm_arg_i, "align", elem_align); | 1036 | dg.addArgAttrInt(llvm_func, llvm_arg_i, "align", elem_align); |
| 1037 | } | 1037 | } |
| 1038 | const ptr_param = llvm_func.getParam(llvm_arg_i); | 1038 | const ptr_param = llvm_func.getParam(llvm_arg_i); |
| ... | @@ -2869,7 +2869,7 @@ pub const DeclGen = struct { | ... | @@ -2869,7 +2869,7 @@ pub const DeclGen = struct { |
| 2869 | if (field_val.tag() != .unreachable_value) continue; | 2869 | if (field_val.tag() != .unreachable_value) continue; |
| 2870 | 2870 | ||
| 2871 | const field_align = field_ty.abiAlignment(target); | 2871 | const field_align = field_ty.abiAlignment(target); |
| 2872 | big_align = @maximum(big_align, field_align); | 2872 | big_align = @max(big_align, field_align); |
| 2873 | const prev_offset = offset; | 2873 | const prev_offset = offset; |
| 2874 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 2874 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 2875 | 2875 | ||
| ... | @@ -2935,7 +2935,7 @@ pub const DeclGen = struct { | ... | @@ -2935,7 +2935,7 @@ pub const DeclGen = struct { |
| 2935 | const field_ty_align = field.ty.abiAlignment(target); | 2935 | const field_ty_align = field.ty.abiAlignment(target); |
| 2936 | any_underaligned_fields = any_underaligned_fields or | 2936 | any_underaligned_fields = any_underaligned_fields or |
| 2937 | field_align < field_ty_align; | 2937 | field_align < field_ty_align; |
| 2938 | big_align = @maximum(big_align, field_align); | 2938 | big_align = @max(big_align, field_align); |
| 2939 | const prev_offset = offset; | 2939 | const prev_offset = offset; |
| 2940 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 2940 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 2941 | 2941 | ||
| ... | @@ -3557,7 +3557,7 @@ pub const DeclGen = struct { | ... | @@ -3557,7 +3557,7 @@ pub const DeclGen = struct { |
| 3557 | if (!field_ty.hasRuntimeBitsIgnoreComptime()) continue; | 3557 | if (!field_ty.hasRuntimeBitsIgnoreComptime()) continue; |
| 3558 | 3558 | ||
| 3559 | const field_align = field_ty.abiAlignment(target); | 3559 | const field_align = field_ty.abiAlignment(target); |
| 3560 | big_align = @maximum(big_align, field_align); | 3560 | big_align = @max(big_align, field_align); |
| 3561 | const prev_offset = offset; | 3561 | const prev_offset = offset; |
| 3562 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 3562 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 3563 | 3563 | ||
| ... | @@ -3652,7 +3652,7 @@ pub const DeclGen = struct { | ... | @@ -3652,7 +3652,7 @@ pub const DeclGen = struct { |
| 3652 | if (field.is_comptime or !field.ty.hasRuntimeBits()) continue; | 3652 | if (field.is_comptime or !field.ty.hasRuntimeBits()) continue; |
| 3653 | 3653 | ||
| 3654 | const field_align = field.alignment(target, struct_obj.layout); | 3654 | const field_align = field.alignment(target, struct_obj.layout); |
| 3655 | big_align = @maximum(big_align, field_align); | 3655 | big_align = @max(big_align, field_align); |
| 3656 | const prev_offset = offset; | 3656 | const prev_offset = offset; |
| 3657 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 3657 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 3658 | 3658 | ||
| ... | @@ -4244,7 +4244,7 @@ pub const DeclGen = struct { | ... | @@ -4244,7 +4244,7 @@ pub const DeclGen = struct { |
| 4244 | if (ptr_info.@"align" != 0) { | 4244 | if (ptr_info.@"align" != 0) { |
| 4245 | dg.addArgAttrInt(llvm_fn, llvm_arg_i, "align", ptr_info.@"align"); | 4245 | dg.addArgAttrInt(llvm_fn, llvm_arg_i, "align", ptr_info.@"align"); |
| 4246 | } else { | 4246 | } else { |
| 4247 | const elem_align = @maximum( | 4247 | const elem_align = @max( |
| 4248 | ptr_info.pointee_type.abiAlignment(target), | 4248 | ptr_info.pointee_type.abiAlignment(target), |
| 4249 | 1, | 4249 | 1, |
| 4250 | ); | 4250 | ); |
| ... | @@ -4710,7 +4710,7 @@ pub const FuncGen = struct { | ... | @@ -4710,7 +4710,7 @@ pub const FuncGen = struct { |
| 4710 | } else { | 4710 | } else { |
| 4711 | // LLVM does not allow bitcasting structs so we must allocate | 4711 | // LLVM does not allow bitcasting structs so we must allocate |
| 4712 | // a local, bitcast its pointer, store, and then load. | 4712 | // a local, bitcast its pointer, store, and then load. |
| 4713 | const alignment = @maximum( | 4713 | const alignment = @max( |
| 4714 | param_ty.abiAlignment(target), | 4714 | param_ty.abiAlignment(target), |
| 4715 | self.dg.object.target_data.abiAlignmentOfType(int_llvm_ty), | 4715 | self.dg.object.target_data.abiAlignmentOfType(int_llvm_ty), |
| 4716 | ); | 4716 | ); |
| ... | @@ -7778,7 +7778,7 @@ pub const FuncGen = struct { | ... | @@ -7778,7 +7778,7 @@ pub const FuncGen = struct { |
| 7778 | 7778 | ||
| 7779 | if (result_is_ref) { | 7779 | if (result_is_ref) { |
| 7780 | // Bitcast the result pointer, then store. | 7780 | // Bitcast the result pointer, then store. |
| 7781 | const alignment = @maximum(operand_ty.abiAlignment(target), inst_ty.abiAlignment(target)); | 7781 | const alignment = @max(operand_ty.abiAlignment(target), inst_ty.abiAlignment(target)); |
| 7782 | const result_ptr = self.buildAlloca(llvm_dest_ty, alignment); | 7782 | const result_ptr = self.buildAlloca(llvm_dest_ty, alignment); |
| 7783 | const operand_llvm_ty = try self.dg.lowerType(operand_ty); | 7783 | const operand_llvm_ty = try self.dg.lowerType(operand_ty); |
| 7784 | const casted_ptr = self.builder.buildBitCast(result_ptr, operand_llvm_ty.pointerType(0), ""); | 7784 | const casted_ptr = self.builder.buildBitCast(result_ptr, operand_llvm_ty.pointerType(0), ""); |
| ... | @@ -7791,7 +7791,7 @@ pub const FuncGen = struct { | ... | @@ -7791,7 +7791,7 @@ pub const FuncGen = struct { |
| 7791 | // Both our operand and our result are values, not pointers, | 7791 | // Both our operand and our result are values, not pointers, |
| 7792 | // but LLVM won't let us bitcast struct values. | 7792 | // but LLVM won't let us bitcast struct values. |
| 7793 | // Therefore, we store operand to bitcasted alloca, then load for result. | 7793 | // Therefore, we store operand to bitcasted alloca, then load for result. |
| 7794 | const alignment = @maximum(operand_ty.abiAlignment(target), inst_ty.abiAlignment(target)); | 7794 | const alignment = @max(operand_ty.abiAlignment(target), inst_ty.abiAlignment(target)); |
| 7795 | const result_ptr = self.buildAlloca(llvm_dest_ty, alignment); | 7795 | const result_ptr = self.buildAlloca(llvm_dest_ty, alignment); |
| 7796 | const operand_llvm_ty = try self.dg.lowerType(operand_ty); | 7796 | const operand_llvm_ty = try self.dg.lowerType(operand_ty); |
| 7797 | const casted_ptr = self.builder.buildBitCast(result_ptr, operand_llvm_ty.pointerType(0), ""); | 7797 | const casted_ptr = self.builder.buildBitCast(result_ptr, operand_llvm_ty.pointerType(0), ""); |
| ... | @@ -9444,7 +9444,7 @@ pub const FuncGen = struct { | ... | @@ -9444,7 +9444,7 @@ pub const FuncGen = struct { |
| 9444 | const elem_llvm_ty = try self.dg.lowerType(info.pointee_type); | 9444 | const elem_llvm_ty = try self.dg.lowerType(info.pointee_type); |
| 9445 | if (isByRef(info.pointee_type)) { | 9445 | if (isByRef(info.pointee_type)) { |
| 9446 | const result_align = info.pointee_type.abiAlignment(target); | 9446 | const result_align = info.pointee_type.abiAlignment(target); |
| 9447 | const max_align = @maximum(result_align, ptr_alignment); | 9447 | const max_align = @max(result_align, ptr_alignment); |
| 9448 | const result_ptr = self.buildAlloca(elem_llvm_ty, max_align); | 9448 | const result_ptr = self.buildAlloca(elem_llvm_ty, max_align); |
| 9449 | const llvm_ptr_u8 = self.context.intType(8).pointerType(0); | 9449 | const llvm_ptr_u8 = self.context.intType(8).pointerType(0); |
| 9450 | const llvm_usize = self.context.intType(Type.usize.intInfo(target).bits); | 9450 | const llvm_usize = self.context.intType(Type.usize.intInfo(target).bits); |
| ... | @@ -9995,7 +9995,7 @@ fn llvmFieldIndex( | ... | @@ -9995,7 +9995,7 @@ fn llvmFieldIndex( |
| 9995 | if (tuple.values[i].tag() != .unreachable_value) continue; | 9995 | if (tuple.values[i].tag() != .unreachable_value) continue; |
| 9996 | 9996 | ||
| 9997 | const field_align = field_ty.abiAlignment(target); | 9997 | const field_align = field_ty.abiAlignment(target); |
| 9998 | big_align = @maximum(big_align, field_align); | 9998 | big_align = @max(big_align, field_align); |
| 9999 | const prev_offset = offset; | 9999 | const prev_offset = offset; |
| 10000 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 10000 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 10001 | 10001 | ||
| ... | @@ -10028,7 +10028,7 @@ fn llvmFieldIndex( | ... | @@ -10028,7 +10028,7 @@ fn llvmFieldIndex( |
| 10028 | if (field.is_comptime or !field.ty.hasRuntimeBits()) continue; | 10028 | if (field.is_comptime or !field.ty.hasRuntimeBits()) continue; |
| 10029 | 10029 | ||
| 10030 | const field_align = field.alignment(target, layout); | 10030 | const field_align = field.alignment(target, layout); |
| 10031 | big_align = @maximum(big_align, field_align); | 10031 | big_align = @max(big_align, field_align); |
| 10032 | const prev_offset = offset; | 10032 | const prev_offset = offset; |
| 10033 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 10033 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 10034 | 10034 |
src/link/Coff.zig+3-3| ... | @@ -609,7 +609,7 @@ fn allocateAtom(self: *Coff, atom: *Atom, new_atom_size: u32, alignment: u32) !u | ... | @@ -609,7 +609,7 @@ fn allocateAtom(self: *Coff, atom: *Atom, new_atom_size: u32, alignment: u32) !u |
| 609 | self.markRelocsDirtyByAddress(header.virtual_address + needed_size); | 609 | self.markRelocsDirtyByAddress(header.virtual_address + needed_size); |
| 610 | } | 610 | } |
| 611 | 611 | ||
| 612 | header.virtual_size = @maximum(header.virtual_size, needed_size); | 612 | header.virtual_size = @max(header.virtual_size, needed_size); |
| 613 | header.size_of_raw_data = needed_size; | 613 | header.size_of_raw_data = needed_size; |
| 614 | maybe_last_atom.* = atom; | 614 | maybe_last_atom.* = atom; |
| 615 | } | 615 | } |
| ... | @@ -1657,7 +1657,7 @@ fn writeBaseRelocations(self: *Coff) !void { | ... | @@ -1657,7 +1657,7 @@ fn writeBaseRelocations(self: *Coff) !void { |
| 1657 | try self.growSectionVM(self.reloc_section_index.?, needed_size); | 1657 | try self.growSectionVM(self.reloc_section_index.?, needed_size); |
| 1658 | } | 1658 | } |
| 1659 | } | 1659 | } |
| 1660 | header.virtual_size = @maximum(header.virtual_size, needed_size); | 1660 | header.virtual_size = @max(header.virtual_size, needed_size); |
| 1661 | header.size_of_raw_data = needed_size; | 1661 | header.size_of_raw_data = needed_size; |
| 1662 | 1662 | ||
| 1663 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); | 1663 | try self.base.file.?.pwriteAll(buffer.items, header.pointer_to_raw_data); |
| ... | @@ -1937,7 +1937,7 @@ pub fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) { | ... | @@ -1937,7 +1937,7 @@ pub fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) { |
| 1937 | } | 1937 | } |
| 1938 | 1938 | ||
| 1939 | fn detectAllocCollision(self: *Coff, start: u32, size: u32) ?u32 { | 1939 | fn detectAllocCollision(self: *Coff, start: u32, size: u32) ?u32 { |
| 1940 | const headers_size = @maximum(self.getSizeOfHeaders(), self.page_size); | 1940 | const headers_size = @max(self.getSizeOfHeaders(), self.page_size); |
| 1941 | if (start < headers_size) | 1941 | if (start < headers_size) |
| 1942 | return headers_size; | 1942 | return headers_size; |
| 1943 | 1943 |
src/link/Dwarf.zig+1-1| ... | @@ -1898,7 +1898,7 @@ fn writeDbgInfoNopsToArrayList( | ... | @@ -1898,7 +1898,7 @@ fn writeDbgInfoNopsToArrayList( |
| 1898 | next_padding_size: usize, | 1898 | next_padding_size: usize, |
| 1899 | trailing_zero: bool, | 1899 | trailing_zero: bool, |
| 1900 | ) Allocator.Error!void { | 1900 | ) Allocator.Error!void { |
| 1901 | try buffer.resize(gpa, @maximum( | 1901 | try buffer.resize(gpa, @max( |
| 1902 | buffer.items.len, | 1902 | buffer.items.len, |
| 1903 | offset + content.len + next_padding_size + 1, | 1903 | offset + content.len + next_padding_size + 1, |
| 1904 | )); | 1904 | )); |
src/link/MachO.zig+3-3| ... | @@ -3419,7 +3419,7 @@ pub fn populateMissingMetadata(self: *MachO) !void { | ... | @@ -3419,7 +3419,7 @@ pub fn populateMissingMetadata(self: *MachO) !void { |
| 3419 | if (self.header_segment_cmd_index == null) { | 3419 | if (self.header_segment_cmd_index == null) { |
| 3420 | // The first __TEXT segment is immovable and covers MachO header and load commands. | 3420 | // The first __TEXT segment is immovable and covers MachO header and load commands. |
| 3421 | self.header_segment_cmd_index = @intCast(u8, self.segments.items.len); | 3421 | self.header_segment_cmd_index = @intCast(u8, self.segments.items.len); |
| 3422 | const ideal_size = @maximum(self.base.options.headerpad_size orelse 0, default_headerpad_size); | 3422 | const ideal_size = @max(self.base.options.headerpad_size orelse 0, default_headerpad_size); |
| 3423 | const needed_size = mem.alignForwardGeneric(u64, padToIdeal(ideal_size), self.page_size); | 3423 | const needed_size = mem.alignForwardGeneric(u64, padToIdeal(ideal_size), self.page_size); |
| 3424 | 3424 | ||
| 3425 | log.debug("found __TEXT segment (header-only) free space 0x{x} to 0x{x}", .{ 0, needed_size }); | 3425 | log.debug("found __TEXT segment (header-only) free space 0x{x} to 0x{x}", .{ 0, needed_size }); |
| ... | @@ -3647,7 +3647,7 @@ pub fn calcMinHeaderPad(self: *MachO) !u64 { | ... | @@ -3647,7 +3647,7 @@ pub fn calcMinHeaderPad(self: *MachO) !u64 { |
| 3647 | log.debug("headerpad_max_install_names minimum headerpad size 0x{x}", .{ | 3647 | log.debug("headerpad_max_install_names minimum headerpad size 0x{x}", .{ |
| 3648 | min_headerpad_size + @sizeOf(macho.mach_header_64), | 3648 | min_headerpad_size + @sizeOf(macho.mach_header_64), |
| 3649 | }); | 3649 | }); |
| 3650 | padding = @maximum(padding, min_headerpad_size); | 3650 | padding = @max(padding, min_headerpad_size); |
| 3651 | } | 3651 | } |
| 3652 | const offset = @sizeOf(macho.mach_header_64) + padding; | 3652 | const offset = @sizeOf(macho.mach_header_64) + padding; |
| 3653 | log.debug("actual headerpad size 0x{x}", .{offset}); | 3653 | log.debug("actual headerpad size 0x{x}", .{offset}); |
| ... | @@ -3980,7 +3980,7 @@ pub fn addAtomToSection(self: *MachO, atom: *Atom) !void { | ... | @@ -3980,7 +3980,7 @@ pub fn addAtomToSection(self: *MachO, atom: *Atom) !void { |
| 3980 | const aligned_end_addr = mem.alignForwardGeneric(u64, section.header.size, atom_alignment); | 3980 | const aligned_end_addr = mem.alignForwardGeneric(u64, section.header.size, atom_alignment); |
| 3981 | const padding = aligned_end_addr - section.header.size; | 3981 | const padding = aligned_end_addr - section.header.size; |
| 3982 | section.header.size += padding + atom.size; | 3982 | section.header.size += padding + atom.size; |
| 3983 | section.header.@"align" = @maximum(section.header.@"align", atom.alignment); | 3983 | section.header.@"align" = @max(section.header.@"align", atom.alignment); |
| 3984 | self.sections.set(sect_id, section); | 3984 | self.sections.set(sect_id, section); |
| 3985 | } | 3985 | } |
| 3986 | 3986 |
src/link/MachO/dead_strip.zig+1-1| ... | @@ -284,7 +284,7 @@ fn prune(arena: Allocator, alive: std.AutoHashMap(*Atom, void), macho_file: *Mac | ... | @@ -284,7 +284,7 @@ fn prune(arena: Allocator, alive: std.AutoHashMap(*Atom, void), macho_file: *Mac |
| 284 | const aligned_end_addr = mem.alignForwardGeneric(u64, section.header.size, atom_alignment); | 284 | const aligned_end_addr = mem.alignForwardGeneric(u64, section.header.size, atom_alignment); |
| 285 | const padding = aligned_end_addr - section.header.size; | 285 | const padding = aligned_end_addr - section.header.size; |
| 286 | section.header.size += padding + atom.size; | 286 | section.header.size += padding + atom.size; |
| 287 | section.header.@"align" = @maximum(section.header.@"align", atom.alignment); | 287 | section.header.@"align" = @max(section.header.@"align", atom.alignment); |
| 288 | 288 | ||
| 289 | if (atom.next) |next| { | 289 | if (atom.next) |next| { |
| 290 | atom = next; | 290 | atom = next; |
src/print_zir.zig+2-2| ... | @@ -342,8 +342,8 @@ const Writer = struct { | ... | @@ -342,8 +342,8 @@ const Writer = struct { |
| 342 | .reduce, | 342 | .reduce, |
| 343 | .bitcast, | 343 | .bitcast, |
| 344 | .vector_type, | 344 | .vector_type, |
| 345 | .maximum, | 345 | .max, |
| 346 | .minimum, | 346 | .min, |
| 347 | .elem_ptr_node, | 347 | .elem_ptr_node, |
| 348 | .elem_val_node, | 348 | .elem_val_node, |
| 349 | .elem_ptr, | 349 | .elem_ptr, |
src/stage1/all_types.hpp+2-2| ... | @@ -2996,8 +2996,8 @@ enum IrBinOp { | ... | @@ -2996,8 +2996,8 @@ enum IrBinOp { |
| 2996 | IrBinOpRemMod, | 2996 | IrBinOpRemMod, |
| 2997 | IrBinOpArrayCat, | 2997 | IrBinOpArrayCat, |
| 2998 | IrBinOpArrayMult, | 2998 | IrBinOpArrayMult, |
| 2999 | IrBinOpMaximum, | 2999 | IrBinOpMax, |
| 3000 | IrBinOpMinimum, | 3000 | IrBinOpMin, |
| 3001 | IrBinOpAddSat, | 3001 | IrBinOpAddSat, |
| 3002 | IrBinOpSubSat, | 3002 | IrBinOpSubSat, |
| 3003 | IrBinOpMultSat, | 3003 | IrBinOpMultSat, |
src/stage1/astgen.cpp+2-2| ... | @@ -4758,7 +4758,7 @@ static Stage1ZirInst *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -4758,7 +4758,7 @@ static Stage1ZirInst *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, Ast |
| 4758 | if (arg1_value == ag->codegen->invalid_inst_src) | 4758 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4759 | return arg1_value; | 4759 | return arg1_value; |
| 4760 | 4760 | ||
| 4761 | Stage1ZirInst *bin_op = ir_build_bin_op(ag, scope, node, IrBinOpMaximum, arg0_value, arg1_value, true); | 4761 | Stage1ZirInst *bin_op = ir_build_bin_op(ag, scope, node, IrBinOpMax, arg0_value, arg1_value, true); |
| 4762 | return ir_lval_wrap(ag, scope, bin_op, lval, result_loc); | 4762 | return ir_lval_wrap(ag, scope, bin_op, lval, result_loc); |
| 4763 | } | 4763 | } |
| 4764 | case BuiltinFnIdMemcpy: | 4764 | case BuiltinFnIdMemcpy: |
| ... | @@ -4813,7 +4813,7 @@ static Stage1ZirInst *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, Ast | ... | @@ -4813,7 +4813,7 @@ static Stage1ZirInst *astgen_builtin_fn_call(Stage1AstGen *ag, Scope *scope, Ast |
| 4813 | if (arg1_value == ag->codegen->invalid_inst_src) | 4813 | if (arg1_value == ag->codegen->invalid_inst_src) |
| 4814 | return arg1_value; | 4814 | return arg1_value; |
| 4815 | 4815 | ||
| 4816 | Stage1ZirInst *bin_op = ir_build_bin_op(ag, scope, node, IrBinOpMinimum, arg0_value, arg1_value, true); | 4816 | Stage1ZirInst *bin_op = ir_build_bin_op(ag, scope, node, IrBinOpMin, arg0_value, arg1_value, true); |
| 4817 | return ir_lval_wrap(ag, scope, bin_op, lval, result_loc); | 4817 | return ir_lval_wrap(ag, scope, bin_op, lval, result_loc); |
| 4818 | } | 4818 | } |
| 4819 | case BuiltinFnIdWasmMemorySize: | 4819 | case BuiltinFnIdWasmMemorySize: |
src/stage1/codegen.cpp+6-6| ... | @@ -3590,10 +3590,10 @@ static LLVMValueRef gen_soft_float_bin_op(CodeGen *g, LLVMValueRef op1_value, LL | ... | @@ -3590,10 +3590,10 @@ static LLVMValueRef gen_soft_float_bin_op(CodeGen *g, LLVMValueRef op1_value, LL |
| 3590 | snprintf(fn_name, sizeof(fn_name), "__ge%sf2", compiler_rt_type_abbrev); | 3590 | snprintf(fn_name, sizeof(fn_name), "__ge%sf2", compiler_rt_type_abbrev); |
| 3591 | res_icmp = EQ_ONE; | 3591 | res_icmp = EQ_ONE; |
| 3592 | break; | 3592 | break; |
| 3593 | case IrBinOpMaximum: | 3593 | case IrBinOpMax: |
| 3594 | snprintf(fn_name, sizeof(fn_name), "%sfmax%s", math_float_prefix, math_float_suffix); | 3594 | snprintf(fn_name, sizeof(fn_name), "%sfmax%s", math_float_prefix, math_float_suffix); |
| 3595 | break; | 3595 | break; |
| 3596 | case IrBinOpMinimum: | 3596 | case IrBinOpMin: |
| 3597 | snprintf(fn_name, sizeof(fn_name), "%sfmin%s", math_float_prefix, math_float_suffix); | 3597 | snprintf(fn_name, sizeof(fn_name), "%sfmin%s", math_float_prefix, math_float_suffix); |
| 3598 | break; | 3598 | break; |
| 3599 | case IrBinOpMult: | 3599 | case IrBinOpMult: |
| ... | @@ -3864,7 +3864,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable, | ... | @@ -3864,7 +3864,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable, |
| 3864 | case IrBinOpRemMod: | 3864 | case IrBinOpRemMod: |
| 3865 | return gen_rem(g, want_runtime_safety, ir_want_fast_math(g, &bin_op_instruction->base), | 3865 | return gen_rem(g, want_runtime_safety, ir_want_fast_math(g, &bin_op_instruction->base), |
| 3866 | op1_value, op2_value, operand_type, RemKindMod); | 3866 | op1_value, op2_value, operand_type, RemKindMod); |
| 3867 | case IrBinOpMaximum: | 3867 | case IrBinOpMax: |
| 3868 | if (scalar_type->id == ZigTypeIdFloat) { | 3868 | if (scalar_type->id == ZigTypeIdFloat) { |
| 3869 | return ZigLLVMBuildMaxNum(g->builder, op1_value, op2_value, ""); | 3869 | return ZigLLVMBuildMaxNum(g->builder, op1_value, op2_value, ""); |
| 3870 | } else if (scalar_type->id == ZigTypeIdInt) { | 3870 | } else if (scalar_type->id == ZigTypeIdInt) { |
| ... | @@ -3876,7 +3876,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable, | ... | @@ -3876,7 +3876,7 @@ static LLVMValueRef ir_render_bin_op(CodeGen *g, Stage1Air *executable, |
| 3876 | } else { | 3876 | } else { |
| 3877 | zig_unreachable(); | 3877 | zig_unreachable(); |
| 3878 | } | 3878 | } |
| 3879 | case IrBinOpMinimum: | 3879 | case IrBinOpMin: |
| 3880 | if (scalar_type->id == ZigTypeIdFloat) { | 3880 | if (scalar_type->id == ZigTypeIdFloat) { |
| 3881 | return ZigLLVMBuildMinNum(g->builder, op1_value, op2_value, ""); | 3881 | return ZigLLVMBuildMinNum(g->builder, op1_value, op2_value, ""); |
| 3882 | } else if (scalar_type->id == ZigTypeIdInt) { | 3882 | } else if (scalar_type->id == ZigTypeIdInt) { |
| ... | @@ -10182,8 +10182,8 @@ static void define_builtin_fns(CodeGen *g) { | ... | @@ -10182,8 +10182,8 @@ static void define_builtin_fns(CodeGen *g) { |
| 10182 | create_builtin_fn(g, BuiltinFnIdWasmMemoryGrow, "wasmMemoryGrow", 2); | 10182 | create_builtin_fn(g, BuiltinFnIdWasmMemoryGrow, "wasmMemoryGrow", 2); |
| 10183 | create_builtin_fn(g, BuiltinFnIdSrc, "src", 0); | 10183 | create_builtin_fn(g, BuiltinFnIdSrc, "src", 0); |
| 10184 | create_builtin_fn(g, BuiltinFnIdReduce, "reduce", 2); | 10184 | create_builtin_fn(g, BuiltinFnIdReduce, "reduce", 2); |
| 10185 | create_builtin_fn(g, BuiltinFnIdMaximum, "maximum", 2); | 10185 | create_builtin_fn(g, BuiltinFnIdMaximum, "max", 2); |
| 10186 | create_builtin_fn(g, BuiltinFnIdMinimum, "minimum", 2); | 10186 | create_builtin_fn(g, BuiltinFnIdMinimum, "min", 2); |
| 10187 | create_builtin_fn(g, BuiltinFnIdPrefetch, "prefetch", 2); | 10187 | create_builtin_fn(g, BuiltinFnIdPrefetch, "prefetch", 2); |
| 10188 | create_builtin_fn(g, BuiltinFnIdAddrSpaceCast, "addrSpaceCast", 2); | 10188 | create_builtin_fn(g, BuiltinFnIdAddrSpaceCast, "addrSpaceCast", 2); |
| 10189 | } | 10189 | } |
src/stage1/ir.cpp+6-6| ... | @@ -10072,14 +10072,14 @@ static ErrorMsg *ir_eval_math_op_scalar(IrAnalyze *ira, Scope *scope, AstNode *s | ... | @@ -10072,14 +10072,14 @@ static ErrorMsg *ir_eval_math_op_scalar(IrAnalyze *ira, Scope *scope, AstNode *s |
| 10072 | float_mod(out_val, op1_val, op2_val); | 10072 | float_mod(out_val, op1_val, op2_val); |
| 10073 | } | 10073 | } |
| 10074 | break; | 10074 | break; |
| 10075 | case IrBinOpMaximum: | 10075 | case IrBinOpMax: |
| 10076 | if (is_int) { | 10076 | if (is_int) { |
| 10077 | bigint_max(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint); | 10077 | bigint_max(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 10078 | } else { | 10078 | } else { |
| 10079 | float_max(out_val, op1_val, op2_val); | 10079 | float_max(out_val, op1_val, op2_val); |
| 10080 | } | 10080 | } |
| 10081 | break; | 10081 | break; |
| 10082 | case IrBinOpMinimum: | 10082 | case IrBinOpMin: |
| 10083 | if (is_int) { | 10083 | if (is_int) { |
| 10084 | bigint_min(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint); | 10084 | bigint_min(&out_val->data.x_bigint, &op1_val->data.x_bigint, &op2_val->data.x_bigint); |
| 10085 | } else { | 10085 | } else { |
| ... | @@ -10440,8 +10440,8 @@ static bool ok_float_op(IrBinOp op) { | ... | @@ -10440,8 +10440,8 @@ static bool ok_float_op(IrBinOp op) { |
| 10440 | case IrBinOpRemRem: | 10440 | case IrBinOpRemRem: |
| 10441 | case IrBinOpRemMod: | 10441 | case IrBinOpRemMod: |
| 10442 | case IrBinOpRemUnspecified: | 10442 | case IrBinOpRemUnspecified: |
| 10443 | case IrBinOpMaximum: | 10443 | case IrBinOpMax: |
| 10444 | case IrBinOpMinimum: | 10444 | case IrBinOpMin: |
| 10445 | return true; | 10445 | return true; |
| 10446 | 10446 | ||
| 10447 | case IrBinOpBoolOr: | 10447 | case IrBinOpBoolOr: |
| ... | @@ -11451,8 +11451,8 @@ static Stage1AirInst *ir_analyze_instruction_bin_op(IrAnalyze *ira, Stage1ZirIns | ... | @@ -11451,8 +11451,8 @@ static Stage1AirInst *ir_analyze_instruction_bin_op(IrAnalyze *ira, Stage1ZirIns |
| 11451 | case IrBinOpRemUnspecified: | 11451 | case IrBinOpRemUnspecified: |
| 11452 | case IrBinOpRemRem: | 11452 | case IrBinOpRemRem: |
| 11453 | case IrBinOpRemMod: | 11453 | case IrBinOpRemMod: |
| 11454 | case IrBinOpMaximum: | 11454 | case IrBinOpMax: |
| 11455 | case IrBinOpMinimum: | 11455 | case IrBinOpMin: |
| 11456 | case IrBinOpAddSat: | 11456 | case IrBinOpAddSat: |
| 11457 | case IrBinOpSubSat: | 11457 | case IrBinOpSubSat: |
| 11458 | case IrBinOpMultSat: | 11458 | case IrBinOpMultSat: |
src/stage1/ir_print.cpp+4-4| ... | @@ -739,10 +739,10 @@ static const char *ir_bin_op_id_str(IrBinOp op_id) { | ... | @@ -739,10 +739,10 @@ static const char *ir_bin_op_id_str(IrBinOp op_id) { |
| 739 | return "++"; | 739 | return "++"; |
| 740 | case IrBinOpArrayMult: | 740 | case IrBinOpArrayMult: |
| 741 | return "**"; | 741 | return "**"; |
| 742 | case IrBinOpMaximum: | 742 | case IrBinOpMax: |
| 743 | return "@maximum"; | 743 | return "@max"; |
| 744 | case IrBinOpMinimum: | 744 | case IrBinOpMin: |
| 745 | return "@minimum"; | 745 | return "@min"; |
| 746 | case IrBinOpAddSat: | 746 | case IrBinOpAddSat: |
| 747 | return "@addWithSaturation"; | 747 | return "@addWithSaturation"; |
| 748 | case IrBinOpSubSat: | 748 | case IrBinOpSubSat: |
src/type.zig+13-13| ... | @@ -2998,7 +2998,7 @@ pub const Type = extern union { | ... | @@ -2998,7 +2998,7 @@ pub const Type = extern union { |
| 2998 | return child_type.abiAlignmentAdvanced(target, strat); | 2998 | return child_type.abiAlignmentAdvanced(target, strat); |
| 2999 | }, | 2999 | }, |
| 3000 | .lazy => |arena| switch (try child_type.abiAlignmentAdvanced(target, strat)) { | 3000 | .lazy => |arena| switch (try child_type.abiAlignmentAdvanced(target, strat)) { |
| 3001 | .scalar => |x| return AbiAlignmentAdvanced{ .scalar = @maximum(x, 1) }, | 3001 | .scalar => |x| return AbiAlignmentAdvanced{ .scalar = @max(x, 1) }, |
| 3002 | .val => return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, | 3002 | .val => return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, |
| 3003 | }, | 3003 | }, |
| 3004 | } | 3004 | } |
| ... | @@ -3014,7 +3014,7 @@ pub const Type = extern union { | ... | @@ -3014,7 +3014,7 @@ pub const Type = extern union { |
| 3014 | if (!(try data.payload.hasRuntimeBitsAdvanced(false, sema_kit))) { | 3014 | if (!(try data.payload.hasRuntimeBitsAdvanced(false, sema_kit))) { |
| 3015 | return AbiAlignmentAdvanced{ .scalar = code_align }; | 3015 | return AbiAlignmentAdvanced{ .scalar = code_align }; |
| 3016 | } | 3016 | } |
| 3017 | return AbiAlignmentAdvanced{ .scalar = @maximum( | 3017 | return AbiAlignmentAdvanced{ .scalar = @max( |
| 3018 | code_align, | 3018 | code_align, |
| 3019 | (try data.payload.abiAlignmentAdvanced(target, strat)).scalar, | 3019 | (try data.payload.abiAlignmentAdvanced(target, strat)).scalar, |
| 3020 | ) }; | 3020 | ) }; |
| ... | @@ -3023,7 +3023,7 @@ pub const Type = extern union { | ... | @@ -3023,7 +3023,7 @@ pub const Type = extern union { |
| 3023 | switch (try data.payload.abiAlignmentAdvanced(target, strat)) { | 3023 | switch (try data.payload.abiAlignmentAdvanced(target, strat)) { |
| 3024 | .scalar => |payload_align| { | 3024 | .scalar => |payload_align| { |
| 3025 | return AbiAlignmentAdvanced{ | 3025 | return AbiAlignmentAdvanced{ |
| 3026 | .scalar = @maximum(code_align, payload_align), | 3026 | .scalar = @max(code_align, payload_align), |
| 3027 | }; | 3027 | }; |
| 3028 | }, | 3028 | }, |
| 3029 | .val => {}, | 3029 | .val => {}, |
| ... | @@ -3077,14 +3077,14 @@ pub const Type = extern union { | ... | @@ -3077,14 +3077,14 @@ pub const Type = extern union { |
| 3077 | .lazy => |arena| return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, | 3077 | .lazy => |arena| return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, |
| 3078 | }, | 3078 | }, |
| 3079 | }; | 3079 | }; |
| 3080 | big_align = @maximum(big_align, field_align); | 3080 | big_align = @max(big_align, field_align); |
| 3081 | 3081 | ||
| 3082 | // This logic is duplicated in Module.Struct.Field.alignment. | 3082 | // This logic is duplicated in Module.Struct.Field.alignment. |
| 3083 | if (struct_obj.layout == .Extern or target.ofmt == .c) { | 3083 | if (struct_obj.layout == .Extern or target.ofmt == .c) { |
| 3084 | if (field.ty.isAbiInt() and field.ty.intInfo(target).bits >= 128) { | 3084 | if (field.ty.isAbiInt() and field.ty.intInfo(target).bits >= 128) { |
| 3085 | // The C ABI requires 128 bit integer fields of structs | 3085 | // The C ABI requires 128 bit integer fields of structs |
| 3086 | // to be 16-bytes aligned. | 3086 | // to be 16-bytes aligned. |
| 3087 | big_align = @maximum(big_align, 16); | 3087 | big_align = @max(big_align, 16); |
| 3088 | } | 3088 | } |
| 3089 | } | 3089 | } |
| 3090 | } | 3090 | } |
| ... | @@ -3099,7 +3099,7 @@ pub const Type = extern union { | ... | @@ -3099,7 +3099,7 @@ pub const Type = extern union { |
| 3099 | if (val.tag() != .unreachable_value) continue; // comptime field | 3099 | if (val.tag() != .unreachable_value) continue; // comptime field |
| 3100 | 3100 | ||
| 3101 | switch (try field_ty.abiAlignmentAdvanced(target, strat)) { | 3101 | switch (try field_ty.abiAlignmentAdvanced(target, strat)) { |
| 3102 | .scalar => |field_align| big_align = @maximum(big_align, field_align), | 3102 | .scalar => |field_align| big_align = @max(big_align, field_align), |
| 3103 | .val => switch (strat) { | 3103 | .val => switch (strat) { |
| 3104 | .eager => unreachable, // field type alignment not resolved | 3104 | .eager => unreachable, // field type alignment not resolved |
| 3105 | .sema_kit => unreachable, // passed to abiAlignmentAdvanced above | 3105 | .sema_kit => unreachable, // passed to abiAlignmentAdvanced above |
| ... | @@ -3194,7 +3194,7 @@ pub const Type = extern union { | ... | @@ -3194,7 +3194,7 @@ pub const Type = extern union { |
| 3194 | .lazy => |arena| return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, | 3194 | .lazy => |arena| return AbiAlignmentAdvanced{ .val = try Value.Tag.lazy_align.create(arena, ty) }, |
| 3195 | }, | 3195 | }, |
| 3196 | }; | 3196 | }; |
| 3197 | max_align = @maximum(max_align, field_align); | 3197 | max_align = @max(max_align, field_align); |
| 3198 | } | 3198 | } |
| 3199 | return AbiAlignmentAdvanced{ .scalar = max_align }; | 3199 | return AbiAlignmentAdvanced{ .scalar = max_align }; |
| 3200 | } | 3200 | } |
| ... | @@ -3565,7 +3565,7 @@ pub const Type = extern union { | ... | @@ -3565,7 +3565,7 @@ pub const Type = extern union { |
| 3565 | } | 3565 | } |
| 3566 | 3566 | ||
| 3567 | fn intAbiAlignment(bits: u16, target: Target) u32 { | 3567 | fn intAbiAlignment(bits: u16, target: Target) u32 { |
| 3568 | return @minimum( | 3568 | return @min( |
| 3569 | std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8), | 3569 | std.math.ceilPowerOfTwoPromote(u16, (bits + 7) / 8), |
| 3570 | target.maxIntAlignment(), | 3570 | target.maxIntAlignment(), |
| 3571 | ); | 3571 | ); |
| ... | @@ -3648,7 +3648,7 @@ pub const Type = extern union { | ... | @@ -3648,7 +3648,7 @@ pub const Type = extern union { |
| 3648 | 3648 | ||
| 3649 | var size: u64 = 0; | 3649 | var size: u64 = 0; |
| 3650 | for (union_obj.fields.values()) |field| { | 3650 | for (union_obj.fields.values()) |field| { |
| 3651 | size = @maximum(size, try bitSizeAdvanced(field.ty, target, sema_kit)); | 3651 | size = @max(size, try bitSizeAdvanced(field.ty, target, sema_kit)); |
| 3652 | } | 3652 | } |
| 3653 | return size; | 3653 | return size; |
| 3654 | }, | 3654 | }, |
| ... | @@ -5760,7 +5760,7 @@ pub const Type = extern union { | ... | @@ -5760,7 +5760,7 @@ pub const Type = extern union { |
| 5760 | } | 5760 | } |
| 5761 | 5761 | ||
| 5762 | const field_align = field.alignment(it.target, it.struct_obj.layout); | 5762 | const field_align = field.alignment(it.target, it.struct_obj.layout); |
| 5763 | it.big_align = @maximum(it.big_align, field_align); | 5763 | it.big_align = @max(it.big_align, field_align); |
| 5764 | const field_offset = std.mem.alignForwardGeneric(u64, it.offset, field_align); | 5764 | const field_offset = std.mem.alignForwardGeneric(u64, it.offset, field_align); |
| 5765 | it.offset = field_offset + field.ty.abiSize(it.target); | 5765 | it.offset = field_offset + field.ty.abiSize(it.target); |
| 5766 | return FieldOffset{ .field = i, .offset = field_offset }; | 5766 | return FieldOffset{ .field = i, .offset = field_offset }; |
| ... | @@ -5789,7 +5789,7 @@ pub const Type = extern union { | ... | @@ -5789,7 +5789,7 @@ pub const Type = extern union { |
| 5789 | return field_offset.offset; | 5789 | return field_offset.offset; |
| 5790 | } | 5790 | } |
| 5791 | 5791 | ||
| 5792 | return std.mem.alignForwardGeneric(u64, it.offset, @maximum(it.big_align, 1)); | 5792 | return std.mem.alignForwardGeneric(u64, it.offset, @max(it.big_align, 1)); |
| 5793 | }, | 5793 | }, |
| 5794 | 5794 | ||
| 5795 | .tuple, .anon_struct => { | 5795 | .tuple, .anon_struct => { |
| ... | @@ -5807,12 +5807,12 @@ pub const Type = extern union { | ... | @@ -5807,12 +5807,12 @@ pub const Type = extern union { |
| 5807 | } | 5807 | } |
| 5808 | 5808 | ||
| 5809 | const field_align = field_ty.abiAlignment(target); | 5809 | const field_align = field_ty.abiAlignment(target); |
| 5810 | big_align = @maximum(big_align, field_align); | 5810 | big_align = @max(big_align, field_align); |
| 5811 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); | 5811 | offset = std.mem.alignForwardGeneric(u64, offset, field_align); |
| 5812 | if (i == index) return offset; | 5812 | if (i == index) return offset; |
| 5813 | offset += field_ty.abiSize(target); | 5813 | offset += field_ty.abiSize(target); |
| 5814 | } | 5814 | } |
| 5815 | offset = std.mem.alignForwardGeneric(u64, offset, @maximum(big_align, 1)); | 5815 | offset = std.mem.alignForwardGeneric(u64, offset, @max(big_align, 1)); |
| 5816 | return offset; | 5816 | return offset; |
| 5817 | }, | 5817 | }, |
| 5818 | 5818 |
test/behavior/maximum_minimum.zig+14-14| ... | @@ -4,7 +4,7 @@ const mem = std.mem; | ... | @@ -4,7 +4,7 @@ const mem = std.mem; |
| 4 | const expect = std.testing.expect; | 4 | const expect = std.testing.expect; |
| 5 | const expectEqual = std.testing.expectEqual; | 5 | const expectEqual = std.testing.expectEqual; |
| 6 | 6 | ||
| 7 | test "@maximum" { | 7 | test "@max" { |
| 8 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 8 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 9 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 9 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| ... | @@ -14,15 +14,15 @@ test "@maximum" { | ... | @@ -14,15 +14,15 @@ test "@maximum" { |
| 14 | fn doTheTest() !void { | 14 | fn doTheTest() !void { |
| 15 | var x: i32 = 10; | 15 | var x: i32 = 10; |
| 16 | var y: f32 = 0.68; | 16 | var y: f32 = 0.68; |
| 17 | try expect(@as(i32, 10) == @maximum(@as(i32, -3), x)); | 17 | try expect(@as(i32, 10) == @max(@as(i32, -3), x)); |
| 18 | try expect(@as(f32, 3.2) == @maximum(@as(f32, 3.2), y)); | 18 | try expect(@as(f32, 3.2) == @max(@as(f32, 3.2), y)); |
| 19 | } | 19 | } |
| 20 | }; | 20 | }; |
| 21 | try S.doTheTest(); | 21 | try S.doTheTest(); |
| 22 | comptime try S.doTheTest(); | 22 | comptime try S.doTheTest(); |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | test "@maximum on vectors" { | 25 | test "@max on vectors" { |
| 26 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 26 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 27 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 27 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 28 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 28 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| ... | @@ -33,17 +33,17 @@ test "@maximum on vectors" { | ... | @@ -33,17 +33,17 @@ test "@maximum on vectors" { |
| 33 | fn doTheTest() !void { | 33 | fn doTheTest() !void { |
| 34 | var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 }; | 34 | var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 }; |
| 35 | var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 }; | 35 | var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 }; |
| 36 | var x = @maximum(a, b); | 36 | var x = @max(a, b); |
| 37 | try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 2147483647, 2147483647, 30, 40 })); | 37 | try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 2147483647, 2147483647, 30, 40 })); |
| 38 | 38 | ||
| 39 | var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 }; | 39 | var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 }; |
| 40 | var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 }; | 40 | var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 }; |
| 41 | var y = @maximum(c, d); | 41 | var y = @max(c, d); |
| 42 | try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ 0, 0.42, -0.64, 7.8 })); | 42 | try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ 0, 0.42, -0.64, 7.8 })); |
| 43 | 43 | ||
| 44 | var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 }; | 44 | var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 }; |
| 45 | var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 }; | 45 | var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 }; |
| 46 | var z = @maximum(e, f); | 46 | var z = @max(e, f); |
| 47 | try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 })); | 47 | try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 })); |
| 48 | } | 48 | } |
| 49 | }; | 49 | }; |
| ... | @@ -51,7 +51,7 @@ test "@maximum on vectors" { | ... | @@ -51,7 +51,7 @@ test "@maximum on vectors" { |
| 51 | comptime try S.doTheTest(); | 51 | comptime try S.doTheTest(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | test "@minimum" { | 54 | test "@min" { |
| 55 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 55 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 56 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 56 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 57 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 57 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| ... | @@ -61,15 +61,15 @@ test "@minimum" { | ... | @@ -61,15 +61,15 @@ test "@minimum" { |
| 61 | fn doTheTest() !void { | 61 | fn doTheTest() !void { |
| 62 | var x: i32 = 10; | 62 | var x: i32 = 10; |
| 63 | var y: f32 = 0.68; | 63 | var y: f32 = 0.68; |
| 64 | try expect(@as(i32, -3) == @minimum(@as(i32, -3), x)); | 64 | try expect(@as(i32, -3) == @min(@as(i32, -3), x)); |
| 65 | try expect(@as(f32, 0.68) == @minimum(@as(f32, 3.2), y)); | 65 | try expect(@as(f32, 0.68) == @min(@as(f32, 3.2), y)); |
| 66 | } | 66 | } |
| 67 | }; | 67 | }; |
| 68 | try S.doTheTest(); | 68 | try S.doTheTest(); |
| 69 | comptime try S.doTheTest(); | 69 | comptime try S.doTheTest(); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | test "@minimum for vectors" { | 72 | test "@min for vectors" { |
| 73 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 73 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 74 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 74 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 75 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 75 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| ... | @@ -80,17 +80,17 @@ test "@minimum for vectors" { | ... | @@ -80,17 +80,17 @@ test "@minimum for vectors" { |
| 80 | fn doTheTest() !void { | 80 | fn doTheTest() !void { |
| 81 | var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 }; | 81 | var a: @Vector(4, i32) = [4]i32{ 2147483647, -2, 30, 40 }; |
| 82 | var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 }; | 82 | var b: @Vector(4, i32) = [4]i32{ 1, 2147483647, 3, 4 }; |
| 83 | var x = @minimum(a, b); | 83 | var x = @min(a, b); |
| 84 | try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 1, -2, 3, 4 })); | 84 | try expect(mem.eql(i32, &@as([4]i32, x), &[4]i32{ 1, -2, 3, 4 })); |
| 85 | 85 | ||
| 86 | var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 }; | 86 | var c: @Vector(4, f32) = [4]f32{ 0, 0.4, -2.4, 7.8 }; |
| 87 | var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 }; | 87 | var d: @Vector(4, f32) = [4]f32{ -0.23, 0.42, -0.64, 0.9 }; |
| 88 | var y = @minimum(c, d); | 88 | var y = @min(c, d); |
| 89 | try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ -0.23, 0.4, -2.4, 0.9 })); | 89 | try expect(mem.eql(f32, &@as([4]f32, y), &[4]f32{ -0.23, 0.4, -2.4, 0.9 })); |
| 90 | 90 | ||
| 91 | var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 }; | 91 | var e: @Vector(2, f32) = [2]f32{ 0, std.math.qnan_f32 }; |
| 92 | var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 }; | 92 | var f: @Vector(2, f32) = [2]f32{ std.math.qnan_f32, 0 }; |
| 93 | var z = @maximum(e, f); | 93 | var z = @max(e, f); |
| 94 | try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 })); | 94 | try expect(mem.eql(f32, &@as([2]f32, z), &[2]f32{ 0, 0 })); |
| 95 | } | 95 | } |
| 96 | }; | 96 | }; |