[issue22501] Optimise PyLong division by 1 or -1

Stefan Behnel report at bugs.python.org
Fri Sep 26 12:57:27 CEST 2014


Stefan Behnel added the comment:

Here is an incremental patch that adds fast paths for adding and subtracting 0.

Question: the module calls long_long() in some places (e.g. long_abs()) and thus forces the return type to be exactly a PyLong and not a subtype. My changes use a plain "incref+return input value" in some places. Should they call long_long() on it instead?

----------
Added file: http://bugs.python.org/file36734/add_sub_0_fast_path.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22501>
_______________________________________


More information about the Python-bugs-list mailing list