Advertisement
Guest User

Untitled

a guest
Feb 18th, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. struct Result sum_custom() {
  2.         int i;
  3.         struct Result res;
  4.         int16_t table[0xFFFF];
  5.         int idx;
  6.  
  7.         gettimeofday(&res.time_start, NULL);
  8.         res.sum = 0;
  9.         for(i = -32767; i <=32767;i++){
  10.                 table[i & 0xFFFF] = i * VOL;
  11.         }
  12.  
  13.         int sz = SIZE;
  14.         for(i = 0; i < sz ; i++){
  15.                 idx = (unsigned short) data[i];
  16.                 res.sum += output[i] = table[idx];
  17.                 res.sum += output[i] = table[(unsigned short) data[i++]];
  18.                 res.sum += output[i] = table[(unsigned short) data[i++]];
  19.                 res.sum += output[i] = table[(unsigned short) data[i++]];
  20.                 res.sum += output[i] = table[(unsigned short) data[i++]];
  21.  
  22.                 res.sum += table[data[i++] & 0xFFFF]
  23.                         + table[data[i++] & 0xFFFF]
  24.                         + table[data[i] & 0xFFFF];
  25.  
  26.         }
  27.  
  28.         gettimeofday(&res.time_end, NULL);
  29.         return res;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement