1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

fix cstring, cwchar

This commit is contained in:
bolero-MURAKAMI 2012-12-22 01:02:49 +09:00
parent 8227569c43
commit 0670013702
17 changed files with 172 additions and 127 deletions

View file

@ -3,23 +3,17 @@
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/cstring/strchr.hpp>
#include <sprout/cwchar/wcschr.hpp>
namespace sprout {
// Copyright (C) 2011 RiSK (sscrisk)
namespace detail {
inline SPROUT_CONSTEXPR std::size_t
wcscspn_impl(wchar_t const* s1, wchar_t const* s2, std::size_t n) {
return !*s1 || sprout::wcschr(s2, *s1) ? n
: sprout::detail::wcscspn_impl(s1 + 1, s2, n + 1)
;
}
} // amespace detail
//
// wcscspn
//
inline SPROUT_CONSTEXPR std::size_t
wcscspn(wchar_t const* s1, wchar_t const* s2) {
return sprout::detail::wcscspn_impl(s1, s2, 0);
return !*s1 || sprout::wcschr(s2, *s1) ? 0
: 1 + sprout::wcscspn(s1 + 1, s2)
;
}
} // namespace sprout