diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-10 23:37:02 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-10-15 11:58:29 +0100 |
commit | 9ebf7b6dcfcebb290b5faa0f55f8e5d41e383be1 (patch) | |
tree | 153ad5d1b3d9891f5f8f84eb437e91e596687eb4 /src/ringct/rctOps.cpp | |
parent | ringct: add a few consts where possible (diff) | |
download | monero-9ebf7b6dcfcebb290b5faa0f55f8e5d41e383be1.tar.xz |
ringct: avoid unnecessary memcpy
Diffstat (limited to 'src/ringct/rctOps.cpp')
-rw-r--r-- | src/ringct/rctOps.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index 7182861cf..239168388 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -368,15 +368,8 @@ namespace rct { //This takes the outputs and commitments //and hashes them into a 32 byte sized key key cn_fast_hash(const ctkeyV &PC) { - key rv = identity(); - std::size_t l = (std::size_t)PC.size(); - size_t i = 0, j = 0; - vector<char> m(l * 64); - for (i = 0 ; i < l ; i++) { - memcpy(&m[i * 64], &PC[i].dest, 32); - memcpy(&m[i * 64 + 32], &PC[i].mask, 32); - } - cn_fast_hash(rv, &m[0], 64*l); + key rv; + cn_fast_hash(rv, &PC[0], 64*PC.size()); return rv; } @@ -391,14 +384,8 @@ namespace rct { //put them in the key vector and it concatenates them //and then hashes them key cn_fast_hash(const keyV &keys) { - size_t l = keys.size(); - vector<unsigned char> m(l * 32); - size_t i; - for (i = 0 ; i < l ; i++) { - memcpy(&m[i * 32], keys[i].bytes, 32); - } key rv; - cn_fast_hash(rv, &m[0], 32 * l); + cn_fast_hash(rv, &keys[0], keys.size() * sizeof(keys[0])); //dp(rv); return rv; } |