| author | |
| committer | |
| log | 9d6f236728cf433b44048e21f81efdd167fe0098 |
| tree | b2c159f7032e470aa4cdaf9b24f096a8defd0dc2 |
| parent | f08c6e4fe6ad63145ef69377f36f34e9f04cadec |
this should also be friendlier to the optimizer2 files changed, 2 insertions(+), 3 deletions(-)
std/hash_map.zig+1-3| ... | @@ -23,9 +23,7 @@ pub fn StringHashMap(comptime V: type) type { | ... | @@ -23,9 +23,7 @@ pub fn StringHashMap(comptime V: type) type { |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | pub fn eqlString(a: []const u8, b: []const u8) bool { | 25 | pub fn eqlString(a: []const u8, b: []const u8) bool { |
| 26 | if (a.len != b.len) return false; | 26 | return mem.eql(u8, a, b); |
| 27 | if (a.ptr == b.ptr) return true; | ||
| 28 | return mem.compare(u8, a, b) == .Equal; | ||
| 29 | } | 27 | } |
| 30 | 28 | ||
| 31 | pub fn hashString(s: []const u8) u32 { | 29 | pub fn hashString(s: []const u8) u32 { |
std/mem.zig+1| ... | @@ -339,6 +339,7 @@ test "mem.lessThan" { | ... | @@ -339,6 +339,7 @@ test "mem.lessThan" { |
| 339 | /// Compares two slices and returns whether they are equal. | 339 | /// Compares two slices and returns whether they are equal. |
| 340 | pub fn eql(comptime T: type, a: []const T, b: []const T) bool { | 340 | pub fn eql(comptime T: type, a: []const T, b: []const T) bool { |
| 341 | if (a.len != b.len) return false; | 341 | if (a.len != b.len) return false; |
| 342 | if (a.ptr == b.ptr) return true; | ||
| 342 | for (a) |item, index| { | 343 | for (a) |item, index| { |
| 343 | if (b[index] != item) return false; | 344 | if (b[index] != item) return false; |
| 344 | } | 345 | } |