entries.count = 0;
}
+empty :: proc (use map: ^Map($K, $V)) -> bool {
+ return entries.count == 0;
+}
+
hash_function :: proc {
proc (key: rawptr) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; },
proc (key: i32) -> u32 { return 0xcbf29ce7 ^ cast(u32) key; },
return false;
}
-// compare :: proc (str1: str, str2: str) -> i32 {
-// if str1.count != str2.count do return str1.count - str2.count;
-//
-// i := 0;
-// while i < str1.count && str1[i] == str2[i] do i += 1;
-//
-// if i == str1.count do return 0;
-// return ~~(str1[i] - str2[i]);
-// }
+// TODO: Check this proc for edge cases and other bugs. I'm not confident
+// it will work perfectly yet. - brendanfh 2020/12/21
+compare :: proc (str1: str, str2: str) -> i32 {
+ i := 0;
+ while i < str1.count && i < str2.count && str1[i] == str2[i] do i += 1;
+
+ if i == str1.count && i == str2.count do return 0;
+ return ~~(str1[i] - str2[i]);
+}
equal :: proc (str1: str, str2: str) -> bool {
if str1.count != str2.count do return false;
[ ] `TileData :: [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` results in a
segfault because it is an invalid top level node, but that is not checked
before it is tried to be used.
+
+[ ] `defer` statements are not executed at the end of a loop if the loop is
+ exited using a `break` statement, or a `continue` statement.
[X] `TileData :: #type [TILE_DATA_WIDTH * TILE_DATA_HEIGHT] bool;` produces the
following error: