File: HsXXHash.h

package info (click to toggle)
haskell-hashable 1.5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 460 kB
  • sloc: ansic: 3,274; haskell: 1,295; makefile: 7
file content (35 lines) | stat: -rw-r--r-- 1,103 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef HS_XXHASH_H
#define HS_XXHASH_H

#include <stdint.h>

#define XXH_INLINE_ALL
#include "xxhash.h"

#define hs_XXH3_sizeof_state_s sizeof(struct XXH3_state_s)

static inline uint64_t hs_XXH3_64bits_withSeed_offset(const uint8_t *ptr, size_t off, size_t len, uint64_t seed) {
    return XXH3_64bits_withSeed(ptr + off, len, seed);
}

static inline uint64_t hs_XXH3_64bits_withSeed_u64(uint64_t val, uint64_t seed) {
    return XXH3_64bits_withSeed(&val, sizeof(val), seed);
}

static inline uint64_t hs_XXH3_64bits_withSeed_u32(uint32_t val, uint64_t seed) {
    return XXH3_64bits_withSeed(&val, sizeof(val), seed);
}

static inline void hs_XXH3_64bits_update_offset(XXH3_state_t *statePtr, const uint8_t *ptr, size_t off, size_t len) {
    XXH3_64bits_update(statePtr, ptr + off, len);
}

static inline void hs_XXH3_64bits_update_u64(XXH3_state_t *statePtr, uint64_t val) {
    XXH3_64bits_update(statePtr, &val, sizeof(val));
}

static inline void hs_XXH3_64bits_update_u32(XXH3_state_t *statePtr, uint32_t val) {
    XXH3_64bits_update(statePtr, &val, sizeof(val));
}

#endif /* HS_XXHASH_H */