📄 longlong.h
字号:
} while (0)#endif#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("addl %5,%1\n\tadcl %3,%0" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%0" ((USItype) (ah)), \ "g" ((USItype) (bh)), \ "%1" ((USItype) (al)), \ "g" ((USItype) (bl)))#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("subl %5,%1\n\tsbbl %3,%0" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "0" ((USItype) (ah)), \ "g" ((USItype) (bh)), \ "1" ((USItype) (al)), \ "g" ((USItype) (bl)))#define umul_ppmm(w1, w0, u, v) \ __asm__ ("mull %3" \ : "=a" ((USItype) (w0)), \ "=d" ((USItype) (w1)) \ : "%0" ((USItype) (u)), \ "rm" ((USItype) (v)))#define udiv_qrnnd(q, r, n1, n0, dv) \ __asm__ ("divl %4" \ : "=a" ((USItype) (q)), \ "=d" ((USItype) (r)) \ : "0" ((USItype) (n0)), \ "1" ((USItype) (n1)), \ "rm" ((USItype) (dv)))#define count_leading_zeros(count, x) \ do { \ USItype __cbtmp; \ __asm__ ("bsrl %1,%0" \ : "=r" (__cbtmp) : "rm" ((USItype) (x))); \ (count) = __cbtmp ^ 31; \ } while (0)#define count_trailing_zeros(count, x) \ __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x)))#define UMUL_TIME 40#define UDIV_TIME 40#endif /* 80x86 */#if defined (__i960__) && W_TYPE_SIZE == 32#define umul_ppmm(w1, w0, u, v) \ ({union {UDItype __ll; \ struct {USItype __l, __h;} __i; \ } __xx; \ __asm__ ("emul %2,%1,%0" \ : "=d" (__xx.__ll) \ : "%dI" ((USItype) (u)), \ "dI" ((USItype) (v))); \ (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})#define __umulsidi3(u, v) \ ({UDItype __w; \ __asm__ ("emul %2,%1,%0" \ : "=d" (__w) \ : "%dI" ((USItype) (u)), \ "dI" ((USItype) (v))); \ __w; })#endif /* __i960__ */#if defined (__M32R__) && W_TYPE_SIZE == 32#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ /* The cmp clears the condition bit. */ \ __asm__ ("cmp %0,%0\n\taddx %%5,%1\n\taddx %%3,%0" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%0" ((USItype) (ah)), \ "r" ((USItype) (bh)), \ "%1" ((USItype) (al)), \ "r" ((USItype) (bl)) \ : "cbit")#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ /* The cmp clears the condition bit. */ \ __asm__ ("cmp %0,%0\n\tsubx %5,%1\n\tsubx %3,%0" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "0" ((USItype) (ah)), \ "r" ((USItype) (bh)), \ "1" ((USItype) (al)), \ "r" ((USItype) (bl)) \ : "cbit")#endif /* __M32R__ */#if defined (__mc68000__) && W_TYPE_SIZE == 32#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("add%.l %5,%1\n\taddx%.l %3,%0" \ : "=d" ((USItype) (sh)), \ "=&d" ((USItype) (sl)) \ : "%0" ((USItype) (ah)), \ "d" ((USItype) (bh)), \ "%1" ((USItype) (al)), \ "g" ((USItype) (bl)))#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("sub%.l %5,%1\n\tsubx%.l %3,%0" \ : "=d" ((USItype) (sh)), \ "=&d" ((USItype) (sl)) \ : "0" ((USItype) (ah)), \ "d" ((USItype) (bh)), \ "1" ((USItype) (al)), \ "g" ((USItype) (bl)))/* The '020, '030, '040 and CPU32 have 32x32->64 and 64/32->32q-32r. */#if defined (__mc68020__) || defined(mc68020) \ || defined(__mc68030__) || defined(mc68030) \ || defined(__mc68040__) || defined(mc68040) \ || defined(__mcpu32__) || defined(mcpu32)#define umul_ppmm(w1, w0, u, v) \ __asm__ ("mulu%.l %3,%1:%0" \ : "=d" ((USItype) (w0)), \ "=d" ((USItype) (w1)) \ : "%0" ((USItype) (u)), \ "dmi" ((USItype) (v)))#define UMUL_TIME 45#define udiv_qrnnd(q, r, n1, n0, d) \ __asm__ ("divu%.l %4,%1:%0" \ : "=d" ((USItype) (q)), \ "=d" ((USItype) (r)) \ : "0" ((USItype) (n0)), \ "1" ((USItype) (n1)), \ "dmi" ((USItype) (d)))#define UDIV_TIME 90#define sdiv_qrnnd(q, r, n1, n0, d) \ __asm__ ("divs%.l %4,%1:%0" \ : "=d" ((USItype) (q)), \ "=d" ((USItype) (r)) \ : "0" ((USItype) (n0)), \ "1" ((USItype) (n1)), \ "dmi" ((USItype) (d)))#else /* not mc68020 */#if !defined(__mcf5200__)/* %/ inserts REGISTER_PREFIX, %# inserts IMMEDIATE_PREFIX. */#define umul_ppmm(xh, xl, a, b) \ __asm__ ("| Inlined umul_ppmm\n" \ " move%.l %2,%/d0\n" \ " move%.l %3,%/d1\n" \ " move%.l %/d0,%/d2\n" \ " swap %/d0\n" \ " move%.l %/d1,%/d3\n" \ " swap %/d1\n" \ " move%.w %/d2,%/d4\n" \ " mulu %/d3,%/d4\n" \ " mulu %/d1,%/d2\n" \ " mulu %/d0,%/d3\n" \ " mulu %/d0,%/d1\n" \ " move%.l %/d4,%/d0\n" \ " eor%.w %/d0,%/d0\n" \ " swap %/d0\n" \ " add%.l %/d0,%/d2\n" \ " add%.l %/d3,%/d2\n" \ " jcc 1f\n" \ " add%.l %#65536,%/d1\n" \ "1: swap %/d2\n" \ " moveq %#0,%/d0\n" \ " move%.w %/d2,%/d0\n" \ " move%.w %/d4,%/d2\n" \ " move%.l %/d2,%1\n" \ " add%.l %/d1,%/d0\n" \ " move%.l %/d0,%0" \ : "=g" ((USItype) (xh)), \ "=g" ((USItype) (xl)) \ : "g" ((USItype) (a)), \ "g" ((USItype) (b)) \ : "d0", "d1", "d2", "d3", "d4")#define UMUL_TIME 100#define UDIV_TIME 400#endif /* not mcf5200 */#endif /* not mc68020 *//* The '020, '030, '040 and '060 have bitfield insns. */#if defined (__mc68020__) || defined(mc68020) \ || defined(__mc68030__) || defined(mc68030) \ || defined(__mc68040__) || defined(mc68040) \ || defined(__mc68060__) || defined(mc68060)#define count_leading_zeros(count, x) \ __asm__ ("bfffo %1{%b2:%b2},%0" \ : "=d" ((USItype) (count)) \ : "od" ((USItype) (x)), "n" (0))#endif#endif /* mc68000 */#if defined (__m88000__) && W_TYPE_SIZE == 32#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "%rJ" ((USItype) (ah)), \ "rJ" ((USItype) (bh)), \ "%rJ" ((USItype) (al)), \ "rJ" ((USItype) (bl)))#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ __asm__ ("subu.co %1,%r4,%r5\n\tsubu.ci %0,%r2,%r3" \ : "=r" ((USItype) (sh)), \ "=&r" ((USItype) (sl)) \ : "rJ" ((USItype) (ah)), \ "rJ" ((USItype) (bh)), \ "rJ" ((USItype) (al)), \ "rJ" ((USItype) (bl)))#define count_leading_zeros(count, x) \ do { \ USItype __cbtmp; \ __asm__ ("ff1 %0,%1" \ : "=r" (__cbtmp) \ : "r" ((USItype) (x))); \ (count) = __cbtmp ^ 31; \ } while (0)#define COUNT_LEADING_ZEROS_0 63 /* sic */#if defined (__mc88110__)#define umul_ppmm(wh, wl, u, v) \ do { \ union {UDItype __ll; \ struct {USItype __h, __l;} __i; \ } __xx; \ __asm__ ("mulu.d %0,%1,%2" \ : "=r" (__xx.__ll) \ : "r" ((USItype) (u)), \ "r" ((USItype) (v))); \ (wh) = __xx.__i.__h; \ (wl) = __xx.__i.__l; \ } while (0)#define udiv_qrnnd(q, r, n1, n0, d) \ ({union {UDItype __ll; \ struct {USItype __h, __l;} __i; \ } __xx; \ USItype __q; \ __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ __asm__ ("divu.d %0,%1,%2" \ : "=r" (__q) \ : "r" (__xx.__ll), \ "r" ((USItype) (d))); \ (r) = (n0) - __q * (d); (q) = __q; })#define UMUL_TIME 5#define UDIV_TIME 25#else#define UMUL_TIME 17#define UDIV_TIME 150#endif /* __mc88110__ */#endif /* __m88000__ */#if defined (__mips__) && W_TYPE_SIZE == 32#define umul_ppmm(w1, w0, u, v) \ __asm__ ("multu %2,%3" \ : "=l" ((USItype) (w0)), \ "=h" ((USItype) (w1)) \ : "d" ((USItype) (u)), \ "d" ((USItype) (v)))#define UMUL_TIME 10#define UDIV_TIME 100#endif /* __mips__ */#if defined (__ns32000__) && W_TYPE_SIZE == 32#define umul_ppmm(w1, w0, u, v) \ ({union {UDItype __ll; \ struct {USItype __l, __h;} __i; \ } __xx; \ __asm__ ("meid %2,%0" \ : "=g" (__xx.__ll) \ : "%0" ((USItype) (u)), \ "g" ((USItype) (v))); \ (w1) = __xx.__i.__h; (w0) = __xx.__i.__l;})#define __umulsidi3(u, v) \ ({UDItype __w; \ __asm__ ("meid %2,%0" \ : "=g" (__w) \ : "%0" ((USItype) (u)), \ "g" ((USItype) (v))); \ __w; })#define udiv_qrnnd(q, r, n1, n0, d) \ ({union {UDItype __ll; \ struct {USItype __l, __h;} __i; \ } __xx; \ __xx.__i.__h = (n1); __xx.__i.__l = (n0); \ __asm__ ("deid %2,%0" \ : "=g" (__xx.__ll) \ : "0" (__xx.__ll), \ "g" ((USItype) (d))); \ (r) = __xx.__i.__l; (q) = __xx.__i.__h; })#define count_trailing_zeros(count,x) \ do { \ __asm__ ("ffsd %2,%0" \ : "=r" ((USItype) (count)) \ : "0" ((USItype) 0), \ "r" ((USItype) (x))); \ } while (0)#endif /* __ns32000__ *//* FIXME: We should test _IBMR2 here when we add assembly support for the system vendor compilers. FIXME: What's needed for gcc PowerPC VxWorks? __vxworks__ is not good enough, since that hits ARM and m68k too. */#if (defined (_ARCH_PPC) /* AIX */ \ || defined (_ARCH_PWR) /* AIX */ \ || defined (_ARCH_COM) /* AIX */ \ || defined (__powerpc__) /* gcc */ \ || defined (__POWERPC__) /* BEOS */ \ || defined (__ppc__) /* Darwin */ \ || defined (PPC) /* GNU/Linux, SysV */ \ ) && W_TYPE_SIZE == 32#define add_ssaaaa(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (bh) && (bh) == 0) \ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\ else \ __asm__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %0,%2,%3" \ : "=r" (sh), "=&r" (sl) \ : "%r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \ } while (0)#define sub_ddmmss(sh, sl, ah, al, bh, bl) \ do { \ if (__builtin_constant_p (ah) && (ah) == 0) \ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == 0) \ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\ else \ __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \ : "=r" (sh), "=&r" (sl) \ : "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -