1#[cfg(not(any(Py_LIMITED_API, PyPy)))]
2use crate::pyport::{Py_hash_t, Py_ssize_t};
3#[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
4use std::os::raw::c_char;
5#[cfg(not(any(Py_LIMITED_API, PyPy)))]
6use std::os::raw::c_void;
7
8use std::os::raw::{c_int, c_ulong};
9
10extern "C" {
11 #[cfg(not(any(Py_LIMITED_API, PyPy)))]
16 pub fn _Py_HashBytes(src: *const c_void, len: Py_ssize_t) -> Py_hash_t;
17}
18
19pub const _PyHASH_MULTIPLIER: c_ulong = 1000003;
20
21#[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
26#[repr(C)]
27#[derive(Copy, Clone)]
28pub struct PyHash_FuncDef {
29 pub hash: Option<extern "C" fn(arg1: *const c_void, arg2: Py_ssize_t) -> Py_hash_t>,
30 pub name: *const c_char,
31 pub hash_bits: c_int,
32 pub seed_bits: c_int,
33}
34
35#[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
36impl Default for PyHash_FuncDef {
37 #[inline]
38 fn default() -> Self {
39 unsafe { std::mem::zeroed() }
40 }
41}
42
43extern "C" {
44 #[cfg(not(any(Py_LIMITED_API, PyPy, GraalPy)))]
45 pub fn PyHash_GetFuncDef() -> *mut PyHash_FuncDef;
46}
47
48pub const Py_HASH_EXTERNAL: c_int = 0;
51pub const Py_HASH_SIPHASH24: c_int = 1;
52pub const Py_HASH_FNV: c_int = 2;
53
54