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 16374 of file exprtk.hpp.

Member Typedef Documentation

◆ ivector_ptr

Definition at line 16376 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 16378 of file exprtk.hpp.

16379 {
16380 const T* vec = v->vec()->vds().data();
16381 const std::size_t vec_size = v->size();
16382
16383 loop_unroll::details lud(vec_size);
16384
16385 if (vec_size <= static_cast<std::size_t>(lud.batch_size))
16386 {
16387 T result = T(0);
16388 int i = 0;
16389
16390 switch (vec_size)
16391 {
16392 #define case_stmt(N,fall_through) \
16393 case N : result += vec[i++]; \
16394 fall_through \
16395
16396 #ifndef exprtk_disable_superscalar_unroll
16403
16404 #endif
16406 case_stmt( 2, exprtk_fallthrough) case_stmt( 1, (void)0;)
16407 }
16408
16409 #undef case_stmt
16410
16411 return result;
16412 }
16413
16414 T r[] = {
16415 T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0),
16416 T(0), T(0), T(0), T(0), T(0), T(0), T(0), T(0)
16417 };
16418
16419 const T* upper_bound = vec + lud.upper_bound;
16420
16421 while (vec < upper_bound)
16422 {
16423 #define exprtk_loop(N) \
16424 r[N] += vec[N]; \
16425
16426 exprtk_loop( 0) exprtk_loop( 1)
16427 exprtk_loop( 2) exprtk_loop( 3)
16428 #ifndef exprtk_disable_superscalar_unroll
16429 exprtk_loop( 4) exprtk_loop( 5)
16430 exprtk_loop( 6) exprtk_loop( 7)
16431 exprtk_loop( 8) exprtk_loop( 9)
16432 exprtk_loop(10) exprtk_loop(11)
16433 exprtk_loop(12) exprtk_loop(13)
16434 exprtk_loop(14) exprtk_loop(15)
16435 #endif
16436
16437 vec += lud.batch_size;
16438 }
16439
16440 int i = 0;
16441
16442 switch (lud.remainder)
16443 {
16444 #define case_stmt(N,fall_through) \
16445 case N : r[0] += vec[i++]; \
16446 fall_through \
16447
16448 #ifndef exprtk_disable_superscalar_unroll
16455 #endif
16457 case_stmt( 1, (void)0;)
16458 }
16459
16460 #undef exprtk_loop
16461 #undef case_stmt
16462
16463 return (r[ 0] + r[ 1] + r[ 2] + r[ 3])
16464 #ifndef exprtk_disable_superscalar_unroll
16465 + (r[ 4] + r[ 5] + r[ 6] + r[ 7])
16466 + (r[ 8] + r[ 9] + r[10] + r[11])
16467 + (r[12] + r[13] + r[14] + r[15])
16468 #endif
16469 ;
16470 }
#define case_stmt(N)
Definition exprtk.hpp:32731
#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:598

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: