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_t
with 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_limits
std::hash
std::to_string
std::strtoumax
2std::to_chars
std::from_chars
std::ostream.operator<<
std::istream.operator>>
std::swap
- to
bool
- to
digit_t
(explicit) - to
extend_digit_t
(explicit) - to
uintN_t
with greater width - to
uintN_t
with less width (explicit) - to
uintN_t
with same width and other digit type byto_another_digits
- to string by
std::to_string
orstd::to_chars
orstd::ostream
- from string by
std::strtoumax
orstd::from_chars
orstd::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