mirror of
https://github.com/ziglang/zig.git
synced 2025-12-16 19:23:08 +00:00
Change math.Order order (#16356)
This speeds up algorithms like binary search
This commit is contained in:
parent
131bfe2f74
commit
27a66191c2
@ -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,
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user