Universal Numbers Library C++ API
sw::universal -- header-only custom arithmetic types (posit, cfloat, lns, fixpnt, dd/qd, and more)
Loading...
Searching...
No Matches
bitblock_v2.hpp File Reference
#include <iostream>
#include <string>
#include <sstream>
#include <cassert>
#include "ubb.h"

Classes

class  sw::universal::bitblock< nbits >
 templated class implementing efficient multi-precision binary arithmetic and logic More...
struct  sw::universal::__uint128
struct  sw::universal::round_t< tgt_size, src_size >
struct  sw::universal::round_t< 0, src_size >

Namespaces

namespace  sw
 required std libraries
namespace  sw::universal

Typedefs

typedef struct sw::universal::__uint128 sw::universal::uint128

Functions

template<size_t nbits>
unsigned int sw::universal::getSignBit (const bitblock< nbits > &val)
template<size_t nbits>
bool sw::universal::lessThan (const bitblock< nbits > &lhs, const bitblock< nbits > &rhs)
template<size_t nbits>
bool sw::universal::lessThan_unsigned (const bitblock< nbits > &lhs, const bitblock< nbits > &rhs)
 Vestigial alias for '<' operator: unsigned.
template<size_t nbits>
bool sw::universal::increment_bitset (bitblock< nbits > &number)
 Increments value in place.
template<size_t nbits>
bool sw::universal::increment_unsigned (bitblock< nbits > &number, int nrBits=nbits - 1)
template<size_t nbits>
bool sw::universal::decrement_bitset (bitblock< nbits > &number)
 Decrements value in place.
template<size_t nbits>
bool sw::universal::add_unsigned (const bitblock< nbits > &a, const bitblock< nbits > &b, bitblock< nbits+1 > &sum)
 Adds two nbit summands into nbit+1 result.
template<size_t nbits>
bool sw::universal::subtract_unsigned (bitblock< nbits > a, bitblock< nbits > b, bitblock< nbits+1 > &dif)
template<size_t nbits>
bool sw::universal::add_signed_magnitude (bitblock< nbits > a, bitblock< nbits > b, bitblock< nbits > &sum)
template<size_t nbits>
bool sw::universal::subtract_signed_magnitude (bitblock< nbits > a, bitblock< nbits > b, bitblock< nbits > &diff)
template<size_t nbits>
bitblock< nbits > sw::universal::extract_23b_fraction (uint32_t _23b_fraction_without_hidden_bit)
template<size_t nbits>
bitblock< nbits > sw::universal::extract_52b_fraction (uint64_t _52b_fraction_without_hidden_bit)
template<size_t nbits>
bitblock< nbits > sw::universal::extract_63b_fraction (uint64_t _63b_fraction_without_hidden_bit)
template<size_t nbits>
bitblock< nbits > sw::universal::extract_long_double_fraction (uint128 *_112b_fraction_without_hidden_bit)
template<size_t nbits>
bitblock< nbits > sw::universal::copy_integer_fraction (unsigned long long _fraction_without_hidden_bit)
template<size_t src_size, size_t tgt_size>
void sw::universal::copy_into (const bitblock< src_size > &src, size_t shift, bitblock< tgt_size > &tgt)
template<size_t src_size, size_t tgt_size>
void sw::universal::copy_slice_into (bitblock< src_size > &src, bitblock< tgt_size > &tgt, size_t begin=0, size_t end=src_size, size_t shift=0)
template<size_t from, size_t to, size_t src_size>
bitblock< to - from > sw::universal::fixed_subset (const bitblock< src_size > &src)
template<size_t operand_size>
void sw::universal::multiply_unsigned (const bitblock< operand_size > &a, const bitblock< operand_size > &b, bitblock< 2 *operand_size > &result)
template<size_t operand_size>
void sw::universal::integer_divide_unsigned (const bitblock< operand_size > &a, const bitblock< operand_size > &b, bitblock< 2 *operand_size > &result)
template<size_t operand_size, size_t result_size>
void sw::universal::divide_with_fraction (const bitblock< operand_size > &a, const bitblock< operand_size > &b, bitblock< result_size > &result)
template<size_t src_size, size_t tgt_size>
void sw::universal::truncate (bitblock< src_size > &src, bitblock< tgt_size > &tgt)
template<size_t tgt_size, size_t src_size>
bitblock< tgt_size > sw::universal::round (const bitblock< src_size > &src, size_t n)
 Round off n last bits of bitset src.
template<size_t nbits, class Type>
bitblock< nbits > sw::universal::convert_to_bitblock (Type number)
template<size_t nbits>
std::string sw::universal::to_binary (bitblock< nbits > const &bits)
 Constructs a string of 1's and 0's representing the value passed.
template<size_t nbits>
std::string sw::universal::to_hex (bitblock< nbits > bits)
template<size_t nbits>
std::string sw::universal::sign_magnitude_to_string (bitblock< nbits > bits)
template<size_t nbits>
int sw::universal::findMostSignificantBit (const bitblock< nbits > &bits)
template<size_t nbits>
bitblock< nbits > sw::universal::ones_complement (const bitblock< nbits > &number)
template<size_t nbits>
bitblock< nbits > sw::universal::twos_complement (const bitblock< nbits > &number)
template<size_t nbits>
bitblock< nbits > sw::universal::flip_sign_bit (const bitblock< nbits > &number)
 Flips the sign bit of value passed.
template<size_t nbits>
bool sw::universal::anyAfter (const bitblock< nbits > &bits, unsigned msb)