Skip to content

Commit

Permalink
Go back to old fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Aug 2, 2023
1 parent 1efe3be commit 89091d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions pandas/_libs/include/pandas/vendored/klib/khash_python.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@


typedef struct {
double real;
double imag;
float real;
float imag;
} khcomplex64_t;
typedef struct {
double real;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/khash.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 89091d7

Please sign in to comment.