<div dir="ltr">It's not a struct alignment thing (anymore) but there is a danger in mutating the point array storage directly, because in the database context it's not clear who owns it, and we've had problems in the past w/ functions that directly write into the database storage. If you're going to be changing data, the safest thing is always to take a copy at the start.<div><br>P.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 6, 2017 at 12:25 PM, Björn Harrtell <span dir="ltr"><<a href="mailto:bjorn.harrtell@gmail.com" target="_blank">bjorn.harrtell@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I want to mutate one axis of the points in a POINTARRAY in the most efficient way.</div><div><br></div><div>Something similar to ptarray_longitude_shift, see:</div><div><a href="https://github.com/postgis/postgis/blob/svn-trunk/liblwgeom/ptarray.c#L1393" target="_blank">https://github.com/postgis/<wbr>postgis/blob/svn-trunk/<wbr>liblwgeom/ptarray.c#L1393</a><br></div><div><br></div><div>I see memcpy being used there and other places and afaik it has something to do with fears of struct misalignment.</div><div><br></div><div>Does this mean I should most definitely not do this? :)</div><div><br></div><div><div>POINT2D *p = (POINT2D *) getPoint_internal(pa, 0);</div><div>p->y = extent - p->y;</div></div><div><br></div><div>Regards,</div><div>Björn<br></div></div>
<br>______________________________<wbr>_________________<br>
postgis-devel mailing list<br>
<a href="mailto:postgis-devel@lists.osgeo.org">postgis-devel@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-devel" rel="noreferrer" target="_blank">https://lists.osgeo.org/<wbr>mailman/listinfo/postgis-devel</a><br></blockquote></div><br></div>