[libc-commits] [PATCH] D129808: [libc] add unsafe mode to strlen

Nick Desaulniers via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Nov 28 13:24:17 PST 2022


nickdesaulniers added inline comments.


================
Comment at: libc/src/string/string_utils.h:60
+  for (; reinterpret_cast<uintptr_t>(char_ptr) % sizeof(T) != 0; ++char_ptr) {
+    if (*char_ptr == 0)
+      return char_ptr - src;
----------------
Dunno how similar `memchr` is to `strlen`, but I'd bet that the implementations are pretty similar. Maybe the value being searched for could be a parameter, then similar code shared between the two?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129808



More information about the libc-commits mailing list