24 LogDebug(
"ForwardSim") <<
"Creating TotemNumberMerger";
30 LogDebug(
"ForwardSim") <<
"Destruction of TotemNumberMerger";
39 unsigned long c(value1 + value2);
40 unsigned long result(((c * (c + 1)) >> 1) + value1);
43 LogDebug(
"ForwardSim") <<
"Merge(value1=" << value1 <<
", value2=" << value2 <<
")=" <<
result;
45 unsigned long invValue1, invValue2;
46 Split(result, invValue1, invValue2);
48 assert(invValue1 == value1);
49 assert(invValue2 == value2);
62 unsigned long value4)
const {
67 unsigned long c(static_cast<unsigned long>(floor(
sqrt(1. + 8. * static_cast<float>(source)) * 0.5 - 0.5)));
69 value1 = source - ((c * (c + 1)) >> 1);
73 LogDebug(
"ForwardSim") <<
"source=" << source <<
", c=" << c <<
", value1=" << value1 <<
", value2=" <<
value2;
80 unsigned long &value3)
const {
83 Split(source, mix12, value3);
84 Split(mix12, value1, value2);
90 unsigned long &value3,
91 unsigned long &value4)
const {
92 unsigned long mix12, mix34;
94 Split(source, mix12, mix34);
95 Split(mix12, value1, value2);
96 Split(mix34, value3, value4);
unsigned long Merge(unsigned long value1, unsigned long value2) const
void Split(unsigned long source, unsigned long &value1, unsigned long &value2) const
static std::string const source