Function deserialize

Synopsis

#include <include/rapidcheck/Random.hpp>

template <typename Iterator>
Iterator deserialize(Iterator begin, Iterator end, Random &output)

Description

No description yet.

Source

Lines 18-44 in include/rapidcheck/Random.hpp.

template <typename Iterator>
Iterator deserialize(Iterator begin, Iterator end, Random &output) {
  using namespace rc::detail;
  auto iit = begin;

  iit = deserializeN<typename Random::Block::value_type>(
      iit, end, output.m_key.size(), output.m_key.begin());
  iit = deserializeCompact(iit, end, output.m_bits);

  Random::Counter counter;
  iit = deserializeCompact(iit, end, counter);
  // Normally, the block is calculated lazily if counter is divisible by 4 so
  // let's simulate this.
  if (counter != 0) {
    const auto blki =
        ((counter - 1) % std::tuple_size<Random::Block>::value) + 1;
    if (blki != 0) {
      // Calculate the block as if counter % 4 == 0
      output.m_counter = counter - blki;
      output.mash(output.m_block);
    }
  }
  output.m_counter = counter;

  output.m_bitsi = *iit;
  return ++iit;
}





Add Discussion as Guest

Log in