Skip to content

Instantly share code, notes, and snippets.

@RevoluPowered
Created August 3, 2021 13:45
Show Gist options
  • Save RevoluPowered/050db986b9f86ddd48622b27a09e8f83 to your computer and use it in GitHub Desktop.
Save RevoluPowered/050db986b9f86ddd48622b27a09e8f83 to your computer and use it in GitHub Desktop.
// this is the old code
const float *v = (const float *)&r[j * total_elem_size + offsets[i]];
w[j] = Vector3(v[0], v[1], v[2]);
// this is the replacement (has correct alignment)
float x = (float)r[j*total_elem_size*offsets[i]];
float y = (float)r[j*total_elem_size*offsets[i]+1];
float z = (float)r[j*total_elem_size*offsets[i]+2];
w[j] = Vector3(x,y,z);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment