Aesi Multiprecision
C++ class library of long integer arithmetic for GPU parallelization
Loading...
Searching...
No Matches
Aesi< bitness > Class Template Referencefinal

Long precision signed integer. More...

#include <Aesi.h>

Public Member Functions

gpu constexpr Aesi () noexcept=default
 Default constructor.
 
gpu constexpr ~Aesi () noexcept=default
 Destructor.
 
gpu constexpr Aesi (const Aesi &copy) noexcept=default
 Copy constructor.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr Aesi (Integral value) noexcept
 Integral constructor.
 
template<typename Char >
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
gpu constexpr Aesi (const Char *ptr, std::size_t size) noexcept
 Pointer-based character constructor.
 
template<typename Char , std::size_t arrayLength>
requires (arrayLength > 1 && (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>))
gpu constexpr Aesi (const Char(&literal)[arrayLength]) noexcept
 C-style string literal constructor.
 
template<typename String , typename Char = typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>, std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
gpu constexpr Aesi (String &&stringView) noexcept
 String / String-view constructor.
 
template<typename String , typename Char = typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>, std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
gpu constexpr Aesi (const String &stringView) noexcept
 
gpu constexpr Aesi (const Aeu< bitness > &value)
 Unsigned integer conversion.
 
template<typename Integral >
requires (std::is_signed_v<Integral>)
gpu constexpr Aesioperator= (Integral value) noexcept
 Integral assignment operator.
 
gpu constexpr Aesioperator= (const Aesi &other) noexcept
 Copy assignment operator.
 
gpu constexpr auto operator+ () const noexcept -> Aesi
 Unary plus operator.
 
gpu constexpr auto operator- () const noexcept -> Aesi
 Unary minus operator.
 
gpu constexpr auto operator++ () noexcept -> Aesi &
 Prefix increment operator.
 
gpu constexpr auto operator++ (int) &noexcept -> Aesi
 Postfix increment operator.
 
gpu constexpr auto operator-- () noexcept -> Aesi &
 Prefix decrement operator.
 
gpu constexpr auto operator-- (int) &noexcept -> Aesi
 Postfix decrement operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr auto compareTo (Integral integral) const noexcept -> Comparison
 Comparison operator for built-in types.
 
template<std::size_t otherBitness = bitness>
gpu constexpr auto compareTo (const Aesi< otherBitness > &value) const noexcept -> Comparison
 Different precision comparison operator.
 
gpu constexpr auto compareTo (const Aesi &value) const noexcept -> Comparison
 Comparison operator.
 
gpu constexpr auto operator<=> (const Aesi &other) const noexcept -> std::strong_ordering
 Three-way comparison operator.
 
template<typename Object >
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.
 
gpu constexpr auto setBit (std::size_t index, bool bit) noexcept -> void
 Set bit in number by index starting from the right.
 
gpu constexpr auto getBit (std::size_t index) const noexcept -> bool
 Get bit in number by index starting from the right.
 
gpu constexpr auto setByte (std::size_t index, byte byte) noexcept -> void
 Set byte in number by index starting from the right.
 
gpu constexpr auto getByte (std::size_t index) const noexcept -> byte
 Get byte in number by index starting from the right.
 
gpu constexpr auto setBlock (std::size_t index, block block) noexcept -> void
 Set block in number by index starting from the right.
 
gpu constexpr auto getBlock (std::size_t index) const noexcept -> block
 Get block in number by index starting from the right.
 
gpu constexpr auto byteCount () const noexcept -> std::size_t
 Get amount of non-empty bytes in number right to left.
 
gpu constexpr auto bitCount () const noexcept -> std::size_t
 Get amount of non-empty bits in number right to left.
 
gpu constexpr auto isOdd () const noexcept -> bool
 Check whether number is odd.
 
gpu constexpr auto isEven () const noexcept -> bool
 Check whether number is even.
 
gpu constexpr auto isZero () const noexcept -> bool
 Check whether number is zero.
 
gpu constexpr auto isPositive () const noexcept -> bool
 Check whether number is positive.
 
gpu constexpr auto isNegative () const noexcept -> bool
 Check whether number is negative.
 
gpu constexpr auto filledBlocksNumber () const noexcept -> std::size_t
 Get number of non-empty blocks inside object starting from the right.
 
gpu constexpr auto swap (Aesi &other) noexcept -> void
 Make swap between two objects.
 
gpu constexpr auto inverse () noexcept -> void
 Invertes number's bitness.
 
