Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions inst/include/Rcpp/internal/wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,13 @@ namespace Rcpp {
switch (size - i) {
case 3:
start[i] = first[i]; i++;
// fallthrough
case 2:
start[i] = first[i]; i++;
// fallthrough
case 1:
start[i] = first[i]; i++;
// fallthrough
case 0:
default:
{}
Expand Down
76 changes: 38 additions & 38 deletions inst/include/Rcpp/macros/unroll.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,46 @@ switch (n - i){ \
}


#define RCPP_LOOP_UNROLL(TARGET,SOURCE) \
R_xlen_t __trip_count = n >> 2 ; \
R_xlen_t i = 0 ; \
for ( ; __trip_count > 0 ; --__trip_count) { \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
} \
switch (n - i){ \
case 3: \
TARGET[i] = SOURCE[i] ; i++ ; \
case 2: \
TARGET[i] = SOURCE[i] ; i++ ; \
case 1: \
TARGET[i] = SOURCE[i] ; i++ ; \
case 0: \
default: \
{} \
#define RCPP_LOOP_UNROLL(TARGET,SOURCE) \
R_xlen_t __trip_count = n >> 2 ; \
R_xlen_t i = 0 ; \
for ( ; __trip_count > 0 ; --__trip_count) { \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
TARGET[i] = SOURCE[i] ; i++ ; \
} \
switch (n - i){ \
case 3: \
TARGET[i] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 2: \
TARGET[i] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 1: \
TARGET[i] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 0: \
default: \
{} \
}

#define RCPP_LOOP_UNROLL_LHSFUN(TARGET,FUN,SOURCE) \
R_xlen_t __trip_count = n >> 2 ; \
R_xlen_t i = 0 ; \
for ( ; __trip_count > 0 ; --__trip_count) { \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
} \
switch (n - i){ \
case 3: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
case 2: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
case 1: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
case 0: \
default: \
{} \
#define RCPP_LOOP_UNROLL_LHSFUN(TARGET,FUN,SOURCE) \
R_xlen_t __trip_count = n >> 2 ; \
R_xlen_t i = 0 ; \
for ( ; __trip_count > 0 ; --__trip_count) { \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; \
} \
switch (n - i){ \
case 3: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 2: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 1: \
TARGET[FUN(i)] = SOURCE[i] ; i++ ; /* fallthrough */ \
case 0: \
default: \
{} \
}

#endif