xref: /llvm-project/libc/src/string/strcoll.cpp (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1f418f888SMichael Jones //===-- Implementation of strcoll -----------------------------------------===//
2f418f888SMichael Jones //
3f418f888SMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4f418f888SMichael Jones // See https://llvm.org/LICENSE.txt for license information.
5f418f888SMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6f418f888SMichael Jones //
7f418f888SMichael Jones //===----------------------------------------------------------------------===//
8f418f888SMichael Jones 
9f418f888SMichael Jones #include "src/string/strcoll.h"
10f418f888SMichael Jones 
11f418f888SMichael Jones #include "src/__support/common.h"
12*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h"
13f418f888SMichael Jones 
14*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL {
15f418f888SMichael Jones 
16f418f888SMichael Jones // TODO: Add support for locales.
17f418f888SMichael Jones LLVM_LIBC_FUNCTION(int, strcoll, (const char *left, const char *right)) {
18f418f888SMichael Jones   for (; *left && *left == *right; ++left, ++right)
19f418f888SMichael Jones     ;
20f418f888SMichael Jones   return static_cast<int>(*left) - static_cast<int>(*right);
21f418f888SMichael Jones }
22f418f888SMichael Jones 
23*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL
24