[llvm] [APInt] add sfloordiv_ov APInt's member function (PR #84720)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 10 23:00:13 PDT 2024


================
@@ -2022,6 +2022,14 @@ APInt APInt::ushl_ov(unsigned ShAmt, bool &Overflow) const {
   return *this << ShAmt;
 }
 
+APInt APInt::sfloordiv_ov(const APInt &RHS, bool &Overflow) const {
+  auto quotient = sdiv_ov(RHS, Overflow);
+  if ((quotient * RHS != *this) && (isNegative() != RHS.isNegative()))
+    return quotient - 1;
+  else
----------------
topperc wrote:

No else after return

https://github.com/llvm/llvm-project/pull/84720


More information about the llvm-commits mailing list