bridge/class-master/depend/pari/src/modules/mpqs.c
/* factor base constructor. Really a home-grown memalign(3c) underneath.
 * We don't want FB entries to straddle L1 cache line boundaries, and
 * malloc(3c) only guarantees alignment adequate for all primitive data
 * types of the platform ABI - typically to 8 or 16 byte boundaries.
 * Also allocate the inv_A_H array.
 * The FB array pointer is returned for convenience */
factor base constructor. Really a home-grown memalign(3c) underneath.
We don't want FB entries to straddle L1 cache line boundaries, and
malloc(3c) only guarantees alignment adequate for all primitive data
types of the platform ABI - typically to 8 or 16 byte boundaries.
Also allocate the inv_A_H array.
The FB array pointer is returned for convenience
factor base constructor . Really a home - grown memalign ( 3c ) underneath . We don ' t want FB entries to straddle L1 cache line boundaries and malloc ( 3c ) only guarantees alignment adequate for all primitive data types of the platform ABI - typically to 8 or 16 byte boundaries . Also allocate the inv_A_H array . The FB array pointer is returned for convenience
static mpqs_FB_entry_t *
mpqs_FB_ctor(mpqs_handle_t *h)
{
  long size_FB_chunk = (h->size_of_FB + 3) * sizeof(mpqs_FB_entry_t);
  long size_IAH_chunk = (h->size_of_FB + 2) * sizeof(mpqs_inv_A_H_t);
  char *fbp = (char*)pari_malloc(size_FB_chunk + 64);
  char *iahp = (char*)pari_malloc(size_IAH_chunk + 64);
  long fbl, iahl;
  h->FB_chunk = (void *)fbp;
  h->invAH_chunk = (void *)iahp;
  fbl = (((long)fbp) + 64) & ~0x3FL;
  h->FB = (mpqs_FB_entry_t *)fbl;
  iahl = (((long)iahp) + 64) & ~0x3FL;
  h->inv_A_H = (mpqs_inv_A_H_t *)iahl;
  return (mpqs_FB_entry_t *)fbl;
}
static mpqs_FB_entry_t * mpqs_FB_ctor ( mpqs_handle_t * h ) { long size_FB_chunk = ( h -> size_of_FB + 3 ) * sizeof ( mpqs_FB_entry_t ) ; long size_IAH_chunk = ( h -> size_of_FB + 2 ) * sizeof ( mpqs_inv_A_H_t ) ; char * fbp = ( char * ) pari_malloc ( size_FB_chunk + 64 ) ; char * iahp = ( char * ) pari_malloc ( size_IAH_chunk + 64 ) ; long fbl , iahl ; h -> FB_chunk = ( void * ) fbp ; h -> invAH_chunk = ( void * ) iahp ; fbl = ( ( ( long ) fbp ) + 64 ) & ~ 0x3FL ; h -> FB = ( mpqs_FB_entry_t * ) fbl ; iahl = ( ( ( long ) iahp ) + 64 ) & ~ 0x3FL ; h -> inv_A_H = ( mpqs_inv_A_H_t * ) iahl ; return ( mpqs_FB_entry_t * ) fbl ; }
factor base constructor.
factor base constructor .
/* leave room for slots 0, 1, and sentinel slot at the end of the array */ /* like FB, except this one does not have a sentinel slot at the end */ /* round up to next higher 64-bytes-aligned address */ /* and put the actual array there */