-
- Downloads
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.
Showing
- py/modbuiltins.c 1 addition, 20 deletionspy/modbuiltins.c
- py/objcomplex.c 5 additions, 0 deletionspy/objcomplex.c
- py/objfloat.c 9 additions, 0 deletionspy/objfloat.c
- py/objint.c 0 additions, 10 deletionspy/objint.c
- py/objint.h 0 additions, 1 deletionpy/objint.h
- py/objint_longlong.c 10 additions, 24 deletionspy/objint_longlong.c
- py/objint_mpz.c 9 additions, 21 deletionspy/objint_mpz.c
- py/runtime.c 9 additions, 0 deletionspy/runtime.c
- py/runtime0.h 1 addition, 0 deletionspy/runtime0.h
- tests/unix/extra_coverage.py.exp 1 addition, 1 deletiontests/unix/extra_coverage.py.exp
Loading
Please register or sign in to comment