Mstdlib-1.24.0
m_hash_func.h
1/* The MIT License (MIT)
2 *
3 * Copyright (c) 2015 Monetra Technologies, LLC.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23
24#ifndef __M_HASH_INT_H__
25#define __M_HASH_INT_H__
26
27/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
28
29#include <mstdlib/base/m_defs.h>
30#include <mstdlib/base/m_types.h>
31
32/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
33
34__BEGIN_DECLS
35/*! \addtogroup m_hash_func Hashtable - Callback default implementations
36 * \ingroup m_hashtable
37 * @{
38 */
39
40/*! Implementation will compute a hash using FNV1a from a string. */
41M_API M_uint32 M_hash_func_hash_str(const void *key, M_uint32 seed);
42
43/*! Implementation will compute a hash using FNV1a from a string in a case-insensitive manner. */
44M_API M_uint32 M_hash_func_hash_str_casecmp(const void *key, M_uint32 seed);
45
46/*! Implementation will compute a hash using FNV1a from a u64 (pointer). */
47M_API M_uint32 M_hash_func_hash_u64(const void *key, M_uint32 seed);
48
49/*! Implemntation will compute a hash using FNV1a from a pointer address */
50M_API M_uint32 M_hash_func_hash_vp(const void *key, M_uint32 seed);
51
52/*! This function duplicates a M_uint64 (pointer). */
53M_API void *M_hash_func_u64dup(const void *arg);
54
55/* Void wrapper for strdup to silence incompatible pointer warnings when using
56 * strdup with hashtable callbacks. */
57M_API void *M_hash_void_strdup(const void *arg);
58
59/*! @} */
60
61__END_DECLS
62
63#endif /* __M_HASH_INT_H__ */
void * M_hash_func_u64dup(const void *arg)
M_uint32 M_hash_func_hash_u64(const void *key, M_uint32 seed)
M_uint32 M_hash_func_hash_vp(const void *key, M_uint32 seed)
void * M_hash_void_strdup(const void *arg)
M_uint32 M_hash_func_hash_str_casecmp(const void *key, M_uint32 seed)
M_uint32 M_hash_func_hash_str(const void *key, M_uint32 seed)