2
/* Copyright (C) 1994 W. Schelter
4
This file is part of GNU Common Lisp, herein referred to as GCL
6
GCL is free software; you can redistribute it and/or modify it under
7
the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
8
the Free Software Foundation; either version 2, or (at your option)
11
GCL is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16
You should have received a copy of the GNU library general public
17
license along with GCL; see the file COPYING. If not, write to the
18
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27
(y = mulul3(a,b,&hiremainder), hiremainder:y == a*b) is TRUE.
29
#ifdef USE_WORD_MULUL3
31
int mulul3(x,y,hiremainder)
32
ulong x,y,*hiremainder;
34
ulong xlo,xhi,ylo,yhi;
37
xlo=x&65535;xhi=x>>16;ylo=y&65535;yhi=y>>16;
38
z=addll(xlo*yhi,xhi*ylo);
39
*hiremainder=(overflow)?xhi*yhi+65536+(z>>16):xhi*yhi+(z>>16);
40
z=addll(xlo*ylo,(z<<16));*hiremainder+=overflow;
48
{unsigned int temph,templ,ah,al,i;
51
/* in case the shift by 32 does not zero an unsigned int..
52
we separate out the first step.*/
55
lladd(temph,templ,ah,al);}
56
/* printf("\n%d b=%d a=%d (%d:%d)",i,b,a,ah,al); */
62
{llshift(a,i,temph,templ);
63
lladd(temph,templ,ah,al);}