Bitcoin ABC  0.24.10
P2P Digital Currency
Functions
intmath.h File Reference
#include <cstdlib>
#include <limits>
Include dependency graph for intmath.h:

Go to the source code of this file.

Functions

static bool AddInt63OverflowEmulated (int64_t a, int64_t b, int64_t &result)
 Computes a + b and stores it in result. More...
 
static bool AddInt63Overflow (int64_t a, int64_t b, int64_t &result)
 Computes a + b and stores it in result. More...
 
static bool SubInt63OverflowEmulated (int64_t a, int64_t b, int64_t &result)
 Computes a - b and stores it in result. More...
 
static bool SubInt63Overflow (int64_t a, int64_t b, int64_t &result)
 Computes a - b and stores it in result. More...
 

Function Documentation

◆ AddInt63Overflow()

static bool AddInt63Overflow ( int64_t  a,
int64_t  b,
int64_t &  result 
)
static

Computes a + b and stores it in result.

If the sum overflows or results in an invalid 63+sign-bit integer, return true, otherwise false. Uses built-in overflow functions if available, and emulated overflow math otherwise.

Definition at line 34 of file intmath.h.

Here is the call graph for this function:

◆ AddInt63OverflowEmulated()

static bool AddInt63OverflowEmulated ( int64_t  a,
int64_t  b,
int64_t &  result 
)
static

Computes a + b and stores it in result.

If the sum overflows or results in an invalid 63+sign-bit integer, return true, otherwise false. Overflow checks are emulated and don't rely on built-in overflow checks.

Definition at line 15 of file intmath.h.

Here is the caller graph for this function:

◆ SubInt63Overflow()

static bool SubInt63Overflow ( int64_t  a,
int64_t  b,
int64_t &  result 
)
static

Computes a - b and stores it in result.

If the sum difference or results in an invalid 63+sign-bit integer, return true, otherwise false. Uses built-in overflow functions if available, and emulated overflow math otherwise.

Definition at line 69 of file intmath.h.

Here is the call graph for this function:

◆ SubInt63OverflowEmulated()

static bool SubInt63OverflowEmulated ( int64_t  a,
int64_t  b,
int64_t &  result 
)
static

Computes a - b and stores it in result.

If the difference overflows or results in an invalid 63+sign-bit integer, return true, otherwise false. Overflow checks are emulated and don't rely on built-in overflow checks.

Definition at line 50 of file intmath.h.

Here is the caller graph for this function: