version 1.1, 2001/10/02 11:17:07 |
version 1.2, 2002/09/11 07:26:58 |
Line 27 typedef int (*QSCOMP)(const void *, const void *); |
|
Line 27 typedef int (*QSCOMP)(const void *, const void *); |
|
#endif |
#endif |
|
|
#ifdef LONG_IS_64BIT |
#ifdef LONG_IS_64BIT |
# define MAXULONG (0xffffffffffffffffUL) |
|
# define MAXHALFULONG (0x00000000ffffffffUL) |
|
# define HIGHBIT (0x8000000000000000UL) |
|
# define HIGHMASK (0xffffffff00000000UL) |
|
# define LOWMASK (0x00000000ffffffffUL) |
|
# define SMALL_MASK (0x4000000000000000UL) |
|
|
|
# define DEFAULTPREC 3 |
|
# define MEDDEFAULTPREC 4 |
|
# define BIGDEFAULTPREC 5 |
|
# define TWOPOTBYTES_IN_LONG 3 |
# define TWOPOTBYTES_IN_LONG 3 |
# define TWOPOTBITS_IN_LONG 6 |
|
# define BYTES_IN_LONG 8 |
|
# define BITS_IN_LONG 64 |
|
# define BITS_IN_HALFULONG 32 |
|
/* For a 64-bit random generator, change the following 32 to 64 */ |
|
# define BITS_IN_RANDOM 32 |
|
|
|
#else |
#else |
|
|
# define MAXULONG (0xffffffffUL) |
|
# define MAXHALFULONG (0x0000ffffUL) |
|
# define HIGHBIT (0x80000000UL) |
|
# define HIGHMASK (0xffff0000UL) |
|
# define LOWMASK (0x0000ffffUL) |
|
# define SMALL_MASK (0x40000000UL) |
|
|
|
# define DEFAULTPREC 4 |
|
# define MEDDEFAULTPREC 6 |
|
# define BIGDEFAULTPREC 8 |
|
# define TWOPOTBYTES_IN_LONG 2 |
# define TWOPOTBYTES_IN_LONG 2 |
# define TWOPOTBITS_IN_LONG 5 |
|
# define BYTES_IN_LONG 4 |
|
# define BITS_IN_LONG 32 |
|
# define BITS_IN_HALFULONG 16 |
|
# define BITS_IN_RANDOM 32 |
|
#endif |
#endif |
|
|
#ifndef LONG_IS_64BIT |
#define DEFAULTPREC 2 + (8>>TWOPOTBYTES_IN_LONG) |
/* second codeword x[1], for types: INT,REAL,PADIC,POL,SER */ |
#define MEDDEFAULTPREC 2 + (16>>TWOPOTBYTES_IN_LONG) |
# define EXPOBITS (0x00ffffffUL) |
#define BIGDEFAULTPREC 2 + (24>>TWOPOTBYTES_IN_LONG) |
# define HIGHEXPOBIT (0x00800000L) |
#define TWOPOTBITS_IN_LONG (TWOPOTBYTES_IN_LONG+3) |
# define LGEFBITS (0x0000ffffUL) |
#define BYTES_IN_LONG (1UL<<TWOPOTBYTES_IN_LONG) |
# define VALPBITS (0x0000ffffUL) /* used only for type PADIC */ |
#define BITS_IN_LONG (1UL<<TWOPOTBITS_IN_LONG) |
# define HIGHVALPBIT (0x00008000L) /* used only for type PADIC, SER */ |
#define HIGHBIT (1UL << (BITS_IN_LONG-1)) |
# define PRECPBITS (0xffff0000UL) /* used only for type PADIC */ |
#define BITS_IN_HALFULONG (BITS_IN_LONG>>1) |
# define PRECPSHIFT 16 |
#define MAXULONG (~0x0UL) |
# define VARNSHIFT 16 |
#define MAXHALFULONG ((1UL<<BITS_IN_HALFULONG) - 1) |
|
#define LOWMASK (MAXHALFULONG) |
|
#define HIGHMASK (~LOWMASK) |
|
#define SMALL_MASK (HIGHBIT>>1) |
|
/* You may want to change the following 32 to BITS_IN_LONG */ |
|
#define BITS_IN_RANDOM 32 |
|
|
# ifndef OLD_CODES |
/* Order of bits in codewords: |
# define SIGNBITS (0xc0000000UL) |
* x[0] TYPBITS, CLONEBIT, LGBITS |
# define VARNBITS (0x3fff0000UL) |
* x[1].real SIGNBITS, EXPOBITS |
# define LGEFINTBITS (0x00ffffffUL) |
* int SIGNBITS, LGEFINTBITS |
# define SIGNSHIFT 30 |
* ser,pol SIGNBITS, VARNBITS ,LGEFBITS |
# define MAXVARN 16383 |
* padic VALPBITS, PRECPBITS |
# else |
* Length of bitfields are independant and satisfy: |
# define SIGNBITS (0xff000000UL) |
* TYPnumBITS + LGnumBITS + 1 <= BITS_IN_LONG (optimally =) |
# define VARNBITS (0x00ff0000UL) |
* SIGNnumBITS + EXPOnumBITS <= BITS_IN_LONG |
# define LGEFINTBITS (0x0000ffffUL) |
* SIGNnumBITS + LGnumBITS <= BITS_IN_LONG |
# define SIGNSHIFT 24 |
* SIGNnumBITS + LGEFnumBITS + 2 <= BITS_IN_LONG |
# define MAXVARN 255 |
* VALPnumbits + 1 <= BITS_IN_LONG */ |
# endif |
#ifdef OLD_CODES |
|
# define TYPnumBITS 8 /* obsolete (for hard-coded assembler in mp.s) */ |
|
# define SIGNnumBITS 8 |
|
#else |
|
# define TYPnumBITS 7 |
|
# define SIGNnumBITS 2 |
|
#endif |
|
|
/* first codeword x[0] */ |
#ifdef LONG_IS_64BIT |
# ifndef OLD_CODES |
# define LGnumBITS 32 |
# define TYPBITS (0xfe000000UL) |
# define EXPOnumBITS 48 |
# define CLONEBIT (0x01000000UL) |
# define LGEFnumBITS 46 /* otherwise MAXVARN too large */ |
# define LGBITS (0x00ffffffUL) |
# define VALPnumBITS 32 |
# define TYPSHIFT 25 |
#else |
|
# ifdef OLD_CODES |
|
# define LGnumBITS 16 /* obsolete */ |
# else |
# else |
# define TYPBITS (0xff000000UL) |
# define LGnumBITS 24 |
# define CLONEBIT (0x00010000UL) |
|
# define LGBITS (0x0000ffffUL) |
|
# define TYPSHIFT 24 |
|
# endif |
# endif |
|
# define EXPOnumBITS 24 |
|
# define LGEFnumBITS 16 |
|
# define VALPnumBITS 16 |
#endif |
#endif |
|
|
#ifdef LONG_IS_64BIT |
/* no user serviceable parts below :-) */ |
/* first codeword x[0] */ |
#define VARNnumBITS (BITS_IN_LONG - SIGNnumBITS - LGEFnumBITS) |
# define TYPBITS (0xffff000000000000UL) |
#define PRECPSHIFT VALPnumBITS |
# define CLONEBIT (0x0000000100000000UL) |
#define VARNSHIFT LGEFnumBITS |
# define LGBITS (0x00000000ffffffffUL) |
#define TYPSHIFT (BITS_IN_LONG - TYPnumBITS) |
# define TYPSHIFT 48 |
#define SIGNSHIFT (LGEFnumBITS+VARNnumBITS) |
|
|
/* second codeword x[1] */ |
#define EXPOBITS ((1UL<<EXPOnumBITS)-1) |
# define SIGNBITS (0xffff000000000000UL) |
#define SIGNBITS (0xffffUL << SIGNSHIFT) |
# define VARNBITS (0x0000ffff00000000UL) |
#define TYPBITS (0xffffUL << TYPSHIFT) |
# define LGEFBITS (0x00000000ffffffffUL) |
#define PRECPBITS (~VALPBITS) |
# define SIGNSHIFT 48 |
#define LGBITS ((1UL<<LGnumBITS)-1) |
# define MAXVARN 65535 |
#define LGEFINTBITS LGBITS |
|
#define LGEFBITS ((1UL<<LGEFnumBITS)-1) |
|
#define VALPBITS ((1UL<<VALPnumBITS)-1) |
|
#define VARNBITS (MAXVARN<<VARNSHIFT) |
|
#define MAXVARN ((1UL<<VARNnumBITS)-1) |
|
#define HIGHEXPOBIT (1UL<<(EXPOnumBITS-1)) |
|
#define HIGHVALPBIT (1UL<<(VALPnumBITS-1)) |
|
#define CLONEBIT (1UL<<LGnumBITS) |
|
|
# define EXPOBITS (0x0000ffffffffffffUL) |
|
# define HIGHEXPOBIT (0x0000800000000000L) |
|
# define LGEFINTBITS (0x00000000ffffffffUL) |
|
# define VALPBITS (0x00000000ffffffffUL) |
|
# define HIGHVALPBIT (0x0000000080000000L) |
|
# define PRECPBITS (0xffffffff00000000UL) |
|
# define PRECPSHIFT 32 |
|
# define VARNSHIFT 32 |
|
#endif |
|
|
|
#define evaltyp(x) (((ulong)(x)) << TYPSHIFT) |
#define evaltyp(x) (((ulong)(x)) << TYPSHIFT) |
#define evalvarn(x) (((ulong)(x)) << VARNSHIFT) |
#define evalvarn(x) (((ulong)(x)) << VARNSHIFT) |
#define evalsigne(x) (((long)(x)) << SIGNSHIFT) |
#define evalsigne(x) (((long)(x)) << SIGNSHIFT) |
#define evalprecp(x) (((long)(x)) << PRECPSHIFT) |
#define evalprecp(x) (((long)(x)) << PRECPSHIFT) |
#define m_evalexpo(x) (HIGHEXPOBIT + (x)) |
#define _evalexpo(x) (HIGHEXPOBIT + (x)) |
#define m_evalvalp(x) (HIGHVALPBIT + (x)) |
#define _evalvalp(x) (HIGHVALPBIT + (x)) |
#define evallgefint(x) (x) |
#define evallgefint(x) (x) |
#define m_evallg(x) (x) |
#define _evallg(x) (x) |
#define m_evallgef(x) (x) |
#define _evallgef(x) (x) |
|
|
#define typ(x) ((((long)(x))&1)? t_SMALL: (((ulong) ((GEN) (x))[0]) >> TYPSHIFT)) |
#define typ(x) ((((ulong)(x))&1)? (long)t_SMALL: (long)(((ulong) ((GEN) (x))[0]) >> TYPSHIFT)) |
#define settyp(x,s) (((GEN)(x))[0]=\ |
#define settyp(x,s) (((GEN)(x))[0]=\ |
(((GEN)(x))[0]&(~TYPBITS)) | evaltyp(s)) |
(((GEN)(x))[0]&(~TYPBITS)) | evaltyp(s)) |
#define smalltos(x) (((long)(x))>>1) |
#define smalltos(x) (((long)(x))>>1) |
Line 147 typedef int (*QSCOMP)(const void *, const void *); |
|
Line 124 typedef int (*QSCOMP)(const void *, const void *); |
|
#define setisclone(x) (((GEN) (x))[0] |= CLONEBIT) |
#define setisclone(x) (((GEN) (x))[0] |= CLONEBIT) |
#define unsetisclone(x) (((GEN) (x))[0] &= (~CLONEBIT)) |
#define unsetisclone(x) (((GEN) (x))[0] &= (~CLONEBIT)) |
|
|
#define lg(x) ((((long)(x))&1)?1: ((long) (((GEN) (x))[0] & LGBITS))) |
#define lg(x) ((((ulong)(x))&1)?1L: ((long) (((GEN) (x))[0] & LGBITS))) |
#define setlg(x,s) (((GEN)(x))[0]=\ |
#define setlg(x,s) (((GEN)(x))[0]=\ |
(((GEN)(x))[0]&(~LGBITS)) | evallg(s)) |
(((GEN)(x))[0]&(~LGBITS)) | evallg(s)) |
|
|
Line 155 typedef int (*QSCOMP)(const void *, const void *); |
|
Line 132 typedef int (*QSCOMP)(const void *, const void *); |
|
#define setsigne(x,s) (((GEN)(x))[1]=\ |
#define setsigne(x,s) (((GEN)(x))[1]=\ |
(((GEN)(x))[1]&(~SIGNBITS)) | evalsigne(s)) |
(((GEN)(x))[1]&(~SIGNBITS)) | evalsigne(s)) |
|
|
#define lgef(x) ((long) (((GEN) (x))[1] & LGEFBITS)) |
#define lgef(x) (((GEN) (x))[1] & LGEFBITS) |
#define setlgef(x,s) (((GEN)(x))[1]=\ |
#define setlgef(x,s) (((GEN)(x))[1]=\ |
(((GEN)(x))[1]&(~LGEFBITS)) | evallgef(s)) |
(((GEN)(x))[1]&(~LGEFBITS)) | evallgef(s)) |
|
|
#define lgefint(x) ((long) (((GEN) (x))[1] & LGEFINTBITS)) |
#define lgefint(x) (((GEN) (x))[1] & LGEFINTBITS) |
#define setlgefint(x,s) (((GEN)(x))[1]=\ |
#define setlgefint(x,s) (((GEN)(x))[1]=\ |
(((GEN)(x))[1]&(~LGEFINTBITS)) | evallgefint(s)) |
(((GEN)(x))[1]&(~LGEFINTBITS)) | evallgefint(s)) |
|
|
Line 175 typedef int (*QSCOMP)(const void *, const void *); |
|
Line 152 typedef int (*QSCOMP)(const void *, const void *); |
|
#define setprecp(x,s) (((GEN)(x))[1]=\ |
#define setprecp(x,s) (((GEN)(x))[1]=\ |
(((GEN)(x))[1]&(~PRECPBITS)) | evalprecp(s)) |
(((GEN)(x))[1]&(~PRECPBITS)) | evalprecp(s)) |
|
|
#define varn(x) ((long) ((((GEN) (x))[1]&VARNBITS) >> VARNSHIFT)) |
#define varn(x) ((((GEN) (x))[1]&VARNBITS) >> VARNSHIFT) |
#define setvarn(x,s) (((GEN)(x))[1]=\ |
#define setvarn(x,s) (((GEN)(x))[1]=\ |
(((GEN)(x))[1]&(~VARNBITS)) | evalvarn(s)) |
(((GEN)(x))[1]&(~VARNBITS)) | evalvarn(s)) |
|
|