@@ -10,14 +10,22 @@ WARNING: DO NOT edit .pxi FILE directly, .pxi is generated from .pxi.in
10
10
11
11
{{py:
12
12
13
- # name, dtype, ctype
14
- dtypes = [('Float64', 'float64', 'float64_t'),
15
- ('UInt64', 'uint64', 'uint64_t'),
16
- ('Int64', 'int64', 'int64_t'),
17
- ('Object', 'object', 'object')]
13
+ # name, dtype, ctype, hashtable_name, hashtable_dtype
14
+ dtypes = [('Float64', 'float64', 'float64_t', 'Float64', 'float64'),
15
+ ('Float32', 'float32', 'float32_t', 'Float64', 'float64'),
16
+ ('Int64', 'int64', 'int64_t', 'Int64', 'int64'),
17
+ ('Int32', 'int32', 'int32_t', 'Int64', 'int64'),
18
+ ('Int16', 'int16', 'int16_t', 'Int64', 'int64'),
19
+ ('Int8', 'int8', 'int8_t', 'Int64', 'int64'),
20
+ ('UInt64', 'uint64', 'uint64_t', 'UInt64', 'uint64'),
21
+ ('UInt32', 'uint32', 'uint32_t', 'UInt64', 'uint64'),
22
+ ('UInt16', 'uint16', 'uint16_t', 'UInt64', 'uint64'),
23
+ ('UInt8', 'uint8', 'uint8_t', 'UInt64', 'uint64'),
24
+ ('Object', 'object', 'object', 'PyObject', 'object'),
25
+ ]
18
26
}}
19
27
20
- {{for name, dtype, ctype in dtypes}}
28
+ {{for name, dtype, ctype, hashtable_name, hashtable_dtype in dtypes}}
21
29
22
30
23
31
cdef class {{name}}Engine(IndexEngine):
@@ -34,13 +42,9 @@ cdef class {{name}}Engine(IndexEngine):
34
42
other, limit=limit)
35
43
36
44
cdef _make_hash_table(self, n):
37
- {{if name == 'Object'}}
38
- return _hash.PyObjectHashTable(n)
39
- {{else}}
40
- return _hash.{{name}}HashTable(n)
41
- {{endif}}
45
+ return _hash.{{hashtable_name}}HashTable(n)
42
46
43
- {{if name != 'Float64' and name != 'Object'}}
47
+ {{if name not in { 'Float64', 'Float32', 'Object'} }}
44
48
cdef _check_type(self, object val):
45
49
hash(val)
46
50
if util.is_bool_object(val):
@@ -60,7 +64,7 @@ cdef class {{name}}Engine(IndexEngine):
60
64
ndarray[{{ctype}}] values
61
65
int count = 0
62
66
63
- {{if name != 'Float64'}}
67
+ {{if name not in { 'Float64', 'Float32'} }}
64
68
if not util.is_integer_object(val):
65
69
raise KeyError(val)
66
70
{{endif}}
0 commit comments