[postgis-devel] getPoint_internal and alignment

Paul Ramsey pramsey at cleverelephant.ca
Thu Sep 18 07:42:54 PDT 2014


You can safely cast now, though with great care with respect to dimensionality: casting a 2d pointarray into a  4d point would not be good. The getPoint2d_cp (??) function basically does this already, returning a const pointer to a point2d (always safe).

P

--  
http://postgis.net  
http://cleverelephant.ca


On September 18, 2014 at 2:28:50 AM, Sandro Santilli (strk at keybit.net) wrote:
> Paul, while reading ptarray.c I stumbled across this comment:
>  
> /*
> * Get a pointer to nth point of a POINTARRAY.
> * You cannot safely cast this to a real POINT, due to memory alignment
> * constraints. Use getPoint*_p for that.
> */
> uint8_t *
> getPoint_internal(const POINTARRAY *pa, int n)
>  
> Is that still the new serialization format ?
> Or can we safely cast the return to a POINT ?
>  
> --strk;
>  
> () ASCII ribbon campaign -- Keep it simple !
> /\ http://strk.keybit.net/rants/ascii_mails.txt
>  




More information about the postgis-devel mailing list