| 110 | |
| 111 | |
| 112 | NPY_NO_EXPORT int |
| 113 | npy_to_float(PyArray_Descr *descr, |
| 114 | const Py_UCS4 *str, const Py_UCS4 *end, char *dataptr, |
| 115 | parser_config *NPY_UNUSED(pconfig)) |
| 116 | { |
| 117 | double double_val; |
| 118 | const Py_UCS4 *p_end; |
| 119 | if (double_from_ucs4(str, end, true, &double_val, &p_end) < 0) { |
| 120 | return -1; |
| 121 | } |
| 122 | if (p_end != end) { |
| 123 | return -1; |
| 124 | } |
| 125 | |
| 126 | float val = (float)double_val; |
| 127 | memcpy(dataptr, &val, sizeof(float)); |
| 128 | if (!PyArray_ISNBO(descr->byteorder)) { |
| 129 | npy_bswap4_unaligned(dataptr); |
| 130 | } |
| 131 | return 0; |
| 132 | } |
| 133 | |
| 134 | |
| 135 | NPY_NO_EXPORT int |
nothing calls this directly
no test coverage detected