From 7bdd5557964bdda3c64c5c17069d8ad8b6fd8345 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Tue, 2 Aug 2022 23:05:46 -0700 Subject: [PATCH 1/3] CLN: remove deprecated DEF --- pandas/_libs/hashing.pyx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/_libs/hashing.pyx b/pandas/_libs/hashing.pyx index 4a12659aa1f57..752153fcc7c8d 100644 --- a/pandas/_libs/hashing.pyx +++ b/pandas/_libs/hashing.pyx @@ -21,8 +21,9 @@ import_array() from pandas._libs.util cimport is_nan -DEF cROUNDS = 2 -DEF dROUNDS = 4 +cdef enum: + cROUNDS = 2 + dROUNDS = 4 @cython.boundscheck(False) From 38545da32aeb24235de729ef7790466095d22cb2 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 3 Aug 2022 11:30:16 -0700 Subject: [PATCH 2/3] fix empty line --- pandas/_libs/hashing.pyx | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/_libs/hashing.pyx b/pandas/_libs/hashing.pyx index 752153fcc7c8d..41b31a52010a4 100644 --- a/pandas/_libs/hashing.pyx +++ b/pandas/_libs/hashing.pyx @@ -21,6 +21,7 @@ import_array() from pandas._libs.util cimport is_nan + cdef enum: cROUNDS = 2 dROUNDS = 4 From 1b9f7b6b5428a5616ec5f8c866f9d6edb16fd58f Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 3 Aug 2022 22:18:28 -0700 Subject: [PATCH 3/3] move consts inside of func --- pandas/_libs/hashing.pyx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pandas/_libs/hashing.pyx b/pandas/_libs/hashing.pyx index 41b31a52010a4..9ea0fa73cbc9f 100644 --- a/pandas/_libs/hashing.pyx +++ b/pandas/_libs/hashing.pyx @@ -22,11 +22,6 @@ import_array() from pandas._libs.util cimport is_nan -cdef enum: - cROUNDS = 2 - dROUNDS = 4 - - @cython.boundscheck(False) def hash_object_array( ndarray[object] arr, str key, str encoding="utf8" @@ -164,6 +159,8 @@ cdef uint64_t low_level_siphash(uint8_t* data, size_t datalen, cdef uint8_t* end = data + datalen - (datalen % sizeof(uint64_t)) cdef int left = datalen & 7 cdef int left_byte + cdef int cROUNDS = 2 + cdef int dROUNDS = 4 b = (datalen) << 56 v3 ^= k1