gpu constexpr auto squareRoot () const noexcept -> Aesi
 Square root.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr auto integralCast () const noexcept -> Integral
 Cast for built-in integral types.
 
template<std::size_t newBitness>
requires (newBitness != bitness)
gpu constexpr auto precisionCast () const noexcept -> Aesi< newBitness >
 Number's precision cast.
 
gpu constexpr auto unsignedCast () const noexcept -> Aeu< bitness >
 Unsigned cast.
 
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))
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.
 
__device__ constexpr auto tryAtomicSet (const Aesi &value) noexcept -> void
 Atomicity-oriented object assignment operator.
 
__device__ constexpr auto tryAtomicExchange (const Aesi &value) noexcept -> void
 Atomicity-oriented object exchangement operator.
 

Static Public Member Functions

static gpu constexpr auto getBitness () noexcept -> std::size_t
 Get number's precision.
 
static gpu constexpr auto totalBlocksNumber () noexcept -> std::size_t
 Get the number of blocks (length of array of uint32_t integers) inside object.
 
static gpu constexpr auto divide (const Aesi &number, const Aesi &divisor, Aesi &quotient, Aesi &remainder) noexcept -> void
 Integral division.
 
static gpu constexpr auto power2 (std::size_t power) noexcept -> Aesi
 Fast exponentiation of 2.
 

Friends

gpu constexpr friend auto operator+ (const Aesi &addition, const Aesi &addendum) noexcept -> Aesi
 Addition operator.
 
gpu constexpr friend auto operator+= (Aesi &addition, const Aesi &addendum) noexcept -> Aesi &
 Addition assignment operator.
 
