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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 01:22:42 PDT 2024


================
@@ -3094,3 +3094,35 @@ void llvm::LoadIntFromMemory(APInt &IntVal, const uint8_t *Src,
     memcpy(Dst + sizeof(uint64_t) - LoadBytes, Src, LoadBytes);
   }
 }
+
+APInt APIntOps::avgFloorS(const APInt &C1, const APInt &C2) {
+  // Return floor((C1 + C2)/2))
----------------
jayfoad wrote:

```suggestion
  // Return floor((C1 + C2)/2)
```
Similarly for the other comments below

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


More information about the llvm-commits mailing list