13 #ifndef _MpDspUtilsIntSqrt_h_ 14 #define _MpDspUtilsIntSqrt_h_ 31 #if !defined(_WIN32) || !defined(_MSC_VER) || defined(_WIN64) 38 if (val >= 0x40000000)
44 #define INNER_ISQRT(s) \ 45 temp = (g << (s)) + (1 << ((s) * 2 - 2)); \ 81 __declspec (naked) uint32_t __stdcall MpDspUtils_sqrt(uint32_t x) {
91 #if CPU == ATHLON || CPU == ATHLON64 93 __asm mov edx, (1 << (N)) \ 94 __asm mov ebx, (2 << (N)) \ 100 __asm cmovnc eax, ebx \ 104 __asm mov edx, (1 << (N)) \ 105 __asm mov ebx, (2 << (N)) \ 120 push ebx ; save as per calling convention
121 push esi ; save as per calling convention
122 xor eax, eax ; 2*root
151 mov esi, [esp] ; restore as per calling convention
152 mov ebx, [esp+4] ; restore as per calling convention
153 add esp, 8 ;
remove temp variables
154 ret 4 ; pop one DWORD arg and
return 161 return MpDspUtils_sqrt(x);
166 #endif // _MpDspUtilsIntSqrt_h_ static uint32_t sqrt(uint32_t val)
Integer square root.
Definition: MpDspUtilsIntSqrt.h:33
static int16_t add(int16_t a, int16_t b)
Return (a+b) saturated (16-bit).
Definition: MpDspUtilsSum.h:22