summaryrefslogtreecommitdiffstats
path: root/include/jau
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-04-10 02:11:36 +0200
committerSven Gothel <[email protected]>2022-04-10 02:11:36 +0200
commit8f7901fee1fb4689f5e7d4bc648a951cbf2c2637 (patch)
tree414aeb4aa8d33da4169d251e5c531f0d800821a5 /include/jau
parent54644844036a5eeaf3830ad327ad8a2ba197a4dd (diff)
uint[128,192,256]_t: Add ctor with given byte array in native byte order, useful for const initialization
Diffstat (limited to 'include/jau')
-rw-r--r--include/jau/int_types.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/jau/int_types.hpp b/include/jau/int_types.hpp
index edebcb6..a58af79 100644
--- a/include/jau/int_types.hpp
+++ b/include/jau/int_types.hpp
@@ -65,6 +65,7 @@ namespace jau {
uint8_t data[16];
constexpr uint128_t() noexcept : data{0} {}
+ constexpr uint128_t(const uint8_t v[16]) noexcept : data{0} { std::memcpy(data, v, 16); }
constexpr uint128_t(const uint128_t &o) noexcept = default;
uint128_t(uint128_t &&o) noexcept = default;
constexpr uint128_t& operator=(const uint128_t &o) noexcept = default;
@@ -86,6 +87,7 @@ namespace jau {
uint8_t data[24];
constexpr uint192_t() noexcept : data{0} {}
+ constexpr uint192_t(const uint8_t v[24]) noexcept : data{0} { std::memcpy(data, v, 24); }
constexpr uint192_t(const uint192_t &o) noexcept = default;
uint192_t(uint192_t &&o) noexcept = default;
constexpr uint192_t& operator=(const uint192_t &o) noexcept = default;
@@ -107,6 +109,7 @@ namespace jau {
uint8_t data[32];
constexpr uint256_t() noexcept : data{0} {}
+ constexpr uint256_t(const uint8_t v[32]) noexcept : data{0} { std::memcpy(data, v, 32); }
constexpr uint256_t(const uint256_t &o) noexcept = default;
uint256_t(uint256_t &&o) noexcept = default;
constexpr uint256_t& operator=(const uint256_t &o) noexcept = default;