1db8a88feSMichael Jones //===-- Implementation of mempcpy ----------------------------------------===//
2db8a88feSMichael Jones //
3db8a88feSMichael Jones // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4db8a88feSMichael Jones // See https://llvm.org/LICENSE.txt for license information.
5db8a88feSMichael Jones // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6db8a88feSMichael Jones //
7db8a88feSMichael Jones //===----------------------------------------------------------------------===//
8db8a88feSMichael Jones 
9db8a88feSMichael Jones #include "src/string/mempcpy.h"
10*7b59fcb7SSiva Chandra Reddy #include "src/string/memory_utils/memcpy_implementations.h"
11db8a88feSMichael Jones 
12db8a88feSMichael Jones #include "src/__support/common.h"
13db8a88feSMichael Jones #include <stddef.h> // For size_t.
14db8a88feSMichael Jones 
15db8a88feSMichael Jones namespace __llvm_libc {
16db8a88feSMichael Jones 
17db8a88feSMichael Jones LLVM_LIBC_FUNCTION(void *, mempcpy,
18db8a88feSMichael Jones                    (void *__restrict dest, const void *__restrict src,
19db8a88feSMichael Jones                     size_t count)) {
20*7b59fcb7SSiva Chandra Reddy   char *result = reinterpret_cast<char *>(dest);
21*7b59fcb7SSiva Chandra Reddy   inline_memcpy(result, reinterpret_cast<const char *>(src), count);
22*7b59fcb7SSiva Chandra Reddy   return result + count;
23db8a88feSMichael Jones }
24db8a88feSMichael Jones 
25db8a88feSMichael Jones } // namespace __llvm_libc
26