diff --git a/exercises/week02.md b/exercises/week02.md index 77b3163898f12d2214d90908968d8747065df966..13735fe06464b21ee0490a9b233fbe544fd47d20 100644 --- a/exercises/week02.md +++ b/exercises/week02.md @@ -60,12 +60,12 @@ int special_add(int a, int b){ } ``` -10. **(optional)** Have you heard about vectorization before? Declare the function provided below and set the flags to **-O2** and observe how the asembly code differs to having set the flags to to **-O2** **-mavx** +10. **(optional)** Have you heard about vectorization before? Declare the function provided below and set the flags to **-O1**, **-O2** and observe how the asembly code differs to having set the flags to to **-O2** **-mavx**. Now change the size of the loop, try 4, 8, 16. How many add-operations are run in the assembly? ```c -void add_arrays(float *a, float *b, float *result, int n) { - for (int i = 0; i < n; i++) { - result[i] = a[i] + b[i]; +void add_arrays(float *a, float b) { + for (int i = 0; i < 8; i++) { + a[i] += b; } } ```