authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2022-10-03 20:04:30+03:30
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-10-18 14:15:16+03:00
logca27055cdaa82fc26a8d9f8bf6a71de995adc539
tree8a8bf8a5f6848a2c7a55deeecf5a1257fa4ed794
parentedc842ff18e19d8c07cde1199f72903356fbf77f

all: rename `@maximum` to `@max` and `@minimum` to `@min`


33 files changed, 298 insertions(+), 298 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#}
89798979
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#}
89908990
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>
9025mem.set(u8, dest, c);{#endsyntax#}</pre>9025mem.set(u8, dest, c);{#endsyntax#}</pre>
9026 {#header_close#}9026 {#header_close#}
90279027
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#}
90389038
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 }
463463
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": {
...@@ -2069,7 +2069,7 @@ var zigAnalysis;...@@ -2069,7 +2069,7 @@ var zigAnalysis;
2069 if (2069 if (
2070 rootIsStd &&2070 rootIsStd &&
2071 typeObj ===2071 typeObj ===
2072 getType(zigAnalysis.packages[zigAnalysis.rootPkg].main)2072 getType(zigAnalysis.packages[zigAnalysis.rootPkg].main)
2073 ) {2073 ) {
2074 name = "std";2074 name = "std";
2075 } else {2075 } else {
...@@ -2328,7 +2328,7 @@ var zigAnalysis;...@@ -2328,7 +2328,7 @@ var zigAnalysis;
2328 function renderSourceFileLink(decl) {2328 function renderSourceFileLink(decl) {
2329 let srcNode = getAstNode(decl.src);2329 let srcNode = getAstNode(decl.src);
23302330
2331 return "<a style=\"float: right;\" href=\"" +2331 return "<a style=\"float: right;\" href=\"" +
2332 sourceFileUrlTemplate.replace("{{file}}",2332 sourceFileUrlTemplate.replace("{{file}}",
2333 zigAnalysis.files[srcNode.file]).replace("{{line}}", srcNode.line + 1) + "\">[src]</a>";2333 zigAnalysis.files[srcNode.file]).replace("{{line}}", srcNode.line + 1) + "\">[src]</a>";
2334 }2334 }
...@@ -2888,12 +2888,12 @@ var zigAnalysis;...@@ -2888,12 +2888,12 @@ var zigAnalysis;
2888 let cut = false;2888 let cut = false;
28892889
2890 if (index < 0 || index > 80) {2890 if (index < 0 || index > 80) {
2891 if (trimmed_docs.length > 80) {2891 if (trimmed_docs.length > 80) {
2892 index = 80;2892 index = 80;
2893 cut = true;2893 cut = true;
2894 } else {2894 } else {
2895 index = trimmed_docs.length;2895 index = trimmed_docs.length;
2896 }2896 }
2897 }2897 }
28982898
2899 let slice = trimmed_docs.slice(0, index);2899 let slice = trimmed_docs.slice(0, index);
...@@ -3527,7 +3527,7 @@ var zigAnalysis;...@@ -3527,7 +3527,7 @@ var zigAnalysis;
3527 decltest: decl[4],3527 decltest: decl[4],
3528 };3528 };
3529 }3529 }
3530 3530
3531 function getAstNode(idx) {3531 function getAstNode(idx) {
3532 const ast = zigAnalysis.astNodes[idx];3532 const ast = zigAnalysis.astNodes[idx];
3533 return {3533 return {
...@@ -3541,141 +3541,141 @@ var zigAnalysis;...@@ -3541,141 +3541,141 @@ var zigAnalysis;
3541 comptime: ast[7],3541 comptime: ast[7],
3542 };3542 };
3543 }3543 }
3544 3544
3545 function getType(idx){3545 function getType(idx) {
3546 const ty = zigAnalysis.types[idx];3546 const ty = zigAnalysis.types[idx];
3547 switch(ty[0]) {3547 switch (ty[0]) {
3548 default: 3548 default:
3549 throw "unhandled type kind!";3549 throw "unhandled type kind!";
3550 case 0: // Unanalyzed3550 case 0: // Unanalyzed
3551 throw "unanalyzed type!";3551 throw "unanalyzed type!";
3552 case 1: // Type3552 case 1: // Type
3553 case 2: // Void 3553 case 2: // Void
3554 case 3: // Bool3554 case 3: // Bool
3555 case 4: // NoReturn3555 case 4: // NoReturn
3556 case 5: // Int3556 case 5: // Int
3557 case 6: // Float3557 case 6: // Float
3558 return { kind: ty[0], name: ty[1]};3558 return { kind: ty[0], name: ty[1] };
3559 case 7: // Pointer3559 case 7: // Pointer
3560 return {3560 return {
3561 kind: ty[0],3561 kind: ty[0],
3562 size: ty[1],3562 size: ty[1],
3563 child: ty[2],3563 child: ty[2],
3564 sentinel: ty[3],3564 sentinel: ty[3],
3565 align: ty[4],3565 align: ty[4],
3566 address_space: ty[5],3566 address_space: ty[5],
3567 bit_start: ty[6],3567 bit_start: ty[6],
3568 host_size: ty[7],3568 host_size: ty[7],
3569 is_ref: ty[8],3569 is_ref: ty[8],
3570 is_allowzero: ty[9],3570 is_allowzero: ty[9],
3571 is_mutable: ty[10],3571 is_mutable: ty[10],
3572 is_volatile: ty[11],3572 is_volatile: ty[11],
3573 has_sentinel: ty[12],3573 has_sentinel: ty[12],
3574 has_align: ty[13],3574 has_align: ty[13],
3575 has_addrspace: ty[14],3575 has_addrspace: ty[14],
3576 has_bit_range: ty[15],3576 has_bit_range: ty[15],
3577 };3577 };
3578 case 8: // Array3578 case 8: // Array
3579 return {3579 return {
3580 kind: ty[0],3580 kind: ty[0],
3581 len: ty[1],3581 len: ty[1],
3582 child: ty[2],3582 child: ty[2],
3583 sentinel: ty[3],3583 sentinel: ty[3],
3584 };3584 };
3585 case 9: // Struct3585 case 9: // Struct
3586 return {3586 return {
3587 kind: ty[0],3587 kind: ty[0],
3588 name: ty[1],3588 name: ty[1],
3589 src: ty[2],3589 src: ty[2],
3590 privDecls: ty[3],3590 privDecls: ty[3],
3591 pubDecls: ty[4],3591 pubDecls: ty[4],
3592 fields: ty[5],3592 fields: ty[5],
3593 line_number: ty[6],3593 line_number: ty[6],
3594 outer_decl: ty[7],3594 outer_decl: ty[7],
3595 };3595 };
3596 case 10: // ComptimeExpr3596 case 10: // ComptimeExpr
3597 case 11: // ComptimeFloat3597 case 11: // ComptimeFloat
3598 case 12: // ComptimeInt3598 case 12: // ComptimeInt
3599 case 13: // Undefined3599 case 13: // Undefined
3600 case 14: // Null3600 case 14: // Null
3601 return { kind: ty[0], name: ty[1] };3601 return { kind: ty[0], name: ty[1] };
3602 case 15: // Optional3602 case 15: // Optional
3603 return {3603 return {
3604 kind: ty[0],3604 kind: ty[0],
3605 name: ty[1],3605 name: ty[1],
3606 child: ty[2],3606 child: ty[2],
3607 };3607 };
3608 case 16: // ErrorUnion3608 case 16: // ErrorUnion
3609 return {3609 return {
3610 kind: ty[0],3610 kind: ty[0],
3611 lhs: ty[1],3611 lhs: ty[1],
3612 rhs: ty[2],3612 rhs: ty[2],
3613 };3613 };
3614 case 17: // InferredErrorUnion3614 case 17: // InferredErrorUnion
3615 return {3615 return {
3616 kind: ty[0],3616 kind: ty[0],
3617 payload: ty[1],3617 payload: ty[1],
3618 };3618 };
3619 case 18: // ErrorSet3619 case 18: // ErrorSet
3620 return {3620 return {
3621 kind: ty[0],3621 kind: ty[0],
3622 name: ty[1],3622 name: ty[1],
3623 fields: ty[2],3623 fields: ty[2],
3624 };3624 };
3625 case 19: // Enum3625 case 19: // Enum
3626 return {3626 return {
3627 kind: ty[0],3627 kind: ty[0],
3628 name: ty[1],3628 name: ty[1],
3629 src: ty[2],3629 src: ty[2],
3630 privDecls: ty[3],3630 privDecls: ty[3],
3631 pubDecls: ty[4],3631 pubDecls: ty[4],
3632 };3632 };
3633 case 20: // Union3633 case 20: // Union
3634 return {3634 return {
3635 kind: ty[0],3635 kind: ty[0],
3636 name: ty[1],3636 name: ty[1],
3637 src: ty[2],3637 src: ty[2],
3638 privDecls: ty[3],3638 privDecls: ty[3],
3639 pubDecls: ty[4],3639 pubDecls: ty[4],
3640 fields: ty[5],3640 fields: ty[5],
3641 }; 3641 };
3642 case 21: // Fn3642 case 21: // Fn
3643 return {3643 return {
3644 kind: ty[0],3644 kind: ty[0],
3645 name: ty[1],3645 name: ty[1],
3646 src: ty[2],3646 src: ty[2],
3647 ret: ty[3],3647 ret: ty[3],
3648 generic_ret: ty[4],3648 generic_ret: ty[4],
3649 params: ty[5],3649 params: ty[5],
3650 lib_name: ty[6],3650 lib_name: ty[6],
3651 is_var_args: ty[7],3651 is_var_args: ty[7],
3652 is_inferred_error: ty[8],3652 is_inferred_error: ty[8],
3653 has_lib_name: ty[9],3653 has_lib_name: ty[9],
3654 has_cc: ty[10],3654 has_cc: ty[10],
3655 cc: ty[11],3655 cc: ty[11],
3656 align: ty[12],3656 align: ty[12],
3657 has_align: ty[13],3657 has_align: ty[13],
3658 is_test: ty[14],3658 is_test: ty[14],
3659 is_extern: ty[15],3659 is_extern: ty[15],
3660 };3660 };
3661 case 22: // BoundFn3661 case 22: // BoundFn
3662 return { kind: ty[0], name: ty[1] };3662 return { kind: ty[0], name: ty[1] };
3663 case 23: // Opaque3663 case 23: // Opaque
3664 return {3664 return {
3665 kind: ty[0],3665 kind: ty[0],
3666 name: ty[1],3666 name: ty[1],
3667 src: ty[2],3667 src: ty[2],
3668 privDecls: ty[3],3668 privDecls: ty[3],
3669 pubDecls: ty[4],3669 pubDecls: ty[4],
3670 };3670 };
3671 case 24: // Frame3671 case 24: // Frame
3672 case 25: // AnyFrame3672 case 25: // AnyFrame
3673 case 26: // Vector3673 case 26: // Vector
3674 case 27: // EnumLiteral3674 case 27: // EnumLiteral
3675 return { kind: ty[0], name: ty[1] };3675 return { kind: ty[0], name: ty[1] };
3676 }3676 }
3677 }3677 }
3678 3678
3679})();3679})();
36803680
36813681
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.?)];
361361
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);
302302
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;
307307
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 }
106106
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 {
134134
135 // The tree can't have greater depth than n - 1, no matter what. This135 // The tree can't have greater depth than n - 1, no matter what. This
136 // saves a little bit of work in some small cases136 // 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);
138138
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 that140 // 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
20872087
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 }
317317
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_len320 aligned_len
321 else321 else
...@@ -554,7 +554,7 @@ const WasmPageAllocator = struct {...@@ -554,7 +554,7 @@ const WasmPageAllocator = struct {
554554
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);
646646
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);
775775
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.pread64777 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);
10311031
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);
11871187
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.pwrite641189 system.pwrite64
...@@ -6006,8 +6006,8 @@ pub fn sendfile(...@@ -6006,8 +6006,8 @@ pub fn sendfile(
6006 }6006 }
60076007
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 @minimum6010 // 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);
60126012
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 }
60936093
6094 const adjusted_count = @minimum(in_len, max_count);6094 const adjusted_count = @min(in_len, max_count);
60956095
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 }
61726172
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);
61766176
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 @minimum6230 // 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 }
63306330
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 counter6497 // 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");
9pub fn suggestVectorSizeForCpu(comptime T: type, comptime cpu: std.Target.Cpu) ?usize {9pub 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 here10 // 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 it11 // 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 };
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 },
78777877
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 // @check1355 // @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 structs993 // 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 }
997997
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;
13271327
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's1409 // 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();
54985498
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),
915915
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),
918918
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 and3886 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 and4097 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);
42824282
4283 // If the next instructon is a store with a comptime operand, this element4283 // 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}
46114611
4612fn zirStore(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void {4612fn 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.*;
68896889
6890 callee.branch_quota = @maximum(callee.branch_quota, sema.branch_quota);6890 callee.branch_quota = @max(callee.branch_quota, sema.branch_quota);
68916891
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);
68936893
...@@ -20382,7 +20382,7 @@ fn analyzeMinMax(...@@ -20382,7 +20382,7 @@ fn analyzeMinMax(
20382) CompileError!Air.Inst.Ref {20382) CompileError!Air.Inst.Ref {
20383 const simd_op = try sema.checkSimdBinOp(block, src, lhs, rhs, lhs_src, rhs_src);20383 const simd_op = try sema.checkSimdBinOp(block, src, lhs, rhs, lhs_src, rhs_src);
2038420384
20385 // TODO @maximum(max_int, undefined) should return max_int20385 // TODO @max(max_int, undefined) should return max_int
2038620386
20387 const runtime_src = if (simd_op.lhs_val) |lhs_val| rs: {20387 const runtime_src = if (simd_op.lhs_val) |lhs_val| rs: {
20388 if (lhs_val.isUndef()) return sema.addConstUndef(simd_op.result_ty);20388 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,
17931793
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 {
418418
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);
422422
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 appending885 // 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 appending3643 // 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);
36473647
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 appending895 // 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);
899899
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);
422422
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 appending884 // 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;
28702870
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);
28752875
...@@ -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 or2936 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);
29412941
...@@ -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;
35583558
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);
35633563
...@@ -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;
36533653
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);
36583658
...@@ -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 allocate4711 // 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 {
77787778
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;
99969996
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);
1000110001
...@@ -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;
1002910029
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);
1003410034
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 }
611611
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;
16621662
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}
19381938
1939fn detectAllocCollision(self: *Coff, start: u32, size: u32) ?u32 {1939fn 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;
19431943
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);
34243424
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}
39863986
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);
288288
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;
47604760
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;
48154815
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;
1044610446
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);
30813081
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 structs3085 // 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 field3099 if (val.tag() != .unreachable_value) continue; // comptime field
31003100
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 resolved3104 .eager => unreachable, // field type alignment not resolved
3105 .sema_kit => unreachable, // passed to abiAlignmentAdvanced above3105 .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 }
35663566
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 {
36483648
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 }
57615761
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 }
57915791
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 },
57945794
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 }
58085808
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 },
58185818
test/behavior/maximum_minimum.zig+14-14
...@@ -4,7 +4,7 @@ const mem = std.mem;...@@ -4,7 +4,7 @@ const mem = std.mem;
4const expect = std.testing.expect;4const expect = std.testing.expect;
5const expectEqual = std.testing.expectEqual;5const expectEqual = std.testing.expectEqual;
66
7test "@maximum" {7test "@max" {
8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO8 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
9 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO9 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
10 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO10 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}
2424
25test "@maximum on vectors" {25test "@max on vectors" {
26 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO26 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
27 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO27 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
28 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO28 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 }));
3838
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 }));
4343
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}
5353
54test "@minimum" {54test "@min" {
55 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO55 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
56 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO56 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
57 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO57 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}
7171
72test "@minimum for vectors" {72test "@min for vectors" {
73 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO73 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO74 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
75 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO75 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 }));
8585
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 }));
9090
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 };