diff options
author | Olivier Gayot <og@satcom1.com> | 2017-11-19 13:12:12 +0100 |
---|---|---|
committer | Olivier Gayot <og@satcom1.com> | 2017-11-19 16:21:05 +0100 |
commit | 471186ab6e721fed603871f385d9590a69878de3 (patch) | |
tree | 6bafd2b5de0ef26032e2e49d2429c45f3cc7b29c /number.cpp | |
parent | 5a2d18587b53133bc831967ccd8d6a5dd6e54190 (diff) |
Allowed construction of number from 64-bits-wide integer
Signed-off-by: Olivier Gayot <og@satcom1.com>
Diffstat (limited to 'number.cpp')
-rw-r--r-- | number.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -2,9 +2,18 @@ #include <sstream> #include "number.h" -number::number(std::uint32_t n): - _operands{n} -{ } +number::number(std::uint64_t n) +{ + if (n == 0) { + return; + } + + _operands.push_back(n & UINT32_MAX); + + if (n > UINT32_MAX) { + _operands.push_back(n >> 32); + } +} /* Type Conversion {{{ */ |