diff --git a/pandas/_libs/include/pandas/vendored/klib/khash_python.h b/pandas/_libs/include/pandas/vendored/klib/khash_python.h index 0311f168dcc4a..76b212a4b4660 100644 --- a/pandas/_libs/include/pandas/vendored/klib/khash_python.h +++ b/pandas/_libs/include/pandas/vendored/klib/khash_python.h @@ -3,8 +3,8 @@ typedef struct { - double real; - double imag; + float real; + float imag; } khcomplex64_t; typedef struct { double real; @@ -93,9 +93,9 @@ khuint64_t PANDAS_INLINE asuint64(double key) { return val; } -khuint32_t PANDAS_INLINE asuint32(double key) { +khuint32_t PANDAS_INLINE asuint32(float key) { khuint32_t val; - memcpy(&val, &key, sizeof(double)); + memcpy(&val, &key, sizeof(float)); return val; } @@ -115,9 +115,9 @@ khuint32_t PANDAS_INLINE kh_float64_hash_func(double val){ return murmur2_64to32(as_int); } -khuint32_t PANDAS_INLINE kh_float32_hash_func(double val){ +khuint32_t PANDAS_INLINE kh_float32_hash_func(float val){ // 0.0 and -0.0 should have the same hash: - if (val == 0.0){ + if (val == 0.0f){ return ZERO_HASH; } // all nans should have the same hash: diff --git a/pandas/_libs/khash.pxd b/pandas/_libs/khash.pxd index 06595f44a591a..c439e1cca772b 100644 --- a/pandas/_libs/khash.pxd +++ b/pandas/_libs/khash.pxd @@ -29,8 +29,8 @@ cdef extern from "pandas/vendored/klib/khash_python.h": "kh_complex_hash_equal" (khcomplex128_t a, khcomplex128_t b) nogil ctypedef struct khcomplex64_t: - double real - double imag + float real + float imag bint are_equivalent_khcomplex64_t \ "kh_complex_hash_equal" (khcomplex64_t a, khcomplex64_t b) nogil