mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-29 15:04:57 +00:00
Fix unreachable return & simplify some branches.
llvm-svn: 145627
This commit is contained in:
parent
3c06b26f09
commit
a787220c76
@ -1440,15 +1440,11 @@ APInt APInt::sqrt() const {
|
||||
APInt nextSquare((x_old + 1) * (x_old +1));
|
||||
if (this->ult(square))
|
||||
return x_old;
|
||||
else if (this->ule(nextSquare)) {
|
||||
APInt midpoint((nextSquare - square).udiv(two));
|
||||
APInt offset(*this - square);
|
||||
if (offset.ult(midpoint))
|
||||
return x_old;
|
||||
else
|
||||
return x_old + 1;
|
||||
} else
|
||||
llvm_unreachable("Error in APInt::sqrt computation");
|
||||
assert(this->ule(nextSquare) && "Error in APInt::sqrt computation");
|
||||
APInt midpoint((nextSquare - square).udiv(two));
|
||||
APInt offset(*this - square);
|
||||
if (offset.ult(midpoint))
|
||||
return x_old;
|
||||
return x_old + 1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user