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 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 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 gpu
constexpr Aesi() noexcept = default;
87 gpu constexpr ~
Aesi() noexcept = default;
93 gpu constexpr
Aesi(const
Aesi& copy) noexcept = default;
99 template <typename Integral> requires (std::is_integral_v<Integral>)
100 gpu constexpr
Aesi(Integral value) noexcept {
104 base =
Base(
static_cast<unsigned long long>(value));
106 }
else if(value > 0) {
107 base =
Base(
static_cast<unsigned long long>(value));
120 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
121 gpu
constexpr Aesi(
const Char* ptr, std::size_t size) noexcept : base(ptr, size) {
123 sign = traverseDashes(ptr, size);
124 else sign = Sign::Zero;
131 template <
typename Char, std::
size_t arrayLength>
requires (arrayLength > 1 && (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>))
132 gpu
constexpr Aesi(
const Char (&literal)[arrayLength]) noexcept :
Aesi(literal, arrayLength) {}
138 template <
typename String,
typename Char =
typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>,
139 std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
140 gpu
constexpr Aesi(String&& stringView) noexcept :
Aesi(stringView.data(), stringView.size()) {}
142 template <
typename String,
typename Char =
typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>,
143 std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
144 gpu
constexpr Aesi(
const String& stringView) noexcept :
Aesi(stringView.data(), stringView.size()) {}
150 explicit gpu
constexpr Aesi(
const Aeu<bitness>& value) : sign(Sign::Positive), base(value) {}
152#ifdef AESI_CRYPTOPP_INTEGRATION
157 constexpr Aesi(
const CryptoPP::Integer& number) {
163 if(number.IsNegative())
165 else sign = Positive;
170#ifdef AESI_GMP_INTEGRATION
175 constexpr Aesi(
const mpz_class& number) {
183 else sign = Positive;
192 template <
typename Integral>
requires (std::is_signed_v<Integral>)
193 gpu
constexpr Aesi&
operator=(Integral value)
noexcept {
199 }
else sign = Positive;
200 base =
static_cast<unsigned long long>(value);
235 if(sign == Negative) {
236 --base;
if(base.
isZero()) sign = Zero;
237 }
else if(sign == Positive) {
239 }
else { base = 1u; sign = Positive; }
255 if(sign == Negative) {
257 }
else if(sign == Positive) {
258 --base;
if(base.
isZero()) sign = Zero;
259 }
else { base = 1u; sign = Negative; }
279 Aesi result = addition; result += addendum;
return result;
290 Sign& lSign = addition.sign;
const Sign& rSign = addendum.sign;
291 Base& lBase = addition.base;
const Base& rBase = addendum.base;
295 else if(lSign == Zero)
296 return addition = addendum;
297 else if(lSign == rSign) {
302 if(lSign == Positive) {
304 using enum Comparison;
310 lBase = rBase - lBase;
320 switch(
const auto ratio = lBase.
compareTo(rBase)) {
321 using enum Comparison;
327 lBase = rBase - lBase;
349 Aesi result = subtraction; result -= subtrahend;
return result;
360 Sign& lSign = subtraction.sign;
const Sign& rSign = subtrahend.sign;
361 Base& lBase = subtraction.base;
const Base& rBase = subtrahend.base;
366 subtraction = subtrahend;
367 subtraction.inverse();
371 if(lSign == Positive) {
372 if(rSign == Positive) {
374 using enum Comparison;
380 lBase = rBase - lBase;
394 if(rSign == Negative) {
396 using enum Comparison;
402 lBase = rBase - lBase;
426 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
427 gpu
constexpr friend auto operator*(
const Aesi& multiplication, Integral factor)
noexcept ->
Aesi {
428 Aesi result = multiplication; result *= factor;
return result;
439 Aesi result = multiplication; result *= factor;
return result;
448 template <
typename Integral>
requires (std::is_integral_v<Integral>)
449 gpu
constexpr friend auto operator*=(
Aesi& multiplication, Integral factor)
noexcept ->
Aesi& {
452 multiplication.sign = Zero;
458 multiplication.base *=
static_cast<unsigned long long>(factor);
460 return multiplication;
471 if(factor.isZero()) {
472 multiplication.sign = Zero;
474 if(factor.isNegative())
476 multiplication.base *= factor.base;
478 return multiplication;
490 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
491 gpu
constexpr friend auto operator/(
const Aesi& division, Integral divisor)
noexcept ->
Aesi {
492 Aesi result = division; result /= divisor;
return result;
504 Aesi result = division; result /= divisor;
return result;
514 template <
typename Integral>
requires (std::is_integral_v<Integral>)
515 gpu
constexpr friend auto operator/=(
Aesi& division, Integral divisor)
noexcept ->
Aesi& {
518 division.sign = Zero;
524 division.base /=
static_cast<unsigned long long>(divisor);
525 if(division.base.
isZero()) division.sign = Zero;
539 if(divisor.isZero()) {
540 division.sign = Zero;
542 if(divisor.isNegative())
544 division.base /= divisor.base;
545 if(division.base.
isZero()) division.sign = Zero;
559 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
560 gpu
constexpr friend auto operator%(
const Aesi& modulation, Integral modulo)
noexcept ->
Aesi {
561 Aesi result = modulation; result %= modulo;
return result;
574 Aesi result = modulation; result %= modulo;
return result;
584 template <
typename Integral>
requires (std::is_integral_v<Integral>)
585 gpu
constexpr friend auto operator%=(
Aesi& modulation, Integral modulo)
noexcept ->
Aesi& {
588 modulation.sign = Zero;
594 modulation.base %=
static_cast<unsigned long long>(modulo);
611 if(modulo.isNegative())
613 modulation.base %= modulo.base;
614 if(modulation.base.
isZero())
615 modulation.sign = Sign::Zero;
630 template <
typename Integral>
requires (std::is_integral_v<Integral>)
631 gpu
constexpr friend auto operator==(
const Aesi& our, Integral integral)
noexcept ->
bool {
632 return our.
compareTo(integral) == Comparison::equal;
641 template <std::
size_t otherBitness>
643 if constexpr (bitness == otherBitness) {
644 return our.
compareTo(other) == Comparison::equal;
658 template <
typename Integral>
requires (std::is_integral_v<Integral>)
659 gpu
constexpr auto compareTo(Integral integral)
const noexcept -> Comparison {
660 using enum Sign;
using enum Comparison;
670 }
else if(integral < 0) {
672 switch(base.
compareTo(
static_cast<unsigned long long>(integral * -1))) {
673 using enum Comparison;
684 return base.
compareTo(
static_cast<unsigned long long>(integral));
694 template <std::
size_t otherBitness = bitness> [[nodiscard]]
696 return precisionCast<otherBitness>().compareTo(value);
705 gpu
constexpr auto compareTo(
const Aesi& value)
const noexcept -> Comparison {
706 using enum Sign;
using enum Comparison;
718 if(value.isNegative()) {
738#if (defined(__CUDACC__) || __cplusplus < 202002L || defined (PRE_CPP_20)) && !defined DOXYGEN_SKIP
742 gpu
constexpr auto operator!=(
const Aeu& value)
const noexcept ->
bool {
743 return !this->operator==(value);
745 gpu
constexpr auto operator<(
const Aeu& value)
const noexcept ->
bool {
746 return this->compareTo(value) == Comparison::less;
748 gpu
constexpr auto operator<=(
const Aeu& value)
const noexcept ->
bool {
749 return !this->operator>(value);
751 gpu
constexpr auto operator>(
const Aeu& value)
const noexcept ->
bool {
752 return this->compareTo(value) == Comparison::greater;
754 gpu
constexpr auto operator>=(
const Aeu& value)
const noexcept ->
bool {
755 return !this->operator<(value);
764 gpu
constexpr auto operator<=>(
const Aesi& other)
const noexcept -> std::strong_ordering {
765 switch(this->compareTo(other)) {
766 using enum Comparison;
768 return std::strong_ordering::less;
770 return std::strong_ordering::greater;
772 return std::strong_ordering::equal;
774 return std::strong_ordering::equivalent;
784 template <
typename Object>
785 gpu
constexpr auto operator<=>(
const Object& other)
const noexcept -> std::strong_ordering {
786 switch(this->compareTo(other)) {
787 using enum Comparison;
789 return std::strong_ordering::less;
791 return std::strong_ordering::greater;
793 return std::strong_ordering::equal;
795 return std::strong_ordering::equivalent;
809 gpu
constexpr auto setBit(std::size_t index,
bool bit)
noexcept ->
void {
return base.
setBit(index, bit); }
818 gpu
constexpr auto getBit(std::size_t index)
const noexcept ->
bool {
return base.
getBit(index); }
826 gpu
constexpr auto setByte(std::size_t index,
byte byte)
noexcept ->
void {
return base.
setByte(index,
byte); }
835 gpu
constexpr auto getByte(std::size_t index)
const noexcept ->
byte {
return base.
getByte(index); }
843 gpu
constexpr auto setBlock(std::size_t index, block block)
noexcept ->
void {
return base.
setBlock(index, block); }
852 gpu
constexpr auto getBlock(std::size_t index)
const noexcept -> block {
return base.
getBlock(index); }
873 gpu
constexpr auto isOdd() const noexcept ->
bool {
return base.
isOdd(); }
880 gpu
constexpr auto isEven() const noexcept ->
bool {
return base.
isEven(); }
887 gpu
constexpr auto isZero() const noexcept ->
bool {
return sign == Sign::Zero; }
894 gpu
constexpr auto isPositive() const noexcept ->
bool {
return sign == Sign::Positive; }
901 gpu
constexpr auto isNegative() const noexcept ->
bool {
return sign == Sign::Negative; }
915 gpu
static constexpr auto getBitness() noexcept -> std::
size_t {
return bitness; }
928 gpu
constexpr auto swap(
Aesi& other)
noexcept ->
void {
929 Sign tSign = sign; sign = other.sign; other.sign = tSign;
930 base.
swap(other.base);
937 gpu
constexpr auto inverse() noexcept ->
void {
939 sign = (sign == Zero ? Zero : (sign == Negative ? Positive : Negative));
952 gpu
static constexpr auto divide(
const Aesi& number,
const Aesi& divisor,
Aesi& quotient,
Aesi& remainder)
noexcept ->
void {
954 if(number.sign == Zero || divisor.sign == Zero) {
955 quotient.sign = Zero;
956 remainder.sign = Zero;
960 Base::divide(number.base, divisor.base, quotient.base, remainder.base);
961 if(number.sign == Positive) {
962 if(divisor.sign == Positive) {
963 quotient.sign = Positive;
964 remainder.sign = Positive;
966 quotient.sign = Negative;
967 remainder.sign = Positive;
970 if(divisor.sign == Positive) {
971 quotient.sign = Negative;
972 remainder.sign = Negative;
974 quotient.sign = Positive;
975 remainder.sign = Negative;
979 if(quotient.base.isZero())
980 quotient.sign = Zero;
981 if(remainder.base.isZero())
982 remainder.sign = Zero;
995 Aesi result; result.sign = Zero;
return result;
1003 gpu
static constexpr auto power2(std::size_t power)
noexcept ->
Aesi {
1006 if(result.base.isZero())
1016 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
1022 if constexpr (std::is_signed_v<Integral>) {
1023 if(sign == Negative)
1024 return base.template integralCast<Integral>() * -1;
1027 return base.template integralCast<Integral>();
1034 template <std::
size_t newBitness>
requires (newBitness != bitness) [[nodiscard]]
1041 for(std::size_t blockIdx = 0; blockIdx < blockBoarder; ++blockIdx)
1042 result.
setBlock(blockIdx, getBlock(blockIdx));
1044 if(sign == Negative)
1070 template <
byte notation,
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t> && (notation == 2 || notation == 8 || notation == 10 || notation == 16))
1071 gpu
constexpr auto getString(Char* buffer, std::size_t bufferSize,
bool showBase =
false,
bool hexUppercase =
false)
const noexcept -> std::size_t {
1075 if(sign == Negative && bufferSize > 0) {
1076 *buffer++ = [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1079 return base.template getString<notation, Char>(buffer, bufferSize, showBase, hexUppercase);
1085 if(bufferSize < 3)
return 0;
1086 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1087 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'b'; }
else {
return L
'b'; } } ();
1088 buffer[2] = buffer[0];
1092 if(bufferSize < 3)
return 0;
1093 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1094 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'o'; }
else {
return L
'o'; } } ();
1095 buffer[2] = buffer[0];
1099 if(bufferSize < 3)
return 0;
1100 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1101 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'x'; }
else {
return L
'x'; } } ();
1102 buffer[2] = buffer[0];
1106 if(bufferSize < 1)
return 0;
1107 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1113 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1128 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
1129 friend constexpr auto operator<<(std::basic_ostream<Char>& os,
const Aesi& number) -> std::basic_ostream<Char>& {
1131 if(number.sign != Zero) {
1132 if(number.sign == Negative)
1133 os << [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1134 return os << number.base;
1140#if defined __CUDACC__ || defined DOXYGEN_SKIP
1148 base.tryAtomicSet(value.base);
1159 base.tryAtomicExchange(value.base);
1229template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1238template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1247template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1256template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1265template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1274template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1283template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1292template <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:573
gpu constexpr auto byteCount() const noexcept -> std::size_t
Get amount of non-empty bytes in number right to left.
Definition Aesi.h:859
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:785
gpu constexpr friend auto operator/=(Aesi &division, const Aesi &divisor) noexcept -> Aesi &
Assignment division operator.
Definition Aesi.h:537
gpu constexpr auto swap(Aesi &other) noexcept -> void
Make swap between two objects.
Definition Aesi.h:928
gpu constexpr auto inverse() noexcept -> void
Invertes number's bitness.
Definition Aesi.h:937
gpu constexpr Aesi(const Aeu< bitness > &value)
Unsigned integer conversion.
Definition Aesi.h:150
gpu constexpr auto operator++(int) &noexcept -> Aesi
Postfix increment operator.
Definition Aesi.h:247
gpu constexpr auto operator--(int) &noexcept -> Aesi
Postfix decrement operator.
Definition Aesi.h:267
gpu constexpr Aesi & operator=(const Aesi &other) noexcept=default
Copy assignment operator.
gpu constexpr friend auto operator-=(Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi &
Subtraction assignment operator.
Definition Aesi.h:358
gpu constexpr auto operator--() noexcept -> Aesi &
Prefix decrement operator.
Definition Aesi.h:253
gpu constexpr auto compareTo(const Aesi< otherBitness > &value) const noexcept -> Comparison
Different precision comparison operator.
Definition Aesi.h:695
gpu constexpr friend auto operator==(const Aesi &our, const Aesi< otherBitness > &other) noexcept -> bool
Different precision equlity operator.
Definition Aesi.h:642
__device__ constexpr auto tryAtomicSet(const Aesi &value) noexcept -> void
Atomicity-oriented object assignment operator.
Definition Aesi.h:1147
gpu constexpr friend auto operator*(const Aesi &multiplication, const Aesi &factor) noexcept -> Aesi
Multiplication operator.
Definition Aesi.h:438
gpu constexpr auto getString(Char *buffer, std::size_t bufferSize, bool showBase=false, bool hexUppercase=false) const noexcept -> std::size_t
Character buffer output operator.
Definition Aesi.h:1071
gpu constexpr auto operator++() noexcept -> Aesi &
Prefix increment operator.
Definition Aesi.h:233
gpu constexpr friend auto operator%=(Aesi &modulation, const Aesi &modulo) noexcept -> Aesi &
Modulo assignment operator.
Definition Aesi.h:607
gpu constexpr auto operator<=>(const Aesi &other) const noexcept -> std::strong_ordering
Three-way comparison operator.
Definition Aesi.h:764
gpu constexpr Aesi(String &&stringView) noexcept
String / String-view constructor.
Definition Aesi.h:140
gpu constexpr friend auto operator+(const Aesi &addition, const Aesi &addendum) noexcept -> Aesi
Addition operator.
Definition Aesi.h:278
static gpu constexpr auto power2(std::size_t power) noexcept -> Aesi
Fast exponentiation of 2.
Definition Aesi.h:1003
gpu constexpr auto integralCast() const noexcept -> Integral
Cast for built-in integral types.
Definition Aesi.h:1017
gpu constexpr auto precisionCast() const noexcept -> Aesi< newBitness >
Number's precision cast.
Definition Aesi.h:1035
gpu constexpr friend auto operator+=(Aesi &addition, const Aesi &addendum) noexcept -> Aesi &
Addition assignment operator.
Definition Aesi.h:288
gpu constexpr friend auto operator-(const Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi
Subtraction operator.
Definition Aesi.h:348
gpu constexpr friend auto operator/(const Aesi &division, const Aesi &divisor) noexcept -> Aesi
Division operator.
Definition Aesi.h:503
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:843
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aesi.h:873
static gpu constexpr auto getBitness() noexcept -> std::size_t
Get number's precision.
Definition Aesi.h:915
__device__ constexpr auto tryAtomicExchange(const Aesi &value) noexcept -> void
Atomicity-oriented object exchangement operator.
Definition Aesi.h:1158
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aesi.h:852
gpu constexpr Aesi(const Char *ptr, std::size_t size) noexcept
Pointer-based character constructor.
Definition Aesi.h:121
gpu constexpr auto isNegative() const noexcept -> bool
Check whether number is negative.
Definition Aesi.h:901
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aesi.h:880
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aesi.h:887
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aesi.h:908
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aesi.h:835
gpu constexpr auto operator-() const noexcept -> Aesi
Unary minus operator.
Definition Aesi.h:227
gpu constexpr auto getBit(std::size_t index) const noexcept -> bool
Get bit in number by index starting from the right.
Definition Aesi.h:818
gpu constexpr auto squareRoot() const noexcept -> Aesi
Square root.
Definition Aesi.h:991
gpu constexpr auto compareTo(const Aesi &value) const noexcept -> Comparison
Comparison operator.
Definition Aesi.h:705
gpu constexpr auto compareTo(Integral integral) const noexcept -> Comparison
Comparison operator for built-in types.
Definition Aesi.h:659
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:826
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:922
gpu constexpr auto isPositive() const noexcept -> bool
Check whether number is positive.
Definition Aesi.h:894
static gpu constexpr auto divide(const Aesi &number, const Aesi &divisor, Aesi "ient, Aesi &remainder) noexcept -> void
Integral division.
Definition Aesi.h:952
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:809
gpu constexpr auto unsignedCast() const noexcept -> Aeu< bitness >
Unsigned cast.
Definition Aesi.h:1057
gpu constexpr Aesi(const Char(&literal)[arrayLength]) noexcept
C-style string literal constructor.
Definition Aesi.h:132
gpu constexpr friend auto operator*=(Aesi &multiplication, const Aesi &factor) noexcept -> Aesi &
Multiplication assignment operator.
Definition Aesi.h:469
gpu constexpr Aesi() noexcept=default
Default constructor.
gpu constexpr auto operator+() const noexcept -> Aesi
Unary plus operator.
Definition Aesi.h:220
gpu constexpr auto bitCount() const noexcept -> std::size_t
Get amount of non-empty bits in number right to left.
Definition Aesi.h:866
Long precision unsigned integer.
Definition Aeu.h:83
gpu constexpr auto bitCount() const noexcept -> std::size_t
Get amount of non-empty bits in number right to left.
Definition Aeu.h:1015
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:779
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aeu.h:1059
static gpu constexpr auto power2(std::size_t power) noexcept -> Aeu
Fast exponentiation for powers of 2.
Definition Aeu.h:1259
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aeu.h:1045
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:941
gpu constexpr auto byteCount() const noexcept -> std::size_t
Get amount of non-empty bytes in number right to left.
Definition Aeu.h:998
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:972
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aeu.h:957
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aeu.h:1038
gpu constexpr auto swap(Aeu &other) noexcept -> void
Make swap between two objects.
Definition Aeu.h:1083
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:907
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:1077
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aeu.h:1052
gpu constexpr auto getBit(std::size_t index) const noexcept -> bool
Get bit in number by index staring from the right.
Definition Aeu.h:926
gpu constexpr auto squareRoot() const noexcept -> Aeu
Get square root.
Definition Aeu.h:1267
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aeu.h:986