| 253 | |
| 254 | |
| 255 | NPY_NO_EXPORT int |
| 256 | npy_to_cdouble(PyArray_Descr *descr, |
| 257 | const Py_UCS4 *str, const Py_UCS4 *end, char *dataptr, |
| 258 | parser_config *pconfig) |
| 259 | { |
| 260 | double real; |
| 261 | double imag; |
| 262 | |
| 263 | bool success = to_complex_int( |
| 264 | str, end, &real, &imag, pconfig->imaginary_unit, true); |
| 265 | |
| 266 | if (!success) { |
| 267 | return -1; |
| 268 | } |
| 269 | npy_complex128 val = {real, imag}; |
| 270 | memcpy(dataptr, &val, sizeof(npy_complex128)); |
| 271 | if (!PyArray_ISNBO(descr->byteorder)) { |
| 272 | npy_bswap8_unaligned(dataptr); |
| 273 | npy_bswap8_unaligned(dataptr + 8); |
| 274 | } |
| 275 | return 0; |
| 276 | } |
| 277 | |
| 278 | |
| 279 | /* |
nothing calls this directly
no test coverage detected