Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
helpers.h File Reference
#include <cstdint>
Include dependency graph for helpers.h:
This graph shows which files directly or indirectly include this file:

Functions

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 uint64_t add_overflow (uint64_t a, uint64_t b, unsigned &overflow)
 Compute a + b and set overflow accordingly.
 
static int64_t compute_r (const uint64_t *upper, uint64_t *r)
 Update r = r - (t1 + t2) + (t3 + t2) * b ** 10.
 
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 sub_overflow (uint64_t a, uint64_t b, unsigned &overflow)
 Compute a - b and set overflow accordingly.
 

Function Documentation

◆ add_carry()

static uint64_t add_carry ( uint64_t  a,
uint64_t  b,
unsigned &  carry 
)
inlinestatic

Compute a + b and increment carry if there was an overflow.

Definition at line 26 of file helpers.h.

◆ add_overflow()

static uint64_t add_overflow ( uint64_t  a,
uint64_t  b,
unsigned &  overflow 
)
inlinestatic

Compute a + b and set overflow accordingly.

Definition at line 18 of file helpers.h.

◆ compute_r()

static int64_t compute_r ( const uint64_t *  upper,
uint64_t *  r 
)
inlinestatic

Update r = r - (t1 + t2) + (t3 + t2) * b ** 10.

This function also yields cbar = floor(r / m) as its return value (int64_t because the value can be -1). With an initial value of r = t0, this can be used for computing the remainder after division by m (see the function mod_m in mulmod.h). The function to_ranlux passes r = 0 and uses only the return value to obtain the decimal expansion after division by m.

Definition at line 62 of file helpers.h.

◆ sub_carry()

static uint64_t sub_carry ( uint64_t  a,
uint64_t  b,
unsigned &  carry 
)
inlinestatic

Compute a - b and increment carry if there was an overflow.

Definition at line 45 of file helpers.h.

◆ sub_overflow()

static uint64_t sub_overflow ( uint64_t  a,
uint64_t  b,
unsigned &  overflow 
)
inlinestatic

Compute a - b and set overflow accordingly.

Definition at line 37 of file helpers.h.