aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-27 14:22:31 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2016-08-28 21:30:45 +0100
commit16732a85d7955e59f9e81420ddea0d161f5320e8 (patch)
tree4d4777d355dda92c1e82fd7206a01d34b4e2f5b8
parentwallet: fix some "may be used uninitialized" warnings (diff)
downloadmonero-16732a85d7955e59f9e81420ddea0d161f5320e8.tar.xz
rct: faster Cryptonote/rct conversions
-rw-r--r--src/ringct/rctTypes.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ringct/rctTypes.h b/src/ringct/rctTypes.h
index 58e08b0f7..f231d30fb 100644
--- a/src/ringct/rctTypes.h
+++ b/src/ringct/rctTypes.h
@@ -334,14 +334,14 @@ namespace rct {
//int[64] to uint long long
xmr_amount b2d(bits amountb);
- static inline rct::key pk2rct(const crypto::public_key &pk) { rct::key k; memcpy(&k, &pk, 32); return k; }
- static inline rct::key sk2rct(const crypto::secret_key &sk) { rct::key k; memcpy(&k, &sk, 32); return k; }
- static inline rct::key ki2rct(const crypto::key_image &ki) { rct::key k; memcpy(&k, &ki, 32); return k; }
- static inline rct::key hash2rct(const crypto::hash &h) { rct::key k; memcpy(&k, &h, 32); return k; }
- static inline crypto::public_key rct2pk(const rct::key &k) { crypto::public_key pk; memcpy(&pk, &k, 32); return pk; }
- static inline crypto::secret_key rct2sk(const rct::key &k) { crypto::secret_key sk; memcpy(&sk, &k, 32); return sk; }
- static inline crypto::key_image rct2ki(const rct::key &k) { crypto::key_image ki; memcpy(&ki, &k, 32); return ki; }
- static inline crypto::hash rct2hash(const rct::key &k) { crypto::hash h; memcpy(&h, &k, 32); return h; }
+ static inline const rct::key pk2rct(const crypto::public_key &pk) { return (const rct::key&)pk; }
+ static inline const rct::key sk2rct(const crypto::secret_key &sk) { return (const rct::key&)sk; }
+ static inline const rct::key ki2rct(const crypto::key_image &ki) { return (const rct::key&)ki; }
+ static inline const rct::key hash2rct(const crypto::hash &h) { return (const rct::key&)h; }
+ static inline const crypto::public_key rct2pk(const rct::key &k) { return (const crypto::public_key&)k; }
+ static inline const crypto::secret_key rct2sk(const rct::key &k) { return (const crypto::secret_key&)k; }
+ static inline const crypto::key_image rct2ki(const rct::key &k) { return (const crypto::key_image&)k; }
+ static inline const crypto::hash rct2hash(const rct::key &k) { return (const crypto::hash&)k; }
static inline bool operator==(const rct::key &k0, const crypto::public_key &k1) { return !memcmp(&k0, &k1, 32); }
static inline bool operator!=(const rct::key &k0, const crypto::public_key &k1) { return memcmp(&k0, &k1, 32); }
}