我有一个关于C编译器优化的问题以及内联函数何时/如何循环展开.
我正在开发一个类似于下面例子的数字代码.基本上,my_for()会计算某种模板并调用每个op()数据.在这里,包装,创建参数并将函数指针发送给...谁的工作是修改每个()双数组的th double .my_type *argimy_func()my_for()my_op()iarg->narg->dest[j]
typedef struct my_type {
int const n;
double *dest[16];
double const *src[16];
} my_type;
static inline void my_for( void (*op)(my_type *,int), my_type *arg, int N ) {
int i;
for( i=0; i<N; ++i )
op( arg, i );
}
static inline void my_op( my_type *arg, int i ) {
int j;
int const n = arg->n;
for( j=0; j<n; ++j )
arg->dest[j][i] += …Run Code Online (Sandbox Code Playgroud)