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];
33 bits += ranlux[i + 5] >> 16;
35 bits += ranlux[i + 6] << 48;
43 for (
int i = 0; i < 9; i++) {
55static void to_ranlux(
const uint64_t *lcg, uint64_t *ranlux,
unsigned &c_out) {
61 for (
int i = 0; i < 9; i++) {
62 uint64_t in_i = lcg[i];
67 bits += lcg[i + 5] >> 16;
69 bits += lcg[i + 6] << 48;
79 for (
int i = 1; i < 9; i++) {
80 uint64_t ranlux_i = ranlux[i];
82 ranlux_i =
add_carry(ranlux_i, c1, carry);
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)
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)
static void to_ranlux(const uint64_t *lcg, uint64_t *ranlux, unsigned &c_out)