+ if (attr != 0) {
+ if (unlikely(oldSize)) {
+ unsigned offset = exec->vtx.attrptr[attr] - exec->vtx.vertex;
+
+ /* If there are attribs after the resized attrib... */
+ if (offset + oldSize < old_vtx_size_no_pos) {
+ int size_diff = newSize - oldSize;
+ fi_type *old_first = exec->vtx.attrptr[attr] + oldSize;
+ fi_type *new_first = exec->vtx.attrptr[attr] + newSize;
+ fi_type *old_last = exec->vtx.vertex + old_vtx_size_no_pos - 1;
+ fi_type *new_last = exec->vtx.vertex + exec->vtx.vertex_size_no_pos - 1;
+
+ if (size_diff < 0) {
+ /* Decreasing the size: Copy from first to last to move
+ * elements to the left.
+ */
+ fi_type *old_end = old_last + 1;
+ fi_type *old = old_first;
+ fi_type *new = new_first;
+
+ do {
+ *new++ = *old++;
+ } while (old != old_end);
+ } else {
+ /* Increasing the size: Copy from last to first to move
+ * elements to the right.
+ */
+ fi_type *old_end = old_first - 1;
+ fi_type *old = old_last;
+ fi_type *new = new_last;
+
+ do {
+ *new-- = *old--;
+ } while (old != old_end);
+ }