| ... | ... | @@ -748,6 +748,19 @@ test lessThan { |
| 748 | 748 | try testing.expect(lessThan(u8, "", "a")); |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | /// Returns `true` if `lhs < rhs`; `false` otherwise, operating on null-terminated arrays. |
| 752 | pub fn lessThanZ(comptime T: type, lhs: [*:0]const T, rhs: [*:0]const T) bool { |
| 753 | return orderZ(T, lhs, rhs) == .lt; |
| 754 | } |
| 755 | |
| 756 | test lessThanZ { |
| 757 | try testing.expect(lessThanZ(u8, "abcd", "bee")); |
| 758 | try testing.expect(!lessThanZ(u8, "abc", "abc")); |
| 759 | try testing.expect(lessThanZ(u8, "abc", "abc0")); |
| 760 | try testing.expect(!lessThanZ(u8, "", "")); |
| 761 | try testing.expect(lessThanZ(u8, "", "a")); |
| 762 | } |
| 763 | |
| 751 | 764 | const use_vectors = switch (builtin.zig_backend) { |
| 752 | 765 | // These backends don't support vectors yet. |
| 753 | 766 | .stage2_aarch64, |