#define signe(x)          (((long)((GEN)(x))[1])>>SIGNSHIFT)
#define setsigne(x,s)     (((GEN)(x))[1]=(((GEN)(x))[1]&(~SIGNBITS))+(((long)(s))<<SIGNSHIFT))
#define typ(x)            (((ulong)((GEN)(x))[0])>>TYPSHIFT)
#define settyp(x,s)       (((GEN)(x))[0]=(((GEN)(x))[0]&(~TYPBITS))+(((ulong)(s))<<TYPSHIFT))
#define pere(x)           ((ulong)(((GEN)(x))[0]&PEREBITS)>>PERESHIFT)
#define setpere(x,s)      (((GEN)(x))[0]=(((GEN)(x))[0]&(~PEREBITS))+(((ulong)(s))<<PERESHIFT))
#define lg(x)             ((long)(((GEN)(x))[0]&LGBITS))
#define setlg(x,s)        (((GEN)(x))[0]=(((GEN)(x))[0]&(~LGBITS))+(s))
#define lgef(x)           ((long)(((GEN)(x))[1]&LGEFBITS))
#define setlgef(x,s)      (((GEN)(x))[1]=(((GEN)(x))[1]&(~LGEFBITS))+(s))
#define expo(x)           ((long)((((GEN)(x))[1]&EXPOBITS)-HIGHEXPOBIT))
#define setexpo(x,s)      (((GEN)(x))[1]=(((GEN)(x))[1]&(~EXPOBITS))+(HIGHEXPOBIT+(s)))
#define valp(x)           ((long)((((GEN)(x))[1]&VALPBITS)-HIGHVALPBIT))
#define setvalp(x,s)      (((GEN)(x))[1]=(((GEN)(x))[1]&(~VALPBITS))+(HIGHVALPBIT+(s)))
#define precp(x)          ((long)(((ulong)((GEN)(x))[1])>>PRECPSHIFT))
#define setprecp(x,s)     (((GEN)(x))[1]=(((GEN)(x))[1]&(~PRECPBITS))+(((long)(s))<<PRECPSHIFT))
#define varn(x)           ((long)((((GEN)(x))[1]&VARNBITS)>>VARNSHIFT))
#define setvarn(x,s)      (((GEN)(x))[1]=(((GEN)(x))[1]&(~VARNBITS))+(((ulong)(s))<<VARNSHIFT))
#define mant(x,i)         ((((GEN)(x))[1]&SIGNBITS)?((GEN)(x))[i+1]:0)
#define setmant(x,i,s)    (((GEN)(x))[i+1]=s)
