From 9c1e5bc2b74ea0f63bae1b8dac0bfffe3609a223 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 6 Mar 2018 21:55:23 +0100 Subject: [PATCH] Merge #12564: [arith_uint256] Avoid unnecessary this-copy using prefix operator 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 --- src/arith_uint256.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arith_uint256.h b/src/arith_uint256.h index 89a5272f1f..d4b0ec6152 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -85,7 +85,7 @@ public: base_uint ret; for (int i = 0; i < WIDTH; i++) ret.pn[i] = ~pn[i]; - ret++; + ++ret; return ret; }