how smart is the bit shifting?

David Fu dfu1@csee.umbc.edu
Mon, 31 Mar 2003 15:53:22 -0500


Hello All,

I'm in a situation where I would like to set various limbs in mpz_t objects.
However, such access is not exposed in the manual, and experiments have been
fussy (confirming that it is indeed a "nono" to be mucking about directly with
_mp_d, _mp_size, and _mp_alloc).

So, the next best thing would be to use shifts and masks etc. In my case, asll
 such shifts would be multiples of the limbsize (32). So my question is
the ff: 

if the bitshift is a multiple of the limbsize, does gmp do this smartly? I.e.,
does it do "word/limb-sized" shifts if it can. I.e., why shift 32 times when
pointers to limbs can be changed once?

If the answer is "no", then is there a way other than manipulating the
fields of an mpz_t directly?

Thank you for your attention,

David Fu