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

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