SDL: Added SDL_HashPointer() and SDL_KeyMatchPointer()

From c84d825241447a466cc3df24a04d85b83148834d Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 29 Sep 2024 10:58:54 -0700
Subject: [PATCH] Added SDL_HashPointer() and SDL_KeyMatchPointer()

---
 src/SDL_hashtable.c | 15 +++++++++++----
 src/SDL_hashtable.h |  3 +++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c
index 6e852bf21720c..63f738a9f8aaf 100644
--- a/src/SDL_hashtable.c
+++ b/src/SDL_hashtable.c
@@ -493,6 +493,16 @@ static SDL_INLINE Uint32 hash_string_djbxor(const char *str, size_t len)
     return hash;
 }
 
+Uint32 SDL_HashPointer(const void *key, void *unused)
+{
+    return SDL_murmur3_32(&key, sizeof(key), 0);
+}
+
+bool SDL_KeyMatchPointer(const void *a, const void *b, void *unused)
+{
+    return (a == b);
+}
+
 Uint32 SDL_HashString(const void *key, void *data)
 {
     const char *str = (const char *)key;
@@ -524,10 +534,7 @@ Uint32 SDL_HashID(const void *key, void *unused)
 
 bool SDL_KeyMatchID(const void *a, const void *b, void *unused)
 {
-    if (a == b) {
-        return true;
-    }
-    return false;
+    return (a == b);
 }
 
 void SDL_NukeFreeKey(const void *key, const void *value, void *unused)
diff --git a/src/SDL_hashtable.h b/src/SDL_hashtable.h
index 55b6d53e86363..76f40929d7f54 100644
--- a/src/SDL_hashtable.h
+++ b/src/SDL_hashtable.h
@@ -49,6 +49,9 @@ extern bool SDL_IterateHashTableKey(const SDL_HashTable *table, const void *key,
 // iterate all key/value pairs in a hash (stackable hashes can have duplicate keys with multiple values).
 extern bool SDL_IterateHashTable(const SDL_HashTable *table, const void **_key, const void **_value, void **iter);
 
+extern Uint32 SDL_HashPointer(const void *key, void *unused);
+extern bool SDL_KeyMatchPointer(const void *a, const void *b, void *unused);
+
 extern Uint32 SDL_HashString(const void *key, void *unused);
 extern bool SDL_KeyMatchString(const void *a, const void *b, void *unused);