tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
memcmp.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2
3#ifndef TETL_CSTRING_MEMCMP_HPP
4#define TETL_CSTRING_MEMCMP_HPP
5
8
9namespace etl {
10
18[[nodiscard]] inline auto memcmp(void const* lhs, void const* rhs, etl::size_t count) noexcept -> int
19{
20#if defined(__clang__)
21 return __builtin_memcmp(lhs, rhs, count);
22#else
23 auto const* l = static_cast<unsigned char const*>(lhs);
24 auto const* r = static_cast<unsigned char const*>(rhs);
25 return etl::detail::strncmp<unsigned char, etl::size_t>(l, r, count);
26#endif
27}
28
29} // namespace etl
30
31#endif // TETL_CSTRING_MEMCMP_HPP
constexpr auto count(InputIt first, InputIt last, T const &value) -> typename iterator_traits< InputIt >::difference_type
Returns the number of elements in the range [first, last) satisfying specific criteria....
Definition count.hpp:21
auto memcmp(void const *lhs, void const *rhs, etl::size_t count) noexcept -> int
Reinterprets the objects pointed to by lhs and rhs as arrays of unsigned char and compares the first ...
Definition memcmp.hpp:18
Definition adjacent_find.hpp:8
TETL_BUILTIN_SIZET size_t
etl::size_t is the unsigned integer type of the result of the sizeof operator.
Definition size_t.hpp:14