Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
integers.hpp File Reference
#include <cstdint>
#include <limits>
#include <type_traits>
#include <universal/native/integer_core.hpp>
#include <sstream>
#include <string>

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal

Functions

template<typename Integer, typename = typename std::enable_if< std::is_integral<Integer>::value, Integer >::type>
Integer sw::universal::two_to_the_power (Integer n)
int64_t sw::universal::ipow (int64_t base, unsigned exp)
 efficient and fast integer power function Note: uses unsigned arithmetic internally to avoid undefined behavior on overflow.
int64_t sw::universal::fastipow (int64_t base, uint8_t exp)
template<typename Integer, typename = typename std::enable_if< std::is_integral<Integer>::value, Integer >::type>
std::string sw::universal::to_binary (const Integer &number, bool bNibbleMarker=true, int nbits=0)
template<typename Integer, typename = typename std::enable_if< std::is_integral<Integer>::value, Integer >::type>
std::string sw::universal::to_hex (const Integer &number, bool nibbleMarker=false, bool hexPrefix=true)