|
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.
[in,out] | pResult | A pointer to a buffer which on input holds the subtrahend and on output receives the difference. |
[in] | pMinuend | A pointer to a byte vector which holds the minuend of the operation. |
cb | Byte size of the operands and the capacity of the output buffer. |
true
if a borrow has taken place and false
otherwise.The subtraction 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 Little-Endian byte order. That is, if n = cb - 1
, the subtrahend addressed by pResult
and the minuend addressed by pMinuend
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_i\cdot b^i\) and \(Y=\sum_{i=0}^{n}y_i\cdot b^i\). The difference \(X - Y\) is also written to pResult
in the Little-Endian byte order.
To subtract numbers given in the Big-Endian byte order use memsub_BE_inplace.
To produce the difference in place of a minuend, rather than subtrahend, use the memnegsub_LE_inplace function.
To produce the difference in a separate buffer and leave the input integrals unmodified, use memsub_LE_copy or memsub_LE.