authorgravatar for Validark@pm.meNiles Salter <Validark@pm.me> 2023-07-08 23:22:52-06:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-07-09 01:22:52-04:00
log27a66191c271d2a8b1b6ebcbef0bbdeb8d389a38
treec5b89505b06183f67eb240f59affce8d1f0f531d
parent131bfe2f7488cab02c492ca3afc6d2a18bc83aac
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Change math.Order order (#16356)

This speeds up algorithms like binary search

2 files changed, 4 insertions(+), 4 deletions(-)

lib/std/math.zig+3-3
...@@ -1482,15 +1482,15 @@ test "mulWide" {...@@ -1482,15 +1482,15 @@ test "mulWide" {
14821482
1483/// See also `CompareOperator`.1483/// See also `CompareOperator`.
1484pub const Order = enum {1484pub const Order = enum {
1485 /// Greater than (`>`)
1486 gt,
1487
1485 /// Less than (`<`)1488 /// Less than (`<`)
1486 lt,1489 lt,
14871490
1488 /// Equal (`==`)1491 /// Equal (`==`)
1489 eq,1492 eq,
14901493
1491 /// Greater than (`>`)
1492 gt,
1493
1494 pub fn invert(self: Order) Order {1494 pub fn invert(self: Order) Order {
1495 return switch (self) {1495 return switch (self) {
1496 .lt => .gt,1496 .lt => .gt,
test/cases/compile_errors/unhandled_enum_value_in_switch_with_enum_declared_in_other_file.zig+1-1
...@@ -10,7 +10,7 @@ pub export fn entry1() void {...@@ -10,7 +10,7 @@ pub export fn entry1() void {
10// target=native10// target=native
11//11//
12// :5:5: error: switch must handle all possibilities12// :5:5: error: switch must handle all possibilities
13// :?:?: note: unhandled enumeration value: 'gt'
13// :?:?: note: unhandled enumeration value: 'lt'14// :?:?: note: unhandled enumeration value: 'lt'
14// :?:?: note: unhandled enumeration value: 'eq'15// :?:?: note: unhandled enumeration value: 'eq'
15// :?:?: note: unhandled enumeration value: 'gt'
16// :?:?: note: enum 'math.Order' declared here16// :?:?: note: enum 'math.Order' declared here