[libc-commits] [PATCH] D129808: [libc] add unsafe mode to strlen
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Fri Jul 15 00:54:48 PDT 2022
sivachandra added inline comments.
================
Comment at: libc/src/string/string_utils.h:24
+ T result = 0;
+ byte = byte & ((1 << BITS_IN_BYTE) - 1);
+ for (size_t i = 0; i < sizeof(T); ++i)
----------------
If you know `BITS_IN_BYTE`, then you as well know the `BYTE_MASK`. So, why not just use a `BYTE_MASK`?
================
Comment at: libc/src/string/string_utils.h:86
+ // TODO: pick size of var based on requested size.
+ return string_length_unsafe<size_t>(src);
+#else
----------------
I think the most appropriate type would be `uintptr_t`.
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