aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks
diff options
context:
space:
mode:
authorNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-11-10 10:55:18 +0000
committerNadesh Ramanathan <nadeshramanathan88@gmail.com>2020-11-10 10:55:18 +0000
commit426caa587cfa8fdf546b6e8cbccfdb0fccea9c36 (patch)
tree887af96096a7f8e53f680e04b8ff009d9af68338 /benchmarks
parentd030cd2dbc1e97df341745516089719c24abe425 (diff)
downloadvericert-426caa587cfa8fdf546b6e8cbccfdb0fccea9c36.tar.gz
vericert-426caa587cfa8fdf546b6e8cbccfdb0fccea9c36.zip
fixing nussinov
Diffstat (limited to 'benchmarks')
-rw-r--r--benchmarks/polybench-syn/medley/nussinov.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/benchmarks/polybench-syn/medley/nussinov.c b/benchmarks/polybench-syn/medley/nussinov.c
index fd33ec4..f39f742 100644
--- a/benchmarks/polybench-syn/medley/nussinov.c
+++ b/benchmarks/polybench-syn/medley/nussinov.c
@@ -19,10 +19,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)((i+ONE)%FOUR);
}
for (i=0; i <n; plus(i))
@@ -55,22 +56,23 @@ 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]);
}