return this->urem(RHS);
}
- /// Sometimes it is convenient to divide two APInt values and obtain both
- /// the quotient and remainder. This function does both operations in the
- /// same computation making it a little more efficient.
+ /// Sometimes it is convenient to divide two APInt values and obtain both the
+ /// quotient and remainder. This function does both operations in the same
+ /// computation making it a little more efficient. The pair of input arguments
+ /// may overlap with the pair of output arguments. It is safe to call
+ /// udivrem(X, Y, X, Y), for example.
/// @brief Dual division/remainder interface.
static void udivrem(const APInt &LHS, const APInt &RHS,
APInt &Quotient, APInt &Remainder);
return toString(radix, false);
}
- /// Considers the APInt to be unsigned and converts it into a string in the
+ /// Considers the APInt to be signed and converts it into a string in the
/// radix given. The radix can be 2, 8, 10 or 16.
/// @returns a character interpretation of the APInt
- /// @brief Convert unsigned APInt to string representation.
+ /// @brief Convert signed APInt to string representation.
std::string toStringSigned(uint8_t radix = 10) const {
return toString(radix, true);
}
return *this;
}
+ /// @returns the multiplicative inverse for a given modulo.
+ APInt multiplicativeInverse(const APInt& modulo) const;
+
/// @}
/// @name Building-block Operations for APInt and APFloat
/// @{
}
/// GreatestCommonDivisor - This function returns the greatest common
-/// divisor of the two APInt values using Enclid's algorithm.
+/// divisor of the two APInt values using Euclid's algorithm.
/// @returns the greatest common divisor of Val1 and Val2
/// @brief Compute GCD of two APInt values.
APInt GreatestCommonDivisor(const APInt& Val1, const APInt& Val2);