uintN_t is a type used to represent a large unsigned integer with a fixed number of bits.
Implement all base operations for integers (+, -, * and etc.).
Just include the file uintN_t.hpp.
Create a variable with type uintN_t<bits, digit>
or use base size aliases (uintX_t, X = 128, 256, 512, 1024)
where:
- bits - integer width (8, 16, 32, 64, 128, 256, etc.)
- digit - unsigned integer type for represent digit (width equal 8, 16, 32 and 641)
Ways of create object:
- using literal suffix
_Ui+ bits from namespaceuintN_t_literals - initialize with
{0, 0, ...}i.e. array of digits (C++14 and later) - create from 'short' number or array of digits with use
create_uintN_twith template parameter of bits and digit - using string conversions
#include "uintN_t.hpp"
#include <iostream>
using namespace uintN_t_literals;
int main() {
auto n = 12345_Ui128;
// or n = uintN_t<128, uint32_t>{12345}
// or n = create_uintN_t<128, uint32_t>(12345)
std::cout << n << '\n';
}std::numeric_limitsstd::hashstd::to_stringstd::strtoumax2std::to_charsstd::from_charsstd::ostream.operator<<std::istream.operator>>std::swap
- to
bool - to
digit_t(explicit) - to
extend_digit_t(explicit) - to
uintN_twith greater width - to
uintN_twith less width (explicit) - to
uintN_twith same width and other digit type byto_another_digits - to string by
std::to_stringorstd::to_charsorstd::ostream - from string by
std::strtoumaxorstd::from_charsorstd::istream
- Add support for C++11
- Add literal check in operator
- Full implement Toom-Cook algorithm with k = 4
- Add conversion from string or istream
- Add support of different digit type