1 //===-- str{,case}str implementation ----------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H
10 #define LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H
12 #include "src/string/memory_utils/memmem_implementations.h"
13 #include "src/string/string_utils.h"
16 namespace __llvm_libc
{
18 template <typename Comp
>
19 constexpr static char *strstr_implementation(const char *haystack
,
20 const char *needle
, Comp
&&comp
) {
21 void *result
= memmem_implementation(
22 static_cast<const void *>(haystack
), internal::string_length(haystack
),
23 static_cast<const void *>(needle
), internal::string_length(needle
), comp
);
24 return static_cast<char *>(result
);
27 } // namespace __llvm_libc
29 #endif // LLVM_LIBC_SRC_STRING_MEMORY_UTILS_STRSTR_IMPLEMENTATIONS_H