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/_config/all.hpp>
8
9#include <etl/_cstddef/size_t.hpp>
10#include <etl/_strings/cstr.hpp>
11
12namespace etl {
13
14/// \brief Copies exactly count successive wide characters from the wide
15/// character array pointed to by src to the wide character array pointed to by
16/// dest. If the objects overlap, the behavior is undefined. If count is zero,
17/// the function does nothing.
18///
19/// https://en.cppreference.com/w/cpp/string/wide/wmemcpy
20constexpr auto wmemcpy(wchar_t* dest, wchar_t const* src, etl::size_t count) noexcept -> wchar_t*
21{
22#if __has_builtin(__builtin_wmemcpy)
23 return __builtin_wmemcpy(dest, src, count);
24#else
25 if (count == 0) {
26 return dest;
27 }
28 return etl::detail::strncpy(dest, src, count);
29#endif
30}
31
32} // namespace etl
33
34#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:20