Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
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.
 
static bool AddInt63Overflow (int64_t a, int64_t b, int64_t &result)
 Computes a + b and stores it in result.
 
static bool SubInt63OverflowEmulated (int64_t a, int64_t b, int64_t &result)
 Computes a - b and stores it in result.
 
static bool SubInt63Overflow (int64_t a, int64_t b, int64_t &result)
 Computes a - b and stores it in result.
 

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 call graph for this function:
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 call graph for this function:
Here is the caller graph for this function: