Commit 1d6aecf0 authored by Stefan Behnel's avatar Stefan Behnel

also optimise negative PyLong 2-digit case in float +/- operator optimisation

parent c05cbbdf
......@@ -602,10 +602,13 @@ static PyObject* __Pyx_PyFloat_{{op}}{{order}}(PyObject *op1, PyObject *op2, dou
case 0: {{fval}} = 0.0; break;
case 1: {{fval}} = (double)((PyLongObject*){{pyval}})->ob_digit[0]; break;
case 2:
case -2:
if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
{{fval}} = (double) ((((unsigned long)((PyLongObject*){{pyval}})->ob_digit[1]) << PyLong_SHIFT) | ((PyLongObject*){{pyval}})->ob_digit[0]);
// let CPython do its own float rounding from 2**53 on (max. consecutive integer in double float)
if ((8 * sizeof(unsigned long) < 53) || (2 * PyLong_SHIFT < 53) || ({{fval}} < (double) (1L<<53))) {
if (size == -2)
{{fval}} = -{{fval}};
break;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment