1: /* Copyright (c) 1982, Regents, University of California */
   2: 
   3: struct vl   { long high; long low; };
   4: long
   5: mlsb(utop,ubot,vtop,nqhat)
   6: register long *utop, *ubot, *vtop;
   7: register nqhat;
   8: {
   9:     register handy, carry;
  10:     struct vl work;
  11: 
  12:     for(carry = 0; utop >= ubot; utop--) {
  13:         emul(nqhat,*--vtop,carry+*utop,&work);
  14:         carry = work.high;
  15:         handy = work.low;
  16:         *utop = handy & 0x3fffffff;
  17:         carry <<= 2;
  18:         if(handy & 0x80000000) carry += 2;
  19:         if(handy & 0x40000000) carry += 1;
  20:     }
  21:     return(carry);
  22: }
  23: long
  24: adback(utop,ubot,vtop)
  25: register long *utop, *ubot, *vtop;
  26: {
  27:     register handy, carry;
  28:     carry = 0;
  29:     for(; utop >= ubot; utop--) {
  30:         carry += *--vtop;
  31:         carry += *utop;
  32:         *utop = carry & 0x3fffffff;
  33:         /* next junk is faster version of  carry >>= 30; */
  34:         handy = carry;
  35:         carry = 0;
  36:         if(handy & 0x80000000) carry -= 2;
  37:         if(handy & 0x40000000) carry += 1;
  38:     }
  39:     return(carry);
  40: }
  41: long dsdiv(top,bot,div)
  42: register long *top, *bot;
  43: register long div;
  44: {
  45:     struct vl work; char err;
  46:     register long handy, carry = 0;
  47:     for(carry = 0;bot <= top; bot++) {
  48:         handy = *bot;
  49:         if(carry & 1) handy |= 0x40000000;
  50:         if(carry & 2) handy |= 0x80000000;
  51:         carry >>= 2;
  52:         work.low = handy;
  53:         work.high = carry;
  54:         *bot = ediv(&work,div,&err);
  55:         carry = work.high;
  56:     }
  57:     return(carry);
  58: }
  59: dsadd1(top,bot)
  60: long *top, *bot;
  61: {
  62:     register long *p, work, carry = 0;
  63: 
  64:     /*
  65: 	 * this assumes canonical inputs
  66: 	 */
  67:     for(p = top; p >= bot; p--) {
  68:         work = *p + carry;
  69:         *p = work & 0x3fffffff;
  70:         carry = 0;
  71:         if (work & 0x40000000) carry += 1;
  72:         if (work & 0x80000000) carry -= 2;
  73:     }
  74:     p[1] = work;
  75: }
  76: long
  77: dsrsh(top,bot,ncnt,mask1)
  78: long *top, *bot;
  79: long ncnt, mask1;
  80: {
  81:     register long *p = bot;
  82:     register r = -ncnt, l = 30+ncnt, carry = 0, work, save;
  83:     long mask = -1 ^ mask1;
  84: 
  85:     while(p <= top) {
  86:         save = work = *p; save &= mask; work >>= r;
  87:         carry <<= l; work |= carry; *p++ = work;
  88:         carry = save;
  89:     }
  90:     return(carry);
  91: }

Defined functions

adback defined in line 23; never used
dsadd1 defined in line 59; never used
dsdiv defined in line 41; never used
dsrsh defined in line 76; never used
mlsb defined in line 4; never used

Defined struct's

vl defined in line 3; used 4 times
  • in line 10(2), 45(2)
Last modified: 1985-08-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 698
Valid CSS Valid XHTML 1.0 Strict