[libcxx-commits] [PATCH] D69459: Optimize std::midpoint for integers

Marshall Clow via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Nov 14 08:52:58 PST 2019


mclow.lists added a comment.

I did some playing with compiler explorer, and got even better codegen by sprinkling casts to `_Up` over the calculation to `__half_diff`.
This only makes a difference if `_Tp` is smaller than `int`.

  _Up __half_diff = _Up(__diff / 2) + 
                    _Up(__sign_bit << __bitshift) + 
                    _Up(__sign_bit & __diff);


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69459/new/

https://reviews.llvm.org/D69459





More information about the libcxx-commits mailing list