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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 08:25:46 PST 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 average of C1 and C2
----------------
jayfoad wrote:

Should say "unsigned average" here for consistency. Same for avgCeilU below.

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


More information about the llvm-commits mailing list