|
Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
|
#include <fixpnt_impl.hpp>
Public Types | |
| typedef bt | BlockType |
Public Member Functions | |
| fixpnt () noexcept=default | |
| fixpnt (const fixpnt &) noexcept=default | |
| fixpnt (fixpnt &&) noexcept=default | |
| constexpr fixpnt & | operator= (const fixpnt &) noexcept=default |
| constexpr fixpnt & | operator= (fixpnt &&) noexcept=default |
| template<unsigned src_nbits, unsigned src_rbits> | |
| constexpr | fixpnt (const fixpnt< src_nbits, src_rbits, arithmetic, bt > &a) noexcept |
| construct a new fixpnt from another, sign extend or round when necessary: src and tgt fixpnt need to have the same arithmetic and blocktype | |
| constexpr | fixpnt (const SpecificValue code) |
| template<unsigned nnbits, typename Bbt> | |
| constexpr fixpnt & | operator= (const blockbinary< nnbits, Bbt > &rhs) |
| template<unsigned src_nbits, unsigned src_rbits> | |
| constexpr fixpnt & | operator= (const fixpnt< src_nbits, src_rbits, arithmetic, bt > &a) noexcept |
| constexpr | fixpnt (signed char initial_value) noexcept |
| constexpr | fixpnt (short initial_value) noexcept |
| constexpr | fixpnt (int initial_value) noexcept |
| constexpr | fixpnt (long initial_value) noexcept |
| constexpr | fixpnt (long long initial_value) noexcept |
| constexpr | fixpnt (char initial_value) noexcept |
| constexpr | fixpnt (unsigned short initial_value) noexcept |
| constexpr | fixpnt (unsigned int initial_value) noexcept |
| constexpr | fixpnt (unsigned long initial_value) noexcept |
| constexpr | fixpnt (unsigned long long initial_value) noexcept |
| BIT_CAST_CONSTEXPR | fixpnt (float initial_value) noexcept |
| BIT_CAST_CONSTEXPR | fixpnt (double initial_value) noexcept |
| constexpr fixpnt & | operator= (signed char rhs) noexcept |
| constexpr fixpnt & | operator= (short rhs) noexcept |
| constexpr fixpnt & | operator= (int rhs) noexcept |
| constexpr fixpnt & | operator= (long rhs) noexcept |
| constexpr fixpnt & | operator= (long long rhs) noexcept |
| constexpr fixpnt & | operator= (char rhs) noexcept |
| constexpr fixpnt & | operator= (unsigned short rhs) noexcept |
| constexpr fixpnt & | operator= (unsigned int rhs) noexcept |
| constexpr fixpnt & | operator= (unsigned long rhs) noexcept |
| constexpr fixpnt & | operator= (unsigned long long rhs) noexcept |
| BIT_CAST_CONSTEXPR fixpnt & | operator= (float rhs) noexcept |
| BIT_CAST_CONSTEXPR fixpnt & | operator= (double rhs) noexcept |
| fixpnt & | assign (const std::string &number) |
| constexpr fixpnt | operator- () const |
| constexpr fixpnt | operator~ () const |
| constexpr fixpnt | operator++ (int) |
| constexpr fixpnt & | operator++ () |
| constexpr fixpnt | operator-- (int) |
| constexpr fixpnt & | operator-- () |
| constexpr | operator unsigned short () const noexcept |
| constexpr | operator unsigned int () const noexcept |
| constexpr | operator unsigned long () const noexcept |
| constexpr | operator unsigned long long () const noexcept |
| constexpr | operator short () const noexcept |
| constexpr | operator int () const noexcept |
| constexpr | operator long () const noexcept |
| constexpr | operator long long () const noexcept |
| constexpr | operator float () const noexcept |
| constexpr | operator double () const noexcept |
| constexpr fixpnt & | operator+= (const fixpnt &rhs) |
| constexpr fixpnt & | operator-= (const fixpnt &rhs) |
| constexpr fixpnt & | operator*= (const fixpnt &rhs) |
| constexpr fixpnt & | operator/= (const fixpnt &rhs) |
| Divide this fixpnt by rhs in-place. | |
| constexpr fixpnt & | operator%= (const fixpnt &rhs) |
| constexpr fixpnt & | operator<<= (const signed shift) |
| constexpr fixpnt & | operator>>= (const signed shift) |
| constexpr void | clear () noexcept |
| constexpr void | setzero () noexcept |
| constexpr void | setbit (unsigned bitIndex, bool v=true) noexcept |
| constexpr void | setbits (uint64_t value) noexcept |
| constexpr fixpnt & | minpos () noexcept |
| constexpr fixpnt & | maxpos () noexcept |
| constexpr fixpnt & | zero () noexcept |
| constexpr fixpnt & | minneg () noexcept |
| constexpr fixpnt & | maxneg () noexcept |
| constexpr fixpnt & | flip () noexcept |
| constexpr fixpnt & | twosComplement () noexcept |
| constexpr bool | sign () const noexcept |
| constexpr fixpnt | integer () const noexcept |
| constexpr fixpnt | fraction () const noexcept |
| constexpr bool | iszero () const noexcept |
| constexpr bool | ispos () const noexcept |
| constexpr bool | isneg () const noexcept |
| constexpr bool | isnan () const noexcept |
| constexpr bool | isinf () const noexcept |
| constexpr bool | at (unsigned bitIndex) const noexcept |
| constexpr bool | test (unsigned bitIndex) const noexcept |
| constexpr uint8_t | nibble (unsigned n) const noexcept |
| constexpr blockbinary< nbits, bt, BinaryNumberType::Signed > | bits () const noexcept |
| template<typename TargetBlockType = bt> | |
| void | normalize (blocktriple< rbits, BlockTripleOperator::REP, TargetBlockType > &tgt) const |
Static Public Attributes | |
| static constexpr unsigned | nbits = _nbits |
| static constexpr unsigned | rbits = _rbits |
| static constexpr unsigned | fbits = _rbits |
| static constexpr bool | arithmetic = _arithmetic |
| static constexpr unsigned | bitsInChar = 8 |
| static constexpr unsigned | bitsInBlock = sizeof(bt) * bitsInChar |
| static constexpr unsigned | nrBlocks = (1 + ((nbits - 1) / bitsInBlock)) |
| static constexpr unsigned | MSU = nrBlocks - 1 |
| static constexpr bt | MSU_MASK = bt(bt(~0) >> (nrBlocks * bitsInBlock - nbits)) |
Protected Member Functions | |
| template<typename NativeInt> | |
| constexpr NativeInt | to_integer () const noexcept |
| template<typename NativeInt> | |
| constexpr std::enable_if< std::is_integral_v< NativeInt > &&std::is_signed_v< NativeInt >, NativeInt >::type | to_signed () const |
| template<typename NativeInt> | |
| constexpr std::enable_if< std::is_unsigned_v< NativeInt >, NativeInt >::type | to_unsigned () const |
| template<typename TargetFloat> | |
| constexpr TargetFloat | to_native () const |
Static Protected Member Functions | |
| template<typename Real> | |
| static constexpr Real | exact_pow2 (int e) |
| template<typename Arith> | |
| static constexpr fixpnt | convert (Arith v) |
Friends | |
| template<unsigned nnbits, unsigned rrbits, bool aarithmetic, typename Bbt> | |
| std::string | convert_to_decimal_string (const fixpnt< nnbits, rrbits, aarithmetic, Bbt > &value) |
| template<unsigned nnbits, unsigned rrbits, bool aarithmetic, typename Bbt> | |
| constexpr bool | operator== (const fixpnt< nnbits, rrbits, aarithmetic, Bbt > &lhs, const fixpnt< nnbits, rrbits, aarithmetic, Bbt > &rhs) |
| template<unsigned nnbits, unsigned rrbits, bool aarithmetic, typename Bbt> | |
| constexpr bool | operator< (const fixpnt< nnbits, rrbits, aarithmetic, Bbt > &lhs, const fixpnt< nnbits, rrbits, aarithmetic, Bbt > &rhs) |
| typedef bt sw::universal::fixpnt< _nbits, _rbits, _arithmetic, bt >::BlockType |
|
defaultnoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlineconstexprnoexcept |
construct a new fixpnt from another, sign extend or round when necessary: src and tgt fixpnt need to have the same arithmetic and blocktype
| a | source fixpnt |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprprotected |
|
inlinestaticconstexprprotected |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inline |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineexplicitconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Divide this fixpnt by rhs in-place.
In Modulo mode, the result wraps on overflow. In Saturate mode, the result clamps to maxpos or maxneg on overflow.
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
constexprdefaultnoexcept |
|
inlineconstexprnoexcept |
|
inlinenoexcept |
|
constexprdefaultnoexcept |
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprprotectednoexcept |
|
inlineconstexprprotected |
|
inlineconstexprprotected |
|
inlineconstexprprotected |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
friend |
|
friend |
|
friend |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |