Author vstinner
Recipients casevh, josh.r, lemburg, mark.dickinson, pitrou, rhettinger, serhiy.storchaka, vstinner, yselivanov, zbyrne
Date 2016-02-04.08:13:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
+        if (Py_SIZE(left) != 0) {
+            if (Py_SIZE(right) != 0) {
+                mul = PyLong_FromLongLong(
+                        (long long)SINGLE_DIGIT_LONG_AS_LONG(left) *
+                            SINGLE_DIGIT_LONG_AS_LONG(right));
+                mul = PyNumber_Multiply(left, right);

Why don't you use the same code than long_mul() (you need #include "longintrepr.h")?
        stwodigits v = (stwodigits)(MEDIUM_VALUE(a)) * MEDIUM_VALUE(b);
        return PyLong_FromLongLong((PY_LONG_LONG)v);
        /* if we don't have long long then we're almost certainly
           using 15-bit digits, so v will fit in a long.  In the
           unlikely event that we're using 30-bit digits on a platform
           without long long, a large v will just cause us to fall
           through to the general multiplication code below. */
        if (v >= LONG_MIN && v <= LONG_MAX)
            return PyLong_FromLong((long)v);

I guess that long_mul() was always well optimized, no need to experiment something new.
Date User Action Args
2016-02-04 08:13:35vstinnersetrecipients: + vstinner, lemburg, rhettinger, mark.dickinson, pitrou, casevh, serhiy.storchaka, yselivanov, josh.r, zbyrne
2016-02-04 08:13:35vstinnersetmessageid: <>
2016-02-04 08:13:35vstinnerlinkissue21955 messages
2016-02-04 08:13:35vstinnercreate