samedi 31 mars 2018

how do I handle with 180000 if statements in c?

Deal All, I'm trying to implement c program with 180000 if statements as the below. I'm on Visual Studio 2013. the problem is that build never goes to done. I know there are so many if statements. so is there any way to resolve this kind of problem?

   if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 0))  data[i*rwsize + j] =    2;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 1))  data[i*rwsize + j] =    12;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 2))  data[i*rwsize + j] =    100;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 3))  data[i*rwsize + j] =    20;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 4))  data[i*rwsize + j] =    0;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 5))  data[i*rwsize + j] =    30;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 6))  data[i*rwsize + j] =    0;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 7))  data[i*rwsize + j] =    40;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 8))  data[i*rwsize + j] =    0;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 9))  data[i*rwsize + j] =    120;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 10))  data[i*rwsize + j] =    3;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 11))  data[i*rwsize + j] =    4;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 12))  data[i*rwsize + j] =    7;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 13))  data[i*rwsize + j] =    3;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 14))  data[i*rwsize + j] =    5;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 15))  data[i*rwsize + j] =    30;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 16))  data[i*rwsize + j] =    0;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 17))  data[i*rwsize + j] =    0;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 18))  data[i*rwsize + j] =    1;
if ((  pre_data[i*rwsize + j]  == 0) && ( bdata[i*rwsize + (j)] == 19))  data[i*rwsize + j] =    0;
...

if ((  pre_data[i*rwsize + j]  == 255) && ( bdata[i*rwsize + (j)] == 255))  data[i*rwsize + j] =    25;

Aucun commentaire:

Enregistrer un commentaire