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);
209 gpu
constexpr Aesi&
operator=(
const Aesi& other)
noexcept { base = other.base; sign = other.sign;
return *
this; }
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;
649 template <std::
size_t otherBitness>
requires (otherBitness != bitness)
662 template <
typename Integral>
requires (std::is_integral_v<Integral>)
663 gpu
constexpr auto compareTo(Integral integral)
const noexcept -> Comparison {
664 using enum Sign;
using enum Comparison;
674 }
else if(integral < 0) {
676 switch(base.
compareTo(
static_cast<unsigned long long>(integral * -1))) {
677 using enum Comparison;
688 return base.
compareTo(
static_cast<unsigned long long>(integral));
698 template <std::
size_t otherBitness = bitness> [[nodiscard]]
700 return precisionCast<otherBitness>().compareTo(value);
709 gpu
constexpr auto compareTo(
const Aesi& value)
const noexcept -> Comparison {
710 using enum Sign;
using enum Comparison;
722 if(value.isNegative()) {
742#if (defined(__CUDACC__) || __cplusplus < 202002L || defined (PRE_CPP_20)) && !defined DOXYGEN_SKIP
746 gpu
constexpr auto operator!=(
const Aeu& value)
const noexcept ->
bool {
747 return !this->operator==(value);
749 gpu
constexpr auto operator<(
const Aeu& value)
const noexcept ->
bool {
750 return this->compareTo(value) == Comparison::less;
752 gpu
constexpr auto operator<=(
const Aeu& value)
const noexcept ->
bool {
753 return !this->operator>(value);
755 gpu
constexpr auto operator>(
const Aeu& value)
const noexcept ->
bool {
756 return this->compareTo(value) == Comparison::greater;
758 gpu
constexpr auto operator>=(
const Aeu& value)
const noexcept ->
bool {
759 return !this->operator<(value);
768 gpu
constexpr auto operator<=>(
const Aesi& other)
const noexcept -> std::strong_ordering {
769 switch(this->compareTo(other)) {
770 using enum Comparison;
772 return std::strong_ordering::less;
774 return std::strong_ordering::greater;
776 return std::strong_ordering::equal;
778 return std::strong_ordering::equivalent;
788 template <
typename Object>
789 gpu
constexpr auto operator<=>(
const Object& other)
const noexcept -> std::strong_ordering {
790 switch(this->compareTo(other)) {
791 using enum Comparison;
793 return std::strong_ordering::less;
795 return std::strong_ordering::greater;
797 return std::strong_ordering::equal;
799 return std::strong_ordering::equivalent;
813 gpu
constexpr auto setBit(std::size_t index,
bool bit)
noexcept ->
void {
return base.
setBit(index, bit); }
822 gpu
constexpr auto getBit(std::size_t index)
const noexcept ->
bool {
return base.
getBit(index); }
830 gpu
constexpr auto setByte(std::size_t index,
byte byte)
noexcept ->
void {
return base.
setByte(index,
byte); }
839 gpu
constexpr auto getByte(std::size_t index)
const noexcept ->
byte {
return base.
getByte(index); }
847 gpu
constexpr auto setBlock(std::size_t index, block block)
noexcept ->
void {
return base.
setBlock(index, block); }
856 gpu
constexpr auto getBlock(std::size_t index)
const noexcept -> block {
return base.
getBlock(index); }
877 gpu
constexpr auto isOdd() const noexcept ->
bool {
return base.
isOdd(); }
884 gpu
constexpr auto isEven() const noexcept ->
bool {
return base.
isEven(); }
891 gpu
constexpr auto isZero() const noexcept ->
bool {
return sign == Sign::Zero; }
898 gpu
constexpr auto isPositive() const noexcept ->
bool {
return sign == Sign::Positive; }
905 gpu
constexpr auto isNegative() const noexcept ->
bool {
return sign == Sign::Negative; }
919 gpu
static constexpr auto getBitness() noexcept -> std::
size_t {
return bitness; }
932 gpu
constexpr auto swap(
Aesi& other)
noexcept ->
void {
933 Sign tSign = sign; sign = other.sign; other.sign = tSign;
934 base.
swap(other.base);
941 gpu
constexpr auto inverse() noexcept ->
void {
943 sign = (sign == Zero ? Zero : (sign == Negative ? Positive : Negative));
956 gpu
static constexpr auto divide(
const Aesi& number,
const Aesi& divisor,
Aesi& quotient,
Aesi& remainder)
noexcept ->
void {
958 if(number.sign == Zero || divisor.sign == Zero) {
959 quotient.sign = Zero;
960 remainder.sign = Zero;
964 Base::divide(number.base, divisor.base, quotient.base, remainder.base);
965 if(number.sign == Positive) {
966 if(divisor.sign == Positive) {
967 quotient.sign = Positive;
968 remainder.sign = Positive;
970 quotient.sign = Negative;
971 remainder.sign = Positive;
974 if(divisor.sign == Positive) {
975 quotient.sign = Negative;
976 remainder.sign = Negative;
978 quotient.sign = Positive;
979 remainder.sign = Negative;
983 if(quotient.base.isZero())
984 quotient.sign = Zero;
985 if(remainder.base.isZero())
986 remainder.sign = Zero;
999 Aesi result; result.sign = Zero;
return result;
1007 gpu
static constexpr auto power2(std::size_t power)
noexcept ->
Aesi {
1010 if(result.base.isZero())
1020 template <
typename Integral>
requires (std::is_integral_v<Integral>) [[nodiscard]]
1026 if constexpr (std::is_signed_v<Integral>) {
1027 if(sign == Negative)
1028 return base.template integralCast<Integral>() * -1;
1031 return base.template integralCast<Integral>();
1038 template <std::
size_t newBitness>
requires (newBitness != bitness) [[nodiscard]]
1045 for(std::size_t blockIdx = 0; blockIdx < blockBoarder; ++blockIdx)
1046 result.
setBlock(blockIdx, getBlock(blockIdx));
1048 if(sign == Negative)
1074 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))
1075 gpu
constexpr auto getString(Char* buffer, std::size_t bufferSize,
bool showBase =
false,
bool hexUppercase =
false)
const noexcept -> std::size_t {
1079 if(sign == Negative && bufferSize > 0) {
1080 *buffer++ = [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1083 return base.template getString<notation, Char>(buffer, bufferSize, showBase, hexUppercase);
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 'b'; }
else {
return L
'b'; } } ();
1092 buffer[2] = buffer[0];
1096 if(bufferSize < 3)
return 0;
1097 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1098 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'o'; }
else {
return L
'o'; } } ();
1099 buffer[2] = buffer[0];
1103 if(bufferSize < 3)
return 0;
1104 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1105 buffer[1] = [] {
if constexpr (std::is_same_v<Char, char>) {
return 'x'; }
else {
return L
'x'; } } ();
1106 buffer[2] = buffer[0];
1110 if(bufferSize < 1)
return 0;
1111 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1117 buffer[0] = [] {
if constexpr (std::is_same_v<Char, char>) {
return '0'; }
else {
return L
'0'; } } ();
1132 template <
typename Char>
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
1133 friend constexpr auto operator<<(std::basic_ostream<Char>& os,
const Aesi& number) -> std::basic_ostream<Char>& {
1135 if(number.sign != Zero) {
1136 if(number.sign == Negative)
1137 os << [] {
if constexpr (std::is_same_v<Char, char>) {
return '-'; }
else {
return L
'-'; } } ();
1138 return os << number.base;
1144#if defined __CUDACC__ || defined DOXYGEN_SKIP
1152 base.tryAtomicSet(value.base);
1163 base.tryAtomicExchange(value.base);
1233template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1242template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1251template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1260template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1269template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1278template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1287template <std::
size_t bitness,
typename Integral>
requires (std::is_integral_v<Integral>)
1296template <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:863
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:789
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:932
gpu constexpr auto inverse() noexcept -> void
Invertes number's bitness.
Definition Aesi.h:941
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
Copy assignment operator.
Definition Aesi.h:209
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:699
__device__ constexpr auto tryAtomicSet(const Aesi &value) noexcept -> void
Atomicity-oriented object assignment operator.
Definition Aesi.h:1151
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:1075
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:768
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:1007
gpu constexpr auto integralCast() const noexcept -> Integral
Cast for built-in integral types.
Definition Aesi.h:1021
gpu constexpr auto precisionCast() const noexcept -> Aesi< newBitness >
Number's precision cast.
Definition Aesi.h:1039
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:847
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aesi.h:877
static gpu constexpr auto getBitness() noexcept -> std::size_t
Get number's precision.
Definition Aesi.h:919
__device__ constexpr auto tryAtomicExchange(const Aesi &value) noexcept -> void
Atomicity-oriented object exchangement operator.
Definition Aesi.h:1162
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aesi.h:856
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:905
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aesi.h:884
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aesi.h:891
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aesi.h:912
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aesi.h:839
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:822
gpu constexpr auto squareRoot() const noexcept -> Aesi
Square root.
Definition Aesi.h:995
gpu constexpr auto compareTo(const Aesi &value) const noexcept -> Comparison
Comparison operator.
Definition Aesi.h:709
gpu constexpr auto compareTo(Integral integral) const noexcept -> Comparison
Comparison operator for built-in types.
Definition Aesi.h:663
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:830
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:926
gpu constexpr auto isPositive() const noexcept -> bool
Check whether number is positive.
Definition Aesi.h:898
static gpu constexpr auto divide(const Aesi &number, const Aesi &divisor, Aesi "ient, Aesi &remainder) noexcept -> void
Integral division.
Definition Aesi.h:956
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:813
gpu constexpr auto unsignedCast() const noexcept -> Aeu< bitness >
Unsigned cast.
Definition Aesi.h:1061
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:870
gpu constexpr friend auto operator==(const Aesi &our, const Aesi &other) noexcept -> bool=default
Equality operator.
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:1023
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:787
gpu constexpr auto filledBlocksNumber() const noexcept -> std::size_t
Get number of non-empty blocks inside object starting from the right.
Definition Aeu.h:1067
static gpu constexpr auto power2(std::size_t power) noexcept -> Aeu
Fast exponentiation for powers of 2.
Definition Aeu.h:1267
gpu constexpr auto isEven() const noexcept -> bool
Check whether number is even.
Definition Aeu.h:1053
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:949
gpu constexpr auto byteCount() const noexcept -> std::size_t
Get amount of non-empty bytes in number right to left.
Definition Aeu.h:1006
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:980
gpu constexpr auto getByte(std::size_t index) const noexcept -> byte
Get byte in number by index starting from the right.
Definition Aeu.h:965
gpu constexpr auto isOdd() const noexcept -> bool
Check whether number is odd.
Definition Aeu.h:1046
gpu constexpr auto swap(Aeu &other) noexcept -> void
Make swap between two objects.
Definition Aeu.h:1091
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:915
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:1085
gpu constexpr auto isZero() const noexcept -> bool
Check whether number is zero.
Definition Aeu.h:1060
gpu constexpr auto getBit(std::size_t index) const noexcept -> bool
Get bit in number by index staring from the right.
Definition Aeu.h:934
gpu constexpr auto squareRoot() const noexcept -> Aeu
Get square root.
Definition Aeu.h:1275
gpu constexpr auto getBlock(std::size_t index) const noexcept -> block
Get block in number by index starting from the right.
Definition Aeu.h:994