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

Function npy_to_unicode

numpy/core/src/multiarray/textreading/conversions.c:311–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309
310
311NPY_NO_EXPORT int
312npy_to_unicode(PyArray_Descr *descr,
313 const Py_UCS4 *str, const Py_UCS4 *end, char *dataptr,
314 parser_config *NPY_UNUSED(unused))
315{
316 int length = descr->elsize / 4;
317
318 if (length <= end - str) {
319 memcpy(dataptr, str, length * 4);
320 }
321 else {
322 size_t given_len = end - str;
323 memcpy(dataptr, str, given_len * 4);
324 memset(dataptr + given_len * 4, '\0', (length - given_len) * 4);
325 }
326
327 if (!PyArray_ISNBO(descr->byteorder)) {
328 for (int i = 0; i < length; i++) {
329 npy_bswap4_unaligned(dataptr);
330 dataptr += 4;
331 }
332 }
333 return 0;
334}
335
336
337

Callers

nothing calls this directly

Calls 1

npy_bswap4_unalignedFunction · 0.85

Tested by

no test coverage detected