jayfoad wrote: Incidentally Hacker's Delight has a section "Average of Two Integers" which has some neat tricks for implementing these operations without extending to N+1-bit integers. https://github.com/llvm/llvm-project/pull/84431