[libcxx-commits] [PATCH] D121074: [libc++] Implement std::boyer_moore{, _horspool}_searcher

Adam Debreceni via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed May 11 01:25:01 PDT 2022


adamdebreceni added inline comments.


================
Comment at: libcxx/include/__functional/boyer_moore_searcher.h:208
+
+    vector<value_type> __scratch(__count);
+
----------------
philnik wrote:
> adamdebreceni wrote:
> > shouldn't this be `vector<difference_type>`?
> Why do you think it should be `vector<difference_type>`?
if `value_type` is `signed` and the range consists of e.g. the same values with length more than the max, `__compute_bm_prefix` will cause a signed overflow, moreover as `__scratch` can now contain negative values we could index out of `__suffix_`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121074



More information about the libcxx-commits mailing list