Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
einteger_impl.hpp File Reference
#include <cstdint>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <limits>
#include <type_traits>
#include <cmath>
#include <universal/utility/exceptions.hpp>
#include <universal/utility/exceptions_check.hpp>
#include <universal/number/einteger/exceptions.hpp>
#include <universal/number/einteger/einteger_fwd.hpp>
#include <universal/native/ieee754_core.hpp>
#include <universal/native/integer_core.hpp>

Classes

class  sw::universal::einteger< BlockType >

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal
namespace  sw::universal::einteger_detail
 string parsing

Macros

#define EINTEGER_ENABLE_LITERALS   1
 BEHAVIORAL COMPILATION SWITCHES.
#define EINTEGER_THROW_DIVIDE_BY_ZERO   UNIVERSAL_HAS_EXCEPTIONS
#define EINTEGER_THROW_ARITHMETIC_EXCEPTION   0
#define EINTEGER_SCALAR_OPERATOR(OP)

Functions

template<typename BlockType>
einteger< BlockType > sw::universal::abs (const einteger< BlockType > &a)
bool sw::universal::einteger_detail::is_sign (char c) noexcept
bool sw::universal::einteger_detail::is_octal_digit (char c) noexcept
bool sw::universal::einteger_detail::is_decimal_digit (char c) noexcept
bool sw::universal::einteger_detail::is_hex_digit (char c) noexcept
std::string::size_type sw::universal::einteger_detail::skip_signs (const std::string &s) noexcept
unsigned sw::universal::einteger_detail::nibble (char c) noexcept
bool sw::universal::einteger_detail::matches_binary (const std::string &s) noexcept
bool sw::universal::einteger_detail::matches_octal (const std::string &s) noexcept
bool sw::universal::einteger_detail::matches_decimal (const std::string &s) noexcept
bool sw::universal::einteger_detail::matches_hex (const std::string &s) noexcept
template<typename Integer>
void sw::universal::einteger_detail::parse_power_of_two_digits (const std::string &number, std::string::size_type first, unsigned bitsPerDigit, Integer &magnitude)
template<typename BlockType>
bool sw::universal::parse (const std::string &number, einteger< BlockType > &v)
template<typename BlockType>
constexpr bool sw::universal::operator== (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
constexpr bool sw::universal::operator!= (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
constexpr bool sw::universal::operator< (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
constexpr bool sw::universal::operator> (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
constexpr bool sw::universal::operator<= (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
constexpr bool sw::universal::operator>= (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs) noexcept
template<typename BlockType>
bool sw::universal::operator== (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator!= (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator< (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator> (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator<= (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator>= (const einteger< BlockType > &lhs, long long rhs)
template<typename BlockType>
bool sw::universal::operator== (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
bool sw::universal::operator!= (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
bool sw::universal::operator< (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
bool sw::universal::operator> (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
bool sw::universal::operator<= (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
bool sw::universal::operator>= (long long lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
einteger< BlockType > sw::universal::operator+ (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
einteger< BlockType > sw::universal::operator- (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
einteger< BlockType > sw::universal::operator* (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
einteger< BlockType > sw::universal::operator/ (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs)
template<typename BlockType>
einteger< BlockType > sw::universal::operator% (const einteger< BlockType > &lhs, const einteger< BlockType > &rhs)
template<typename BlockType, typename Scalar>
einteger< BlockType > sw::universal::einteger_operand (Scalar v)
template<typename BlockType>
einteger< BlockType > sw::universal::ipow_reciprocal (const einteger< BlockType > &a, bool odd)
template<typename BlockType>
einteger< BlockType > sw::universal::ipow (const einteger< BlockType > &a, const einteger< BlockType > &b)
template<typename BlockType>
einteger< BlockType > sw::universal::ipow (const einteger< BlockType > &a, long long b)

Variables

template<typename Scalar>
constexpr bool sw::universal::is_einteger_scalar_v = std::is_arithmetic_v<Scalar> && !std::is_same_v<Scalar, bool>

Macro Definition Documentation

◆ EINTEGER_ENABLE_LITERALS

#define EINTEGER_ENABLE_LITERALS   1

BEHAVIORAL COMPILATION SWITCHES.

These default here, beside the code they govern, rather than in the einteger.hpp umbrella, so that a translation unit which includes core.hpp directly gets the same defaults (#1334, #1436). Defining either before any einteger header still wins.

◆ EINTEGER_SCALAR_OPERATOR

#define EINTEGER_SCALAR_OPERATOR ( OP)
Value:
template<typename BlockType, typename Scalar, std::enable_if_t<is_einteger_scalar_v<Scalar>, int> = 0> \
inline einteger<BlockType> operator OP(const einteger<BlockType>& lhs, Scalar rhs) { \
return operator OP(lhs, einteger_operand<BlockType>(rhs)); \
} \
template<typename BlockType, typename Scalar, std::enable_if_t<is_einteger_scalar_v<Scalar>, int> = 0> \
inline einteger<BlockType> operator OP(Scalar lhs, const einteger<BlockType>& rhs) { \
return operator OP(einteger_operand<BlockType>(lhs), rhs); \
}

◆ EINTEGER_THROW_ARITHMETIC_EXCEPTION

#define EINTEGER_THROW_ARITHMETIC_EXCEPTION   0

◆ EINTEGER_THROW_DIVIDE_BY_ZERO

#define EINTEGER_THROW_DIVIDE_BY_ZERO   UNIVERSAL_HAS_EXCEPTIONS