[libc] add unsafe mode to strlen
authorMichael Jones <michaelrj@google.com>
Thu, 14 Jul 2022 22:17:18 +0000 (15:17 -0700)
committerMichael Jones <michaelrj@google.com>
Thu, 1 Dec 2022 00:48:35 +0000 (16:48 -0800)
commita3b745818d2e13b2899260239c7cab4bf75070f7
treeda000bba92c4a4ffc7553d5fd871dc26a8912415
parent6c2140943cbe257c85f7121349c5bca950a26e0d
[libc] add unsafe mode to strlen

The only safe way to implement strlen involves reading the string one
char at a time. It is faster to read in larger blocks, but this leads to
reading beyond the string boundary, which is undefined behavior. This
patch adds an implementation and flag to use this fast but unsafe
version of strlen.

Reviewed By: sivachandra

Differential Revision: https://reviews.llvm.org/D129808
libc/CMakeLists.txt
libc/common_libc_tuners.cmake [new file with mode: 0644]
libc/src/string/CMakeLists.txt
libc/src/string/string_utils.h