25 #ifndef CRYPTO3_PACK_NUMERIC_HPP
26 #define CRYPTO3_PACK_NUMERIC_HPP
28 #include <boost/assert.hpp>
29 #include <boost/static_assert.hpp>
31 #include <nil/crypto3/multiprecision/cpp_int.hpp>
36 using namespace nil::crypto3::multiprecision;
38 template<
typename Endianness,
int InValueBits,
int OutValueBits,
typename InputIterator,
typename Backend,
39 expression_template_option ExpressionTemplates>
40 inline void pack(InputIterator first, InputIterator last, number<Backend, ExpressionTemplates> &out) {
41 import_bits(out, first, last);
42 BOOST_ASSERT(msb(out) == OutValueBits);
45 template<
typename Endianness,
int OutValueBits,
typename InputType,
typename Backend,
46 expression_template_option ExpressionTemplates>
47 inline void pack(
const InputType &in, number<Backend, ExpressionTemplates> &out) {
48 import_bits(out, in.begin(), in.end());
49 BOOST_ASSERT(msb(out) == OutValueBits);
52 template<
typename Endianness,
int OutValueBits,
typename OutputType,
typename Backend,
53 expression_template_option ExpressionTemplates>
54 inline void pack(
const number<Backend, ExpressionTemplates> &in, OutputType &out) {
56 BOOST_ASSERT(msb(out) == OutValueBits);
void pack(InputIterator first, InputIterator last, std::random_access_iterator_tag, OutputIterator out)
Packs elements from the range [first, last) into elements starting from out. Works for input containe...
Definition: block/include/nil/crypto3/detail/pack.hpp:835