From 4309322f9d2b3e31421a3cc5399ab1f4368e0652 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 27 Feb 2021 00:07:19 +0100 Subject: Some window magic! --- libc/inc/vec.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libc') diff --git a/libc/inc/vec.h b/libc/inc/vec.h index 024e792..a036931 100644 --- a/libc/inc/vec.h +++ b/libc/inc/vec.h @@ -13,21 +13,21 @@ typedef struct vec3 { u32 x, y, z; } vec3; -#define vec2(x, y) ((vec2){ x, y }) -#define vec2to3(a, z) ((vec3){ a.x, a.y, z }) +#define vec2(x, y) ((vec2){ (x), (y) }) +#define vec2to3(a, z) ((vec3){ a.x, a.y, (z) }) #define vec2_add(a, b) ((vec2){ a.x + b.x, a.y + b.y }) #define vec2_sub(a, b) ((vec2){ a.x - b.x, a.y - b.y }) -#define vec2_mul(a, b) ((vec2){ a.x * b, a.y * b }) -#define vec2_div(a, b) ((vec2){ a.x / b, a.y / b }) +#define vec2_mul(a, b) ((vec2){ a.x * (b), a.y * (b) }) +#define vec2_div(a, b) ((vec2){ a.x / (b), a.y / (b) }) #define vec2_dot(a, b) ((u32)(a.x * b.x + a.y * b.y)) #define vec2_eq(a, b) (a.x == b.x && a.y == b.y) -#define vec3(x, y, z) ((vec3){ x, y, z }) +#define vec3(x, y, z) ((vec3){ (x), (y), (z) }) #define vec3to2(a) ((vec2){ a.x, a.y }) #define vec3_add(a, b) ((vec3){ a.x + b.x, a.y + b.y, a.z + b.z }) #define vec3_sub(a, b) ((vec3){ a.x - b.x, a.y - b.y, a.z - b.z }) -#define vec3_mul(a, b) ((vec3){ a.x * b, a.y * b, a.z * b }) -#define vec3_div(a, b) ((vec3){ a.x / b, a.y / b, a.z / b }) +#define vec3_mul(a, b) ((vec3){ a.x * (b), a.y * (b), a.z * (b) }) +#define vec3_div(a, b) ((vec3){ a.x / (b), a.y / (b), a.z / (b) }) #define vec3_dot(a, b) ((u32)(a.x * b.x + a.y * b.y + a.z * b.z)) #define vec3_eq(a, b) (a.x == b.x && a.y == b.y && a.z == c.z) #define vec3_cross(a, b) \ -- cgit v1.2.3