chsvlib
chsv helper source code

◆ memdecr_LE_inplace()

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

Parameters
[in,out]pDataA pointer to a buffer which contains the integer to decrement. On output, the buffer holds the result of the operation.
cbDataSize of the integer in bytes.
Returns
true if the function has borrowed from the digit cbData, i.e. if the value of the integer before the decrement is zero. Otherwise, the return value is false.

The function considers the input vector to specify the integer in the Little-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_i\cdot b^i\), where b = 2CHAR_BIT is a number of values that can be represented with one byte. To decrement Big-Endian integers use memdecr_BE_inplace.

To produce the result in a separate buffer leaving the original integer unchanged use memdecr_LE_copy or memdecr_LE.

See also
memdecr_BE_inplace;
memdecr_LE_copy;
memdecr_LE;
memincr_LE;
memadd_LE;
memsub_LE;
memmul_LE;
memdiv_LE.