C++ Mathematical Expression Toolkit (ExprTk) release
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
exprtk::details::vec_add_op< T > Struct Template Reference

Public Types

typedef vector_interface< T > * ivector_ptr
 

Static Public Member Functions

static T process (const ivector_ptr v)
 

Detailed Description

template<typename T>
struct exprtk::details::vec_add_op< T >

Definition at line 16573 of file exprtk.hpp.

Member Typedef Documentation

◆ ivector_ptr

Definition at line 16575 of file exprtk.hpp.

Member Function Documentation

◆ process()

template<typename T >
static T exprtk::details::vec_add_op< T >::process ( const ivector_ptr  v)
inlinestatic

Definition at line 16577 of file exprtk.hpp.

16578 {
16579 const T* vec = v->vec()->vds().data();
16580 const std::size_t vec_size = v->size();
16581
16582 loop_unroll::details lud(vec_size);
16583
16584 if (vec_size <= static_cast<std::size_t>(lud.batch_size))
16585 {
16586 T result = T(0);
16587 int i = 0;
16588
16589 switch (vec_size)
16590 {
16591 #define case_stmt(N,fall_through) \
16592 case N : result += vec[i++]; \
16593 fall_through \
16594
16595 #ifndef exprtk_disable_superscalar_unroll
16602
16603 #endif
16605 case_stmt( 2, exprtk_fallthrough) case_stmt( 1, (void)0;)
16606 }
16607
16608 #undef case_stmt
16609
16610 return result;
16611 }
16612
16613 T r[] = {
16614 T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
16615 T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0)
16616 };
16617
16618 const T* upper_bound = vec + lud.upper_bound;
16619
16620 while (vec < upper_bound)
16621 {
16622 #define exprtk_loop(N) \
16623 r[N] += vec[N]; \
16624
16625 exprtk_loop( 0) exprtk_loop( 1)
16626 exprtk_loop( 2) exprtk_loop( 3)
16627 #ifndef exprtk_disable_superscalar_unroll
16628 exprtk_loop( 4) exprtk_loop( 5)
16629 exprtk_loop( 6) exprtk_loop( 7)
16630 exprtk_loop( 8) exprtk_loop( 9)
16631 exprtk_loop(10) exprtk_loop(11)
16632 exprtk_loop(12) exprtk_loop(13)
16633 exprtk_loop(14) exprtk_loop(15)
16634 #endif
16635
16636 vec += lud.batch_size;
16637 }
16638
16639 int i = 0;
16640
16641 switch (lud.remainder)
16642 {
16643 #define case_stmt(N,fall_through) \
16644 case N : r[0] += vec[i++]; \
16645 fall_through \
16646
16647 #ifndef exprtk_disable_superscalar_unroll
16654 #endif
16656 case_stmt( 1, (void)0;)
16657 }
16658
16659 #undef exprtk_loop
16660 #undef case_stmt
16661
16662 return (r[ 0] + r[ 1] + r[ 2] + r[ 3])
16663 #ifndef exprtk_disable_superscalar_unroll
16664 + (r[ 4] + r[ 5] + r[ 6] + r[ 7])
16665 + (r[ 8] + r[ 9] + r[10] + r[11])
16666 + (r[12] + r[13] + r[14] + r[15])
16667 #endif
16668 ;
16669 }
#define case_stmt(N)
Definition exprtk.hpp:33204
#define exprtk_fallthrough
Definition exprtk.hpp:86
#define exprtk_loop(N)
bool match_impl(const Iterator pattern_begin, const Iterator pattern_end, const Iterator data_begin, const Iterator data_end, const typename std::iterator_traits< Iterator >::value_type &zero_or_more, const typename std::iterator_traits< Iterator >::value_type &exactly_one)
Definition exprtk.hpp:605

References case_stmt, exprtk::details::vec_data_store< T >::data(), exprtk_fallthrough, exprtk_loop, exprtk::details::match_impl(), exprtk::details::vector_interface< T >::size(), exprtk::details::vector_node< T >::vds(), and exprtk::details::vector_interface< T >::vec().

Referenced by exprtk::details::vec_avg_op< T >::process().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this struct was generated from the following file: