I have data being taken from a source such that if the value is above 2^13 (8192), the values are actually negative. Is there a way to do the following transition without using an if statement such as:
int data[SIZE]
for (int i=0; i<SIZE; i++)
if (data[i] > 8191)
data[i] = data[i]-16384;
or
int data[SIZE]
for (int i=0; i<SIZE; i++)
if (data[i] > 8191)
data[i] = ~(data[i] + 1 8292;
Any help eliminating the if statement without increasing the run time beyond O(n) would be greatly appreciated.
Aucun commentaire:
Enregistrer un commentaire