|
noexcept |
Computes a difference between two distinct arbitrary-precision integers given in the Big-Endian byte order, writes the difference to a separate buffer and returns the resulting borrow bit.
[out] | pResult | A pointer to a buffer which receives the difference. The capacity of the buffer must be at least cb bytes. |
[in] | pX | A pointer to an arbitrary-precision integral subtrahend represented as a vector of bytes. The size of the integer is cb bytes. |
[in] | pY | A pointer to the minuend of cb bytes in size. |
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 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_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 Little-Endian byte order use memsub_LE_copy.
None of the buffers may overlap. To perform a subtraction in place use memsub_BE_inplace, memnegsub_BE_inplace or memsub_BE.