最后更新于7个月前
这有帮助吗?
Structure of arrays
easier manipulation with packed in most
allowing more data to fit onto a single cache line.
struct pointlist3D { float x[N]; float y[N]; float z[N]; }; struct pointlist3D points; float get_point_x(int i) { return points.x[i]; }
Array of structures
struct point3D { float x; float y; float z; }; struct point3D points[N]; float get_point_x(int i) { return points[i].x; }