This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1454573615.56.0.108105825094.issue21955@psf.upfronthosting.co.za>
In-reply-to
Content
+        if (Py_SIZE(left) != 0) {
+            if (Py_SIZE(right) != 0) {
+
+#ifdef HAVE_LONG_LONG
+                mul = PyLong_FromLongLong(
+                        (long long)SINGLE_DIGIT_LONG_AS_LONG(left) *
+                            SINGLE_DIGIT_LONG_AS_LONG(right));
+#else
+                mul = PyNumber_Multiply(left, right);
+#endif

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);
#ifdef HAVE_LONG_LONG
        return PyLong_FromLongLong((PY_LONG_LONG)v);
#else
        /* 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);
#endif
----------------

I guess that long_mul() was always well optimized, no need to experiment something new.
History
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: <1454573615.56.0.108105825094.issue21955@psf.upfronthosting.co.za>
2016-02-04 08:13:35vstinnerlinkissue21955 messages
2016-02-04 08:13:35vstinnercreate