Annotation of OpenXM_contrib2/windows/pari20/win32/parigen.h, Revision 1.1
1.1 ! noro 1: /******************************************************************/
! 2: /* This file defines the parameters of the GEN type */
! 3: /* $Id: parigen.h,v 1.1.1.1 1999/09/16 13:47:45 karim Exp $ */
! 4:
! 5: typedef long *GEN;
! 6: typedef int (*QSCOMP)(const void *, const void *);
! 7: #ifdef ULONG_NOT_DEFINED
! 8: typedef unsigned long ulong;
! 9: #endif
! 10:
! 11: #ifdef __M68K__
! 12: # define OLD_CODES
! 13: #endif
! 14:
! 15: #ifdef LONG_IS_64BIT
! 16: # define MAXULONG (0xffffffffffffffffUL)
! 17: # define MAXHALFULONG (0x00000000ffffffffUL)
! 18: # define HIGHBIT (0x8000000000000000UL)
! 19: # define HIGHMASK (0xffffffff00000000UL)
! 20: # define LOWMASK (0x00000000ffffffffUL)
! 21: # define SMALL_MASK (0x4000000000000000UL)
! 22:
! 23: # define DEFAULTPREC 3
! 24: # define MEDDEFAULTPREC 4
! 25: # define BIGDEFAULTPREC 5
! 26: # define TWOPOTBYTES_IN_LONG 3
! 27: # define TWOPOTBITS_IN_LONG 6
! 28: # define BYTES_IN_LONG 8
! 29: # define BITS_IN_LONG 64
! 30: # define BITS_IN_HALFULONG 32
! 31: /* For a 64-bit random generator, change the following 32 to 64 */
! 32: # define BITS_IN_RANDOM 32
! 33:
! 34: #else
! 35:
! 36: # define MAXULONG (0xffffffffUL)
! 37: # define MAXHALFULONG (0x0000ffffUL)
! 38: # define HIGHBIT (0x80000000UL)
! 39: # define HIGHMASK (0xffff0000UL)
! 40: # define LOWMASK (0x0000ffffUL)
! 41: # define SMALL_MASK (0x40000000UL)
! 42:
! 43: # define DEFAULTPREC 4
! 44: # define MEDDEFAULTPREC 6
! 45: # define BIGDEFAULTPREC 8
! 46: # define TWOPOTBYTES_IN_LONG 2
! 47: # define TWOPOTBITS_IN_LONG 5
! 48: # define BYTES_IN_LONG 4
! 49: # define BITS_IN_LONG 32
! 50: # define BITS_IN_HALFULONG 16
! 51: # define BITS_IN_RANDOM 32
! 52: #endif
! 53:
! 54: #ifndef LONG_IS_64BIT
! 55: /* second codeword x[1], for types: INT,REAL,PADIC,POL,SER */
! 56: # define EXPOBITS (0x00ffffffUL)
! 57: # define HIGHEXPOBIT (0x00800000L)
! 58: # define LGEFBITS (0x0000ffffUL)
! 59: # define VALPBITS (0x0000ffffUL) /* used only for type PADIC */
! 60: # define HIGHVALPBIT (0x00008000L) /* used only for type PADIC, SER */
! 61: # define PRECPBITS (0xffff0000UL) /* used only for type PADIC */
! 62: # define PRECPSHIFT 16
! 63: # define VARNSHIFT 16
! 64:
! 65: # ifndef OLD_CODES
! 66: # define SIGNBITS (0xc0000000UL)
! 67: # define VARNBITS (0x3fff0000UL)
! 68: # define LGEFINTBITS (0x00ffffffUL)
! 69: # define SIGNSHIFT 30
! 70: # define MAXVARN 16383
! 71: # else
! 72: # define SIGNBITS (0xff000000UL)
! 73: # define VARNBITS (0x00ff0000UL)
! 74: # define LGEFINTBITS (0x0000ffffUL)
! 75: # define SIGNSHIFT 24
! 76: # define MAXVARN 255
! 77: # endif
! 78:
! 79: /* first codeword x[0] */
! 80: # ifndef OLD_CODES
! 81: # define TYPBITS (0xfe000000UL)
! 82: # define CLONEBIT (0x01000000UL)
! 83: # define LGBITS (0x00ffffffUL)
! 84: # define TYPSHIFT 25
! 85: # else
! 86: # define TYPBITS (0xff000000UL)
! 87: # define CLONEBIT (0x00010000UL)
! 88: # define LGBITS (0x0000ffffUL)
! 89: # define TYPSHIFT 24
! 90: # endif
! 91: #endif
! 92:
! 93: #ifdef LONG_IS_64BIT
! 94: /* first codeword x[0] */
! 95: # define TYPBITS (0xffff000000000000UL)
! 96: # define CLONEBIT (0x0000000100000000UL)
! 97: # define LGBITS (0x00000000ffffffffUL)
! 98: # define TYPSHIFT 48
! 99:
! 100: /* second codeword x[1] */
! 101: # define SIGNBITS (0xffff000000000000UL)
! 102: # define VARNBITS (0x0000ffff00000000UL)
! 103: # define LGEFBITS (0x00000000ffffffffUL)
! 104: # define SIGNSHIFT 48
! 105: # define MAXVARN 65535
! 106:
! 107: # define EXPOBITS (0x0000ffffffffffffUL)
! 108: # define HIGHEXPOBIT (0x0000800000000000L)
! 109: # define LGEFINTBITS (0x00000000ffffffffUL)
! 110: # define VALPBITS (0x00000000ffffffffUL)
! 111: # define HIGHVALPBIT (0x0000000080000000L)
! 112: # define PRECPBITS (0xffffffff00000000UL)
! 113: # define PRECPSHIFT 32
! 114: # define VARNSHIFT 32
! 115: #endif
! 116:
! 117: #define evaltyp(x) (((ulong)(x)) << TYPSHIFT)
! 118: #define evalvarn(x) (((ulong)(x)) << VARNSHIFT)
! 119: #define evalsigne(x) (((long)(x)) << SIGNSHIFT)
! 120: #define evalprecp(x) (((long)(x)) << PRECPSHIFT)
! 121: #define evalexpo(x) (HIGHEXPOBIT + (x))
! 122: #define evalvalp(x) (HIGHVALPBIT + (x))
! 123: #define evallgefint(x) (x)
! 124: #define m_evallg(x) (x)
! 125: #define m_evallgef(x) (x)
! 126:
! 127: #define typ(x) ((((long)(x))&1)? t_SMALL: (((ulong) ((GEN) (x))[0]) >> TYPSHIFT))
! 128: #define settyp(x,s) (((GEN)(x))[0]=\
! 129: (((GEN)(x))[0]&(~TYPBITS)) | evaltyp(s))
! 130: #define smalltos(x) (((long)(x))>>1)
! 131:
! 132: #define isclone(x) (((GEN) (x))[0] & CLONEBIT)
! 133: #define setisclone(x) (((GEN) (x))[0] |= CLONEBIT)
! 134: #define unsetisclone(x) (((GEN) (x))[0] &= (~CLONEBIT))
! 135:
! 136: #define lg(x) ((((long)(x))&1)?1: ((long) (((GEN) (x))[0] & LGBITS)))
! 137: #define setlg(x,s) (((GEN)(x))[0]=\
! 138: (((GEN)(x))[0]&(~LGBITS)) | evallg(s))
! 139:
! 140: #define signe(x) (((long) ((GEN) (x))[1]) >> SIGNSHIFT)
! 141: #define setsigne(x,s) (((GEN)(x))[1]=\
! 142: (((GEN)(x))[1]&(~SIGNBITS)) | evalsigne(s))
! 143:
! 144: #define lgef(x) ((long) (((GEN) (x))[1] & LGEFBITS))
! 145: #define setlgef(x,s) (((GEN)(x))[1]=\
! 146: (((GEN)(x))[1]&(~LGEFBITS)) | evallgef(s))
! 147:
! 148: #define lgefint(x) ((long) (((GEN) (x))[1] & LGEFINTBITS))
! 149: #define setlgefint(x,s) (((GEN)(x))[1]=\
! 150: (((GEN)(x))[1]&(~LGEFINTBITS)) | evallgefint(s))
! 151:
! 152: #define expo(x) ((long) ((((GEN) (x))[1] & EXPOBITS) - HIGHEXPOBIT))
! 153: #define setexpo(x,s) (((GEN)(x))[1]=\
! 154: (((GEN)(x))[1]&(~EXPOBITS)) | evalexpo(s))
! 155:
! 156: #define valp(x) ((long) ((((GEN)(x))[1] & VALPBITS) - HIGHVALPBIT))
! 157: #define setvalp(x,s) (((GEN)(x))[1]=\
! 158: (((GEN)(x))[1]&(~VALPBITS)) | evalvalp(s))
! 159:
! 160: #define precp(x) ((long) (((ulong) ((GEN) (x))[1]) >> PRECPSHIFT))
! 161: #define setprecp(x,s) (((GEN)(x))[1]=\
! 162: (((GEN)(x))[1]&(~PRECPBITS)) | evalprecp(s))
! 163:
! 164: #define varn(x) ((long) ((((GEN) (x))[1]&VARNBITS) >> VARNSHIFT))
! 165: #define setvarn(x,s) (((GEN)(x))[1]=\
! 166: (((GEN)(x))[1]&(~VARNBITS)) | evalvarn(s))
! 167:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>