Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
pyhash.h55 linesDownload Raw Back to cpython
1#ifndef Py_CPYTHON_HASH_H2#  error "this header file must not be included directly"3#endif4 5/* Prime multiplier used in string and various other hashes. */6#define PyHASH_MULTIPLIER 1000003UL  /* 0xf4243 */7 8/* Parameters used for the numeric hash implementation.  See notes for9   _Py_HashDouble in Python/pyhash.c.  Numeric hashes are based on10   reduction modulo the prime 2**_PyHASH_BITS - 1. */11 12#if SIZEOF_VOID_P >= 813#  define PyHASH_BITS 6114#else15#  define PyHASH_BITS 3116#endif17 18#define PyHASH_MODULUS (((size_t)1 << _PyHASH_BITS) - 1)19#define PyHASH_INF 31415920#define PyHASH_IMAG PyHASH_MULTIPLIER21 22/* Aliases kept for backward compatibility with Python 3.12 */23#define _PyHASH_MULTIPLIER PyHASH_MULTIPLIER24#define _PyHASH_BITS PyHASH_BITS25#define _PyHASH_MODULUS PyHASH_MODULUS26#define _PyHASH_INF PyHASH_INF27#define _PyHASH_IMAG PyHASH_IMAG28 29/* Helpers for hash functions */30PyAPI_FUNC(Py_hash_t) _Py_HashDouble(PyObject *, double);31 32 33/* hash function definition */34typedef struct {35    Py_hash_t (*const hash)(const void *, Py_ssize_t);36    const char *name;37    const int hash_bits;38    const int seed_bits;39} PyHash_FuncDef;40 41PyAPI_FUNC(PyHash_FuncDef*) PyHash_GetFuncDef(void);42 43PyAPI_FUNC(Py_hash_t) Py_HashPointer(const void *ptr);44 45// Deprecated alias kept for backward compatibility46Py_DEPRECATED(3.14) static inline Py_hash_t47_Py_HashPointer(const void *ptr)48{49    return Py_HashPointer(ptr);50}51 52PyAPI_FUNC(Py_hash_t) PyObject_GenericHash(PyObject *);53 54PyAPI_FUNC(Py_hash_t) Py_HashBuffer(const void *ptr, Py_ssize_t len);55 
codekingpro/portable-devtools · Team Ai