This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 28th, 2010  |  syntax: C  |  size: 0.54 KB  |  views: 135  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #define PRECISION 16
  2. #define fixmul32(x, y)  \
  3.     ({ int32_t __hi;  \
  4.        uint32_t __lo;  \
  5.        int32_t __result;  \
  6.        asm ("smull   %0, %1, %3, %4\n\t"  \
  7.             "movs    %0, %0, lsr %5\n\t"  \
  8.             "adc    %2, %0, %1, lsl %6"  \
  9.             : "=&r" (__lo), "=&r" (__hi), "=r" (__result)  \
  10.             : "%r" (x), "r" (y),  \
  11.               "M" (PRECISION), "M" (32 - PRECISION)  \
  12.             : "cc");  \
  13.        __result;  \
  14.     })
  15.  
  16.  
  17.  
  18. tmp = fixmul32(output[i].r,  output[i].r) + fixmul32(output[i].i, output[i].i);
clone this paste RAW Paste Data