1*66d00febSPaula Toth //===-- Implementation of strlen ------------------------------------------===// 21fcfd30fSPaula Toth // 31fcfd30fSPaula Toth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 41fcfd30fSPaula Toth // See https://llvm.org/LICENSE.txt for license information. 51fcfd30fSPaula Toth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 61fcfd30fSPaula Toth // 71fcfd30fSPaula Toth //===----------------------------------------------------------------------===// 81fcfd30fSPaula Toth 91fcfd30fSPaula Toth #include "src/string/strlen.h" 101fcfd30fSPaula Toth 111fcfd30fSPaula Toth #include "src/__support/common.h" 121fcfd30fSPaula Toth 131fcfd30fSPaula Toth namespace __llvm_libc { 141fcfd30fSPaula Toth 151fcfd30fSPaula Toth // TODO: investigate the performance of this function. 160570de73SKazuaki Ishizaki // There might be potential for compiler optimization. 171fcfd30fSPaula Toth size_t LLVM_LIBC_ENTRYPOINT(strlen)(const char *src) { 181fcfd30fSPaula Toth const char *end = src; 191fcfd30fSPaula Toth while (*end != '\0') 201fcfd30fSPaula Toth ++end; 211fcfd30fSPaula Toth return end - src; 221fcfd30fSPaula Toth } 231fcfd30fSPaula Toth 241fcfd30fSPaula Toth } // namespace __llvm_libc 25