Test if conversion is using the sse when possible
This commit is contained in:
parent
13bd166827
commit
1f44e74465
2 changed files with 40 additions and 33 deletions
|
@ -23,6 +23,7 @@
|
|||
#include <sprout/math/abs.hpp>
|
||||
#include <sprout/math/ceil.hpp>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <limits>
|
||||
#include <emmintrin.h>
|
||||
|
@ -176,6 +177,8 @@ namespace dhandy {
|
|||
|
||||
template <typename I, unsigned int Base, typename Tr, bool Constexpr, typename=void>
|
||||
struct AryConversion {
|
||||
constexpr static const bool is_sse = false;
|
||||
|
||||
template <typename C>
|
||||
constexpr static I from_ary (const C* beg, const C* end) {
|
||||
I retval = 0;
|
||||
|
@ -196,12 +199,14 @@ namespace dhandy {
|
|||
};
|
||||
|
||||
template <typename I, unsigned int Base, typename Tr>
|
||||
struct AryConversion<I, Base, Tr, false, typename std::enable_if<Tr::BehavesLikeASCII and std::is_integral<I>::value and not std::is_same<I, bool>::value and sizeof(I) <= sizeof(uint32_t)>::type> {
|
||||
struct AryConversion<I, Base, Tr, false, typename std::enable_if<Tr::BehavesLikeASCII and std::is_integral<I>::value and not std::is_same<I, bool>::value and sizeof(I) <= sizeof(std::uint32_t)>::type> {
|
||||
constexpr static const bool is_sse = true;
|
||||
template <typename C> static I from_ary (C* beg, C* end) { return to_integer_sse<I, C, Base, Tr>(beg, end - beg); }
|
||||
};
|
||||
|
||||
template <unsigned int Base, typename Tr, bool Constexpr>
|
||||
struct AryConversion<bool, Base, Tr, Constexpr> {
|
||||
constexpr static const bool is_sse = false;
|
||||
template <typename C> constexpr static bool from_ary (C* beg, C* end) {
|
||||
if (end == beg)
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue