Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/llvm-libc/src/string/memcmp.cpp
6175 views
1
//===-- Implementation of memcmp ------------------------------------------===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
9
#include "src/string/memcmp.h"
10
#include "src/__support/macros/config.h"
11
#include "src/__support/macros/null_check.h"
12
#include "src/string/memory_utils/inline_memcmp.h"
13
14
#include <stddef.h> // size_t
15
16
namespace LIBC_NAMESPACE_DECL {
17
18
LLVM_LIBC_FUNCTION(int, memcmp,
19
(const void *lhs, const void *rhs, size_t count)) {
20
if (count) {
21
LIBC_CRASH_ON_NULLPTR(lhs);
22
LIBC_CRASH_ON_NULLPTR(rhs);
23
}
24
return inline_memcmp(lhs, rhs, count);
25
}
26
27
} // namespace LIBC_NAMESPACE_DECL
28
29