/* void _DivUns10ArrByUns5Arr(c, a, b) * * ARGUMENT * unsigned c[], a[], b[]; * * DESCRIPTION * Divides a 10-word by a 5-word, giving a 5-word, setting c = a / b. * This functions assumes that b > 0 and a / b < 2^79, and will break if * those conditions are not true. The result is always rounded off. * It calls dmbyn and ginc. * * SIDE EFFECTS * a and b may be destroyed, but they are not needed later on. * * RETURNS * None. * * AUTHOR * Jared Levy Aug 5, 1987 * Copyright (C) 1987-1990 Greenleaf Software Inc. All rights reserved. * * MODIFICATIONS * */ #include #include "gm.h" #include "gmsystem.h" void _DivUns10ArrByUns5Arr(c, a, b) unsigned SHORT c[], a[], b[]; { register int m, n; n = 4; while (b[n] == 0 && n>0) n--; if (n == 0) { /* dividing by a 1 digit number */ _DivUnsArrByUnsRound(a, b[0], 6); for (m=0; m<5; m++) c[m]=a[m]; } else { /* dividing by a multi digit number */ m = 9; while (a[m] == 0 && m>0) m--; _DivUnsArrByUnsArr(c, a, m+1, b, n+1, 1); } }