Unboxed limb

Hans Åberg haberg-1 at telia.com
Mon May 21 09:00:06 UTC 2018


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;




More information about the gmp-discuss mailing list