chsvlib
chsv helper source code

◆ memincr_BE_inplace()

bool Chusov::Memory::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.

Parameters
[in,out]pDataA pointer to a buffer which contains the integer to increment. On output, the buffer holds the result of the operation.
cbDataSize of the integer in bytes.
Returns
A value of a carry flag which results from the operation.

The function considers the input vector to specify the integer in the Big-Endian byte order. That is, given that \(V_X = \{x_0, \dots, x_n\}\) is the input vector pointed to by pSrc, such that \(x_0\) is the first byte in memory of the vector, \(x_n\) is the last byte and n = cbData - 1, the input value for the operation is \(X = \sum_{i=0}^{n}x_{n - i}\cdot b^i\) where b = 2CHAR_BIT is a number of values that can be represented with one byte. To increment Little-Endian integers use memincr_LE_inplace.

To produce the result in a separate buffer leaving the original integer unchanged use memincr_BE_copy or memincr_BE.

See also
memincr_LE_inplace;
memincr_BE_copy;
memincr_BE;
memdecr_BE;
memadd_BE;
memsub_BE;
memmul_BE;
memdiv_BE.