32#define MAX(x,y) ((x)>(y)?(x):(y))
33#define MIN(x,y) ((x)>(y)?(y):(x))
36#define strong_inline __attribute__((always_inline)) inline
37#define UNROLL _Pragma("unroll")
49#define DO_PRAGMA_(x) _Pragma (#x)
50#define DO_PRAGMA(x) DO_PRAGMA_(x)
51#define thread_num(a) omp_get_thread_num()
52#define thread_max(a) omp_get_max_threads()
56#define thread_num(a) (0)
57#define thread_max(a) (1)
60#define thread_for( i, num, ... ) DO_PRAGMA(omp parallel for schedule(static)) for ( uint64_t i=0;i<num;i++) { __VA_ARGS__ } ;
61#define thread_for2d( i1, n1,i2,n2, ... ) \
62 DO_PRAGMA(omp parallel for collapse(2)) \
63 for ( uint64_t i1=0;i1<n1;i1++) { \
64 for ( uint64_t i2=0;i2<n2;i2++) { \
67#define thread_foreach( i, container, ... ) DO_PRAGMA(omp parallel for schedule(static)) for ( uint64_t i=container.begin();i<container.end();i++) { __VA_ARGS__ } ;
68#define thread_for_in_region( i, num, ... ) DO_PRAGMA(omp for schedule(static)) for ( uint64_t i=0;i<num;i++) { __VA_ARGS__ } ;
69#define thread_for_collapse2( i, num, ... ) DO_PRAGMA(omp parallel for collapse(2)) for ( uint64_t i=0;i<num;i++) { __VA_ARGS__ } ;
70#define thread_for_collapse( N , i, num, ... ) DO_PRAGMA(omp parallel for collapse ( N ) ) for ( uint64_t i=0;i<num;i++) { __VA_ARGS__ } ;
71#define thread_for_collapse_in_region( N , i, num, ... ) DO_PRAGMA(omp for collapse ( N )) for ( uint64_t i=0;i<num;i++) { __VA_ARGS__ } ;
72#define thread_region DO_PRAGMA(omp parallel)
73#define thread_critical DO_PRAGMA(omp critical)
76inline void thread_bcopy(
const void *from,
void *to,
size_t bytes)
78 const uint64_t *ufrom = (
const uint64_t *)from;
79 uint64_t *uto = (uint64_t *)to;
81 uint64_t words=bytes/8;
void thread_bcopy(const void *from, void *to, size_t bytes)
#define thread_for(i, num,...)