Karim Belabas on Mon, 10 Sep 2012 19:14:54 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Cleaning the pari-stack


* Manolo [2012-09-10 18:18]:
> > I'd use simply
> >
> > void
> > burn_paristack() { bzero((void*)bot, avma - bot); }
> >
> > (untested:-) to clear up the unused part of the stack.
> 
> Nice! It could even be implemented as a macro! Thank you!
> 
> (But the size variable (avma-bot) gives the size of stack in "long"
> type words, isn't it? It should be multiply by "sizeof(pari_sp)" or
> "sizeof(long)", I guess.)

Hum, don't think so. 

avma and bot are absolute adresses (not pointers to SOME_TYPE), so their
difference is a number of chars, and not to be multiplied by sizeof(SOME_TYPE).
Anyway, just try and check :-)

Cheers,

    K.B.
-- 
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`