]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/mini-os.git/commitdiff
stubdom: fix x86_32 compilation by __moddi3 from FreeBSD
authorKeir Fraser <keir.fraser@citrix.com>
Tue, 26 Feb 2008 15:11:07 +0000 (15:11 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Tue, 26 Feb 2008 15:11:07 +0000 (15:11 +0000)
(like has been done previously for umoddi3 etc.)

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
lib/math.c

index 807bcc8e0decdf89e589a84bb1553b271e423278..f1f7826080fa6d361c841bf78747430e9411c867 100644 (file)
@@ -388,6 +388,29 @@ __umoddi3(u_quad_t a, u_quad_t b)
         return (r);
 }
 
+/*
+ * Return remainder after dividing two signed quads.
+ *
+ * XXX
+ * If -1/2 should produce -1 on this machine, this code is wrong.
+ */
+quad_t
+__moddi3(quad_t a, quad_t b)
+{
+       u_quad_t ua, ub, ur;
+       int neg;
+
+       if (a < 0)
+               ua = -(u_quad_t)a, neg = 1;
+       else
+               ua = a, neg = 0;
+       if (b < 0)
+               ub = -(u_quad_t)b;
+       else
+               ub = b;
+       (void)__qdivrem(ua, ub, &ur);
+       return (neg ? -ur : ur);
+}
 #endif /* !defined(__ia64__) */
 
 #ifndef HAVE_LIBC