HomePhabricator

Merge #12564: [arith_uint256] Avoid unnecessary this-copy using prefix operator

Description

Merge #12564: [arith_uint256] Avoid unnecessary this-copy using prefix operator

Summary:
22b4aae02 [arith_uint256] Avoid unnecessary this-copy using prefix operator (Karl-Johan Alm)

Pull request description:

I noticed while profiling a related project that `operator-()` actually calls the `base_uint` constructor, which is because the postfix operator version of `operator++` (used in `operator-()`) creates a copy of `this` and returns it.

Tree-SHA512: d9a2665caa3d93f064cdeaf1c6fada101b9943bb53d93ccac6d9a0edac20279d2e921349e30239039c71e0a9629e45c29ec9f10d8d7499e936cdba6cb7c3c3eb

Backport of Core PR 12564
https://github.com/bitcoin/bitcoin/pull/12564

Test Plan:

make check
test_runner.py

Reviewers: jasonbcox, deadalnix, Fabien, markblundeberg, O1 Bitcoin ABC, #bitcoin_abc

Reviewed By: Fabien, O1 Bitcoin ABC, #bitcoin_abc

Differential Revision: https://reviews.bitcoinabc.org/D3067

Details

Provenance
Wladimir J. van der Laan <laanwj@gmail.com>Authored on Mar 6 2018, 20:55
nakihitoCommitted on May 20 2019, 21:18
MengerianPushed on May 20 2019, 23:21
Reviewer
Restricted Owners Package
Differential Revision
D3067: Merge #12564: [arith_uint256] Avoid unnecessary this-copy using prefix operator
Parents
rSTAGING7cb2951d02ce: Merge #12182: Remove useless string initializations
Branches
Unknown
Tags
Unknown