I give the following example to illustrate my question:
bool bSign;
// bSign will be set depending on some criteria, which is omitted here.
// b[][][] is a float array, which is initialized in the program
for(int i=0; i<1000; i++)
for(int j=0; j<10000; j++)
for(int k=0; k<10000; k++)
if(bSign)
a[i][j][k] = (b[i][j][k]>500);
else
a[i][j][k] = (b[i][j][k]<500);
In the above codes, I have to rely on bSign
to design the kind of operator (>
or <
) I should use to set the output variable a
. However, I found it costly as it is done within a long for
loop. Any ideas on how I can escape that?