| 228 | |
| 229 | |
| 230 | NPY_NO_EXPORT int |
| 231 | npy_to_cfloat(PyArray_Descr *descr, |
| 232 | const Py_UCS4 *str, const Py_UCS4 *end, char *dataptr, |
| 233 | parser_config *pconfig) |
| 234 | { |
| 235 | double real; |
| 236 | double imag; |
| 237 | |
| 238 | bool success = to_complex_int( |
| 239 | str, end, &real, &imag, |
| 240 | pconfig->imaginary_unit, true); |
| 241 | |
| 242 | if (!success) { |
| 243 | return -1; |
| 244 | } |
| 245 | npy_complex64 val = {(float)real, (float)imag}; |
| 246 | memcpy(dataptr, &val, sizeof(npy_complex64)); |
| 247 | if (!PyArray_ISNBO(descr->byteorder)) { |
| 248 | npy_bswap4_unaligned(dataptr); |
| 249 | npy_bswap4_unaligned(dataptr + 4); |
| 250 | } |
| 251 | return 0; |
| 252 | } |
| 253 | |
| 254 | |
| 255 | NPY_NO_EXPORT int |
nothing calls this directly
no test coverage detected