Unboxed limb

Hans Åberg haberg-1 at telia.com
Mon May 21 10:30:54 UTC 2018


> On 21 May 2018, at 11:54, Marc Glisse <marc.glisse at inria.fr> wrote:
> 
> On Mon, 21 May 2018, Hans Åberg wrote:
> 
>> Have you given thought of using unboxed limbs in the implementation for small numbers, i.e., no heap allocation. In the type below, one might set say _mp_alloc to 0 to indicate that it is the value and not the pointer.
>> 
>> typedef struct
>> {
>> int _mp_alloc;
>> int _mp_size;
>> 
>> union {
>>   mp_limb_t  _mp_0;    /* Unboxed limb.  */
>>   mp_limb_t *_mp_d;    /* Pointer to the limbs.  */
>> };
>> } __mpz_struct;
> 
> This type of idea comes up regularly, yes.

Is it expensive?




More information about the gmp-discuss mailing list