fix missing parenthesis in VEC macros

Mon, 04 Aug 2025 23:06:37 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 04 Aug 2025 23:06:37 +0200
changeset 246
718b9bc3a6cd
parent 245
0cc396ade3b0
child 247
3547254742a7

fix missing parenthesis in VEC macros

src/ascension/datatypes.h file | annotate | diff | comparison | revisions
--- a/src/ascension/datatypes.h	Sun Aug 03 22:15:25 2025 +0200
+++ b/src/ascension/datatypes.h	Mon Aug 04 23:06:37 2025 +0200
@@ -125,7 +125,7 @@
     struct { int width, height; };
     int data[2];
 } asc_vec2i;
-#define ASC_VEC2I(x, y) (asc_vec2i){{(int)x, (int)y}}
+#define ASC_VEC2I(x, y) (asc_vec2i){{(int)(x), (int)(y)}}
 #define ASC_VEC2I_0 (asc_vec2i){{0, 0}}
 #define ASC_VEC2I_1 (asc_vec2i){{1, 1}}
 
@@ -134,7 +134,7 @@
     struct { unsigned width, height; };
     unsigned data[2];
 } asc_vec2u;
-#define ASC_VEC2U(x, y) (asc_vec2u){{(unsigned)x, (unsigned)y}}
+#define ASC_VEC2U(x, y) (asc_vec2u){{(unsigned)(x), (unsigned)(y)}}
 #define ASC_VEC2U_0 (asc_vec2u){{0u, 0u}}
 #define ASC_VEC2U_1 (asc_vec2u){{1u, 1u}}
 
@@ -150,7 +150,7 @@
     struct { float u, v; };
     float data[2];
 } asc_vec2f;
-#define ASC_VEC2F(x, y) (asc_vec2f){{(float)x, (float)y}}
+#define ASC_VEC2F(x, y) (asc_vec2f){{(float)(x), (float)(y)}}
 #define ASC_VEC2F_0 (asc_vec2f){{0.0f, 0.0f}}
 #define ASC_VEC2F_1 (asc_vec2f){{1.0f, 1.0f}}
 
@@ -159,7 +159,7 @@
     struct { float width, height, depth; };
     float data[3];
 } asc_vec3f;
-#define ASC_VEC3F(x, y, z) (asc_vec3f){{(float)x, (float)y, (float)(z)}}
+#define ASC_VEC3F(x, y, z) (asc_vec3f){{(float)(x), (float)(y), (float)(z)}}
 #define ASC_VEC3F_0 (asc_vec3f){{0.0f, 0.0f, 0.0f}}
 #define ASC_VEC3F_1 (asc_vec3f){{1.0f, 1.0f, 1.0f}}
 
@@ -167,7 +167,7 @@
     struct { float x, y, z, w; };
     float data[4];
 } asc_vec4f;
-#define ASC_VEC4F(x, y, z, w) (asc_vec4f){{(float)x, (float)y, (float)(z), (float)(w)}}
+#define ASC_VEC4F(x, y, z, w) (asc_vec4f){{(float)(x), (float)(y), (float)(z), (float)(w)}}
 #define ASC_VEC4F_0 (asc_vec4f){{0.0f, 0.0f, 0.0f, 0.0f}}
 #define ASC_VEC4F_1 (asc_vec4f){{1.0f, 1.0f, 1.0f, 1.0f}}
 
@@ -179,8 +179,9 @@
     float red, green, blue, alpha;
 } asc_col4f;
 
-#define ASC_RGB(r,g,b) (asc_col4i){(asc_ubyte)r, (asc_ubyte)g, (asc_ubyte)b, 255u}
-#define ASC_RGBA(r,g,b,a) (asc_col4i){(asc_ubyte)r, (asc_ubyte)g, (asc_ubyte)b, (asc_ubyte)a}
+// TODO: think about removing integer colors
+#define ASC_RGB(r,g,b) (asc_col4i){(asc_ubyte)(r), (asc_ubyte)(g), (asc_ubyte)(b), 255u}
+#define ASC_RGBA(r,g,b,a) (asc_col4i){(asc_ubyte)(r), (asc_ubyte)(g), (asc_ubyte)(b), (asc_ubyte)(a)}
 #define ASC_RGB_F(r,g,b) (asc_col4f){r,g,b,1.f}
 #define ASC_RGBA_F(r,g,b,a) (asc_col4f){r,g,b,a}
 

mercurial