porting sscrisk/CEL

This commit is contained in:
bolero-MURAKAMI 2012-04-01 22:15:09 +09:00
parent ad60c8c530
commit db20f64991
181 changed files with 2531 additions and 607 deletions

29
sprout/cstring/memcmp.hpp Normal file
View file

@ -0,0 +1,29 @@
#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