10#ifndef RANLUXPP_RANLUX_LCG_H
11#define RANLUXPP_RANLUX_LCG_H
24static void to_lcg(
const uint64_t *ranlux,
unsigned c, uint64_t *lcg) {
27 for (
int i = 0; i < 9; i++) {
28 uint64_t ranlux_i = ranlux[i];
29 uint64_t lcg_i = sub_overflow(ranlux_i, carry, carry);
33 bits += ranlux[i + 5] >> 16;
35 bits += ranlux[i + 6] << 48;
38 lcg_i = sub_carry(lcg_i, bits, carry);
43 for (
int i = 0; i < 9; i++) {
44 lcg[i] = add_overflow(lcg[i], c, c);
55static void to_ranlux(
const uint64_t *lcg, uint64_t *ranlux,
unsigned &c_out) {
57 int64_t c = compute_r(lcg, r);
61 for (
int i = 0; i < 9; i++) {
62 uint64_t in_i = lcg[i];
63 uint64_t tmp_i = add_overflow(in_i, carry, carry);
67 bits += lcg[i + 5] >> 16;
69 bits += lcg[i + 6] << 48;
72 tmp_i = add_carry(tmp_i, bits, carry);
78 ranlux[0] = add_overflow(ranlux[0], c, carry);
79 for (
int i = 1; i < 9; i++) {
80 uint64_t ranlux_i = ranlux[i];
81 ranlux_i = add_overflow(ranlux_i, carry, carry);
82 ranlux_i = add_carry(ranlux_i, c1, carry);