/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1980 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
/* Portions Copyright(c) 1988, Sun Microsystems Inc. */
/* All Rights Reserved */
/*
* Copyright (c) 1997, by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */
/* LINTLIBRARY */
#include <mp.h>
#include <stdio.h>
#include <stdlib.h>
#include "libmp.h"
void
{
MINT x, y;
int sign;
sign = 1;
_mp_move(a, &x);
_mp_move(b, &y);
if (x.len < 0) {
sign = -1;
}
if (y.len < 0) {
}
_mp_xfree(q);
_mp_xfree(r);
m_div(&x, &y, q, r);
if (sign == -1) {
}
_mp_xfree(&x);
_mp_xfree(&y);
}
static int
{
int borrow;
int s3b2shit;
int j;
#ifdef DEBUGDSB
#endif
borrow = 0;
aptr = a;
bptr = b;
for (j = n; j > 0; j--) {
#ifdef DEBUGDSB
#endif
#ifdef DEBUGDSB
#endif
#ifdef DEBUGDSB
#endif
#ifdef DEBUGDSB
#endif
}
if (s3b2shit == 0) {
#ifdef DEBUGDSB
(void) printf("mdsb 0\n");
#endif
return (0);
}
borrow = 0;
aptr = a;
bptr = b;
for (j = n; j > 0; j--) {
}
#ifdef DEBUGDSB
(void) printf("mdsb 1\n");
#endif
return (1);
}
static int
{
short d;
int x1;
int c1;
d = 077777;
} else {
}
do {
--d;
} while (x1 < 0);
#ifdef DEBUGMTRQ
#endif
return ((int)d + 1);
}
static void
{
MINT u, v, x, w;
short d;
short *qval;
short *uval;
int j;
int qq;
int n;
short v1;
short v2;
if (b->len == 0) {
_mp_fatal("mdiv divide by zero");
return;
}
if (b->len == 1) {
if (r->val[0] == 0) {
r->len = 0;
} else {
r->len = 1;
}
return;
}
q->len = 0;
}
return;
}
x.len = 1;
x.val = &d;
n = b->len;
mp_mult(a, &x, &u); /* subtle: relies on mult allocing extra space */
mp_mult(b, &x, &v);
#ifdef DEBUG_MDIV
#endif
for (j = a->len - n; j >= 0; j--) {
uval[j + n - 2]);
qq -= 1;
}
x.len = n;
_mp_mcan(&x);
#ifdef DEBUG_MDIV
(void) printf(" d(in)=%d\n", (d));
#endif
mp_sdiv(&x, d, &w, &d);
#ifdef DEBUG_MDIV
(void) printf(" d(out)=%d\n", (d));
#endif
qq -= 1;
if (qq == 0)
if (x.len != 0)
_mp_xfree(&u);
_mp_xfree(&v);
}