mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[APInt] No need for a copy when taking min/max of an APInt.
llvm-svn: 260827
This commit is contained in:
parent
2bfcfaa743
commit
2316eec7c0
@ -1744,16 +1744,24 @@ inline raw_ostream &operator<<(raw_ostream &OS, const APInt &I) {
|
||||
namespace APIntOps {
|
||||
|
||||
/// \brief Determine the smaller of two APInts considered to be signed.
|
||||
inline APInt smin(const APInt &A, const APInt &B) { return A.slt(B) ? A : B; }
|
||||
inline const APInt &smin(const APInt &A, const APInt &B) {
|
||||
return A.slt(B) ? A : B;
|
||||
}
|
||||
|
||||
/// \brief Determine the larger of two APInts considered to be signed.
|
||||
inline APInt smax(const APInt &A, const APInt &B) { return A.sgt(B) ? A : B; }
|
||||
inline const APInt &smax(const APInt &A, const APInt &B) {
|
||||
return A.sgt(B) ? A : B;
|
||||
}
|
||||
|
||||
/// \brief Determine the smaller of two APInts considered to be signed.
|
||||
inline APInt umin(const APInt &A, const APInt &B) { return A.ult(B) ? A : B; }
|
||||
inline const APInt &umin(const APInt &A, const APInt &B) {
|
||||
return A.ult(B) ? A : B;
|
||||
}
|
||||
|
||||
/// \brief Determine the larger of two APInts considered to be unsigned.
|
||||
inline APInt umax(const APInt &A, const APInt &B) { return A.ugt(B) ? A : B; }
|
||||
inline const APInt &umax(const APInt &A, const APInt &B) {
|
||||
return A.ugt(B) ? A : B;
|
||||
}
|
||||
|
||||
/// \brief Check if the specified APInt has a N-bits unsigned integer value.
|
||||
inline bool isIntN(unsigned N, const APInt &APIVal) { return APIVal.isIntN(N); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user