diff options
Diffstat (limited to 'longlong.h')
-rw-r--r-- | longlong.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/longlong.h b/longlong.h index e03f44f2d..09d6f58d6 100644 --- a/longlong.h +++ b/longlong.h @@ -701,6 +701,18 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype)); __asm__ ("divq %4" /* stringification in K&R C */ \ : "=a" (q), "=d" (r) \ : "0" ((UDItype)(n0)), "1" ((UDItype)(n1)), "rm" ((UDItype)(dx))) +#define count_leading_zeros(count, x) \ + do { \ + USItype __cbtmp; \ + ASSERT ((x) != 0); \ + __asm__ ("bsrq %1,%0" : "=r" (__cbtmp) : "rm" ((USItype)(x))); \ + (count) = __cbtmp ^ 63; \ + } while (0) +#define count_trailing_zeros(count, x) \ + do { \ + ASSERT ((x) != 0); \ + __asm__ ("bsfq %1,%0" : "=r" (count) : "rm" ((USItype)(x))); \ + } while (0) #endif /* x86_64 */ #if defined (__i860__) && W_TYPE_SIZE == 32 |