/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: b_tcom.c,v 1.2 1997/09/25 17:08:51 ae59 Exp $ */
/*
$Log: b_tcom.c,v $
 * Revision 1.2  1997/09/25  17:08:51  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:21:48  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_tcom.c                              */
/*                                                              */
/*      Entries         : void b_tcom(a,expo,mant,vz)           */
/*                        tenbyte *a;                           */
/*                        a_intg *expo;                         */
/*                        a_btyp mant[BSIZE];                   */
/*                        a_bool  *vz;                          */
/*                                                              */
/*      Arguments       : a = tenbyte value                     */
/*                        expo = exponent                       */
/*                        mant = mantissa                       */
/*                        vz = sign                             */
/*                                                              */
/*      Description     : Composition of a tenbyte value.       */
/*                                                              */
/*      Date            : 1992-07-22                            */
/*      1992-07-22 : cast to unsigned char at a->c assignm.=b=  */
/*      1991-06-20 : new routine                                */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void b_tcom(tenbyte *a,a_intg expo,a_btyp *mant,a_bool  vz)
#else
local void b_tcom(a,expo,mant,vz)

tenbyte *a;
a_btyp mant[BSIZE];
a_intg expo;
a_bool  vz;
#endif
        {
        E_TPUSH("b_tcom")

        /* mantissa of real value                               */
#if O_P_4
        a->c[0] = (unsigned char) (mant[1] & tMASK); mant[1] >>= tSHIFT;
        a->c[1] = (unsigned char) (mant[1] & tMASK); mant[1] >>= tSHIFT;
        a->c[2] = (unsigned char) (mant[1] & tMASK); mant[1] >>= tSHIFT;
        a->c[3] = (unsigned char) (mant[1] & tMASK);
        a->c[4] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[5] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[6] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[7] = (unsigned char) (mant[0] & tMASK);
#else
        a->c[9] = (unsigned char) (mant[1] & tMASK) ; mant[1] >>= tSHIFT;
        a->c[8] = (unsigned char) (mant[1] & tMASK); mant[1] >>= tSHIFT;
        a->c[7] = (unsigned char) (mant[1] & tMASK); mant[1] >>= tSHIFT;
        a->c[6] = (unsigned char) (mant[1] & tMASK);
        a->c[5] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[4] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[3] = (unsigned char) (mant[0] & tMASK); mant[0] >>= tSHIFT;
        a->c[2] = (unsigned char) (mant[0] & tMASK);
#endif

        expo += tCHARAC;

        /* exponent of real value                               */
#if O_P_4
        a->c[8] = (unsigned char) (expo & tMASK);  expo >>= tSHIFT;
        a->c[9] = (unsigned char) (expo & tMASK);
#else
        a->c[1] = (unsigned char) (expo & tMASK);  expo >>= tSHIFT;
        a->c[0] = (unsigned char) (expo & tMASK);
#endif

        /* sign of real value                                   */
#if O_P_4
        if (vz) a->c[9] |= tMSB;
#else
        if (vz) a->c[0] |= tMSB;
#endif

        E_TPOPP("b_tcom")
        return;
        }
