/**************************************************************************/
/*                                                                        */
/*                                 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.              */
/*                                                                        */
/**************************************************************************/

#ifndef _BIT64_
#define _BIT64_
/* RCS $Id: b_64bt.h,v 1.2 1997/09/25 16:42:24 ae59 Exp $ */
/*
$Log: b_64bt.h,v $
 * Revision 1.2  1997/09/25  16:42:24  ae59
 * Copyright-message
 *
 * Revision 1.1  1995/06/28  11:56:57  ae59
 * Initial revision
 *
 * Revision 1.4  1995/06/23  08:02:27  ae59
 * added function counters for testing, add files to complete native
 * C interface.
 *
 * Revision 1.3  1995/05/11  15:10:43  ae59
 * inlined 64 bit version is running now
 *
 * Revision 1.2  1995/05/10  09:45:37  ae59
 * inlining finished, 64 bit version added
 *
 * Revision 1.1  1995/04/10  09:29:19  ae59
 * removed api oriented files, inlined all b_ routines, add 64 bit api
 *
 * Revision 1.1  1995/02/01  08:12:17  ae59
 * File introduced to CVS version control
 *
 * Revision 1.2  1994/10/25  11:04:47  ae59
 * add Shortabtyp for 64 bit systems
 *
 * Revision 1.1  1994/01/27  13:21:21  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_defs.h                              */
/*                                                              */
/*      Date            : 1992-01-24                            */
/*      1992-01-24 : MOD_BITS_PER_CHAR/LOG_BITS_PER_CHAR        */
/*      1991-06-20 : constants for tenbyte arithmetic           */
/*      1991-02-25 : DIRNAME_LENGTH defined                     */
/*      1991-01-15 : FPPLT defined                              */
/****************************************************************/

/*    Number of bits forming a 'a_btyp' value.                  */
/*    This number must be 32.                                   */
#define B_LENGTH_64                64
#define LOG_B_LENGTH_64            6

/*    Number of bits forming an 'a_intg' value.                 */
/*    This number must be less than or equal to B_LENGTH.       */
#define I_LENGTH_64                64      

#define MAXINT_64                  ((a_intg)0x7FFFFFFFFFFFL)

#define MININT_64                  ((a_intg)0x800000000000L)

/*------ constants of type 'a_btyp' ----------------------------*/

/*    Mask for upper half of a_btyp value.                      */
#define HIGH_MASK_64               ((a_btyp_64)0xFFFFFFFF00000000ul)

/*    Mask for lower half of a_btyp value.                      */
#define LOW_MASK_64                ((a_btyp_64)0x00000000FFFFFFFFl)

/*    Mask for least significant bit position of a_btyp value.  */
#define LSB_64                     ((a_btyp_64)0x0000000000000001l)

/*    Maximum possible a_btyp value.                            */
#define MAX_BASETYPE_64            ((a_btyp_64)0xFFFFFFFFFFFFFFFFul)

/*    Mask for most significant bit position of a_btyp value.   */
#define MSB_64                     ((a_btyp_64)0x8000000000000000ul)

/*    Inverse mask for most significant bit position of         */
/*    a_btyp value.                                             */
#define NOT_MSB_64                 ((a_btyp_64)0x7FFFFFFFFFFFFFFFl)

#define GETHIGH_64(x)			(((x) >> (B_LENGTH_64/2)) & LOW_MASK_64)
#define GETLOW_64(x)			((x) & LOW_MASK_64)

/* RCS $Id: b_64bt.h,v 1.2 1997/09/25 16:42:24 ae59 Exp $ */
/*
$Log: b_64bt.h,v $
 * Revision 1.2  1997/09/25  16:42:24  ae59
 * Copyright-message
 *
 * Revision 1.1  1995/06/28  11:56:57  ae59
 * Initial revision
 *
 * Revision 1.4  1995/06/23  08:02:27  ae59
 * added function counters for testing, add files to complete native
 * C interface.
 *
 * Revision 1.3  1995/05/11  15:10:43  ae59
 * inlined 64 bit version is running now
 *
 * Revision 1.2  1995/05/10  09:45:37  ae59
 * inlining finished, 64 bit version added
 *
 * Revision 1.1  1995/04/10  09:29:19  ae59
 * removed api oriented files, inlined all b_ routines, add 64 bit api
 *
 * Revision 1.1  1995/02/01  08:13:24  ae59
 * File introduced to CVS version control
 *
 * Revision 1.2  1994/11/15  11:05:09  ae59
 * increment A_LENGTH in case of DEC_ARITh
 *
 * Revision 1.1  1994/01/27  13:22:02  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : d_defs.h                              */
/*                                                              */
/*      Date            : 1990-10-08                            */
/*      1990-10-08 : A_MZERO, A_PZERO defined                   */
/****************************************************************/

/*    Number of 'a_btyp' values used for fraction part.         */
#define A_F_LENGTH_64              (A_F_BITS/B_LENGTH_64+1)

/*    Number of 'a_btyp' values used for integer part.          */
#define A_I_LENGTH_64              (A_I_BITS/B_LENGTH_64+1)

#define A_LENGTH_64                (A_I_LENGTH_64+A_F_LENGTH_64+A_START)

/*    Offset to least significant 'a_btyp'-digit of integer     */
/*    part.                                                     */
#define A_D_P_64                   (A_START+A_I_LENGTH_64-1)

/*    Offset to least significant 'a_btyp' digit of integer     */
/*    part if dotprecision is interpreted as character array.   */
#define B_D_P_64                   (A_D_P_64*sizeof(a_btyp_64))


/* RCS $Id: b_64bt.h,v 1.2 1997/09/25 16:42:24 ae59 Exp $ */
/*
$Log: b_64bt.h,v $
 * Revision 1.2  1997/09/25  16:42:24  ae59
 * Copyright-message
 *
 * Revision 1.1  1995/06/28  11:56:57  ae59
 * Initial revision
 *
 * Revision 1.4  1995/06/23  08:02:27  ae59
 * added function counters for testing, add files to complete native
 * C interface.
 *
 * Revision 1.3  1995/05/11  15:10:43  ae59
 * inlined 64 bit version is running now
 *
 * Revision 1.2  1995/05/10  09:45:37  ae59
 * inlining finished, 64 bit version added
 *
 * Revision 1.1  1995/04/10  09:29:19  ae59
 * removed api oriented files, inlined all b_ routines, add 64 bit api
 *
 * Revision 1.1  1995/02/01  08:13:24  ae59
 * File introduced to CVS version control
 *
 * Revision 1.2  1994/10/25  11:09:30  ae59
 * add shortabtyp for 64 bit systems
 *
 * Revision 1.1  1994/01/27  13:23:54  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : r_defs.h                              */
/*                                                              */
/*      Date            : 1991-09-17                            */
/*      1991-09-17 : add parantheses in negative makro          */
/*      1991-01-28 : EXPONENT_E / DECIMAL_POINT                 */
/*                   MINUS_SIGN / PLUS_SIGN                     */
/*      1990-08-02 : long constants marked by L                 */
/****************************************************************/

/*    Mask for extracting exponent of IEEE value.               */
#define EXPO_MASK_64               ((a_btyp_64)0x7FF0000000000000l)
/*    Number of bit positions needed to shift the exponent      */
/*    of an IEEE value within a 'a_btyp' value most right.      */
#define EXPO_SHIFT_64              (B_LENGTH_64-ZERO_BITS)

/*    Mask for hidden mantissa bit if IEEE value is equivalenced*/
/*    with an array of type 'a_btyp'.                           */
#define HIDDEN_BIT_64              ((a_btyp_64)0x0010000000000000l)

/*    Mask for mantissa bits in most significant 'a_btyp'       */
/*    value if IEEE value is equivalenced with an array of type */
/*    'a_btyp'.                                                 */
#define MANT_64               	((a_btyp_64)0x000FFFFFFFFFFFFFl)

/*    Inverse mask for hidden mantissa bit if IEEE value is     */
/*    equivalenced with an array of type 'a_btyp'.              */
#define NOT_HIDDEN_BIT_64          ((a_btyp_64)0xFFEFFFFFFFFFFFFFul)

/*    Character used as plus sign.                              */
#define PLUS_SIGN               '+'

/*    Mask for bit positions which nether hold a hidden or      */
/*    visible mantissa bit if IEEE value is equivalenced with   */
/*    an array of type 'a_btyp'.                                */
#define SHFT_MASK_64               ((a_btyp_64)0xFFE0000000000000ul)
#define D_U_RATIO_64			(sizeof(a_real)/sizeof(a_btyp_64))
#define BSIZE_64				(2*D_U_RATIO_64+1)
#define ASSERT(a) 


/*    Clear all bits of a 'a_btyp' array.                       */
/*    Actual argument s must not be an expression.              */
#if O_P_1
#define B_CLEAR_64(s,n)    { \
        (void)memset((char *)(s),(int)'\0',(size_t)((n)*sizeof(a_btyp_64)));}
#else
#define B_CLEAR_64(s,n) {size_t _; _=n; while(--_>=0) (s)[_]=ZERO;}
#endif

/*    Copy all bits of a 'a_btyp'/'char' array from left to right.     */
/*    Actual arguments d and s must not be expressions.                */
#if O_P_2
#define B_COPY_64(d,s,n)   { \
        (void)memcpy((char *)(d),(char *)(s),(size_t)((n)*sizeof(a_btyp_64)));}
#else
#define B_COPY_64(d,s,n) {size_t _; _=n; while(--_>=0) (d)[_]=(s)[_];}
#endif

/****************************************************************/
/*                                                              */
/*      Filename        : e_defs.h                              */
/*                                                              */
/*      Date            : 1993-02-16                            */
/*      1993-02-16 : update from Dr. cordes =b=                 */
/*      1992-12-26 : E_TLNG defined for extended long format    */
/*      1992-07-21 : add sun4_gnuc and sun4_cpp switch =b=      */
/*      1992-06-09 : new macro SET_SIGNAL (r_valu)              */
/*      1992-02-26 : (char *) in e_push() =b=                   */
/*      1992-01-22 : (a_char *) in e_push()                     */
/*      1992-01-16 : replace e_renv by o_text[6]                */
/*      1991-11-14 : new macros E_SPUSH(),E_SPOPP()             */
/*      1991-04-33 : MANT_INFINITY for infinity detection       */
/*      1991-02-13 : new data characterization E_TSTG           */
/*      1991-01-23 : E_TEXT must be defined with E_TRES         */
/****************************************************************/

/*    Macro for testing for a signaling NaN                     */
#define SIGNAL_BIT_64              ((a_btyp_64)0x0008000000000000ul)
#define SIGNALING_64(a)            ((a) & SIGNAL_BIT_64)
#define SET_QUIET_64(a)            ((a) & ~SIGNAL_BIT_64)
#define SET_SIGNAL_64(a)		((a) | SIGNAL_BIT_64)

/*    Macro for testing for a mantissa used for infinity        */
#define MANT_INFINITY_64(a)        ((a) == HIDDEN_BIT_64)

typedef long int a_intg_64;
#define ZERO_64 				0x0ul
#endif

