1*1fcfd30fSPaula Toth //===-------------------- Implementation of strlen ------------------------===//
2*1fcfd30fSPaula Toth //
3*1fcfd30fSPaula Toth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*1fcfd30fSPaula Toth // See https://llvm.org/LICENSE.txt for license information.
5*1fcfd30fSPaula Toth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*1fcfd30fSPaula Toth //
7*1fcfd30fSPaula Toth //===----------------------------------------------------------------------===//
8*1fcfd30fSPaula Toth 
9*1fcfd30fSPaula Toth #include "src/string/strlen.h"
10*1fcfd30fSPaula Toth 
11*1fcfd30fSPaula Toth #include "src/__support/common.h"
12*1fcfd30fSPaula Toth 
13*1fcfd30fSPaula Toth namespace __llvm_libc {
14*1fcfd30fSPaula Toth 
15*1fcfd30fSPaula Toth // TODO: investigate the performance of this function.
16*1fcfd30fSPaula Toth // There might be potential for compiler optmization.
17*1fcfd30fSPaula Toth size_t LLVM_LIBC_ENTRYPOINT(strlen)(const char *src) {
18*1fcfd30fSPaula Toth   const char *end = src;
19*1fcfd30fSPaula Toth   while (*end != '\0')
20*1fcfd30fSPaula Toth     ++end;
21*1fcfd30fSPaula Toth   return end - src;
22*1fcfd30fSPaula Toth }
23*1fcfd30fSPaula Toth 
24*1fcfd30fSPaula Toth } // namespace __llvm_libc
25