avx::ULong256

class ULong256

Class providing vectorized version of unsigned long long aka uint64_t. Can hold 4 individual unsigned long long values. Provides arithmetic and bitwise operators. Provides comparison operators == !=.

Public Types

using storedType = unsigned long long

Type that is stored inside vector.

Public Functions

inline ULong256() noexcept
inline ULong256(__m256i init)
inline ULong256(const unsigned long long &init)
inline ULong256(const ULong256 &init)
inline ULong256(const unsigned long long *init)
inline ULong256(const std::array<unsigned long long, 4> &init)
inline ULong256(const std::array<unsigned int, 4> &init) noexcept
inline ULong256(const std::array<unsigned short, 4> &init) noexcept
inline ULong256(const std::array<unsigned char, 4> &init) noexcept
inline ULong256(std::initializer_list<unsigned long long> init) noexcept
inline __m256i get() const noexcept
inline void set(__m256i val) noexcept
inline void load (const unsigned long long *pSrc) N_THROW_REL

Loads data from memory into vector (memory should be of size of at least 32 bytes). Memory doesn’t need to be aligned to any specific boundary. If sP is nullptr this method has no effect.

Parameters:

pSrc – Pointer to memory from which to load data.

Throws:

std::invalid_argument – If in Debug mode and pSrc is nullptr. In Release builds this method never throws (for nullptr method will have no effect).

inline void save(std::array<unsigned long long, 4> &dest) const noexcept

Saves data to destination in memory.

Parameters:

dest – Reference to the list to which vector will be saved. Array doesn’t need to be aligned to any specific boundary.

inline void save (unsigned long long *pDest) const N_THROW_REL

Saves data to destination in memory. The memory doesn’t have to be aligned to any specific boundary.

See https://en.cppreference.com/w/cpp/memory/c/aligned_alloc for more details.

Parameters:

pDest – A valid pointer to a memory of at least 32 bytes (4x unsigned long long).

Throws:

std::invalid_argument – If in Debug mode and pDest is nullptr. In Release builds this method never throws (for nullptr method will have no effect).

inline void saveAligned (unsigned long long *pDest) const N_THROW_REL

Saves data to destination in memory. The memory must be aligned at 32-byte boundary.

See https://en.cppreference.com/w/cpp/memory/c/aligned_alloc for more details.

Parameters:

pDest – A valid pointer to a memory of at least 32 bytes (4x unsigned long long).

Throws:

std::invalid_argument – If in Debug mode and pDest is nullptr. In Release builds this method never throws (for nullptr method will have no effect).

inline unsigned long long operator[](unsigned int index) const
inline bool operator==(const ULong256 &bV) const noexcept

Compares with second vector for equality.

Parameters:

bV – Object to compare.

Returns:

true if all elements are equal or false if not.

inline bool operator==(const unsigned long long b) const noexcept

Compares with value for equality.

Parameters:

b – Value to compare.

Returns:

true if all elements are equal to passed value false if not.

inline bool operator!=(const ULong256 &bV) const noexcept

Compares with second vector for inequality.

Parameters:

bV – Object to compare.

Returns:

true if any alement is not equal to corresponding element in bV otherwise false.

inline bool operator!=(const unsigned long long b) const noexcept

Compares with value for inequality.

Parameters:

b – Value

Returns:

true if any alement is not equal to corresponding element in bV otherwise false.

inline ULong256 operator+(const ULong256 &bV) const noexcept

Adds values from other vector and returns new vector.

Returns:

New vector being a sum of this vector and bv.

inline ULong256 operator+(const unsigned long long &b) const noexcept

Adds single value across all vector fields.

Returns:

New vector being a sum of this vector and b.

inline ULong256 &operator+=(const ULong256 &bV) noexcept
inline ULong256 &operator+=(const unsigned long long &b) noexcept
inline ULong256 operator-(const ULong256 &bV) const noexcept
inline ULong256 operator-(const unsigned long long &b) const noexcept
inline ULong256 &operator-=(const ULong256 &bV) noexcept
inline ULong256 &operator-=(const unsigned long long &b) noexcept
inline ULong256 operator*(const ULong256 &bV) const noexcept
inline ULong256 operator*(const unsigned long long &b) const noexcept
inline ULong256 &operator*=(const ULong256 &bV) noexcept
inline ULong256 &operator*=(const unsigned long long &b) noexcept
inline ULong256 operator/(const ULong256 &bV) const noexcept
inline ULong256 operator/(const unsigned long long &b) const noexcept
inline ULong256 &operator/=(const ULong256 &bV) noexcept
inline ULong256 &operator/=(const unsigned long long &b) noexcept
inline ULong256 operator%(const ULong256 &bV) const noexcept
inline ULong256 operator%(const unsigned long long &b) const noexcept
inline ULong256 &operator%=(const ULong256 &bV) noexcept
inline ULong256 &operator%=(const unsigned long long &b) noexcept
inline ULong256 operator&(const ULong256 &bV) const noexcept
inline ULong256 operator&(const unsigned long long &b) const noexcept
inline ULong256 &operator&=(const ULong256 &bV) noexcept
inline ULong256 &operator&=(const unsigned long long &b) noexcept
inline ULong256 operator|(const ULong256 &bV) const noexcept
inline ULong256 operator|(const unsigned long long &b) const noexcept
inline ULong256 &operator|=(const ULong256 &bV) noexcept
inline ULong256 &operator|=(const unsigned long long &b) noexcept
inline ULong256 operator^(const ULong256 &bV) const noexcept
inline ULong256 operator^(const unsigned long long &b) const noexcept
inline ULong256 &operator^=(const ULong256 &bV) noexcept
inline ULong256 &operator^=(const unsigned long long &b) noexcept
inline ULong256 operator~() const noexcept
inline ULong256 operator<<(const ULong256 &bV) const noexcept
inline ULong256 operator<<(const unsigned int b) const noexcept
inline ULong256 &operator<<=(const ULong256 &bV) noexcept
inline ULong256 &operator<<=(const unsigned int b) noexcept
inline ULong256 operator>>(const ULong256 &bV) const noexcept
inline ULong256 operator>>(const unsigned int b) const noexcept
inline ULong256 &operator>>=(const ULong256 &bV) noexcept
inline ULong256 &operator>>=(const unsigned int b) noexcept
inline std::string str() const noexcept

Public Static Attributes

static int size = 4

Number of individual values stored by object. This value can be used to iterate over elements.