gpu constexpr friend auto operator- (const Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi
 Subtraction operator.
 
gpu constexpr friend auto operator-= (Aesi &subtraction, const Aesi &subtrahend) noexcept -> Aesi &
 Subtraction assignment operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator* (const Aesi &multiplication, Integral factor) noexcept -> Aesi
 Multiplication operator for built-in types.
 
gpu constexpr friend auto operator* (const Aesi &multiplication, const Aesi &factor) noexcept -> Aesi
 Multiplication operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator*= (Aesi &multiplication, Integral factor) noexcept -> Aesi &
 Multiplication assignment operator for built-in types.
 
gpu constexpr friend auto operator*= (Aesi &multiplication, const Aesi &factor) noexcept -> Aesi &
 Multiplication assignment operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator/ (const Aesi &division, Integral divisor) noexcept -> Aesi
 Division operator for built-in integral types.
 
gpu constexpr friend auto operator/ (const Aesi &division, const Aesi &divisor) noexcept -> Aesi
 Division operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator/= (Aesi &division, Integral divisor) noexcept -> Aesi &
 Assignment division operator for built-in integral types.
 
gpu constexpr friend auto operator/= (Aesi &division, const Aesi &divisor) noexcept -> Aesi &
 Assignment division operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator% (const Aesi &modulation, Integral modulo) noexcept -> Aesi
 Modulo operator for built-in types.
 
gpu constexpr friend auto operator% (const Aesi &modulation, const Aesi &modulo) noexcept -> Aesi
 Modulo operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator%= (Aesi &modulation, Integral modulo) noexcept -> Aesi &
 Modulo assignment operator for built-in types.
 
gpu constexpr friend auto operator%= (Aesi &modulation, const Aesi &modulo) noexcept -> Aesi &
 Modulo assignment operator.
 
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator== (const Aesi &our, Integral integral) noexcept -> bool
 Equality operator for built-in types.
 
gpu constexpr friend auto operator== (const Aesi &our, const Aesi &other) noexcept -> bool=default
 Equality operator.
 
template<std::size_t otherBitness>
requires (otherBitness != bitness)
gpu constexpr friend auto operator== (const Aesi &our, const Aesi< otherBitness > &other) noexcept -> bool
 Different precision equlity operator.
 
template<typename Char >
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
constexpr auto operator<< (std::basic_ostream< Char > &os, const Aesi &number) -> std::basic_ostream< Char > &
 STD stream output operator.
 

Detailed Description

template<std::size_t bitness = 512>
requires (bitness % blockBitLength == 0)
class Aesi< bitness >

Long precision signed integer.

May be used to represent positive and negative integers. Number precision is set in template parameter bitness.

Constructor & Destructor Documentation

◆ Aesi() [1/6]

template<std::size_t bitness = 512>
gpu constexpr Aesi< bitness >::Aesi ( const Aesi< bitness > & copy)
constexprdefaultnoexcept

Copy constructor.

Parameters
copyAesi&

◆ Aesi() [2/6]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr Aesi< bitness >::Aesi ( Integral value)
inlineconstexprnoexcept

Integral constructor.

Parameters
valueIntegral

◆ Aesi() [3/6]

template<std::size_t bitness = 512>
template<typename Char >
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
gpu constexpr Aesi< bitness >::Aesi ( const Char * ptr,
std::size_t size )
inlineconstexprnoexcept

Pointer-based character constructor.

Parameters
ptrChar*
sizeSize_t

Accepts decimal strings (no prefix), binary (0b/0B), octal (0o/0O) and hexadecimal (0x/0X)

Note
An odd number of dashes makes the number negative

◆ Aesi() [4/6]

template<std::size_t bitness = 512>
template<typename Char , std::size_t arrayLength>
requires (arrayLength > 1 && (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>))
gpu constexpr Aesi< bitness >::Aesi ( const Char(&) literal[arrayLength])
inlineconstexprnoexcept

C-style string literal constructor.

Parameters
literalChar[]

◆ Aesi() [5/6]

template<std::size_t bitness = 512>
template<typename String , typename Char = typename String::value_type>
requires (std::is_same_v<std::basic_string<Char>, std::decay_t<String>> || std::is_same_v<std::basic_string_view<Char>, std::decay_t<String>>)
gpu constexpr Aesi< bitness >::Aesi ( String && stringView)
inlineconstexprnoexcept

String / String-view constructor.

Parameters
stringViewString

◆ Aesi() [6/6]

template<std::size_t bitness = 512>
gpu constexpr Aesi< bitness >::Aesi ( const Aeu< bitness > & value)
inlineexplicitconstexpr

Unsigned integer conversion.

Parameters
valueAeu&

Member Function Documentation

◆ operator=() [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_signed_v<Integral>)
gpu constexpr Aesi & Aesi< bitness >::operator= ( Integral value)
inlineconstexprnoexcept

Integral assignment operator.

Parameters
valueIntegral

◆ operator=() [2/2]

template<std::size_t bitness = 512>
gpu constexpr Aesi & Aesi< bitness >::operator= ( const Aesi< bitness > & other)
inlineconstexprnoexcept

Copy assignment operator.

Parameters
otherAesi&

◆ operator+()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator+ ( ) const -> Aesi
inlineconstexprnoexcept

Unary plus operator.

Does basically nothing

Returns
Aesi

◆ operator-()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator- ( ) const -> Aesi
inlinenodiscardconstexprnoexcept

Unary minus operator.

Returns
Aesi

◆ operator++() [1/2]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator++ ( ) -> Aesi&
inlineconstexprnoexcept

Prefix increment operator.

Returns
Aesi&

◆ operator++() [2/2]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator++ ( int ) & -> Aesi
inlineconstexprnoexcept

Postfix increment operator.

Returns
Aesi

◆ operator--() [1/2]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator-- ( ) -> Aesi&
inlineconstexprnoexcept

Prefix decrement operator.

Returns
Aesi&

◆ operator--() [2/2]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator-- ( int ) & -> Aesi
inlineconstexprnoexcept

Postfix decrement operator.

Returns
Aesi

◆ compareTo() [1/3]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr auto Aesi< bitness >::compareTo ( Integral integral) const -> Comparison
inlineconstexprnoexcept

Comparison operator for built-in types.

Parameters
integralIntegral
Returns
Comparison

◆ compareTo() [2/3]

template<std::size_t bitness = 512>
template<std::size_t otherBitness = bitness>
gpu constexpr auto Aesi< bitness >::compareTo ( const Aesi< otherBitness > & value) const -> Comparison
inlinenodiscardconstexprnoexcept

Different precision comparison operator.

Parameters
valueAesi&
Returns
Comparison

◆ compareTo() [3/3]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::compareTo ( const Aesi< bitness > & value) const -> Comparison
inlinenodiscardconstexprnoexcept

Comparison operator.

Parameters
valueAesi&
Returns
Comparison

◆ operator<=>() [1/2]

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::operator<=> ( const Aesi< bitness > & other) const -> std::strong_ordering
inlineconstexprnoexcept

Three-way comparison operator.

Parameters
otherAesi
Returns
Std::Strong_ordering
Note
Available from C++20 standard and further. Should almost never return Strong_ordering::Equivalent

◆ operator<=>() [2/2]

template<std::size_t bitness = 512>
template<typename Object >
gpu constexpr auto Aesi< bitness >::operator<=> ( const Object & other) const -> std::strong_ordering
inlineconstexprnoexcept

Three-way comparison operator for numbers of different precision and built-in integral types.

Parameters
otherUnsigned
Returns
Std::Strong_ordering
Note
Available from C++20 standard and further. Should almost never return Strong_ordering::Equivalent

◆ setBit()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::setBit ( std::size_t index,
bool bit ) -> void
inlineconstexprnoexcept

Set bit in number by index starting from the right.

Parameters
indexSize_t
bitBoolean
Note
Does nothing for index out of range. Does not affect sign

◆ getBit()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::getBit ( std::size_t index) const -> bool
inlinenodiscardconstexprnoexcept

Get bit in number by index starting from the right.

Parameters
indexSize_t
Returns
Boolean
Note
Returns zero for index out of range. Does not affect the sign

◆ setByte()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::setByte ( std::size_t index,
byte byte ) -> void
inlineconstexprnoexcept

Set byte in number by index starting from the right.

Parameters
indexSize_t
byteByte
Note
Does nothing for index out of range. Does not affect the sign

◆ getByte()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::getByte ( std::size_t index) const -> byte
inlinenodiscardconstexprnoexcept

Get byte in number by index starting from the right.

Parameters
indexSize_t
Returns
Byte
Note
Returns zero for index out of range. Does not affect the sign

◆ setBlock()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::setBlock ( std::size_t index,
block block ) -> void
inlineconstexprnoexcept

Set block in number by index starting from the right.

Parameters
indexSize_t
blockBlock
Note
Does nothing for index out of range. Does not affect the sign

◆ getBlock()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::getBlock ( std::size_t index) const -> block
inlinenodiscardconstexprnoexcept

Get block in number by index starting from the right.

Parameters
indexSize_t
Returns
Block
Note
Returns zero for index out of range. Does not affect the sign

◆ byteCount()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::byteCount ( ) const -> std::size_t
inlinenodiscardconstexprnoexcept

Get amount of non-empty bytes in number right to left.

Returns
Size_t

◆ bitCount()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::bitCount ( ) const -> std::size_t
inlinenodiscardconstexprnoexcept

Get amount of non-empty bits in number right to left.

Returns
Size_t

◆ isOdd()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::isOdd ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether number is odd.

Returns
Boolean: true if the number is odd and false otherwise

◆ isEven()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::isEven ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether number is even.

Returns
Boolean: true if the number is even and false otherwise

◆ isZero()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::isZero ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether number is zero.

Returns
Boolean: true if the number is zero and false otherwise

◆ isPositive()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::isPositive ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether number is positive.

Returns
Boolean: true if the number is positive and false otherwise

◆ isNegative()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::isNegative ( ) const -> bool
inlinenodiscardconstexprnoexcept

Check whether number is negative.

Returns
Boolean: true if the number is negative and false otherwise

◆ filledBlocksNumber()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::filledBlocksNumber ( ) const -> std::size_t
inlinenodiscardconstexprnoexcept

Get number of non-empty blocks inside object starting from the right.

Returns
Size_t

◆ getBitness()

template<std::size_t bitness = 512>
static gpu constexpr auto Aesi< bitness >::getBitness ( ) -> std::size_t
inlinestaticnodiscardconstexprnoexcept

Get number's precision.

Returns
Size_t

◆ totalBlocksNumber()

template<std::size_t bitness = 512>
static gpu constexpr auto Aesi< bitness >::totalBlocksNumber ( ) -> std::size_t
inlinestaticnodiscardconstexprnoexcept

Get the number of blocks (length of array of uint32_t integers) inside object.

Returns
Size_t

◆ swap()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::swap ( Aesi< bitness > & other) -> void
inlineconstexprnoexcept

Make swap between two objects.

Parameters
otherAesi

◆ inverse()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::inverse ( ) -> void
inlineconstexprnoexcept

Invertes number's bitness.

Turns negative to positive and otherwise. Leaves zero unchanges

◆ divide()

template<std::size_t bitness = 512>
static gpu constexpr auto Aesi< bitness >::divide ( const Aesi< bitness > & number,
const Aesi< bitness > & divisor,
Aesi< bitness > & quotient,
Aesi< bitness > & remainder ) -> void
inlinestaticconstexprnoexcept

Integral division.

Parameters
numberAesi&
divisorAesi&
quotientAesi& OUT
remainderAesi& OUT

Returns values by references

◆ squareRoot()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::squareRoot ( ) const -> Aesi
inlinenodiscardconstexprnoexcept

Square root.

Returns
Aesi

Returns zero for negative

◆ power2()

template<std::size_t bitness = 512>
static gpu constexpr auto Aesi< bitness >::power2 ( std::size_t power) -> Aesi
inlinestaticnodiscardconstexprnoexcept

Fast exponentiation of 2.

Returns
Aesi

◆ integralCast()

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr auto Aesi< bitness >::integralCast ( ) const -> Integral
inlinenodiscardconstexprnoexcept

Cast for built-in integral types.

Returns
Integral

◆ precisionCast()

template<std::size_t bitness = 512>
template<std::size_t newBitness>
requires (newBitness != bitness)
gpu constexpr auto Aesi< bitness >::precisionCast ( ) const -> Aesi<newBitness>
inlinenodiscardconstexprnoexcept

Number's precision cast.

Returns
Aesi<newBitness>

◆ unsignedCast()

template<std::size_t bitness = 512>
gpu constexpr auto Aesi< bitness >::unsignedCast ( ) const -> Aeu<bitness>
inlineconstexprnoexcept

Unsigned cast.

Returns
Aeu

◆ getString()

template<std::size_t bitness = 512>
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))
gpu constexpr auto Aesi< bitness >::getString ( Char * buffer,
std::size_t bufferSize,
bool showBase = false,
bool hexUppercase = false ) const -> std::size_t
inlineconstexprnoexcept

Character buffer output operator.

Parameters
bufferChar*
bufferSizeSize_t
showBaseBoolean
hexUppercaseBoolean
Returns
Size_t - amount of symbols written

Places the maximum possible amount of number's characters in buffer. Base parameter should be 2, 8, 10, or 16

Note
Works significantly faster for hexadecimal notation

◆ tryAtomicSet()

template<std::size_t bitness = 512>
__device__ constexpr auto Aesi< bitness >::tryAtomicSet ( const Aesi< bitness > & value) -> void
inlineconstexprnoexcept

Atomicity-oriented object assignment operator.

Parameters
Aesiassigning
Note
Method itself is not fully-atomic. There may be race conditions between two consecutive atomic calls on number blocks. This method is an interface for assigning encapsulated class members atomically one by one

◆ tryAtomicExchange()

template<std::size_t bitness = 512>
__device__ constexpr auto Aesi< bitness >::tryAtomicExchange ( const Aesi< bitness > & value) -> void
inlineconstexprnoexcept

Atomicity-oriented object exchangement operator.

Parameters
Aesiexchangeable
Note
Method itself is not fully-atomic. There may be race conditions between two consecutive atomic calls on number blocks. This method is an interface for exchanging encapsulated class members atomically one by one

Friends And Related Symbol Documentation

