A namespace of functions and components used to work with memory. More...
Classes | |
struct | DefaultResourceHandleChecker |
The default functor for checking if a handle to a resource should be closed by an instance of the AutoResource owning the handle. More... | |
class | AutoResource |
Manages the specified resource handles, providing a limited garbage-collection facility. More... | |
struct | C_auto_ptr |
A helper class for defining pointers managed automatically with a limited garbage-collecting facility implemented over the functions of the Chusov::Memory namespace. More... | |
struct | AutoData |
A template of a class specifying std::unique_ptr to manage pointers allocated using one of the allocation functions of the chsvmem.h header, such as AllocateData or AllocateString, automatically deallocating memory pointed to by managed pointers when necessary. pointers using the FreeData function. More... | |
struct | AutoDataSec |
A template of a class specifying std::unique_ptr to manage pointers to sensitive data allocated using one of the allocation functions of the chsvmem.h header, such as AllocateData or AllocateString, deallocating memory, pointed to by the managed pointers, using the SecureFreeData function randomizing data before the actual deallocation. More... | |
struct | raw_delete_t |
A type of a deleter object used with smart pointers to a raw memory block allocated using the global ::operator new function. When the managed memory is released these smart pointers call ::operator delete to perform the cleanup. More... | |
struct | iterator_range |
An auxiliary class for a range given by a pair of iterators. More... | |
struct | allocator |
A class template implementing behavior of the standard allocator interface using the memory management functions of the Chusov::Memory namespace. More... | |
struct | allocator< void > |
A Chusov::Memory::allocator class template specialization for pointers of void* type. More... | |
struct | secure_allocator |
A class template redefining the behavior of the Chusov::Memory::allocator class template so that the deallocation function randomizes the memory before the deallocation. More... | |
class | generating_input_iterator |
Implements semantics of an input iterator to providing access to elements generated by a given functional object. More... | |
struct | transforming_iterator |
struct | subtuple |
Defines a type field which is an alias for a subtuple consisting of elements within the specified range of a given tuple. More... | |
struct | raw_pointer_iterator |
struct | raw_pointer_iterator< T * > |
An wrapper over a raw pointer considered as an iterator used to resolve security warnings produced by Microsoft C++ compilers. The class is defined independently of a compiler used. More... | |
class | sbo_vector |
Implements a vector with customizable small buffer optimization. More... | |
Typedefs | |
template<class value_t , class allocator_t = allocator<value_t>> | |
using | list = std::list< value_t, allocator_t > |
An alias for the standard list container that uses Chusov::Memory::allocator instead of allocator by default. | |
template<class value_t , class allocator_t = allocator<value_t>> | |
using | vector = std::vector< value_t, allocator_t > |
An alias for the standard vector container that uses Chusov::Memory::allocator instead of allocator by default. | |
template<class ... Iterators> | |
using | iterators_size_type = typename std::common_type< typename std::make_unsigned< typename std::iterator_traits< Iterators >::difference_type >::type... >::type |
A SFINAE-friendly alias to a common type which corresponds to unsigned counterparts of difference types of the parameter iterators. More... | |
Functions | |
template<class IteratorBegin , class IteratorEnd > | |
iterator_range< std::common_type_t< std::decay_t< IteratorBegin >, std::decay_t< IteratorEnd > > > | make_iterator_range (IteratorBegin &&begin_iterator, IteratorEnd &&end_iterator) noexcept(std::is_nothrow_constructible< iterator_range< std::common_type_t< std::decay_t< IteratorBegin >, std::decay_t< IteratorEnd >>>, IteratorBegin && >::value &&std::is_nothrow_constructible< iterator_range< std::common_type_t< std::decay_t< IteratorBegin >, std::decay_t< IteratorEnd >>>, IteratorEnd && >::value) |
Forwards the deduced parameters to the corresponding constructor of the iterator_range class template specialized for the common type of both template arguments. More... | |
template<class Iterator > | |
iterator_range< Iterator > | make_iterator_range (const std::pair< Iterator, Iterator > &range_pair) noexcept(std::is_nothrow_copy_constructible< Iterator >::value) |
Constructs an iterator_range object based on a copy of bounding iterators given by a pair. More... | |
template<class Iterator > | |
iterator_range< Iterator > | make_iterator_range (std::pair< Iterator, Iterator > &&range_pair) noexcept(std::is_nothrow_move_constructible< Iterator >::value) |
Constructs an iterator_range object by taking ownership of bounding iterators given by a pair. More... | |
template<class OtherRange > | |
iterator_range< typename std::decay< OtherRange >::type::iterator > | make_iterator_range (OtherRange &&range) noexcept((std::is_rvalue_reference< OtherRange && >::value &&std::is_nothrow_move_constructible< typename std::decay< OtherRange >::type::iterator >::value)||(std::is_lvalue_reference< OtherRange && >::value &&std::is_nothrow_copy_constructible< typename std::decay< OtherRange >::type::iterator >::value)) |
Constructs a range from another range forwarding the call to the corresponding constructor of iterator_range. More... | |
template<class GeneratingFunctor > | |
auto | make_generating_input_iterator (GeneratingFunctor generator) |
A helper function used to create a generating iterator of type generating_input_iterator with deduction of its template parameters prior to C++17. More... | |
template<class BaseRandomAccessIterator , class TransformingFunctor > | |
transforming_iterator< BaseRandomAccessIterator, TransformingFunctor > | operator+ (typename transforming_iterator< BaseRandomAccessIterator, TransformingFunctor >::difference_type n, const transforming_iterator< BaseRandomAccessIterator, TransformingFunctor > &iter) |
Creates a copy of a transforming iterator associated with a position shifted by a specified number to the end. More... | |
template<class BaseIterator , class TransformingFunctor > | |
transforming_iterator< BaseIterator, typename std::remove_reference< TransformingFunctor >::type > | make_transforming_iterator (BaseIterator it, TransformingFunctor &&transformer) |
Returns an instance of transforming_iterator for a given iterator and a transforming Callable object. | |
template<std::size_t Begin, std::size_t End, class Tpl > | |
constexpr auto | make_subtuple (Tpl &&tpl) noexcept(noexcept(Implementation::subtuple< Begin, End >::make(std::forward< Tpl >(tpl)))) -> decltype(Implementation::subtuple< Begin, End >::make(std::forward< Tpl >(tpl))) |
Creates a sub-tuple from elements of a given tuple as specified by a half-range. More... | |
template<std::size_t Begin, std::size_t End, class Tpl > | |
constexpr auto | forward_subtuple (Tpl &&tpl) noexcept(noexcept(Implementation::subtuple< Begin, End >::forward(std::forward< Tpl >(tpl)))) -> decltype(Implementation::subtuple< Begin, End >::forward(std::forward< Tpl >(tpl))) |
Creates a sub-tuple of rvalue references to elements of a given tuple as specified by a half-range. More... | |
template<class T > | |
constexpr raw_pointer_iterator< T * >::reference | operator* (const raw_pointer_iterator< T * > &it) noexcept(noexcept(*it.base())) |
Dereferences a raw_pointer_iterator . More... | |
template<class T > | |
raw_pointer_iterator< T * > | operator++ (raw_pointer_iterator< T * > &it, int) noexcept(noexcept(raw_pointer_iterator< T * >(it)) &&noexcept(++it)) |
Postfix increment operation which shifts the iterated position to the right by 1 but returns a new iterator in the pre-increment state. More... | |
template<class T > | |
raw_pointer_iterator< T * > | operator-- (raw_pointer_iterator< T * > &it, int) noexcept(noexcept(raw_pointer_iterator< T * >(it)) &&noexcept(--it)) |
Postfix decrement operation which shifts the iterated position to the left by 1 but returns a new iterator in the pre-decrement state. More... | |
template<class T > | |
constexpr raw_pointer_iterator< T * > | operator+ (typename raw_pointer_iterator< T * >::difference_type n, const raw_pointer_iterator< T * > &right) noexcept(noexcept(right+n)) |
Adds an offset to an iterator and returns the new raw_pointer_iterator addressing the element at the new offset position. More... | |
template<class T , class U > | |
constexpr common_difference_type | operator- (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) |
Calculates a difference between two iterators, i.e. between the two underlying pointers. More... | |
template<class T , class U > | |
constexpr bool | operator== (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Checks the two iterators for equality. More... | |
template<class T , class U > | |
constexpr bool | operator!= (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Checks the two iterators for inequality. More... | |
template<class T , class U > | |
constexpr bool | operator< (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Performs the "less-than" comparison of two iterators. More... | |
template<class T , class U > | |
constexpr bool | operator<= (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Performs the "less-or-equal-than" comparison of two iterators. More... | |
template<class T , class U > | |
constexpr bool | operator>= (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Performs the "greater-or-equal-than" comparison of two iterators. More... | |
template<class T , class U > | |
constexpr bool | operator> (const raw_pointer_iterator< T * > &left, const raw_pointer_iterator< U * > &right) noexcept |
Performs the "greater-than" comparison of two iterators. More... | |
template<class T > | |
constexpr raw_pointer_iterator< T * > | make_raw_pointer_iterator (T *ptr, std::size_t cSize, typename raw_pointer_iterator< T * >::difference_type iOffset) noexcept(noexcept(raw_pointer_iterator< T * >(ptr, cSize, iOffset))) |
The function for creation iterators, which, in essence, are raw pointers, that has an interface compatible with Microsoft stdext::checked_array_iterator. More... | |
template<class Iterator > | |
constexpr unspecified | offset_iterator_begin (Iterator it) noexcept |
Returns an object of an unspecified type which is an iterator of the same category as the parameter but redefines increment, decrement and comparison operators to keep the current offset from the initial position. More... | |
template<class Iterator > | |
constexpr auto | offset_iterator_end (Iterator it, difference_type offset) noexcept |
Returns an object of an unspecified type which is an iterator of the same category as the parameter but redefines the respective comparison operators to keep the current offset from the initial position given parametrically. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | copy_n (InputIterator input, std::size_t size, OutputIterator output) noexcept(std::is_nothrow_copy_assignable< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Copy-assigns a given number of elements starting from one referred to by an input iterator to a place addressed by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | copy (InputIterator start, InputIterator end, OutputIterator output) noexcept(std::is_nothrow_copy_assignable< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Copy-assigns a sequence of elements addressed by a pair of input iterators to a destination specified by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | move_n (InputIterator input, std::size_t size, OutputIterator output) noexcept(std::is_nothrow_move_assignable< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Move-assigns a given number of elements starting from one referred to by an input iterator to a place addressed by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
void | move (InputIterator start, InputIterator end, OutputIterator output) noexcept(std::is_nothrow_move_assignable< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Move-assigns a sequence of elements addressed by a pair of input iterators to a destination specified by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | construct_copy_n (InputIterator input, std::size_t size, OutputIterator output) noexcept(std::is_nothrow_copy_constructible< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Copy-constructs a given number of elements starting from one referred to by an input iterator in the destination addressed by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | construct_copy (InputIterator start, InputIterator end, OutputIterator output) noexcept(std::is_nothrow_copy_constructible< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Copy-constructs a sequence of elements associated with an output iterator from an input sequence addressed by a pair of input iterators. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | construct_move_n (InputIterator input, std::size_t size, OutputIterator output) noexcept(std::is_nothrow_move_constructible< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Move-constructs a given number of elements starting from one referred to by an input iterator in the destination addressed by an output iterator. More... | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | construct_move (InputIterator start, InputIterator end, OutputIterator output) noexcept(std::is_nothrow_move_constructible< typename std::iterator_traits< OutputIterator >::value_type >::value) |
Move-constructs a sequence of elements in a destination specified by an output iterator from an input sequence addressed by a pair of input iterators. More... | |
template<class ForwardIterator , class T > | |
void | fill (ForwardIterator start, ForwardIterator end, const T &value) noexcept(std::is_nothrow_copy_assignable< T >::value) |
Copy-assigns a value to all elements of a sequence specified by a pair of forward iterators. More... | |
template<class ForwardIterator , class T > | |
void | fill_n (ForwardIterator start, std::size_t size, const T &value) noexcept(std::is_nothrow_copy_assignable< T >::value) |
Copy-assigns a value to all elements of a sequence specified by a starting iterator and the sequence size. More... | |
template<class ForwardIterator , class T > | |
void | construct_fill (ForwardIterator start, ForwardIterator end, const T &value) noexcept(std::is_nothrow_copy_constructible< T >::value) |
Copy-constructs elements of an output sequence, specified by a pair of forward iterators, using a copy of a supplied value. More... | |
template<class ForwardIterator , class T > | |
void | construct_fill_n (ForwardIterator start, std::size_t size, const T &value) noexcept(std::is_nothrow_copy_constructible< T >::value) |
Copy-constructs elements of an iterated output sequence of a given size using a copy of a supplied value. More... | |
template<class ElementType , std::size_t sbo_threshold, class Allocator > | |
void | swap (sbo_vector< ElementType, sbo_threshold, Allocator > &left, sbo_vector< ElementType, sbo_threshold, Allocator > &right) |
Swaps contents of two SBO vectors. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator== (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Lexicographically compares two vectors to check them against elementwise equality. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator!= (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Lexicographically compares two vectors to check them against elementwise inequality. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator< (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Checks whether the left vector is lexicographically less than the right vector. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator<= (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Checks whether the left vector is lexicographically less than or equal to the right vector. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator> (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Checks whether the left vector is lexicographically greater than the right vector. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
bool | operator>= (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
Checks whether the left vector is lexicographically greater than or equal to the right vector. More... | |
template<class ValueTypeLeft , std::size_t sbo_threshold_left, class AllocatorLeft , class ValueTypeRight , std::size_t sbo_threshold_right, class AllocatorRight > | |
auto | operator<=> (const sbo_vector< ValueTypeLeft, sbo_threshold_left, AllocatorLeft > &left, const sbo_vector< ValueTypeRight, sbo_threshold_right, AllocatorRight > &right) |
In C++20 performs three-way lexicographical comparison of elements of two SBO vectors. More... | |
Memory allocation functions | |
Portable allocation functions | |
void * | AllocateData (std::size_t cb) noexcept |
Allocates a memory buffer of the specified size and returns a pointer to it. More... | |
bool | FreeData (void *pData) noexcept |
Frees memory occupied by the specified buffer which had been allocated using one of the Allocate* functions declared in the Chusov::Memory namespace. More... | |
std::size_t | DataSize (const void *pData) noexcept |
Returns a size of memory pointed by the specified parameter, in bytes. More... | |
bool | SecureFreeData (volatile void *pData) noexcept |
Randomizes and frees memory occupied by the specified buffer allocated using one of the Allocate* functions of the Chusov::Memory namespace. It is designed to be a more secure version of FreeData. More... | |
Memory allocation mechanisms | |
Portable allocation functions and objects | |
template<class T1 , class T2 > | |
bool | operator== (const allocator< T1 > &, const allocator< T2 > &) |
Compares two Chusov::Memory::allocator objects of different managed types. Since object of both Chusov::Memory::allocator and Chusov::Memory::secure_allocator types are stateless, two allocators are always considered to be equal. More... | |
template<class T1 , class T2 > | |
bool | operator!= (const allocator< T1 > &, const allocator< T2 > &) |
Compares two Chusov::Memory::allocator objects of different managed types. Since object of both Chusov::Memory::allocator and Chusov::Memory::secure_allocator types are stateless, two allocators are always considered to be equal. More... | |
Memory processing | |
typedef std::uintptr_t | IntegerWord |
A generic alias for an unsigned integer machine word. | |
constexpr auto | mirror_byte = implementation |
Resolves to a constexpr array containing a table of byte values which are mirror-bit reflections of their positions in the array. More... | |
void | byte_swap_inplace (void *pBuf, std::size_t cbBuf) noexcept |
Inverses an order of bytes in a buffer in place. More... | |
void | byte_swap (void *pResult, const void *pApi, std::size_t cbApi) noexcept |
Inverses an order of bytes and writes the result to the destination buffer. More... | |
template<class T > | |
constexpr T | byte_swap (T x) noexcept |
Swaps bytes of the specified object of the standard-layout type T. More... | |
template<class T > | |
T | fast_bswap (const T &datum) noexcept |
Performs fast inversion of a byte sequence within a datum using processor intrinsics, if possible. More... | |
template<class T > | |
constexpr auto | mirror_bits (T val) noexcept |
Inverts a bit order of an argument. More... | |
void | mirror_bits_copy (void *restrict pResult, const void *restrict pApi, std::size_t cbApi) noexcept |
Yields a copy of a vector with the inverse bit order. More... | |
void | mirror_bits_inplace (void *pBuf, std::size_t cbBuf) noexcept |
Inverts a bit order within a vector. More... | |
void | mirror_bits (void *pResult, const void *pApi, std::size_t cbApi) noexcept |
Inverts a bit order of data and writes the result to a possibly different buffer. More... | |
template<class T > | |
constexpr auto | mirror_bits_kbo (T val) noexcept |
Inverts a bit order of an argument but keeps its byte order unchanged. More... | |
void | mirror_bits_kbo_copy (void *restrict pResult, const void *restrict pApi, std::size_t cbApi) noexcept |
Inverts bits of data keeping the byte order and stores the result to an output buffer. More... | |
void | mirror_bits_kbo_inplace (void *pBuf, std::size_t cbBuf) noexcept |
Inverts a bit order within a vector keeping its byte order unchanged. More... | |
void | mirror_bits_kbo (void *pResult, const void *pApi, std::size_t cbApi) noexcept |
Inverts a bit order of data keeping its byte order and writes the result to a possibly different buffer. More... | |
void | memlsh_LE_copy (void *restrict pResult, const void *restrict pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Bit-shifts a long integer specified by a vector of bytes in the Little-Endian order to the left and copies the result into a separate output buffer. More... | |
void | memlsh_LE_inplace (void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs an in-place bit-shift of a long integer specified by a vector of bytes in the Little-Endian order to the left. More... | |
void | memlsh_LE (void *pResult, std::size_t cbResult, const void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs a linear bit shift of data representing an unsigned arbitrary precision integer in the Little-Endian format to the left. More... | |
void | memrsh_LE_copy (void *restrict pResult, const void *restrict pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Bit-shifts a long unsigned integer specified by a vector of bytes in the Little-Endian order to the right and copies the result into a separate output buffer. More... | |
void | memrsh_LE_inplace (void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs an in-place bit-shift of a long integer specified by a vector of bytes in the Little-Endian order to the right. More... | |
void | memrsh_LE (void *pResult, std::size_t cbResult, const void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs a linear bit shift of data representing an unsigned arbitrary precision integer in the Little-Endian format to the right. More... | |
void | memlsh_BE_copy (void *restrict pResult, const void *restrict pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Bit-shifts a long integer specified by a vector of bytes in the Big-Endian order to the left and copies the result into a separate output buffer. More... | |
void | memlsh_BE_inplace (void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs an in-place bit-shift of a long integer specified by a vector of bytes in the Big-Endian order to the left. More... | |
void | memlsh_BE (void *pResult, std::size_t cbResult, const void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs a linear bit shift of data representing an unsigned arbitrary precision integer in the Big-Endian format to the left. More... | |
void | memrsh_BE_copy (void *restrict pResult, const void *restrict pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Bit-shifts a long integer specified by a vector of bytes in the Big-Endian byte order to the right and copies the result into a separate output buffer. More... | |
void | memrsh_BE_inplace (void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs an inplace bit-shift of a long integer specified by a vector of bytes in the Big-Endian order to the right. More... | |
void | memrsh_BE (void *pResult, std::size_t cbResult, const void *pValue, std::size_t cbValue, std::size_t nShift) noexcept |
Performs a linear bit shift of data representing an unsigned arbitrary precision integer in the Big-Endian format to the right. More... | |
void | memand_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise AND of two arbitrary precision integers and copies the resulting integer into a separate output buffer. More... | |
void | memand_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise AND of two arbitrary precision integers and places the result into a buffer of one of the operands. More... | |
void | memand_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise AND of two operands specified in the Little-Endian byte order. More... | |
void | memand_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise AND of two operands specified in Big-Endian byte order. More... | |
void | memor_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise OR of two arbitrary precision integers and copies the resulting integer into a separate output buffer. More... | |
void | memor_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise OR of two arbitrary precision integers and places the result into a buffer of one of the operands. More... | |
void | memor_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise OR of two operands specified in the Little-Endian byte order. More... | |
void | memor_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise OR of two operands specified in Big-Endian byte order. More... | |
void | memxor_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise XOR of two arbitrary precision integers and copies the resulting integer into a separate output buffer. More... | |
void | memxor_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise OR of two arbitrary precision integers and places the result into a buffer of one of the operands. More... | |
void | memxor_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise XOR of two operands specified in the Little-Endian byte order. More... | |
void | memxor_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
The generic form of bitwise XOR of two operands specified in Big-Endian byte order. More... | |
void | memandnot_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise AND of the result with another arbitrary-precision integer and copies the final result into a separate destination buffer. More... | |
void | memandnot_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise AND of the result with another arbitrary-precision integer producing the final result written in place of the first integer. More... | |
void | memandnot_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-AND of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Little-Endian order. More... | |
void | memandnot_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-AND of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Big-Endian order. More... | |
void | memornot_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise OR of the result with another arbitrary-precision integer and copies the final result into a separate destination buffer. More... | |
void | memornot_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise OR of the result with another arbitrary-precision integer producing the final result written in place of the first integer. More... | |
void | memornot_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-OR of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Little-Endian order. More... | |
void | memornot_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-OR of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Big-Endian order. More... | |
void | memxornot_copy (void *restrict pDest, const void *restrict pSrc1, const void *restrict pSrc2, std::size_t cbSrc) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise XOR of the result with another arbitrary-precision integer and copies the final result into a separate destination buffer. More... | |
void | memxornot_inplace (void *pSrcDest, const void *pSrc2, std::size_t cbSrcDest) noexcept |
Computes bitwise NOT of an arbitrary-precision integer, then computes bitwise XOR of the result with another arbitrary-precision integer producing the final result written in place of the first integer. More... | |
void | memxornot_LE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-XOR of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Little-Endian order. More... | |
void | memxornot_BE (void *pDest, std::size_t cbDest, const void *pSrc1, std::size_t cbSrc1, const void *pSrc2, std::size_t cbSrc2) noexcept |
A generic form of bitwise NOT-XOR of an arbitrary precision integer with another integer both of which are specified with byte vectors in the Big-Endian order. More... | |
void | memnot_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbSrc) noexcept |
Computes bitwise NOT of an arbitrary-precision integer and writes the result into a separate output buffer. More... | |
void | memnot_inplace (void *pSrcDest, std::size_t cbSrcDest) noexcept |
Computes bitwise NOT of value in place of its buffer. More... | |
void | memnot_LE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
The generic form of bitwise NOT of an arbitrary-precision value specified in the Little-Endian byte order. More... | |
void | memnot_BE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
The generic form of bitwise NOT of an arbitrary-precision value specified in the Big-Endian byte order. More... | |
bool | memincr_LE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Little-Endian order, writes the result to a separate memory buffer and returns the carry flag. More... | |
bool | memincr_LE_inplace (void *pData, std::size_t cbData) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Little-Endian order in place and returns the carry flag. More... | |
bool | memincr_LE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Little-Endian byte order doing it in place or writing the result into a separate buffer with zero-extension or contraction to fit the buffer and returns the resulting carry flag. More... | |
bool | memincr_BE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Big-Endian order, writes the result to a separate memory buffer and returns the carry flag. More... | |
bool | memincr_BE_inplace (void *pData, std::size_t cbData) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Big-Endian order in place and returns the carry flag. More... | |
bool | memincr_BE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Increments an arbitrary precision integer specified by a vector of bytes in the Big-Endian byte order doing it in place or writing the result into a separate buffer with zero-extension or contraction to fit the buffer and returns the resulting carry flag. More... | |
bool | memdecr_LE_inplace (void *pData, std::size_t cbData) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Little-Endian order in place and returns the borrow bit. More... | |
bool | memdecr_LE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Little-Endian order, writes the result to a separate memory buffer and returns the borrow bit. More... | |
bool | memdecr_LE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Little-Endian byte order doing it in place or writing the result into a separate buffer with zero-extension or contraction to fit the buffer and returns the resulting borrow bit. More... | |
bool | memdecr_BE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Big-Endian order, writes the result to a separate memory buffer and returns the borrow bit. More... | |
bool | memdecr_BE_inplace (void *pData, std::size_t cbData) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Big-Endian order in place and returns the borrow bit. More... | |
bool | memdecr_BE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Decrements an arbitrary precision integer specified by a vector of bytes in the Big-Endian byte order doing it in place or writing the result into a separate buffer with zero-extension or contraction to fit the buffer and returns the resulting borrow bit. More... | |
bool | memneg_LE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Calculates an additive inversion of an arbitrary-precision integer given by a vector of bytes in the Little-Endian order and writes it to a separate buffer returning the value of the highest bit of the result. More... | |
bool | memneg_LE_inplace (void *pData, std::size_t cbData) noexcept |
Replaces an arbitrary-precision integer given by a vector of bytes in the Little-Endian order with its additive inversion returning the value of the highest bit of the result. More... | |
bool | memneg_LE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Zero-extends or contracts an arbitrary-precision integer given in the Little-Endian byte order, then computes an additive inversion of it in a separate of the same destination buffer returning a value of the highest bit of the result. More... | |
bool | memneg_BE_copy (void *restrict pDest, const void *restrict pSrc, std::size_t cbData) noexcept |
Calculates an additive inversion of an arbitrary-precision integer given by a vector of bytes in the Big-Endian order and writes it to a separate buffer returning the value of the highest bit of the result. More... | |
bool | memneg_BE_inplace (void *pData, std::size_t cbData) noexcept |
Replaces an arbitrary-precision integer given by a vector of bytes in the Big-Endian order with its additive inversion returning the value of the highest bit of the result. More... | |
bool | memneg_BE (void *pDest, std::size_t cbDest, const void *pSrc, std::size_t cbSrc) noexcept |
Zero-extends or contracts an arbitrary-precision integer given in the Big-Endian byte order, then computes an additive inversion of it in a separate of the same destination buffer returning a value of the highest bit of the result. More... | |
bool | memadd_LE_copy (void *restrict pResult, const void *restrict pX, const void *restrict pY, std::size_t cb) noexcept |
Performs an addition of two arbitrary-precision integers given in the Little-Endian byte order and of the same size and writes the result into a separate output buffer. More... | |
bool | memadd_LE_inplace (void *pResult, const void *pAddend, std::size_t cb) noexcept |
Replaces an integer given by a vector of bytes in the Little-Endian order with the result of its addition with another integer. More... | |
bool | memadd_LE (void *pResult, std::size_t cbResult, const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Performs an addition of two Little-Endian arbitrary-precision integers and returns the carry flag. More... | |
bool | memadd_BE_copy (void *restrict pResult, const void *restrict pX, const void *restrict pY, std::size_t cb) noexcept |
Performs an addition of two arbitrary-precision integers given in the Big-Endian byte order and of the same size and writes the result into a separate output buffer. More... | |
bool | memadd_BE_inplace (void *pResult, const void *pAddend, std::size_t cb) noexcept |
Replaces an integer given by a vector of bytes in the Big-Endian order with the result of its addition with another integer. More... | |
bool | memadd_BE (void *pResult, std::size_t cbResult, const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Performs an addition of two Big-Endian arbitrary-precision integers and returns the carry flag. More... | |
bool | memsub_LE_copy (void *restrict pResult, const void *restrict pX, const void *restrict pY, std::size_t cb) noexcept |
Computes a difference between two distinct arbitrary-precision integers given in the Little-Endian byte order, writes the difference to a separate buffer and returns the resulting borrow bit. More... | |
bool | memsub_LE_inplace (void *pResult, const void *pMinuend, std::size_t cb) noexcept |
Subtracts an arbitrary-precision integer from another arbitrary-precision integer in place of the latter and returns the resulting borrow bit. The operands and the result are considered to be in the Little-Endian byte order. More... | |
bool | memnegsub_LE_inplace (void *pResult, const void *pSubtrahend, std::size_t cb) noexcept |
Subtracts an arbitrary-precision integer from another arbitrary-precision integer in place of the former and returns the resulting borrow bit. The operands and the result are considered to be in the Little-Endian byte order. More... | |
bool | memsub_LE (void *pResult, std::size_t cbResult, const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Computes a difference between two arbitrary-precision integers specified with vectors in the Little-Endian byte order and returns the borrow bit. More... | |
bool | memsub_BE_copy (void *restrict pResult, const void *restrict pX, const void *restrict pY, std::size_t cb) noexcept |
Computes a difference between two distinct arbitrary-precision integers given in the Big-Endian byte order, writes the difference to a separate buffer and returns the resulting borrow bit. More... | |
bool | memsub_BE_inplace (void *pResult, const void *pMinuend, std::size_t cb) noexcept |
Subtracts an arbitrary-precision integer from another arbitrary-precision integer in place of the latter and returns the resulting borrow bit. The operands and the result are considered to be in the Big-Endian byte order. More... | |
bool | memnegsub_BE_inplace (void *pResult, const void *pSubtrahend, std::size_t cb) noexcept |
Subtracts an arbitrary-precision integer from another arbitrary-precision integer in place of the former and returns the resulting borrow bit. The operands and the result are considered to be in the Big-Endian byte order. More... | |
bool | memsub_BE (void *pResult, std::size_t cbResult, const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Computes a difference between two arbitrary-precision integers specified with vectors in the Big-Endian byte order and returns the borrow bit. More... | |
int | memcmp_LE (const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Compares two arbitrary-precision integers specified with vectors of bytes in the Little-Endian order. More... | |
int | memcmp_BE (const void *pX, std::size_t cbX, const void *pY, std::size_t cbY) noexcept |
Compares two arbitrary-precision integers specified with vectors of bytes in the Big-Endian order. More... | |
void | memfmadd_LE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Computes fused multiply-add multiplying two arbitrary-precision integers and adding them to a third integer writing the result in place of the latter. All integers are specified by vectors of bytes in the Little-Endian order. More... | |
void | memfmsub_LE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Performs fused multiplication of two arbitrary-precision integers and a subtraction of the product from another arbitrary-precision integer in place. All integers are specified with vectors of bytes in the Little-Endian order. More... | |
void | memfmadd_BE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Computes fused multiply-add multiplying two arbitrary-precision integers and adding them to a third integer writing the result in place of the latter. All integers are specified by vectors of bytes in the Big-Endian order. More... | |
void | memfmsub_BE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Performs fused multiplication of two arbitrary-precision integers and a subtraction of the product from another arbitrary-precision integer in place. All integers are specified with vectors of bytes in the Big-Endian order. More... | |
void | memmul_LE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Multiplies two arbitrary-precision integers specified by vectors of bytes in the Little-Endian byte order. More... | |
void | memmul_BE (void *restrict pResult, std::size_t cbResult, const void *restrict pX, std::size_t cbX, const void *restrict pY, std::size_t cbY) noexcept |
Multiplies two arbitrary-precision integers specified by vectors of bytes in the Big-Endian byte order. More... | |
chsverror_t | memdiv_LE (const void *restrict pDividend, std::size_t cbDividend, const void *restrict pDivisor, std::size_t cbDivisor, void *restrict pQuotient, std::size_t cbQuotient, void *restrict pRemainder, std::size_t cbRemainder) noexcept |
Performs Euclidean division of two arbitrary-precision integers specified with vectors of bytes in the Little-Endian order and produces an arbitrary-precision quotient and remainder. More... | |
chsverror_t | memdiv_BE (const void *restrict pDividend, std::size_t cbDividend, const void *restrict pDivisor, std::size_t cbDivisor, void *restrict pQuotient, std::size_t cbQuotient, void *restrict pRemainder, std::size_t cbRemainder) noexcept |
Performs Euclidean division of two arbitrary-precision integers specified with vectors of bytes in the Big-Endian order and produces an arbitrary-precision quotient and remainder. More... | |
template<class T > | |
constexpr std::uint8_t | bsf (T val) noexcept |
Returns an index of the rightmost (least significant) nonzero bit of an integer. More... | |
template<class T > | |
constexpr std::uint8_t | bsr (T val) noexcept |
Returns an index of the leftmost (most significant) nonzero bit of an integer. More... | |
unsigned long long | GetDefaultSeed () noexcept |
Returns an 8 byte random value that can be used in non secure random operations. More... | |
unsigned long long | RandomizeMemory_LE (unsigned long long nSeed, void *pMemory, std::size_t cbMemory) noexcept |
Randomize a memory buffer. More... | |
unsigned long long | RandomizeMemory_BE (unsigned long long nSeed, void *pMemory, std::size_t cbMemory) noexcept |
Randomize a memory buffer writing the least significant byte of a random value to the end of the buffer. More... | |
unsigned long long | RandomizeMemory (unsigned long long nSeed, void *pMemory, std::size_t cbMemory) noexcept |
Randomize a memory buffer. More... | |
A namespace of functions and components used to work with memory.