Bitcoin ABC 0.26.3
P2P Digital Currency
Loading...
Searching...
No Matches
Functions
intmath.cpp File Reference
#include <script/intmath.h>
#include <cstdint>
#include <limits>
Include dependency graph for intmath.cpp:

Go to the source code of this file.

Functions

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

Function Documentation

◆ AddInt63Overflow()

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

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 27 of file intmath.cpp.

Here is the call graph for this function:

◆ AddInt63OverflowEmulated()

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

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 14 of file intmath.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SubInt63Overflow()

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

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 51 of file intmath.cpp.

Here is the call graph for this function:

◆ SubInt63OverflowEmulated()

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

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 38 of file intmath.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: