Files
rope/src/ordering.zig
T
yves-biener ae666cb436
Zig Project Action / Lint, Spell-check and test zig project (push) Has been cancelled
initial commit
based on sources of https://github.com/noahbald/noe which are MIT-licensed
2026-06-06 20:48:35 +02:00

22 lines
510 B
Zig

pub const Ordering = enum(u2) {
less = 0,
equal = 1,
greater = 2,
pub fn cmp(a: anytype, b: anytype) Ordering {
if (a < b) return .less else if (a == b) return .equal else return .greater;
}
pub fn gte(self: Ordering) bool {
return @intFromEnum(self) > 1;
}
pub fn lte(self: Ordering) bool {
return @intFromEnum(self) < 1;
}
pub fn is(self: Ordering, other: Ordering) bool {
return @intFromEnum(self) == @intFromEnum(other);
}
};