◆ operator+

template<std::size_t bitness = 512>
gpu constexpr friend auto operator+ ( const Aesi< bitness > & addition,
const Aesi< bitness > & addendum ) -> Aesi
friend

Addition operator.

Parameters
additionAesi
addendumAesi&
Returns
Aesi

◆ operator+=

template<std::size_t bitness = 512>
gpu constexpr friend auto operator+= ( Aesi< bitness > & addition,
const Aesi< bitness > & addendum ) -> Aesi&
friend

Addition assignment operator.

Parameters
additionAesi
addendumAesi&
Returns
Aesi&

◆ operator-

template<std::size_t bitness = 512>
gpu constexpr friend auto operator- ( const Aesi< bitness > & subtraction,
const Aesi< bitness > & subtrahend ) -> Aesi
friend

Subtraction operator.

Parameters
subtractionAesi
subtrahendAesi&
Returns
Aesi

◆ operator-=

template<std::size_t bitness = 512>
gpu constexpr friend auto operator-= ( Aesi< bitness > & subtraction,
const Aesi< bitness > & subtrahend ) -> Aesi&
friend

Subtraction assignment operator.

Parameters
subtractionAesi
subtrahendAesi&
Returns
Aesi&

◆ operator* [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator* ( const Aesi< bitness > & multiplication,
Integral factor ) -> Aesi
friend

Multiplication operator for built-in types.

Parameters
multiplicationAesi
factorIntegral
Returns
Aesi

◆ operator* [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator* ( const Aesi< bitness > & multiplication,
const Aesi< bitness > & factor ) -> Aesi
friend

Multiplication operator.

Parameters
multiplicationAesi
factorAesi
Returns
Aesi

◆ operator*= [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator*= ( Aesi< bitness > & multiplication,
Integral factor ) -> Aesi&
friend

Multiplication assignment operator for built-in types.

Parameters
multiplicationAesi
factorIntegral
Returns
Aesi&

◆ operator*= [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator*= ( Aesi< bitness > & multiplication,
const Aesi< bitness > & factor ) -> Aesi&
friend

Multiplication assignment operator.

Parameters
multiplicationAesi
factorAesi
Returns
Aesi&

◆ operator/ [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator/ ( const Aesi< bitness > & division,
Integral divisor ) -> Aesi
friend

Division operator for built-in integral types.

Parameters
divisionAesi
divisorIntegral
Returns
Aesi
Note
Undefined behaviour for division by zero

◆ operator/ [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator/ ( const Aesi< bitness > & division,
const Aesi< bitness > & divisor ) -> Aesi
friend

Division operator.

Parameters
divisionAesi
divisorAesi
Returns
Aesi
Note
Undefined behaviour for division by zero

◆ operator/= [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator/= ( Aesi< bitness > & division,
Integral divisor ) -> Aesi&
friend

Assignment division operator for built-in integral types.

Parameters
divisionAesi
divisorIntegral
Returns
Aesi&
Note
Undefined behaviour for division by zero

◆ operator/= [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator/= ( Aesi< bitness > & division,
const Aesi< bitness > & divisor ) -> Aesi&
friend

Assignment division operator.

Parameters
divisionAesi
divisorAesi
Returns
Aesi&
Note
Undefined behaviour for division by zero

◆ operator% [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator% ( const Aesi< bitness > & modulation,
Integral modulo ) -> Aesi
friend

Modulo operator for built-in types.

Parameters
modulationAesi
moduloIntegral
Returns
Aesi
Note
Returns zero for the modulo of zero

◆ operator% [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator% ( const Aesi< bitness > & modulation,
const Aesi< bitness > & modulo ) -> Aesi
friend

Modulo operator.

Parameters
modulationAesi
moduloAesi
Returns
Aesi

DETAILS

Note
Returns zero for the modulo of zero

◆ operator%= [1/2]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator%= ( Aesi< bitness > & modulation,
Integral modulo ) -> Aesi&
friend

Modulo assignment operator for built-in types.

Parameters
modulationAesi
moduloIntegral
Returns
Aesi&
Note
Returns zero for the modulo of zero

◆ operator%= [2/2]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator%= ( Aesi< bitness > & modulation,
const Aesi< bitness > & modulo ) -> Aesi&
friend

Modulo assignment operator.

Parameters
modulationAesi
moduloAesi
Returns
Aesi&

DETAILS

Note
Returns zero for the modulo of zero

◆ operator== [1/3]

template<std::size_t bitness = 512>
template<typename Integral >
requires (std::is_integral_v<Integral>)
gpu constexpr friend auto operator== ( const Aesi< bitness > & our,
Integral integral ) -> bool
friend

Equality operator for built-in types.

Parameters
ourAesi
integralIntegral
Returns
bool

◆ operator== [2/3]

template<std::size_t bitness = 512>
gpu constexpr friend auto operator== ( const Aesi< bitness > & our,
const Aesi< bitness > & other ) -> bool=default
friend

Equality operator.

Parameters
ourAesi
otherAesi
Returns
bool

◆ operator== [3/3]

template<std::size_t bitness = 512>
template<std::size_t otherBitness>
requires (otherBitness != bitness)
gpu constexpr friend auto operator== ( const Aesi< bitness > & our,
const Aesi< otherBitness > & other ) -> bool
friend

Different precision equlity operator.

Parameters
ourAesi
otherAesi
Returns
bool

◆ operator<<

template<std::size_t bitness = 512>
template<typename Char >
requires (std::is_same_v<Char, char> || std::is_same_v<Char, wchar_t>)
auto operator<< ( std::basic_ostream< Char > & os,
const Aesi< bitness > & number ) -> std::basic_ostream<Char>&
friend

STD stream output operator.

Parameters
osOstream
numberAeu
Returns
Ostream

Writes number in stream. Accepts STD streams based on char or wchar_t. Supports stream manipulators:

  • Number's notation (std::hex, std::dec, std::oct);
  • Number's base (std::showbase);
  • Hexadecimal letters case (std::uppercase, std::lowercase)
    Note
    Works significantly faster for hexadecimal notation

The documentation for this class was generated from the following file: