|
noexcept |
Replaces an integer given by a vector of bytes in the Big-Endian order with the result of its addition with another integer.
[in,out] | pResult | A pointer to a vector holding an integer to increase by the second integer pointed to by pAddend . |
[in] | pAddend | A pointer to a byte vector with the second integer. Although the pointer is qualified with const , pAddend may address the same integer as pResult . Other than that, the pointers may not overlap. |
cb | A byte size of the input integers as well as the result written to pResult on output. |
The addition is carried out modulo bcb
, where b = 2CHAR_BIT
is a number of values that a byte can represent.
All of the integers are specified with vectors in the Big-Endian byte order. That is, if n = cb - 1
, and the first and the second integers are respectively specified with vectors \(V_X = \{x_0,\dots, x_n\}\) and \(V_Y = \{y_0,\dots, y_n\}\), where \(x_0\) and \(y_0\) are the first bytes of the vectors, then the respective integers are defined as \(X=\sum_{i=0}^{n}x_{n-i}\cdot b^i\) and \(Y=\sum_{i=0}^{n}y_{n-i}\cdot b^i\). The result of the addition is also written to pResult
in the Big-Endian byte order.
To add up numbers given in the Little-Endian byte order use memadd_LE_inplace.
To right the sum into a separate buffer leaving the original operands unmodified, use memadd_BE_copy or memadd_BE.