1//===-- Implementation of memcpy ------------------------------------------===//
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/memcpy.h"
10#include "src/__support/common.h"
11#include "src/__support/macros/config.h"
12#include "src/__support/macros/null_check.h"
13#include "src/string/memory_utils/inline_memcpy.h"
14
15namespace LIBC_NAMESPACE_DECL {
16
17LLVM_LIBC_FUNCTION(void *, memcpy,
18 (void *__restrict dst, const void *__restrict src,
19 size_t size)) {
20 if (size) {
21 LIBC_CRASH_ON_NULLPTR(dst);
22 LIBC_CRASH_ON_NULLPTR(src);
23 }
24 inline_memcpy(dst, src, size);
25 return dst;
26}
27
28} // namespace LIBC_NAMESPACE_DECL
29

source code of libc/src/string/memcpy.cpp