1#![no_std]
4#![allow(clippy::all)]
5#![cfg_attr(rustfmt, rustfmt_skip)]
6
7use ::core::ffi::c_void;
8
9pub const XXH_VERSION_MAJOR: u32 = 0;
10pub const XXH_VERSION_MINOR: u32 = 8;
11pub const XXH_VERSION_RELEASE: u32 = 3;
12pub const XXH_VERSION_NUMBER: u32 = XXH_VERSION_MAJOR*100*100 + XXH_VERSION_MINOR*100 + XXH_VERSION_RELEASE;
13pub const XXH3_SECRET_SIZE_MIN: libc::c_int = 136;
14pub const XXH_errorcode_XXH_OK: XXH_errorcode = 0;
15pub const XXH_errorcode_XXH_ERROR: XXH_errorcode = 1;
16pub type XXH_errorcode = libc::c_int;
17pub type XXH32_hash_t = u32;
18#[repr(C)]
19#[derive(Debug, Copy, Clone)]
20pub struct XXH32_state_s {
21 total_len_32: XXH32_hash_t,
22 large_len: XXH32_hash_t,
23 v: [XXH32_hash_t; 4],
24 mem32: [XXH32_hash_t; 4],
25 memsize: XXH32_hash_t,
26 reserved: XXH32_hash_t,
27}
28pub type XXH32_state_t = XXH32_state_s;
29#[repr(C)]
30#[derive(Debug, Copy, Clone)]
31pub struct XXH32_canonical_t {
32 pub digest: [u8; 4usize],
33}
34pub type XXH64_hash_t = u64;
35#[repr(C)]
36#[derive(Debug, Copy, Clone)]
37pub struct XXH64_state_s {
38 total_len: XXH64_hash_t,
39 v: [XXH64_hash_t; 4],
40 mem64: [XXH64_hash_t; 4],
41 memsize: XXH32_hash_t,
42 reserved32: XXH32_hash_t,
43 reserved64: XXH64_hash_t,
44}
45pub type XXH64_state_t = XXH64_state_s;
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct XXH64_canonical_t {
49 pub digest: [u8; core::mem::size_of::<XXH64_hash_t>()],
50}
51pub const XXH3_INTERNALBUFFER_SIZE: libc::c_int = 256;
52pub const XXH3_SECRET_DEFAULT_SIZE: libc::c_int = 192;
53#[repr(C)]
54#[repr(align(64))]
55#[derive(Debug, Copy, Clone)]
56struct Acc([XXH64_hash_t; 8]);
57#[repr(C)]
58#[repr(align(64))]
59#[derive(Debug, Copy, Clone)]
60struct CustomSecret([u8; XXH3_SECRET_DEFAULT_SIZE as usize]);
61#[repr(C)]
62#[repr(align(64))]
63#[derive(Debug, Copy, Clone)]
64struct Buffer([u8; XXH3_INTERNALBUFFER_SIZE as usize]);
65#[repr(C)]
66#[derive(Debug, Copy, Clone)]
67pub struct XXH3_state_s {
68 acc: Acc,
69 customSecret: CustomSecret,
70 buffer: Buffer,
71 bufferedSize: XXH32_hash_t,
72 useSeed: XXH32_hash_t,
73 nbStripesSoFar: usize,
74 totalLen: XXH64_hash_t,
75 nbStripesPerBlock: usize,
76 secretLimit: usize,
77 seed: XXH64_hash_t,
78 reserved64: XXH64_hash_t,
79 extSecret: *const u8,
80}
81pub type XXH3_state_t = XXH3_state_s;
82
83#[repr(C)]
84#[derive(Debug, Copy, Clone)]
85pub struct XXH128_hash_t {
86 pub low64: XXH64_hash_t,
87 pub high64: XXH64_hash_t,
88}
89#[repr(C)]
90#[derive(Debug, Copy, Clone)]
91pub struct XXH128_canonical_t {
92 pub digest: [u8; core::mem::size_of::<XXH128_hash_t>()],
93}
94
95extern "C" {
96 pub fn XXH_versionNumber() -> libc::c_uint;
97 pub fn XXH32(input: *const c_void, length: usize, seed: XXH32_hash_t) -> XXH32_hash_t;
99 pub fn XXH32_createState() -> *mut XXH32_state_t;
100 pub fn XXH32_freeState(statePtr: *mut XXH32_state_t) -> XXH_errorcode;
101 pub fn XXH32_copyState(dst_state: *mut XXH32_state_t, src_state: *const XXH32_state_t);
102 pub fn XXH32_reset(statePtr: *mut XXH32_state_t, seed: XXH32_hash_t) -> XXH_errorcode;
103 pub fn XXH32_update(statePtr: *mut XXH32_state_t, input: *const c_void, length: usize) -> XXH_errorcode;
104 pub fn XXH32_digest(statePtr: *const XXH32_state_t) -> XXH32_hash_t;
105 pub fn XXH32_canonicalFromHash(dst: *mut XXH32_canonical_t, hash: XXH32_hash_t);
106 pub fn XXH32_hashFromCanonical(src: *const XXH32_canonical_t) -> XXH32_hash_t;
107 pub fn XXH64(input: *const c_void, length: usize, seed: XXH64_hash_t) -> XXH64_hash_t;
109 pub fn XXH64_createState() -> *mut XXH64_state_t;
110 pub fn XXH64_freeState(statePtr: *mut XXH64_state_t) -> XXH_errorcode;
111 pub fn XXH64_copyState(dst_state: *mut XXH64_state_t, src_state: *const XXH64_state_t);
112 pub fn XXH64_reset(statePtr: *mut XXH64_state_t, seed: XXH64_hash_t) -> XXH_errorcode;
113 pub fn XXH64_update(statePtr: *mut XXH64_state_t, input: *const c_void, length: usize,) -> XXH_errorcode;
114 pub fn XXH64_digest(statePtr: *const XXH64_state_t) -> XXH64_hash_t;
115 pub fn XXH64_canonicalFromHash(dst: *mut XXH64_canonical_t, hash: XXH64_hash_t);
116 pub fn XXH64_hashFromCanonical(src: *const XXH64_canonical_t) -> XXH64_hash_t;
117 pub fn XXH3_64bits(data: *const c_void, len: usize) -> XXH64_hash_t;
119 pub fn XXH3_64bits_withSeed(data: *const c_void, len: usize, seed: XXH64_hash_t) -> XXH64_hash_t;
120 pub fn XXH3_64bits_withSecret(data: *const c_void, len: usize, secret: *const c_void, secretSize: usize,) -> XXH64_hash_t;
121 pub fn XXH3_createState() -> *mut XXH3_state_t;
122 pub fn XXH3_freeState(statePtr: *mut XXH3_state_t) -> XXH_errorcode;
123 pub fn XXH3_copyState(dst_state: *mut XXH3_state_t, src_state: *const XXH3_state_t);
124 pub fn XXH3_64bits_reset(statePtr: *mut XXH3_state_t) -> XXH_errorcode;
125 pub fn XXH3_64bits_reset_withSeed(statePtr: *mut XXH3_state_t, seed: XXH64_hash_t) -> XXH_errorcode;
126 pub fn XXH3_64bits_reset_withSecret(statePtr: *mut XXH3_state_t, secret: *const c_void, secretSize: usize) -> XXH_errorcode;
127 pub fn XXH3_64bits_update(statePtr: *mut XXH3_state_t, input: *const c_void, length: usize) -> XXH_errorcode;
128 pub fn XXH3_64bits_digest(statePtr: *const XXH3_state_t) -> XXH64_hash_t;
129 pub fn XXH3_128bits(data: *const c_void, len: usize) -> XXH128_hash_t;
130 pub fn XXH3_128bits_withSeed(data: *const c_void, len: usize, seed: XXH64_hash_t) -> XXH128_hash_t;
131 pub fn XXH3_128bits_withSecret(data: *const c_void, len: usize, secret: *const c_void, secretSize: usize) -> XXH128_hash_t;
132 pub fn XXH3_128bits_reset(statePtr: *mut XXH3_state_t) -> XXH_errorcode;
133 pub fn XXH3_128bits_reset_withSeed(statePtr: *mut XXH3_state_t, seed: XXH64_hash_t) -> XXH_errorcode;
134 pub fn XXH3_128bits_reset_withSecret(statePtr: *mut XXH3_state_t, secret: *const c_void, secretSize: usize) -> XXH_errorcode;
135 pub fn XXH3_128bits_update(statePtr: *mut XXH3_state_t, input: *const c_void, length: usize) -> XXH_errorcode;
136 pub fn XXH3_128bits_digest(statePtr: *const XXH3_state_t) -> XXH128_hash_t;
137 pub fn XXH128_isEqual(h1: XXH128_hash_t, h2: XXH128_hash_t) -> libc::c_int;
138 pub fn XXH128_cmp(h128_1: *const c_void, h128_2: *const c_void) -> libc::c_int;
139 pub fn XXH128_canonicalFromHash(dst: *mut XXH128_canonical_t, hash: XXH128_hash_t);
140 pub fn XXH128_hashFromCanonical(src: *const XXH128_canonical_t) -> XXH128_hash_t;
141 pub fn XXH128(data: *const c_void, len: usize, seed: XXH64_hash_t) -> XXH128_hash_t;
142 pub fn XXH3_generateSecret(secretBuffer: *mut c_void, secretSize: usize, customSeed: *const c_void, customSeedSize: usize) -> XXH_errorcode;
143 pub fn XXH3_generateSecret_fromSeed(secretBuffer: *mut c_void, seed: XXH64_hash_t) -> XXH_errorcode;
144 pub fn XXH3_64bits_withSecretandSeed(data: *const c_void, len: usize, secret: *const c_void, secretSize: usize, seed: XXH64_hash_t) -> XXH64_hash_t;
145 pub fn XXH3_128bits_withSecretandSeed(data: *const c_void, len: usize, secret: *const c_void, secretSize: usize, seed: XXH64_hash_t) -> XXH128_hash_t;
146 pub fn XXH3_64bits_reset_withSecretandSeed(statePtr: *mut XXH3_state_t, secret: *const c_void, secretSize: usize, seed: XXH64_hash_t) -> XXH_errorcode;
147 pub fn XXH3_128bits_reset_withSecretandSeed(statePtr: *mut XXH3_state_t, secret: *const c_void, secretSize: usize, seed: XXH64_hash_t) -> XXH_errorcode;
148}