From d26c200ade7dbc8e8ef1e355245978c3bd9c7f88 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Thu, 14 Jan 2021 14:27:14 +0100 Subject: [PATCH] Vector functions should now be inline --- src/vec.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/vec.c b/src/vec.c index aa927ad..19d7a02 100644 --- a/src/vec.c +++ b/src/vec.c @@ -2,49 +2,49 @@ #include "vec.h" -void vec_cpy(Vec *destination, Vec source) { +extern inline void vec_cpy(Vec *destination, Vec source) { /* memcpy for vectors */ destination->x = source.x; destination->y = source.y; } -void vec_add(Vec *vector, Vec force) { +extern inline void vec_add(Vec *vector, Vec force) { /* addition */ vector->x += force.x; vector->y += force.y; } -void vec_sub(Vec *vector, Vec force) { +extern inline void vec_sub(Vec *vector, Vec force) { /* substraction */ vector->x -= force.x; vector->y -= force.y; } -void vec_mul(Vec *vector, int scale) { +extern inline void vec_mul(Vec *vector, int scale) { /* multiplication */ vector->x *= scale; vector->y *= scale; } -void vec_mulf(Vec *vector, float scale) { +extern inline void vec_mulf(Vec *vector, float scale) { /* floating point multiplication */ vector->x *= scale; vector->y *= scale; } -void vec_div(Vec *vector, int scale) { +extern inline void vec_div(Vec *vector, int scale) { /* division */ vector->x /= scale; vector->y /= scale; } -void vec_divf(Vec *vector, float scale) { +extern inline void vec_divf(Vec *vector, float scale) { /* floating point division */ vector->x /= scale; vector->y /= scale; } -void vec_lerp(Vec *from, Vec to, float scale) { +extern inline void vec_lerp(Vec *from, Vec to, float scale) { /* A linear interpolation function, can be used for camera and * animations. 'scale' is the transformation speed, 1 being * instant. */ @@ -52,7 +52,7 @@ void vec_lerp(Vec *from, Vec to, float scale) { from->y = from->y * (1 - scale) + to.y * scale; } -void vec_clamp(Vec *to_limit, Vec min, Vec max) { +extern inline void vec_clamp(Vec *to_limit, Vec min, Vec max) { /* clamp a vector between two points */ if (to_limit->x < min.x) to_limit->x = min.x; if (to_limit->y < min.y) to_limit->y = min.y; @@ -60,7 +60,7 @@ void vec_clamp(Vec *to_limit, Vec min, Vec max) { if (to_limit->y > max.y) to_limit->y = max.y; } -void vec_drect(Vec top_left, Vec bottom_right, int color) { +extern inline void vec_drect(Vec top_left, Vec bottom_right, int color) { /* Draw a rectangle corresponding to two vectors position with * given 'color'. */