--
--      Inmos Libraries
--      Copyright (C) 1988, 1989, 1990, 1991, 1993  Inmos Limited
--
--      This library is free software; you can redistribute it and/or
--      modify it under the terms of the GNU Lesser General Public
--      License as published by the Free Software Foundation; either
--      version 2 of the License, or (at your option) any later version.
--
--      This library is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--      Lesser General Public License for more details.
--
--      You should have received a copy of the GNU Lesser General Public
--      License along with this library; if not, write to the Free Software
--      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
--

--** @module forall

#IF (TARGET.BITS.PER.WORD = 16)

--{{{  #options and #comments
#OPTION "E V"  -- no compiler libs, no vector space
#COMMENT "T2 compiler library, V1.1 21/02/89"
#COMMENT "(c) Copyright INMOS Limited 1988"
--}}}

#PRAGMA TRANSLATE INT64TIMES "INT64TIMES%CHK"

--{{{  INT64TIMES  T2
INT64 FUNCTION INT64TIMES (VAL INT64 U, V)

  -- Function version (10 Jun 87)

  INT64 Prod :
  VALOF
    [4]INT W RETYPES Prod :
    VAL [4]INT U RETYPES U :
    VAL [4]INT V RETYPES V :
    INT Carry :
    INT Carry1 :
    INT Carry2 :
    SEQ
      Carry,   W[0] := LONGPROD ( U[0],  V[0],  0)
      Carry,   W[1] := LONGPROD ( U[1],  V[0],  Carry)
      Carry,   W[2] := LONGPROD ( U[2],  V[0],  Carry)
      Carry,   W[3] := LONGPROD ( U[3],  V[0],  Carry)
      Carry1,  W[1] := LONGPROD ( U[0],  V[1],  W[1])
      Carry2,  W[2] := LONGPROD ( U[1],  V[1],  W[2])
      Carry,   W[3] := LONGPROD ( U[2],  V[1],  W[3])
      Carry,   W[2] := LONGSUM ( Carry1,  W[2],  0)
      Carry,   W[3] := LONGSUM ( Carry2,  W[3],  Carry)
      Carry1,  W[2] := LONGPROD ( U[0],  V[2],  W[2])
      Carry,   W[3] := LONGPROD ( U[1],  V[2],  W[3])
      Carry,   W[3] := LONGSUM ( Carry1,  W[3],  0)
      Carry2,  W[3] := LONGPROD ( U[0],  V[3],  W[3])
    RESULT Prod
:
--}}}

#ENDIF
