File: nmul.c

package info (click to toggle)
gcl 2.6.14-21
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 60,864 kB
  • sloc: ansic: 177,407; lisp: 151,509; asm: 128,169; sh: 22,510; cpp: 11,923; tcl: 3,181; perl: 2,930; makefile: 2,360; sed: 334; yacc: 226; lex: 95; awk: 30; fortran: 24; csh: 23
file content (37 lines) | stat: -rwxr-xr-x 657 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "arith.h"

extended_mul(a,b,c,h,l)
unsigned int a,b,c, *h, *l;
{unsigned int temph,templ,ah,al,i;
 ah=0;
 al=0;
 /* in case the shift by 32 does not zero an unsigned int..
  we separate out the first step.*/
 {if (b & 1)
      {temph=0;templ=a;
       ladd(temph,templ,ah,al);}
/*    printf("\n%d b=%d a=%d (%d:%d)",i,b,a,ah,al); */
    b=b>>1;
}
i=1;
 while(b)
   {if (b & 1)
      {lshift(a,i,temph,templ);
       ladd(temph,templ,ah,al);}
     i++;b=b>>1;
     }
 ladd(0,c,ah,al);
  KCLNORMALIZE(ah,al);
   *h=ah;*l=al;
}

#ifndef VSSIZE
try(h,d, h1,l1, qp, rp)
unsigned int d, h, h1,l1,*qp, *rp;
{
extended_mul (h,d,h1,qp,rp);
}
#endif