MCPcopy Create free account
hub / github.com/numpy/numpy / npy_fasttake

Function npy_fasttake

numpy/core/src/multiarray/item_selection.c:171–215  ·  view source on GitHub ↗

* Helper function instantiating npy_fasttake_impl in different branches * to allow the compiler to optimize each to the specific itemsize. */

Source from the content-addressed store, hash-verified

169 * to allow the compiler to optimize each to the specific itemsize.
170 */
171static NPY_GCC_OPT_3 int
172npy_fasttake(
173 char *dest, char *src, const npy_intp *indices,
174 npy_intp n, npy_intp m, npy_intp max_item,
175 npy_intp nelem, npy_intp chunk,
176 NPY_CLIPMODE clipmode, npy_intp itemsize, int needs_refcounting,
177 PyArray_Descr *dtype, int axis)
178{
179 if (!needs_refcounting) {
180 if (chunk == 1) {
181 return npy_fasttake_impl(
182 dest, src, indices, n, m, max_item, nelem, chunk,
183 clipmode, itemsize, needs_refcounting, dtype, axis);
184 }
185 if (chunk == 2) {
186 return npy_fasttake_impl(
187 dest, src, indices, n, m, max_item, nelem, chunk,
188 clipmode, itemsize, needs_refcounting, dtype, axis);
189 }
190 if (chunk == 4) {
191 return npy_fasttake_impl(
192 dest, src, indices, n, m, max_item, nelem, chunk,
193 clipmode, itemsize, needs_refcounting, dtype, axis);
194 }
195 if (chunk == 8) {
196 return npy_fasttake_impl(
197 dest, src, indices, n, m, max_item, nelem, chunk,
198 clipmode, itemsize, needs_refcounting, dtype, axis);
199 }
200 if (chunk == 16) {
201 return npy_fasttake_impl(
202 dest, src, indices, n, m, max_item, nelem, chunk,
203 clipmode, itemsize, needs_refcounting, dtype, axis);
204 }
205 if (chunk == 32) {
206 return npy_fasttake_impl(
207 dest, src, indices, n, m, max_item, nelem, chunk,
208 clipmode, itemsize, needs_refcounting, dtype, axis);
209 }
210 }
211
212 return npy_fasttake_impl(
213 dest, src, indices, n, m, max_item, nelem, chunk,
214 clipmode, itemsize, needs_refcounting, dtype, axis);
215}
216
217
218/*NUMPY_API

Callers 1

PyArray_TakeFromFunction · 0.85

Calls 1

npy_fasttake_implFunction · 0.85

Tested by

no test coverage detected