numeric.int.multi_word ≡
Copyright: (c) Microsoft Corporation. All rights reserved.
template <typename T> inline pair<T, uint1> add_with_carry(T a, T b, uint1 carry) §
Return the sum and carry generated by adding a,
b, and carry. Expected iteration order while
calling this over multiple words: Least significant to most
significant
Parameters
-
typename TType of values to be added
Arguments
-
T aThe first operand for addition
-
T bThe second operand for addition
-
uint1 carry
The input carry
template <typename T> inline pair<T, uint1> sub_with_borrow(T a, T b, uint1 borrow) §
Return the difference and borrow generated by subtracting
a, b, and borrow. Expected
iteration order while calling this over multiple words: Least
significant to most significant
Parameters
-
typename TType of values to be subtracted
Arguments
-
T aThe first operand for subtraction
-
T bThe second operand for subtraction
-
uint1 borrow
The input borrow
inline comp_metadata get_initial_comp_metadata() §
Returns the metadata to be passed to the first call to
min_with_metadata and max_with_metadata.
template <typename T> inline pair<T, comp_metadata> min_with_metadata(T a, T b, comp_metadata prev_metadata) §
This function is used while computing min of two multi-word variables
a_words and b_words, to which a and b belong. It selects a
if a_words < b_words, or b if b_words < a_words. It
also returns the metadata to be used as incoming metadata for the next
call to this function. Expected iteration order while calling this over
multiple words: Most significant to least significant
Parameters
-
typename TType of the words
Arguments
-
T aThe first operand for min
-
T bThe second operand for min
-
comp_metadata prev_metadata
The incoming metadata
template <typename T> inline pair<T, comp_metadata> max_with_metadata(T a, T b, comp_metadata prev_metadata) §
This function is used while computing max of two multi-word variables
a_words and b_words, to which a and b belong. It selects a
if a_words > b_words, or b if b_words > a_words. It
also returns the metadata to be used as incoming metadata for the next
call to this function. Expected iteration order while calling this over
multiple words: Most significant to least significant
Parameters
-
typename TType of the words
Arguments
-
T aThe first operand for max
-
T bThe second operand for max
-
comp_metadata prev_metadata
The incoming metadata