[llvm] [ADT] Add implementations for avgFloor and avgCeil to APInt (PR #84431)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 14 04:08:18 PDT 2024


================
@@ -2193,6 +2193,18 @@ inline const APInt absdiff(const APInt &A, const APInt &B) {
   return A.uge(B) ? (A - B) : (B - A);
 }
 
+/// Compute the floor of the signed average of C1 and C2
+APInt avgFloorS(const APInt &C1, const APInt &C2);
+
+/// Compute the floor of the unsigned average of C1 and C2
+APInt avgFloorU(const APInt &C1, const APInt &C2);
+
+/// Compute the ceil of the signed average of C1 and C2
+APInt avgCeilS(const APInt &C1, const APInt &C2);
+
+/// Compute the ceil of the unsigned average of C1 and C2
+APInt avgCeilU(const APInt &C1, const APInt &C2);
----------------
jayfoad wrote:

Nope :)

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


More information about the llvm-commits mailing list