mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-25 21:35:41 +00:00
28f7c510a5
rename decimal_to_int -> ascii_to_int
29 lines
785 B
C++
29 lines
785 B
C++
#ifndef SPROUT_CSTRING_MEMCMP_HPP
|
||
#define SPROUT_CSTRING_MEMCMP_HPP
|
||
|
||
#include <cstddef>
|
||
#include <sprout/config.hpp>
|
||
|
||
namespace sprout {
|
||
// Copyright (C) 2011 RiSK (sscrisk)
|
||
|
||
namespace detail {
|
||
inline SPROUT_CONSTEXPR int memcmp_impl(unsigned char const* s1, unsigned char const* s2, std::size_t n) {
|
||
return !n ? 0
|
||
: *s1 == *s2 ? sprout::detail::memcmp_impl(s1 + 1, s2 + 1, n - 1)
|
||
: *s1 - *s2
|
||
;
|
||
}
|
||
} // namespace detail
|
||
|
||
// 7.21.4.1 memcmp ŠÖ<C5A0>”
|
||
inline SPROUT_CONSTEXPR int memcmp(void const* s1, void const* s2, std::size_t n) {
|
||
return sprout::detail::memcmp_impl(
|
||
static_cast<unsigned char const*>(s1),
|
||
static_cast<unsigned char const*>(s2),
|
||
n
|
||
);
|
||
}
|
||
} // namespace sprout
|
||
|
||
#endif // #ifndef SPROUT_CSTRING_MEMCMP_HPP
|