Skip to content
Snippets Groups Projects
Commit 9dce823c authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

py/modbuiltins: Implement abs() by dispatching to MP_UNARY_OP_ABS.

This allows user classes to implement __abs__ special method, and saves
code size (104 bytes for x86_64), even though during refactor, an issue
was fixed and few optimizations were made:

* abs() of minimum (negative) small int value is calculated properly.
* objint_longlong and objint_mpz avoid allocating new object is the
  argument is already non-negative.
parent 72491b3e
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment