1#pragma once
2
3#include <pw_types.h>
4#include <pw_interfaces.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10/****************************************************************
11 * Hash functions
12 */
13
14typedef uint64_t PwType_Hash;
15
16void _pw_hash_uint64(PwHashContext* ctx, uint64_t data);
17void _pw_hash_buffer(PwHashContext* ctx, void* buffer, size_t length);
18void _pw_hash_string(PwHashContext* ctx, char* str);
19void _pw_hash_string32(PwHashContext* ctx, char32_t* str);
20
21static inline void _pw_call_hash(PwValuePtr value, PwHashContext* ctx, _PwCompoundChain* tail)
22/*
23 * Call hash method of value.
24 */
25{
26 if (!pw_call(Basic, hash, value, ctx, tail)) { /* ignore return value, it's always true */ }
27}
28
29PwType_Hash pw_hash(PwValuePtr value);
30/*
31 * Calculate hash of value.
32 */
33
34#ifdef __cplusplus
35}
36#endif