On Thu, 29 Mar 2018, Niels Möller wrote:

> Richard Biener <rguent...@suse.de> writes:
> 
> > I would be surprised if that wouldn't work everywhere - any reason
> > you have doubts?  To clarify, allocation would work like
> >
> >  void *ptr = malloc (... + sizeof (size_t));
> >  ->_mp_d = (char *)ptr + sizeof (size_t);
> >  size_t *size = ptr;
> 
> That would give bad alignment in the case that limbs are 64 bits but
> size_t only 32 bits (and the x86_64 "x32" abi is something like that,
> right?).

Yes.  Make it

  ->_mp_d = (char *)ptr + MAX(sizeof (size_t), alignof (limb_t));

and adjust the access accordingly.

Richard.

> Regards,
> /Niels
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 
21284 (AG Nuernberg)
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to