You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 27, 2025. It is now read-only.
// This is based on get_datetime_metadata_from_dtype in the NumPy source, but that function is private. This does not check that the dytpe is of the appropriate type.
// Based on convert_pyobject_to_datetime and related usage in datetime.c
103
96
PyArray_DatetimeMetaData*dma=&(dts->obmeta);
104
97
returndma->base;
105
98
}
106
99
107
-
108
-
109
100
KeysArrayType
110
101
at_to_kat(intarray_t, PyArrayObject*a) {
111
102
switch (array_t) {
@@ -178,8 +169,7 @@ at_to_kat(int array_t, PyArrayObject* a) {
178
169
}
179
170
}
180
171
181
-
182
-
// To determine when we can use direct array lookups, this function return 1 if we match, 0 if we do not match. Given a keys array type and the kind of lookup key, return true only for the largest KAT types.s
172
+
// To determine when we can use direct array lookups, this function return 1 if we match, 0 if we do not match. Given a keys array type and the kind of lookup key, return true only for the largest KAT types.
// Return the end pointer, or the pointer to the location after the last valid character. The end pointer minus the start pointer is the number of characters. For an empty string, all characters are NULL, and the start pointer and end pointer should be equal. NOTE: would like to use strchr(str, '\0') instead of this routine, but some buffers might not have a null terminator and stread by full to the the dt_size.
// This masks the input with INT64_MAX, which removes the MSB; we then cast to an int64; the range is now between 0 and INT64_MAX. We then use the MSB of the original value; if set, we negate the number, producing negative values for the upper half of the uint64 range. Note that we only need to check for hash -1 in this branch.
319
305
staticinlinePy_hash_t
320
306
uint_to_hash(npy_uint64v) {
@@ -337,7 +323,6 @@ int_to_hash(npy_int64 v) {
337
323
returnhash;
338
324
}
339
325
340
-
341
326
// This is a adapted from https://github.com/python/cpython/blob/ba65a065cf07a7a9f53be61057a090f7311a5ad7/Python/pyhash.c#L92
342
327
#defineHASH_MODULUS (((size_t)1 << 61) - 1)
343
328
#defineHASH_BITS 61
@@ -379,7 +364,6 @@ double_to_hash(double v)
379
364
return (Py_hash_t)x;
380
365
}
381
366
382
-
383
367
// The `str` arg is a pointer to a C-array of Py_UCS4; we will only read `len` characters from this. This is a "djb2" hash algorithm.
// the global int_cache is shared among all instances
416
398
417
399
staticPyObject*int_cache=NULL;
418
400
419
-
420
401
// NOTE: this used to be a Py_ssize_t, which can be 32 bits on some machines and might easily overflow with a few very large indices. Using an explicit 64-bit int seems safer
421
402
staticnpy_int64key_count_global=0;
422
403
423
-
424
404
// Fill the int_cache up to size_needed with PyObject ints; `size` is not the key_count_global.
// For a FAMI, Return appropriate PyObject for items, keys, and values. When values are needed they are retrieved from the int_cache. For consistency with NumPy array iteration, arrays use PyArray_ToScalar instead of PyArray_GETITEM.
0 commit comments