Skip to content

Commit 8983425

Browse files
committed
use template for int64-map
1 parent b871012 commit 8983425

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

pandas/_libs/khash_for_primitive_helper.pxi.in

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,34 @@ Template for wrapping khash-tables for each primitive `dtype`
44
WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
55
"""
66

7+
{{py:
78

9+
# name, c_type
10+
primitive_types = [('int64', 'int64_t')]
11+
}}
12+
13+
{{for name, c_type in primitive_types}}
814

915
cdef extern from "khash_python.h":
10-
ctypedef struct kh_int64_t:
16+
ctypedef struct kh_{{name}}_t:
1117
khint_t n_buckets, size, n_occupied, upper_bound
1218
uint32_t *flags
13-
int64_t *keys
19+
{{c_type}} *keys
1420
size_t *vals
1521

16-
kh_int64_t* kh_init_int64() nogil
17-
void kh_destroy_int64(kh_int64_t*) nogil
18-
void kh_clear_int64(kh_int64_t*) nogil
19-
khint_t kh_get_int64(kh_int64_t*, int64_t) nogil
20-
void kh_resize_int64(kh_int64_t*, khint_t) nogil
21-
khint_t kh_put_int64(kh_int64_t*, int64_t, int*) nogil
22-
void kh_del_int64(kh_int64_t*, khint_t) nogil
22+
kh_{{name}}_t* kh_init_{{name}}() nogil
23+
void kh_destroy_{{name}}(kh_{{name}}_t*) nogil
24+
void kh_clear_{{name}}(kh_{{name}}_t*) nogil
25+
khint_t kh_get_{{name}}(kh_{{name}}_t*, {{c_type}}) nogil
26+
void kh_resize_{{name}}(kh_{{name}}_t*, khint_t) nogil
27+
khint_t kh_put_{{name}}(kh_{{name}}_t*, {{c_type}}, int*) nogil
28+
void kh_del_{{name}}(kh_{{name}}_t*, khint_t) nogil
29+
30+
bint kh_exist_{{name}}(kh_{{name}}_t*, khiter_t) nogil
2331

24-
bint kh_exist_int64(kh_int64_t*, khiter_t) nogil
32+
{{endfor}}
33+
34+
cdef extern from "khash_python.h":
2535

2636
ctypedef uint64_t khuint64_t
2737

0 commit comments

Comments
 (0)