1
0
Fork 0
mirror of https://github.com/albfan/miraclecast.git synced 2025-03-09 23:38:56 +00:00

shl: add u64 htable helpers

Add u64 helpers to shl_htable. They're fairly trivial and just copied from
unsigned-long, however, in case size_t is not 64bit wide we need to do
some trivial hashing.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
This commit is contained in:
David Herrmann 2014-03-21 11:54:45 +01:00
parent 87b804c481
commit 920f3ae250
2 changed files with 77 additions and 2 deletions

View file

@ -18,9 +18,9 @@
#include <assert.h>
#include <errno.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "shl_htable.h"
@ -443,6 +443,16 @@ size_t shl_htable_rehash_ulong(const void *elem, void *priv)
return (size_t)*(const unsigned long*)elem;
}
bool shl_htable_compare_u64(const void *a, const void *b)
{
return *(const uint64_t*)a == *(const uint64_t*)b;
}
size_t shl_htable_rehash_u64(const void *elem, void *priv)
{
return shl__htable_rehash_u64((const uint64_t*)elem);
}
bool shl_htable_compare_str(const void *a, const void *b)
{
if (!*(char**)a || !*(char**)b)