Advertisement
Guest User

Untitled

a guest
Apr 28th, 2010
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1.     int32_t tmp;
  2.     for (i = 0; i < ARRAYSIZE_PLOT; ++i)
  3.     {
  4.         tmp = output[i].r * output[i].r + output[i].i * output[i].i;
  5.  
  6.         while (tmp > 0x7FFFFFFF) tmp >>= 1; /* we can only work on positive values */
  7.         if (tmp > 0)
  8.         {
  9.             tmp = fp_sqrt(tmp, 8); /* linear scaling, nothing
  10.                                       bad should happen */
  11.      
  12.             if (logarithmic)
  13.             {
  14.                 tmp = get_log_value(tmp << 8); /* the log function
  15.                                                   expects s15.16 values */
  16.             }
  17.         }
  18.         plot[i] = tmp;
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement