Get equivalent "uint" alignment given an itemsize, for use in copy code */
| 215 | |
| 216 | /* Get equivalent "uint" alignment given an itemsize, for use in copy code */ |
| 217 | static inline npy_uintp |
| 218 | npy_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 |
no outgoing calls
no test coverage detected