|
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.
[out] | pDest | A pointer to the destination buffer which receives a two's complement of the input integer with respect to 2CHAR_BIT cbData. The capacity of the buffer must be at least cbData bytes. |
[in] | pSrc | A pointer to a vector of cbData bytes given in the Little-Endian order to specify the input integer. The buffer must not overlap with the destination buffer. |
cbData | Size of the input integer and a capacity of the output buffer specified in bytes. |
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 negate Big-Endian integers use memneg_BE_copy.
The buffers pointed to by pDest
and pSrc
may not overlap. To negate an integral value in place use memneg_LE_inplace. The memneg_LE function, which also allows buffers of differing sizes, can negate an integer in place or with copying of the result to a separate buffer.