Clang Extended Vectors support

This commit is contained in:
Jon Daniel 2024-11-09 23:33:58 +01:00
parent d8feef5279
commit 729da53128

View File

@ -113,25 +113,36 @@
// Types and Structures Definition // Types and Structures Definition
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
#if !defined(RL_VECTOR2_TYPE) #if !defined(RL_VECTOR2_TYPE)
#ifdef __clang__
typedef float Vector2 __attribute__((ext_vector_type(2)));
#else
// Vector2 type // Vector2 type
typedef struct Vector2 { typedef struct Vector2 {
float x; float x;
float y; float y;
} Vector2; } Vector2;
#endif
#define RL_VECTOR2_TYPE #define RL_VECTOR2_TYPE
#endif #endif
#if !defined(RL_VECTOR3_TYPE) #if !defined(RL_VECTOR3_TYPE)
#ifdef __clang__
typedef float Vector3 __attribute__((ext_vector_type(3)));
#else
// Vector3 type // Vector3 type
typedef struct Vector3 { typedef struct Vector3 {
float x; float x;
float y; float y;
float z; float z;
} Vector3; } Vector3;
#endif
#define RL_VECTOR3_TYPE #define RL_VECTOR3_TYPE
#endif #endif
#if !defined(RL_VECTOR4_TYPE) #if !defined(RL_VECTOR4_TYPE)
#ifdef __clang__
typedef float Vector4 __attribute__((ext_vector_type(4)));
#else
// Vector4 type // Vector4 type
typedef struct Vector4 { typedef struct Vector4 {
float x; float x;
@ -139,6 +150,7 @@ typedef struct Vector4 {
float z; float z;
float w; float w;
} Vector4; } Vector4;
#endif
#define RL_VECTOR4_TYPE #define RL_VECTOR4_TYPE
#endif #endif