mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-15 07:39:31 +00:00
Let operator/ with uint32_t rhs operand be a member of BranchProbability and add a new operator /=. NFC.
llvm-svn: 255595
This commit is contained in:
parent
54fc055738
commit
8389268d7a
@ -117,6 +117,14 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
BranchProbability &operator/=(uint32_t RHS) {
|
||||
assert(N != UnknownN &&
|
||||
"Unknown probability cannot participate in arithmetics.");
|
||||
assert(RHS > 0 && "The divider cannot be zero.");
|
||||
N /= RHS;
|
||||
return *this;
|
||||
}
|
||||
|
||||
BranchProbability operator+(BranchProbability RHS) const {
|
||||
BranchProbability Prob(*this);
|
||||
return Prob += RHS;
|
||||
@ -132,6 +140,11 @@ public:
|
||||
return Prob *= RHS;
|
||||
}
|
||||
|
||||
BranchProbability operator/(uint32_t RHS) const {
|
||||
BranchProbability Prob(*this);
|
||||
return Prob /= RHS;
|
||||
}
|
||||
|
||||
bool operator==(BranchProbability RHS) const { return N == RHS.N; }
|
||||
bool operator!=(BranchProbability RHS) const { return !(*this == RHS); }
|
||||
|
||||
@ -164,12 +177,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, BranchProbability Prob) {
|
||||
return Prob.print(OS);
|
||||
}
|
||||
|
||||
inline BranchProbability operator/(BranchProbability LHS, uint32_t RHS) {
|
||||
assert(LHS != BranchProbability::getUnknown() &&
|
||||
"Unknown probability cannot participate in arithmetics.");
|
||||
return BranchProbability::getRaw(LHS.getNumerator() / RHS);
|
||||
}
|
||||
|
||||
template <class ProbabilityIter>
|
||||
void BranchProbability::normalizeProbabilities(ProbabilityIter Begin,
|
||||
ProbabilityIter End) {
|
||||
|
Loading…
Reference in New Issue
Block a user