[PATCH] D27068: Improve string::find
JianYongChan via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue May 3 21:17:15 PDT 2022
Tangmou added inline comments.
Herald added a project: All.
================
Comment at: libcxx/trunk/include/__string:557
+ _CharT __f2 = *__first2;
+ while (true) {
+ __len1 = __last1 - __first1;
----------------
Sorry for the comment after such a long time, but I have a question about this patch.
Since we have already calculated `__len1` and ensured that `__len1 < __len2` before the loop, can we just skip the length calculation and the comparison in the first loop cycle? And thus we can replace the `while` loop with `do-while` or keep the `while` loop but delete the length calculation and the comparison before the loop?
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D27068/new/
https://reviews.llvm.org/D27068
More information about the cfe-commits
mailing list