2 #include <asm/gentrap.h>
19 xint NAME (uint num, uint den)
21 uint quot = 0, qbit = 1;
26 /* This is really $16, but $16 and $24 are exchanged by a script */
27 register unsigned long cause asm("$24") = GEN_INTDIV;
28 asm volatile("call_pal %0" :: "i" (PAL_gentrap), "r" (cause));
29 return 0; /* If trap returns... */
33 if ( (sint)(num^den) < 0 )
35 if ( (sint)num < 0 ) num = -num;
36 if ( (sint)den < 0 ) den = -den;
39 /* Left-justify denominator and count shift */
40 while ( (sint)den >= 0 ) {
54 v = (xint)(REM ? num : quot);