Unboxed limb

Marc Glisse marc.glisse at inria.fr
Mon May 21 09:54:33 UTC 2018


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.

-- 
Marc Glisse


More information about the gmp-discuss mailing list