AMInteger
201909
String localization library
|
#include <type_traits>
#include <limits>
Go to the source code of this file.
Functions | |
template<typename TIntType > | |
TIntType | AMCore::AMIntegerHi (TIntType x) |
Safe integer operations with overflow detection. More... | |
template<typename TIntType > | |
TIntType | AMCore::AMIntegerLo (TIntType x) |
Low bits (a half) of argument. More... | |
template<typename TIntType > | |
bool | AMCore::AMIntegerMultiply (TIntType a, TIntType b, TIntType &result) |
Safe multiply with overflow detection. More... | |
template<typename TIntType > | |
bool | AMCore::AMIntegerAdd (TIntType a, TIntType b, TIntType &result) |
Safe addition with overflow detection. More... | |
Safe integer operations with overflow detection
bool AMCore::AMIntegerAdd | ( | TIntType | a, |
TIntType | b, | ||
TIntType & | result | ||
) |
Safe addition with overflow detection.
a | first addend |
b | second addend |
result | reference to result |
This | function will not throw an exception. |
References AMCore::AMIntegerAdd(), AMCore::AMIntegerHi(), and AMCore::AMIntegerLo().
Referenced by AMCore::AMIntegerAdd().
TIntType AMCore::AMIntegerHi | ( | TIntType | x | ) |
Safe integer operations with overflow detection.
All function have TIntType template argument. The argument may by any integral type.
High bits (a half) of argument
x |
This | function will not throw an exception. |
References AMCore::AMIntegerHi().
Referenced by AMCore::AMIntegerAdd(), AMCore::AMIntegerHi(), and AMCore::AMIntegerMultiply().
TIntType AMCore::AMIntegerLo | ( | TIntType | x | ) |
Low bits (a half) of argument.
x |
This | function will not throw an exception. |
References AMCore::AMIntegerLo().
Referenced by AMCore::AMIntegerAdd(), AMCore::AMIntegerLo(), and AMCore::AMIntegerMultiply().
bool AMCore::AMIntegerMultiply | ( | TIntType | a, |
TIntType | b, | ||
TIntType & | result | ||
) |
Safe multiply with overflow detection.
a | first multiplicand |
b | second multiplicand |
result | reference to result |
This | function will not throw an exception. |
References AMCore::AMIntegerHi(), AMCore::AMIntegerLo(), and AMCore::AMIntegerMultiply().
Referenced by AMCore::AMIntegerMultiply().