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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 03:09:04 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);
----------------
RKSimon wrote:

Does anyone have any preference for camelcase vs lowercase? 

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


More information about the llvm-commits mailing list