shithub: rgbds

Download patch

ref: c278a361dadead172322198c8e325e8444b8b047
parent: a2f52867ad6e4cbdef43f4c28a57a5fba73417d5
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Apr 9 10:27:36 EDT 2021

Remove the unused `calchash` djb2 hash function

Note that hashmap.c uses its own FNV-1a hash function

--- a/include/asm/util.h
+++ b/include/asm/util.h
@@ -11,8 +11,8 @@
 
 #include <stdint.h>
 
-uint32_t calchash(const char *s);
 char const *printChar(int c);
+
 /*
  * @return The number of bytes read, or 0 if invalid data was found
  */
--- a/src/asm/util.c
+++ b/src/asm/util.c
@@ -15,21 +15,6 @@
 
 #include "extern/utf8decoder.h"
 
-/*
- * Calculate the hash value for a string.
- * Uses the djb2 algorithm (xor version).
- * http://www.cse.yorku.ca/~oz/hash.html
- */
-uint32_t calchash(const char *s)
-{
-	uint32_t hash = 5381;
-
-	while (*s != 0)
-		hash = (hash * 33) ^ (*s++);
-
-	return hash;
-}
-
 char const *printChar(int c)
 {
 	// "'A'" + '\0': 4 bytes