31#ifndef AESI_MULTIPRECISION
32#define AESI_MULTIPRECISION
39 enum class Sign { Zero = 0, Positive = 1, Negative = -1 };
41 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
42 Sign traverseDashes(
const Char* ptr, std::size_t);
45 inline Sign traverseDashes(
const char* ptr, std::size_t size) {
46 std::byte positive { 1 };
47 for(std::size_t i = 0; i < size; ++i)
48 if(ptr[i] ==
'-') positive ^= std::byte {1};
49 return positive == std::byte {1} ? Sign::Positive : Sign::Negative;
53 inline Sign traverseDashes(
const wchar_t* ptr, std::size_t size) {
54 std::byte positive { 1 };
55 for(std::size_t i = 0; i < size; ++i)
56 if(ptr[i] == L
'-') positive ^= std::byte {1};
57 return positive == std::byte {1} ? Sign::Positive : Sign::Negative;
66template <std::
size_t bitness = 512>
requires (bitness % blockBitLength == 0)
75 gpu
constexpr Aesi(Sign withSign,
Base withBase): sign { withSign }, base { withBase } {}
82 constexpr Aesi() noexcept = default;
87 constexpr ~
Aesi() noexcept = default;
93 constexpr
Aesi(const
Aesi& copy) noexcept = default;
99 template <typename Integral> requires (std::is_integral_v<Integral>)
100 gpu constexpr
Aesi(Integral value) noexcept {
103 base =
Base(
static_cast<unsigned long long>(-value));
105 }
else if(value > 0) {
106 base =
Base(
static_cast<unsigned long long>(value));
121 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
122 gpu
constexpr Aesi(
const Char* ptr, std::size_t size) noexcept : base(ptr, size) {
124 sign = traverseDashes(ptr, size);
125 else sign = Sign::Zero;
132 template <
typename Char, std::
size_t arrayLength>
requires (arrayLength > 1 && (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>))
133 gpu
constexpr Aesi(
const Char (&literal)[arrayLength]) noexcept :
Aesi(literal, arrayLength) {}
139 template <
typename String,
typename Char =
typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>,
140 std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
141 gpu
constexpr Aesi(String&& stringView) noexcept :
Aesi(stringView.data(), stringView.size()) {}
143 template <
typename String,
typename Char =
typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>,
144 std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
145 gpu
constexpr Aesi(
const String& stringView) noexcept :
Aesi(stringView.data(), stringView.size()) {}
151 explicit gpu
constexpr Aesi(
const Aeu<bitness>& value) : sign(Sign::Positive), base(value) {}
154#ifdef AESI_GMP_INTEGRATION
159 constexpr Aesi(
const mpz_class& number) {
168 else sign = Positive;
177 template <
typename Integral>
requires (std::is_signed_v<Integral>)
178 gpu
constexpr Aesi&
operator=(Integral value)
noexcept {
179 return *
this =
Aesi(value);
212 if(sign == Negative) {
213 --base;
if(base.
isZero()) sign = Zero;
214 }
else if(sign == Positive) {
216 }
else { base = 1u; sign = Positive; }
232 if(sign == Negative) {
234 }
else if(sign == Positive) {
235 --base;
if(base.
isZero()) sign = Zero;
236 }
else { base = 1u; sign = Negative; }
256 Aesi result = addition; result += addendum;
return result;
267 Sign& lSign = addition.sign;
const Sign& rSign = addendum.sign;
268 Base& lBase = addition.base;
const Base& rBase = addendum.base;
272 else if(lSign == Zero)
273 return addition = addendum;
274 else if(lSign == rSign) {
279 if(lSign == Positive) {
281 using enum Comparison;
287 lBase = rBase - lBase;
297 switch(
const auto ratio = lBase.
compareTo(rBase)) {
298 using enum Comparison;
304 lBase = rBase - lBase;
326 Aesi result = subtraction; result -= subtrahend;
return result;
337 Sign& lSign = subtraction.sign;
const Sign& rSign = subtrahend.sign;
338 Base& lBase = subtraction.base;
const Base& rBase = subtrahend.base;
343 subtraction = subtrahend;
344 subtraction.inverse();
348 if(lSign == Positive) {
349 if(rSign == Positive) {
351 using enum Comparison;
357 lBase = rBase - lBase;
371 if(rSign == Negative) {
373 using enum Comparison;
379 lBase = rBase - lBase;
403 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
404 gpu
constexpr friend auto operator*(
const Aesi& multiplication, Integral factor)
noexcept ->
Aesi {
405 Aesi result = multiplication; result *= factor;
return result;
416 Aesi result = multiplication; result *= factor;
return result;
425 template <
typename Integral>
requires (std::is_integral_v<Integral>)
426 gpu
constexpr friend auto operator*=(
Aesi& multiplication, Integral factor)
noexcept ->
Aesi& {
429 multiplication.sign = Zero;
433 factor =
static_cast<Integral
>(-factor);
435 multiplication.base *=
static_cast<unsigned long long>(factor);
437 return multiplication;
448 if(factor.isZero()) {
449 multiplication.sign = Zero;
451 if(factor.isNegative())
453 multiplication.base *= factor.base;
455 return multiplication;
467 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
468 gpu
constexpr friend auto operator/(
const Aesi& division, Integral divisor)
noexcept ->
Aesi {
469 Aesi result = division; result /= divisor;
return result;
481 Aesi result = division; result /= divisor;
return result;
491 template <
typename Integral>
requires (std::is_integral_v<Integral>)
492 gpu
constexpr friend auto operator/=(
Aesi& division, Integral divisor)
noexcept ->
Aesi& {
495 division.sign = Zero;
499 divisor =
static_cast<Integral
>(-divisor);
501 division.base /=
static_cast<unsigned long long>(divisor);
502 if(division.base.
isZero()) division.sign = Zero;
516 if(divisor.isZero()) {
517 division.sign = Zero;
519 if(divisor.isNegative())
521 division.base /= divisor.base;
522 if(division.base.
isZero()) division.sign = Zero;
536 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
537 gpu
constexpr friend auto operator%(
const Aesi& modulation, Integral modulo)
noexcept ->
Aesi {
538 Aesi result = modulation; result %= modulo;
return result;
551 Aesi result = modulation; result %= modulo;
return result;
561 template <
typename Integral>
requires (std::is_integral_v<Integral>)
562 gpu
constexpr friend auto operator%=(
Aesi& modulation, Integral modulo)
noexcept ->
Aesi& {
565 modulation.sign = Zero;
569 modulo =
static_cast<Integral
>(-modulo);
571 modulation.base %=
static_cast<unsigned long long>(modulo);
588 if(modulo.isNegative())
590 modulation.base %= modulo.base;
591 if(modulation.base.
isZero())
592 modulation.sign = Sign::Zero;
607 template <
typename Integral>
requires (std::is_integral_v<Integral>)
608 gpu
constexpr friend auto operator==(
const Aesi& our, Integral integral)
noexcept ->
bool {
609 return our.
compareTo(integral) == Comparison::equal;
618 template <std::
size_t otherBitness>
620 if constexpr (bitness == otherBitness) {
621 return our.
compareTo(other) == Comparison::equal;
627#ifdef AESI_GMP_INTEGRATION
634 template <
typename T,
typename U>
635 constexpr friend auto operator==(
const Aesi& our,
const __gmp_expr<T, U>& other)
noexcept ->
bool {
636 return our ==
Aesi(mpz_class(other));
648 template <
typename Integral>
requires (std::is_integral_v<Integral>)
649 gpu
constexpr auto compareTo(Integral integral)
const noexcept -> Comparison {
650 using enum Sign;
using enum Comparison;
660 }
else if(integral < 0) {
662 switch(base.
compareTo(
static_cast<uint64_t
>(-
static_cast<int64_t
>(integral)))) {
663 using enum Comparison;
674 return base.
compareTo(
static_cast<uint64_t
>(
static_cast<int64_t
>(integral)));
684 template <std::
size_t otherBitness = bitness> [[nodiscard]]
686 return precisionCast<otherBitness>().compareTo(value);
695 gpu
constexpr auto compareTo(
const Aesi& value)
const noexcept -> Comparison {
696 using enum Sign;
using enum Comparison;
708 if(value.isNegative()) {
728#if (defined(__CUDACC__) || __cplusplus < 202002L || defined (PRE_CPP_20)) && !defined DOXYGEN_SKIP
732 gpu
constexpr auto operator!=(
const Aeu<bitness>& value)
const noexcept ->
bool {
733 return !this->operator==(value);
735 gpu
constexpr auto operator<(
const Aeu<bitness>& value)
const noexcept ->
bool {
736 return this->compareTo(value) == Comparison::less;
738 gpu
constexpr auto operator<=(
const Aeu<bitness>& value)
const noexcept ->
bool {
739 return !this->operator>(value);
741 gpu
constexpr auto operator>(
const Aeu<bitness>& value)
const noexcept ->
bool {
742 return this->compareTo(value) == Comparison::greater;
744 gpu
constexpr auto operator>=(
const Aeu<bitness>& value)
const noexcept ->
bool {
745 return !this->operator<(value);
754 gpu
constexpr auto operator<=>(
const Aesi& other)
const noexcept -> std::strong_ordering {
755 switch(this->compareTo(other)) {
756 using enum Comparison;
758 return std::strong_ordering::less;
760 return std::strong_ordering::greater;
762 return std::strong_ordering::equal;
764 return std::strong_ordering::equivalent;
774 template <
typename Object>
775 gpu
constexpr auto operator<=>(
const Object& other)
const noexcept -> std::strong_ordering {
776 switch(this->compareTo(other)) {
777 using enum Comparison;
779 return std::strong_ordering::less;
781 return std::strong_ordering::greater;
783 return std::strong_ordering::equal;
785 return std::strong_ordering::equivalent;
799 gpu
constexpr auto setBit(std::size_t index,
bool bit)
noexcept ->
void {
return base.
setBit(index, bit); }
808 gpu
constexpr auto getBit(std::size_t index)
const noexcept ->
bool {
return base.
getBit(index); }
816 gpu
constexpr auto setByte(std::size_t index,
byte byte)
noexcept ->
void {
return base.
setByte(index,
byte); }
825 gpu
constexpr auto getByte(std::size_t index)
const noexcept ->
byte {
return base.
getByte(index); }
833 gpu
constexpr auto setBlock(std::size_t index, block block)
noexcept ->
void {
return base.
setBlock(index, block); }
842 gpu
constexpr auto getBlock(std::size_t index)
const noexcept -> block {
return base.
getBlock(index); }
863 gpu
constexpr auto isOdd() const noexcept ->
bool {
return base.
isOdd(); }
870 gpu
constexpr auto isEven() const noexcept ->
bool {
return base.
isEven(); }
877 gpu
constexpr auto isZero() const noexcept ->
bool {
return sign == Sign::Zero; }
884 gpu
constexpr auto isPositive() const noexcept ->
bool {
return sign == Sign::Positive; }
891 gpu
constexpr auto isNegative() const noexcept ->
bool {
return sign == Sign::Negative; }
905 gpu
static constexpr auto getBitness() noexcept -> std::
size_t {
return bitness; }
918 gpu
constexpr auto swap(
Aesi& other)
noexcept ->
void {
919 Sign tSign = sign; sign = other.sign; other.sign = tSign;
920 base.
swap(other.base);
927 gpu
constexpr auto inverse() noexcept ->
void {
929 sign = (sign == Zero ? Zero : (sign == Negative ? Positive : Negative));
942 gpu
static constexpr auto divide(
const Aesi& number,
const Aesi& divisor,
Aesi& quotient,
Aesi& remainder)
noexcept ->
void {
944 if(number.sign == Zero || divisor.sign == Zero) {
945 quotient.sign = Zero;
946 remainder.sign = Zero;
950 Base::divide(number.base, divisor.base, quotient.base, remainder.base);
951 if(number.sign == Positive) {
952 if(divisor.sign == Positive) {
953 quotient.sign = Positive;
954 remainder.sign = Positive;
956 quotient.sign = Negative;
957 remainder.sign = Positive;
960 if(divisor.sign == Positive) {
961 quotient.sign = Negative;
962 remainder.sign = Negative;
964 quotient.sign = Positive;
965 remainder.sign = Negative;
969 if(quotient.base.isZero())
970 quotient.sign = Zero;
971 if(remainder.base.isZero())
972 remainder.sign = Zero;
993 gpu
static constexpr auto power2(std::size_t power)
noexcept ->
Aesi {
996 if(result.base.isZero())
1006 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
1012 if constexpr (std::is_signed_v<Integral>) {
1013 if(sign == Negative)
1014 return base.template integralCast<Integral>() * -1;
1017 return base.template integralCast<Integral>();
1024 template <std::
size_t newBitness>
requires (newBitness != bitness) [[nodiscard]]
1031 for(std::size_t blockIdx = 0; blockIdx < blockBoarder; ++blockIdx)
1032 result.
setBlock(blockIdx, getBlock(blockIdx));
1034 if(sign == Negative)
1060 template <
byte notation,
bool hexUppercase = false,
typename Char>
requires (std::is_same_v<Char, char> || (std::is_same_v<Char, wchar_t> && (notation == 2 || notation == 8 || notation == 10 || notation == 16)))
1061 gpu
constexpr auto getString(Char* buffer, std::size_t bufferSize,
bool showBase =
false)
const noexcept -> std::size_t {
1065 if(sign == Negative && bufferSize > 0) {
1066 *buffer++ = [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1069 return base.template getString<notation, hexUppercase, Char>(buffer, bufferSize, showBase);
1075 if(bufferSize < 3)
return 0;
1076 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1077 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'b'; }
else {
return L
'b'; } } ();
1078 buffer[2] = buffer[0];
1082 if(bufferSize < 3)
return 0;
1083 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1084 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'o'; }
else {
return L
'o'; } } ();
1085 buffer[2] = buffer[0];
1089 if(bufferSize < 3)
return 0;
1090 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1091 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'x'; }
else {
return L
'x'; } } ();
1092 buffer[2] = buffer[0];
1096 if(bufferSize < 1)
return 0;
1097 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1103 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1118 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
1119 friend constexpr auto operator<<(std::basic_ostream<Char>& os,
const Aesi& number) -> std::basic_ostream<Char>& {
1121 if(number.sign != Zero) {
1122 if(number.sign == Negative)
1123 os << [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1124 return os << number.base;
1130#if defined __CUDACC__ || defined DOXYGEN_SKIP
1138 base.tryAtomicSet(value.base);
1149 base.tryAtomicExchange(value.base);
1219template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1228template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1237template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1246template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1255template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1264template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1273template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1282template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
Long precision unsigned integer with arithmetic operations.
Long precision signed integer.
Definition Aesi.h:67
gpu constexpr friend auto operator%(const Aesi &modulation, const Aesi &modulo) noexcept -> Aesi
Modulo operator.
Definition Aesi.h:550
gpu constexpr auto byteCount() const noexcept -> std::size_t
Get amount of non-empty bytes in number right to left.
Definition Aesi.h:849
gpu constexpr auto operator<=>(const Object &other) const noexcept -> std::strong_ordering
Three-way comparison operator for numbers of different precision and built-in integral types.
Definition Aesi.h:775
gpu constexpr friend auto operator/=(Aesi &division, const Aesi &divisor) noexcept -> Aesi &
Assignment division operator.
Definition Aesi.h:514
gpu constexpr auto swap(Aesi &other) noexcept -> void
Make swap between two objects.
Definition Aesi.h:918
gpu constexpr auto inverse() noexcept -> void
Invertes number's bitness.
Definition Aesi.h:927
gpu constexpr Aesi(const Aeu< bitness > &value)
Unsigned integer conversion.
Definition Aesi.h:151
gpu constexpr auto operator++(int) &noexcept -> Aesi
Postfix increment operator.
Definition Aesi.h:224
gpu constexpr auto operator--(int) &noexcept -> Aesi
Postfix decrement operator.
Definition Aesi.h:244
gpu constexpr friend auto operator-=(Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi &
Subtraction assignment operator.
Definition Aesi.h:335
gpu constexpr auto operator--() noexcept -> Aesi &
Prefix decrement operator.
Definition Aesi.h:230
gpu constexpr auto compareTo(const Aesi< otherBitness > &value) const noexcept -> Comparison
Different precision comparison operator.
Definition Aesi.h:685
gpu constexpr friend auto operator==(const Aesi &our, const Aesi< otherBitness > &other) noexcept -> bool
Different precision equlity operator.
Definition Aesi.h:619
__device__ constexpr auto tryAtomicSet(const Aesi &value) noexcept -> void
Atomicity-oriented object assignment operator.
Definition Aesi.h:1137
gpu constexpr friend auto operator*(const Aesi &multiplication, const Aesi &factor) noexcept -> Aesi
Multiplication operator.
Definition Aesi.h:415
gpu constexpr auto operator++() noexcept -> Aesi &
Prefix increment operator.
Definition Aesi.h:210
constexpr Aesi & operator=(const Aesi &other) noexcept=default
Copy assignment operator.
gpu constexpr friend auto operator%=(Aesi &modulation, const Aesi &modulo) noexcept -> Aesi &
Modulo assignment operator.
Definition Aesi.h:584
gpu constexpr auto operator<=>(const Aesi &other) const noexcept -> std::strong_ordering
Three-way comparison operator.
Definition Aesi.h:754
gpu constexpr Aesi(String &&stringView) noexcept
String / String-view constructor.
Definition Aesi.h:141
gpu constexpr friend auto operator+(const Aesi &addition, const Aesi &addendum) noexcept -> Aesi
Addition operator.
Definition Aesi.h:255
static gpu constexpr auto power2(std::size_t power) noexcept -> Aesi
Fast exponentiation of 2.
Definition Aesi.h:993
gpu constexpr auto integralCast() const noexcept -> Integral
Cast for built-in integral types.
Definition Aesi.h:1007
gpu constexpr auto precisionCast() const noexcept -> Aesi< newBitness >
Number's precision cast.
Definition Aesi.h:1025
gpu constexpr friend auto operator+=(Aesi &addition, const Aesi &addendum) noexcept -> Aesi &
Addition assignment operator.
Definition Aesi.h:265
gpu constexpr friend auto operator-(const Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi
Subtraction operator.
Definition Aesi.h:325
gpu constexpr friend auto operator/(const Aesi &division, const Aesi &divisor) noexcept -> Aesi
Division operator.
Definition Aesi.h:480
gpu constexpr auto setBlock(std::size_t index, block block) noexcept -> void
Set block in number by index starting from the right.
Definition Aesi.h:833
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aesi.h:863
static gpu constexpr auto getBitness() noexcept -> std::size_t
Get number's precision.
Definition Aesi.h:905
__device__ constexpr auto tryAtomicExchange(const Aesi &value) noexcept -> void
Atomicity-oriented object exchangement operator.
Definition Aesi.h:1148
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aesi.h:842
gpu constexpr Aesi(const Char *ptr, std::size_t size) noexcept
Pointer-based character constructor.
Definition Aesi.h:122
gpu constexpr auto isNegative() const noexcept -> bool
Check whether number is negative.
Definition Aesi.h:891
constexpr Aesi() noexcept=default
Default constructor.
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aesi.h:870
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aesi.h:877
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aesi.h:898
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aesi.h:825
gpu constexpr auto operator-() const noexcept -> Aesi
Unary minus operator.
Definition Aesi.h:204
gpu constexpr auto getBit(std::size_t index) const noexcept -> bool
Get bit in number by index starting from the right.
Definition Aesi.h:808
gpu constexpr auto squareRoot() const noexcept -> Aesi
Square root.
Definition Aesi.h:981
gpu constexpr auto compareTo(const Aesi &value) const noexcept -> Comparison
Comparison operator.
Definition Aesi.h:695
gpu constexpr auto compareTo(Integral integral) const noexcept -> Comparison
Comparison operator for built-in types.
Definition Aesi.h:649
gpu constexpr auto setByte(std::size_t index, byte byte) noexcept -> void
Set byte in number by index starting from the right.
Definition Aesi.h:816
static gpu constexpr auto totalBlocksNumber() noexcept -> std::size_t
Get the number of blocks (length of array of uint32_t integers) inside object.
Definition Aesi.h:912
gpu constexpr auto isPositive() const noexcept -> bool
Check whether number is positive.
Definition Aesi.h:884
static gpu constexpr auto divide(const Aesi &number, const Aesi &divisor, Aesi "ient, Aesi &remainder) noexcept -> void
Integral division.
Definition Aesi.h:942
gpu constexpr auto setBit(std::size_t index, bool bit) noexcept -> void
Set bit in number by index starting from the right.
Definition Aesi.h:799
gpu constexpr auto unsignedCast() const noexcept -> Aeu< bitness >
Unsigned cast.
Definition Aesi.h:1047
gpu constexpr Aesi(const Char(&literal)[arrayLength]) noexcept
C-style string literal constructor.
Definition Aesi.h:133
gpu constexpr friend auto operator*=(Aesi &multiplication, const Aesi &factor) noexcept -> Aesi &
Multiplication assignment operator.
Definition Aesi.h:446
gpu constexpr auto getString(Char *buffer, std::size_t bufferSize, bool showBase=false) const noexcept -> std::size_t
Character buffer output operator.
Definition Aesi.h:1061
gpu constexpr auto operator+() const noexcept -> Aesi
Unary plus operator.
Definition Aesi.h:197
gpu constexpr auto bitCount() const noexcept -> std::size_t
Get amount of non-empty bits in number right to left.
Definition Aesi.h:856
Long precision unsigned integer.
Definition Aeu.h:84
gpu constexpr auto bitCount() const noexcept -> std::size_t
Get amount of non-empty bits in number right to left.
Definition Aeu.h:1004
gpu constexpr auto compareTo(Unsigned other) const noexcept -> Comparison
Internal comparison operator for built-in integral types uint8_t, uint16_t, uint32_t.
Definition Aeu.h:768
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aeu.h:1048
static gpu constexpr auto power2(std::size_t power) noexcept -> Aeu
Fast exponentiation for powers of 2.
Definition Aeu.h:1248
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aeu.h:1034
gpu constexpr auto setByte(std::size_t index, byte byte) noexcept -> void
Set byte in number by index starting from the right.
Definition Aeu.h:930
gpu constexpr auto byteCount() const noexcept -> std::size_t
Get amount of non-empty bytes in number right to left.
Definition Aeu.h:987
gpu constexpr auto setBlock(std::size_t index, block block) noexcept -> void
Set block in number by index starting from the right.
Definition Aeu.h:961
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aeu.h:946
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aeu.h:1027
gpu constexpr auto swap(Aeu &other) noexcept -> void
Make swap between two objects.
Definition Aeu.h:1072
gpu constexpr auto setBit(std::size_t index, bool bit) noexcept -> void
Set a bit in number by index starting from the right.
Definition Aeu.h:896
static gpu constexpr auto totalBlocksNumber() noexcept -> std::size_t
Get the number of blocks (length of array of uint32_t integers) inside object.
Definition Aeu.h:1066
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aeu.h:1041
gpu constexpr auto getBit(std::size_t index) const noexcept -> bool
Get bit in number by index staring from the right.
Definition Aeu.h:915
gpu constexpr auto squareRoot() const noexcept -> Aeu
Get square root.
Definition Aeu.h:1256
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aeu.h:975