ucx
UAP Common Extensions
|
Interface for map implementations. More...
#include "common.h"
Go to the source code of this file.
Data Structures | |
struct | cx_hash_key_s |
Internal structure for a key within a hash map. More... | |
Macros | |
#define | cx_hash_key_cxstr(str) cx_hash_key((void*)(str).ptr, (str).length) |
Computes a hash key from a UCX string. | |
Typedefs | |
typedef struct cx_hash_key_s | CxHashKey |
Type for a hash key. | |
Functions | |
void | cx_hash_murmur (CxHashKey *key) |
Computes a murmur2 32 bit hash. | |
CxHashKey | cx_hash_key_str (char const *str) |
Computes a hash key from a string. | |
CxHashKey | cx_hash_key_bytes (unsigned char const *bytes, size_t len) |
Computes a hash key from a byte array. | |
CxHashKey | cx_hash_key (void const *obj, size_t len) |
Computes a hash key for an arbitrary object. | |
Interface for map implementations.
#define cx_hash_key_cxstr | ( | str | ) | cx_hash_key((void*)(str).ptr, (str).length) |
Computes a hash key from a UCX string.
str | the string |
CxHashKey cx_hash_key | ( | void const * | obj, |
size_t | len | ||
) |
Computes a hash key for an arbitrary object.
The computation uses the in-memory representation that might not be the same on different platforms. Therefore, this hash should not be used for data exchange with different machines.
obj | a pointer to an arbitrary object |
len | the length of object in memory |
CxHashKey cx_hash_key_bytes | ( | unsigned char const * | bytes, |
size_t | len | ||
) |
Computes a hash key from a byte array.
bytes | the array |
len | the length |
CxHashKey cx_hash_key_str | ( | char const * | str | ) |
Computes a hash key from a string.
The string needs to be zero-terminated.
str | the string |
void cx_hash_murmur | ( | CxHashKey * | key | ) |
Computes a murmur2 32 bit hash.
You need to initialize data
and len
in the key struct. The hash is then directly written to that struct.
data
is NULL
, the hash is defined as 1574210520.key | the key, the hash shall be computed for |