[libcxx-commits] [libcxx] [libc++] Improve performance of std::midpoint for small types (PR #192804)

Max Graey via libcxx-commits libcxx-commits at lists.llvm.org
Sun Apr 19 04:28:05 PDT 2026


MaxGraey wrote:

Some tests required widening via (_Up) before avg for small types (such as `unsigned char`), but your fast path approach conflicts with this and breaks these tests:
```cpp
static_assert(std::midpoint(T(6), limits::max()) == half_way + 3, "");
```
where T is `unsigned char`. I'm wondering what spec requires for such cases.

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


More information about the libcxx-commits mailing list