[PATCH] D32302: [BitVector] Add find_last() and find_last_unset()
Chandler Carruth via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 10:35:37 PDT 2017
chandlerc accepted this revision.
chandlerc added a comment.
This revision is now accepted and ready to land.
LGTM with some loop simplifications.
================
Comment at: llvm/include/llvm/ADT/BitVector.h:175-179
+ while (i > 0) {
+ if (Bits[i] != BitWord(0))
+ break;
+ --i;
+ }
----------------
I this can be written as:
while (i > 0 && Bits[i] != Bitword(0))
--i;
================
Comment at: llvm/include/llvm/ADT/BitVector.h:213-218
+ if (W == ~BitWord(0)) {
+ while (--i > 0) {
+ if ((W = Bits[i]) != ~BitWord(0))
+ break;
+ }
+ }
----------------
I think this is the same as:
while (W == ~BitWord(0) && --i > 0)
W = Bits[i];
https://reviews.llvm.org/D32302
More information about the llvm-commits
mailing list