#include #include #include "split.h" void pwork(int val) { int *p = arr[0][0]; *p = val; p++; int *pend = p + D1 * D2 * D3; while (p < pend) { *(p++) = *(p-1)+1; } } void awork(int val) { arr[0][0][0] = val; for (int i = 0; i < D1; i++) for (int j = 0; j < D2; j++) for (int k = 0; k < D3; k++) { if (k>0) arr[i][j][k] = arr[i][j][k] + 1; else { if (j>0) arr[i][j][k] = arr[i][j-1][k - 1]; else { // this is 000 and it is done } } } } void t1() { clock_t start, end; start = clock(); for (int i = 0; i < 10; i++) pwork(i); end = clock(); float cpu_time_used = ((float) (end - start)) / CLOCKS_PER_SEC; printf(COLUM, cpu_time_used ); } void t2() { clock_t start, end; start = clock(); for (int i = 0; i < 10; i++) awork(i); end = clock(); float cpu_time_used = ((float) (end - start)) / CLOCKS_PER_SEC; printf(COLUM, cpu_time_used ); }