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

Function npy_uint_alignment

numpy/core/src/multiarray/common.h:217–246  ·  view source on GitHub ↗

Get equivalent "uint" alignment given an itemsize, for use in copy code */

Source from the content-addressed store, hash-verified

215
216/* Get equivalent "uint" alignment given an itemsize, for use in copy code */
217static inline npy_uintp
218npy_uint_alignment(int itemsize)
219{
220 npy_uintp alignment = 0; /* return value of 0 means unaligned */
221
222 switch(itemsize){
223 case 1:
224 return 1;
225 case 2:
226 alignment = NPY_ALIGNOF(npy_uint16);
227 break;
228 case 4:
229 alignment = NPY_ALIGNOF(npy_uint32);
230 break;
231 case 8:
232 alignment = NPY_ALIGNOF(npy_uint64);
233 break;
234 case 16:
235 /*
236 * 16 byte types are copied using 2 uint64 assignments.
237 * See the strided copy function in lowlevel_strided_loops.c.
238 */
239 alignment = NPY_ALIGNOF(npy_uint64);
240 break;
241 default:
242 break;
243 }
244
245 return alignment;
246}
247
248/*
249 * memchr with stride and invert argument

Callers 6

raw_array_assign_scalarFunction · 0.85
PyArray_AssignRawScalarFunction · 0.85
copycast_isalignedFunction · 0.85
PyArray_CastRawArraysFunction · 0.85
IsUintAlignedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected