void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::true_ const&) { // Store. // Non-trivial. // Binary. bool s = val.sign(); std::size_t c = val.size(); ar & s; ar & c; ar.save_binary(val.limbs(), c * sizeof(limb_type)); }
void do_serialize(Archive& ar, Int& val, mpl::true_ const&, mpl::false_ const&, mpl::false_ const&) { // Store. // Non-trivial. // Non binary. bool s = val.sign(); ar & s; limb_type* pl = val.limbs(); std::size_t limb_count = val.size(); std::size_t byte_count = limb_count * sizeof(limb_count); ar & byte_count; for(std::size_t i = 0; i < limb_count; ++i) { limb_type l = pl[i]; for(std::size_t j = 0; j < sizeof(limb_type); ++j) { unsigned char byte = static_cast<unsigned char>((l >> (j * CHAR_BIT)) & ((1u << CHAR_BIT) - 1)); ar & byte; } } }