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