[libcxx-commits] [PATCH] D100828: Remove if-else to make branch predictor happy

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 20 19:41:51 PDT 2021


Quuxplusone accepted this revision.
Quuxplusone added inline comments.


================
Comment at: libcxx/include/bitset:778
         _CharT __c = __str[_Mp - 1 - __i];
         if (__c == __zero)
             (*this)[__i] = false;
----------------
prehistoric-penguin wrote:
> curdeius wrote:
> > When here, please update this part too.
> I have fixed this part. The CI fail is caused by the clang-format checking, it has nothing to do with my change.
Here you //could// use `char_traits<_CharT>::eq(__c, __one)` if you like. I don't think it matters which expression you use, in that they all do the same thing in practice and the Standard doesn't seem to tell us which to pick in theory. I have the weakest of preferences for the idea of using `==` directly and saving a template instantiation, which is exactly what you're doing, so, LGTM.


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

https://reviews.llvm.org/D100828



More information about the libcxx-commits mailing list