mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 10:34:23 +00:00
fix(vec4): force 16 Bytes aligned
This commit is contained in:
@@ -14,11 +14,12 @@
|
||||
#else
|
||||
#endif
|
||||
|
||||
typedef union
|
||||
// must be aligned by 16 Bytes (less instruction executed for SSE)
|
||||
typedef union
|
||||
{
|
||||
struct { float x, y, z, w; };
|
||||
float data[4];
|
||||
} Vec4f_t;
|
||||
}__attribute__((aligned(16))) Vec4f_t;
|
||||
|
||||
Vec4f_t vec4f_from_array(float *__restrict val);
|
||||
Vec4f_t vec4(float x, float y, float z, float w);
|
||||
@@ -26,8 +27,11 @@ Vec4f_t vec4(float x, float y, float z, float w);
|
||||
Vec4f_t vec4f_scalar(float f);
|
||||
// (0, 0, 0, 0)
|
||||
Vec4f_t vec4f_zero(void);
|
||||
Vec4f_t vec4f_clone(Vec4f_t *__restrict v);
|
||||
|
||||
inline static Vec4f_t vec4f_clone(Vec4f_t *__restrict v)
|
||||
{
|
||||
return *v;
|
||||
}
|
||||
Vec4f_t vec4f_add_r(Vec4f_t *__restrict out, Vec4f_t a);
|
||||
Vec4f_t vec4f_add(Vec4f_t a, Vec4f_t b);
|
||||
|
||||
@@ -37,20 +41,20 @@ Vec4f_t vec4f_sub(Vec4f_t a, Vec4f_t b);
|
||||
Vec4f_t vec4f_scale_r(Vec4f_t *__restrict out, float scale);
|
||||
Vec4f_t vec4f_scale(Vec4f_t a, float scale);
|
||||
|
||||
// float vec4_dot(Vec4_t a, Vec4_t b);
|
||||
float vec4_dot(Vec4f_t a, Vec4f_t b);
|
||||
|
||||
// float vec4_len(Vec4_t v);
|
||||
float vec4_len(Vec4f_t v);
|
||||
|
||||
// Vec4_t vec4_norm(Vec4_t v);
|
||||
Vec4f_t vec4_norm(Vec4f_t v);
|
||||
|
||||
// Vec4_t vec4_lerp(Vec4_t a, Vec4_t b, float t);
|
||||
Vec4f_t vec4_lerp(Vec4f_t a, Vec4f_t b, float t);
|
||||
|
||||
// float vec4_angle(Vec4_t a, Vec4_t b);
|
||||
float vec4_angle(Vec4f_t a, Vec4f_t b);
|
||||
|
||||
// Vec4_t vec4_proj(Vec4_t a, Vec4_t b);
|
||||
Vec4f_t vec4_proj(Vec4f_t a, Vec4f_t b);
|
||||
|
||||
// Vec4_t vec4_refl(Vec4_t v, Vec4_t normal);
|
||||
Vec4f_t vec4_refl(Vec4f_t v, Vec4f_t normal);
|
||||
|
||||
// float vec4_dist(Vec4_t a, Vec4_t b);
|
||||
float vec4_dist(Vec4f_t a, Vec4f_t b);
|
||||
|
||||
#endif // VECTOR4_H
|
||||
|
||||
Reference in New Issue
Block a user