1: /* Copyright (c) 1982, Regents, University of California */
2: struct vl { long high; long low; };
3: calqhat(uj,v1)
4: register long *uj, *v1;
5: {
6: struct vl work1, work2;
7: register handy, handy2;
8: register qhat, rhat;
9: char err;
10: if(*v1==*uj) {
11: /* set qhat to b-1
12: * rhat is easily calculated since if we substite b-1
13: * for qhat in the formula below, one gets (u[j+1] + v[1])
14: */
15: qhat = 0x3fffffff;
16: rhat = uj[1] + *v1;
17: } else {
18: /* work1 = u[j]b + u[j+1]; */
19: handy2 = uj[1];
20: handy = *uj;
21: if(handy & 1) handy2 |= 0x40000000;
22: if(handy & 2) handy2 |= 0x80000000;
23: handy >>= 2;
24: work1.low = handy2; work1.high = handy;
25: qhat = ediv(&work1,*v1,&err);
26: /* rhat = work1 - qhat*v[1]; */
27: rhat = work1.high;
28: }
29: again:
30: /* check if v[2]*qhat > rhat*b+u[j+2] */
31: emul(qhat,v1[1],0,&work1);
32: /* work2 = rhat*b+u[j+2]; */
33: { handy2 = uj[2]; handy = rhat;
34: if(handy & 1) handy2 |= 0x40000000;
35: if(handy & 2) handy2 |= 0x80000000;
36: handy >>= 2; work2.low = handy2; work2.high = handy; }
37: vlsub(&work1,&work2);
38: if(work1.high <= 0) return(qhat);
39: qhat--; rhat += *v1;
40: goto again;
41: }
Defined functions
Defined struct's
vl
defined in line
2; used 2 times