diff options
author | Yann Herklotz <git@yannherklotz.com> | 2020-11-14 16:23:00 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2020-11-14 16:23:00 +0000 |
commit | 4201a38997543ceedad52f77b992dd8eb4a2ee5e (patch) | |
tree | 16b4adb28028e21f3ae9d46539167ece72c1c4a8 /benchmarks/polybench-syn/medley/nussinov.c | |
parent | 43773b8d4a69dfd30759db2a5026a4f44cdac4cb (diff) | |
parent | 95861dbef966e2cb612b303615681fc29c3acd3d (diff) | |
download | vericert-4201a38997543ceedad52f77b992dd8eb4a2ee5e.tar.gz vericert-4201a38997543ceedad52f77b992dd8eb4a2ee5e.zip |
Merge branch 'dev-experiments'
Diffstat (limited to 'benchmarks/polybench-syn/medley/nussinov.c')
-rw-r--r-- | benchmarks/polybench-syn/medley/nussinov.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/benchmarks/polybench-syn/medley/nussinov.c b/benchmarks/polybench-syn/medley/nussinov.c index fd33ec4..a2c3b70 100644 --- a/benchmarks/polybench-syn/medley/nussinov.c +++ b/benchmarks/polybench-syn/medley/nussinov.c @@ -11,6 +11,8 @@ typedef int base; +#include "../include/misc.h" + #define plus(i) i = i + ONE static void init_array (int n, @@ -19,10 +21,11 @@ void init_array (int n, { int i, j; int ONE = 1; + int FOUR = 4; for (i=0; i <n; plus(i)) { - seq[i] = (base)((i+ONE)%4); + seq[i] = (base)(modulo((i+ONE),FOUR)); } for (i=0; i <n; plus(i)) @@ -55,22 +58,22 @@ void kernel_nussinov(int n, base seq[ 60 + 0], int table[ 60 + 0][60 + 0]) { int i, j, k; + int ZERO = 0; int ONE = 1; int THREE = 3; -#pragma scop - for (i = n-ONE; i >= 0; i=i-ONE) { + for (i = n-ONE; i >= ZERO; i=i-ONE) { for (j=i+ONE; j<n; plus(j)) { - if (j-ONE>=0) + if (j-ONE>=ZERO) table[i][j] = ((table[i][j] >= table[i][j-ONE]) ? table[i][j] : table[i][j-ONE]); if (i+ONE<n) table[i][j] = ((table[i][j] >= table[i+ONE][j]) ? table[i][j] : table[i+ONE][j]); - if (j-ONE>=0 && i+ONE<n) { + if ((j-ONE>=ZERO && i+ONE<n) != (int)0) { if (i<j-ONE) - table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : 0)); + table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)) ? table[i][j] : table[i+ONE][j-ONE]+(((seq[i])+(seq[j])) == THREE ? ONE : ZERO)); else table[i][j] = ((table[i][j] >= table[i+ONE][j-ONE]) ? table[i][j] : table[i+ONE][j-ONE]); } @@ -80,7 +83,6 @@ void kernel_nussinov(int n, base seq[ 60 + 0], } } } -#pragma endscop } |