*/
#define _LGPL_SOURCE
-#include <assert.h>
#include <stdint.h> /* defines uint32_t etc */
#include <stdio.h> /* defines printf for tests */
#include <string.h>
return c;
}
-LTTNG_HIDDEN
unsigned long hash_key_u64(const void *_key, unsigned long seed)
{
union {
* Hash function for number value.
* Pass the value itself as the key, not its address.
*/
-LTTNG_HIDDEN
unsigned long hash_key_ulong(const void *_key, unsigned long seed)
{
uint64_t __key = (uint64_t) _key;
* Hash function for number value.
* Pass the value itself as the key, not its address.
*/
-LTTNG_HIDDEN
unsigned long hash_key_ulong(const void *_key, unsigned long seed)
{
uint32_t key = (uint32_t) _key;
/*
* Hash function for string.
*/
-LTTNG_HIDDEN
unsigned long hash_key_str(const void *key, unsigned long seed)
{
return hashlittle(key, strlen((const char *) key), seed);
/*
* Hash function for two uint64_t.
*/
-LTTNG_HIDDEN
unsigned long hash_key_two_u64(const void *key, unsigned long seed)
{
const struct lttng_ht_two_u64 *k =
/*
* Hash function compare for number value.
*/
-LTTNG_HIDDEN
int hash_match_key_ulong(const void *key1, const void *key2)
{
if (key1 == key2) {
/*
* Hash function compare for number value.
*/
-LTTNG_HIDDEN
int hash_match_key_u64(const void *key1, const void *key2)
{
if (*(const uint64_t *) key1 == *(const uint64_t *) key2) {
/*
* Hash compare function for string.
*/
-LTTNG_HIDDEN
int hash_match_key_str(const void *key1, const void *key2)
{
if (strcmp(key1, key2) == 0) {
/*
* Hash function compare two uint64_t.
*/
-LTTNG_HIDDEN
int hash_match_key_two_u64(const void *key1, const void *key2)
{
const struct lttng_ht_two_u64 *k1 =