12#ifndef RANLUXPP_RANLUX_LCG_H
13#define RANLUXPP_RANLUX_LCG_H
26static void to_lcg(
const uint64_t *ranlux,
unsigned c, uint64_t *lcg)
30 for (
int i = 0; i < 9; i++) {
31 uint64_t ranlux_i = ranlux[i];
36 bits += ranlux[i + 5] >> 16;
38 bits += ranlux[i + 6] << 48;
46 for (
int i = 0; i < 9; i++) {
58static void to_ranlux(
const uint64_t *lcg, uint64_t *ranlux,
unsigned &c_out)
65 for (
int i = 0; i < 9; i++) {
66 uint64_t in_i = lcg[i];
71 bits += lcg[i + 5] >> 16;
73 bits += lcg[i + 6] << 48;
83 for (
int i = 1; i < 9; i++) {
84 uint64_t ranlux_i = ranlux[i];
static uint64_t sub_overflow(uint64_t a, uint64_t b, unsigned &overflow)
Compute a - b and set overflow accordingly.
static uint64_t sub_carry(uint64_t a, uint64_t b, unsigned &carry)
Compute a - b and increment carry if there was an overflow.
static uint64_t add_carry(uint64_t a, uint64_t b, unsigned &carry)
Compute a + b and increment carry if there was an overflow.
static int64_t compute_r(const uint64_t *upper, uint64_t *r)
Update r = r - (t1 + t2) + (t3 + t2) * b ** 10.
static uint64_t add_overflow(uint64_t a, uint64_t b, unsigned &overflow)
Compute a + b and set overflow accordingly.
static void to_lcg(const uint64_t *ranlux, unsigned c, uint64_t *lcg)
Convert RANLUX numbers to an LCG state.
static void to_ranlux(const uint64_t *lcg, uint64_t *ranlux, unsigned &c_out)
Convert an LCG state to RANLUX numbers.