From 138d5daf0cce738837090dac760a47e5f72ea1d4 Mon Sep 17 00:00:00 2001 From: Felix Huang <72808219+fffelix-huang@users.noreply.github.com> Date: Thu, 28 Mar 2024 00:55:46 +0800 Subject: [PATCH] Update reduction.md Fix bug in `sum_simd` function --- content/english/hpc/simd/reduction.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/english/hpc/simd/reduction.md b/content/english/hpc/simd/reduction.md index 89678103..f5111175 100644 --- a/content/english/hpc/simd/reduction.md +++ b/content/english/hpc/simd/reduction.md @@ -40,7 +40,8 @@ int sum_simd(v8si *a, int n) { // add the remainder of a for (int i = n / 8 * 8; i < n; i++) - res += a[i]; + for(int j = 0; j < 8; j++) + res += a[i][j]; return res; }