examples/element/example05.c in bones-compiler-1.3.1 vs examples/element/example05.c in bones-compiler-1.6.0

- old
+ new

@@ -6,19 +6,19 @@ // == More information on Bones // Contact............Cedric Nugteren <c.nugteren@tue.nl> // Web address........http://parse.ele.tue.nl/bones/ // // == File information -// Filename...........element/example5.c +// Filename...........element/example05.c // Author.............Cedric Nugteren -// Last modified on...16-April-2012 +// Last modified on...10-October-2014 // #include <stdio.h> #define SIZE 2311 -// This is 'example5', demonstrating multiple inputs and outputs of different types +// This is 'example05', demonstrating multiple inputs and outputs of different types int main(void) { int i; float result = 0; // Declare input/output arrays @@ -34,21 +34,24 @@ in2[i] = i*3; in3[i] = i%100; } // Perform the computation - #pragma species kernel 0:SIZE-1|element ^ 0:SIZE-1|element ^ 0:SIZE-1|element -> 0:SIZE-1|element ^ 0:SIZE-1|element + #pragma scop + #pragma species kernel in3[0:SIZE-1]|element ^ in2[0:SIZE-1]|element ^ in1[0:SIZE-1]|element -> out1[0:SIZE-1]|element ^ out2[0:SIZE-1]|element for(i=0;i<SIZE;i++) { - if (in3[i] > 50) { + float i3 = in3[i]; + if (i3 > 50) { result = in2[i] / in1[i]; } else { result = in2[i] * in1[i]; } out1[i] = result; out2[i] = in3[i]/255.0; } #pragma species endkernel example5 + #pragma endscop // Clean-up and exit the function fflush(stdout); return 0; }