/* 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 "libmp.h"
void
{
MINT x, y, z, w;
_mp_move(a, &x);
_mp_move(b, &y);
while (y.len != 0) {
mp_mdiv(&x, &y, &w, &z);
_mp_move(&y, &x);
_mp_move(&z, &y);
}
_mp_move(&x, c);
_mp_xfree(&x);
_mp_xfree(&y);
_mp_xfree(&z);
_mp_xfree(&w);
}
void
{
MINT q, r;
MINT t;
/*
* Minimize calls to allocators. Don't use pointers for local
* variables, for the one "initialized" multiple precision
* variable, do it just once.
*/
/* invariant: x0*u1 + x1*u2 = u3 */
/* invariant: x0*v1 + x2*v2 = v3 */
/* invariant: x(n+1) = x(n-1) % x(n) */
}
/* now x0*u1 + x1*u2 == 1, therefore, (u2*x1) % x0 == 1 */
}
_mp_xfree(&q);
_mp_xfree(&r);
_mp_xfree(&t);
}