tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
wmemcpy.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2019 Tobias Hienzsch
3
4#ifndef TETL_CWCHAR_WMEMCPY_HPP
5#define TETL_CWCHAR_WMEMCPY_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8#include <etl/_strings/cstr.hpp>
9
10namespace etl {
11
12/// \brief Copies exactly count successive wide characters from the wide
13/// character array pointed to by src to the wide character array pointed to by
14/// dest. If the objects overlap, the behavior is undefined. If count is zero,
15/// the function does nothing.
16///
17/// https://en.cppreference.com/w/cpp/string/wide/wmemcpy
18constexpr auto wmemcpy(wchar_t* dest, wchar_t const* src, etl::size_t count) noexcept -> wchar_t*
19{
20#if defined(__clang__)
21 return __builtin_wmemcpy(dest, src, count);
22#else
23 if (count == 0) {
24 return dest;
25 }
26 return etl::detail::strncpy(dest, src, count);
27#endif
28}
29
30} // namespace etl
31
32#endif // TETL_CWCHAR_WMEMCPY_HPP
Definition adjacent_find.hpp:9
constexpr auto wmemcpy(wchar_t *dest, wchar_t const *src, etl::size_t count) noexcept -> wchar_t *
Copies exactly count successive wide characters from the wide character array pointed to by src to th...
Definition wmemcpy.hpp:18