Change math.Order order (#16356)

This speeds up algorithms like binary search
This commit is contained in:
Niles Salter 2023-07-08 23:22:52 -06:00 committed by GitHub
parent 131bfe2f74
commit 27a66191c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1482,15 +1482,15 @@ test "mulWide" {
/// See also `CompareOperator`. /// See also `CompareOperator`.
pub const Order = enum { pub const Order = enum {
/// Greater than (`>`)
gt,
/// Less than (`<`) /// Less than (`<`)
lt, lt,
/// Equal (`==`) /// Equal (`==`)
eq, eq,
/// Greater than (`>`)
gt,
pub fn invert(self: Order) Order { pub fn invert(self: Order) Order {
return switch (self) { return switch (self) {
.lt => .gt, .lt => .gt,

View File

@ -10,7 +10,7 @@ pub export fn entry1() void {
// target=native // target=native
// //
// :5:5: error: switch must handle all possibilities // :5:5: error: switch must handle all possibilities
// :?:?: note: unhandled enumeration value: 'gt'
// :?:?: note: unhandled enumeration value: 'lt' // :?:?: note: unhandled enumeration value: 'lt'
// :?:?: note: unhandled enumeration value: 'eq' // :?:?: note: unhandled enumeration value: 'eq'
// :?:?: note: unhandled enumeration value: 'gt'
// :?:?: note: enum 'math.Order' declared here // :?:?: note: enum 'math.Order' declared here