Former-commit-id: 96ff169e46
This commit is contained in:
Jarred Sumner
2021-05-07 01:26:26 -07:00
parent dd9e7de689
commit fad34bb4ab
49 changed files with 5815 additions and 148 deletions

View File

@@ -80,6 +80,8 @@ pub fn eql(self: string, other: anytype) bool {
}
return true;
}
// I have not actually verified that this makes it faster
// It's probably like 0.0001ms faster
pub fn eqlComptime(self: string, comptime alt: string) bool {
comptime var matcher_size: usize = 0;
@@ -346,11 +348,6 @@ pub fn ExactSizeMatcher(comptime max_bytes: usize) type {
return std.mem.readIntNative(T, &tmp);
}
fn hashNoCheck(str: anytype) T {
var tmp = [_]u8{0} ** max_bytes;
std.mem.copy(u8, &tmp, str[0..str.len]);
return std.mem.readIntNative(T, &tmp);
}
fn hashUnsafe(str: anytype) T {
var tmp = [_]u8{0} ** max_bytes;
std.mem.copy(u8, &tmp, str[0..str.len]);