forked from pool/mingw64-winpthreads
43 lines
1.1 KiB
Diff
43 lines
1.1 KiB
Diff
|
--- winpthreads/src/libgcc/dll_math.c 2013-04-10 20:11:34.000000000 +0200
|
||
|
+++ winpthreads/src/libgcc/dll_math.c 2017-05-31 13:02:25.869883546 +0200
|
||
|
@@ -120,6 +120,7 @@
|
||
|
u_quad_t __udivdi3(u_quad_t a, u_quad_t b);
|
||
|
u_quad_t __umoddi3(u_quad_t a, u_quad_t b);
|
||
|
int __ucmpdi2(u_quad_t a, u_quad_t b);
|
||
|
+quad_t __divmoddi4(quad_t a, quad_t b, quad_t *rem);
|
||
|
|
||
|
#endif /* !_LIBKERN_QUAD_H_ */
|
||
|
|
||
|
@@ -546,6 +547,31 @@
|
||
|
(void)__qdivrem(a, b, &r);
|
||
|
return (r);
|
||
|
}
|
||
|
+
|
||
|
+/*
|
||
|
+ * Divide two signed quads.
|
||
|
+ * This function is new in GCC 7.
|
||
|
+ */
|
||
|
+quad_t
|
||
|
+__divmoddi4(a, b, rem)
|
||
|
+ quad_t a, b, *rem;
|
||
|
+{
|
||
|
+ u_quad_t ua, ub, uq, ur;
|
||
|
+ int negq, negr;
|
||
|
+
|
||
|
+ if (a < 0)
|
||
|
+ ua = -(u_quad_t)a, negq = 1, negr = 1;
|
||
|
+ else
|
||
|
+ ua = a, negq = 0, negr = 0;
|
||
|
+ if (b < 0)
|
||
|
+ ub = -(u_quad_t)b, negq ^= 1;
|
||
|
+ else
|
||
|
+ ub = b;
|
||
|
+ uq = __qdivrem(ua, ub, &ur);
|
||
|
+ if (rem)
|
||
|
+ *rem = (negr ? -ur : ur);
|
||
|
+ return (negq ? -uq : uq);
|
||
|
+}
|
||
|
#else
|
||
|
static int __attribute__((unused)) dummy;
|
||
|
#endif /*deined (_X86_) && !defined (__x86_64__)*/
|