aboutsummaryrefslogtreecommitdiff
path: root/src/ungrateful.h
diff options
context:
space:
mode:
authorbonmas14 <bonmas14@gmail.com>2025-09-25 14:17:07 +0300
committerbonmas14 <bonmas14@gmail.com>2025-09-25 14:17:07 +0300
commit166877cf15f6afa89c9f8a61e267d485868d0ee1 (patch)
tree9f080314edc4fb293f91227cdc1c01cfec8d7bae /src/ungrateful.h
parent8ebdc95621bc61fdf3c98cd7ae4ddca67398df23 (diff)
downloadungrateful-166877cf15f6afa89c9f8a61e267d485868d0ee1.tar.gz
ungrateful-166877cf15f6afa89c9f8a61e267d485868d0ee1.zip
+disgrace and rework of ungrateful.h
Diffstat (limited to 'src/ungrateful.h')
-rw-r--r--src/ungrateful.h396
1 files changed, 209 insertions, 187 deletions
diff --git a/src/ungrateful.h b/src/ungrateful.h
index 82152fa..ba78eca 100644
--- a/src/ungrateful.h
+++ b/src/ungrateful.h
@@ -59,8 +59,8 @@
#include <stdbool.h>
#include <stdarg.h>
#include <limits.h>
-#include <assert.h>
#include <math.h>
+#include <string.h>
#include <wchar.h>
#define UNUSED(x) (void)(x)
@@ -69,15 +69,40 @@
#define UN_MB(s) (UN_KB(s) * 1024LL)
#define UN_GB(s) (UN_MB(s) * 1024LL)
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define UN_INLINE inline
+#elif defined(__GNUC__) || defined(__clang__)
+#define UN_INLINE __inline__
+#elif defined(_MSC_VER)
+#define UN_INLINE __inline
+#else
+#define UN_INLINE
+#endif
+
#define UN_MAX(a, b) (a) > (b) ? (a) : (b)
#define UN_MIN(a, b) (a) < (b) ? (a) : (b)
#define UN_TODO(msg) assert((msg, false))
-#define UN_CSTR (u8*)
-#define UN_STR(cstr) un_string_from_cstring(UN_CSTR cstr)
-#define CSTR (char*)
+#define UN_STR(cstr) un_string_from_cstring(cstr)
+
+#define UN_CLEAR(var) memset((void*)&var, 0, sizeof(var))
+#define UN_POW_OF2(x) (((uintptr_t)(x) > 0) && (((uintptr_t)(x) & ((uintptr_t)(x) - 1)) == 0))
+#define UN_DEFAULT_ALIGN (2 * sizeof(void *))
+
+#if !defined(assert)
+#if !defined(NDEBUG)
+#include <stdio.h>
+
+#define assert(expr) if ((int)(expr) == 0) {\
+ fprintf(stderr, "Assert at %s:%d failed!\n", __FILE__, __LINE__); \
+ *((int *)0) = 0; \
+}
+
+#else
+#define assert(expr) (void)(expr)
+#endif /* NDEBUG */
+#endif /* assert */
-#define UN_CLEAR(var) un_memory_set((void*)&var, 0, sizeof(var))
#if defined(__cplusplus)
extern "C" {
@@ -88,60 +113,63 @@ typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
-typedef int64_t s64;
-typedef int32_t s32;
-typedef int16_t s16;
-typedef int8_t s8;
-
-typedef int8_t b32;
-typedef int8_t b8;
+typedef int64_t s64;
+typedef int32_t s32;
+typedef int16_t s16;
+typedef int8_t s8;
-typedef float f32;
-typedef double f64;
+typedef int32_t b32;
+typedef int8_t b8;
typedef wchar_t wchar;
+typedef struct float2 { float x, y; } float2;
+typedef struct float3 { float x, y, z; } float3;
+typedef struct float4 { float x, y, z, w; } float4;
+
+typedef struct double2 { double x, y; } double2;
+typedef struct double3 { double x, y, z; } double3;
+typedef struct double4 { double x, y, z, w; } double4;
+
+#if defined(UN_DOUBLE_PRECISION)
+ typedef float real;
+ typedef float2 real2;
+ typedef float3 real3;
+ typedef float4 real4;
+#else
+ typedef double real;
+ typedef double2 real2;
+ typedef double3 real3;
+ typedef double4 real4;
+#endif /* UN_DOUBLE_PRECISION */
+
#if !defined(PI)
-# define PI 3.14159265358979323846f
+# define PI 3.14159265358979323846
+#endif
+
+#if !defined(TAU)
+# define TAU (PI * 2)
#endif
#if !defined(EPSILON)
-# define EPSILON 0.000001f
+# define EPSILON 0.000001
#endif
#if !defined(DEG2RAD)
-# define DEG2RAD (PI/180.0f)
+# define DEG2RAD (PI/180.0)
#endif
#if !defined(RAD2DEG)
-# define RAD2DEG (180.0f/PI)
-#endif
-
-#if defined(UN_DOUBLE_PRECISION)
- typedef double real;
-#else
- typedef float real;
-#endif // UN_DOUBLE_PRECISION
-
-#if !defined(PI_D)
-# define PI_D 3.14159265358979323846
+# define RAD2DEG (180.0/PI)
#endif
#if !defined(EPSILON_D)
# define EPSILON_D 0.000000000000001
#endif
-#if !defined(DEG2RAD_D)
-# define DEG2RAD_D (PI/180.0)
-#endif
-#if !defined(RAD2DEG_D)
-# define RAD2DEG_D (180.0/PI)
-#endif
-
-
-#define un_vec_unwrap2(vec) vec[0], vec[1]
-#define un_vec_unwrap3(vec) vec[0], vec[1], vec[2]
-#define un_vec_unwrap4(vec) vec[0], vec[1], vec[2], vec[3]
+#define un_vec_unwrap2(vec) (vec).x, (vec).y
+#define un_vec_unwrap3(vec) (vec).x, (vec).y, (vec).z
+#define un_vec_unwrap4(vec) (vec).x, (vec).y, (vec).z, (vec).w
/* ---- Memory Allocators API ---- */
@@ -152,7 +180,7 @@ typedef enum {
} Allocator_Message;
#define ALLOCATOR_PROC_SIGNATURE(name)\
- void *name(void *p, u64 size, Allocator_Message message, void *data)
+ void *name(void *p, u64 size, u32 align, Allocator_Message message, void *data)
typedef ALLOCATOR_PROC_SIGNATURE(Allocator_Proc);
@@ -161,21 +189,18 @@ typedef struct {
void *data;
} Allocator;
-// extern Allocator un_allocator_create_heap(s64 chunk_size); /* ... for large things. */
-extern Allocator un_allocator_create_arena(u64 initial_size); /* Grouping allocator, that will recursively grow. */
-extern Allocator un_allocator_create_wrapper(Allocator target); /* Allocator for debug purposes. */
+extern Allocator un_alloc_std_get(void);
-extern Allocator un_allocator_get_standard(void);
-extern Allocator un_allocator_get_temporary(void);
+extern void un_alloc_temp_init(u64 byte_size);
+extern void un_alloc_temp_reset(void);
+extern Allocator un_alloc_temp_get(void);
-extern void *un_memory_alloc(u64 size, Allocator alloc);
-extern void un_memory_free(void *ptr, Allocator alloc);
-extern void un_memory_destroy(Allocator *alloc);
+extern Allocator un_alloc_arena_create(u64 initial_size);
+extern void un_alloc_arena_destroy(Allocator *alloc);
-extern void un_memory_set(u8 *dest, u8 value, u64 size);
-extern void un_memory_copy(u8 *dest, u8 *src, u64 size);
-extern void un_memory_move(u8 *dest, u8 *src, u64 size);
-extern s32 un_memory_compare(u8 *left, u8 *right, u64 size); /* checks for every byte in arrays for condition: if left is bigger that right. */
+extern void* un_memory_alloc(u64 size, Allocator alloc);
+extern void* un_memory_alloc_align(u64 size, u32 align, Allocator alloc);
+extern void un_memory_free(void *ptr, Allocator alloc);
/* ---- Generic list structure ---- */
@@ -190,7 +215,7 @@ typedef struct {
} List;
extern List un_list_create(u64 start_capacity, u64 element_size, Allocator alloc);
-extern void un_list_destroy(List *list, b32 delete_allocator);
+extern void un_list_destroy(List *list);
extern List un_list_clone(List *list, Allocator alloc);
extern b32 un_list_append(List *list, void *data); /* Returns true if succeed. */
@@ -204,9 +229,7 @@ typedef struct {
u8 *data;
} String;
-extern u64 un_string_get_length(u8 *cstring);
-
-extern String un_string_from_cstring(u8* cstring);
+extern String un_string_from_cstring(char *cstring);
extern u8* un_string_to_cstring(String string, Allocator alloc);
extern String un_string_copy(String source, Allocator alloc);
@@ -246,130 +269,129 @@ extern wchar* un_wstring_from_cstring(u8 *utf8_string, Allocator alloc);
#define un_m_lerpr un_m_lerpf
#endif
-f32 un_m_lerpf(f32 a, f32 b, f32 t);
-f64 un_m_lerpd(f64 a, f64 b, f64 t);
+extern UN_INLINE float un_m_lerpf(float a, float b, float t);
+extern UN_INLINE double un_m_lerpd(double a, double b, double t);
-/* 2d f32 */
-extern void un_m_add2f(f32 *v, f32 *a, f32 *b);
-extern void un_m_sub2f(f32 *v, f32 *a, f32 *b);
-extern void un_m_add_scalar2f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_sub_scalar2f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_mul_scalar2f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_div_scalar2f(f32 *v, f32 *a, f32 scalar);
+/* 2d float */
+extern UN_INLINE float2 un_m_add2f(float2 a, float2 b);
+extern UN_INLINE float2 un_m_sub2f(float2 a, float2 b);
+extern UN_INLINE float2 un_m_add_scalar2f(float2 a, float scalar);
+extern UN_INLINE float2 un_m_sub_scalar2f(float2 a, float scalar);
+extern UN_INLINE float2 un_m_mul_scalar2f(float2 a, float scalar);
+extern UN_INLINE float2 un_m_div_scalar2f(float2 a, float scalar);
-extern void un_m_dot2f(f32 *v, f32 *a, f32 *b);
-extern void un_m_hadamard2f(f32 *v, f32 *a, f32 *b);
-extern void un_m_project2f(f32 *v, f32 *a, f32 *onto);
-extern void un_m_reflect2f(f32 *v, f32 *a, f32 *normal);
-extern void un_m_cross2f(f32 *v, f32 *a);
+extern UN_INLINE float un_m_dot2f(float2 a, float2 b);
+extern UN_INLINE float2 un_m_hadamard2f(float2 a, float2 b);
+extern UN_INLINE float2 un_m_project2f(float2 a, float2 onto);
+extern UN_INLINE float2 un_m_reflect2f(float2 a, float2 normal);
+extern UN_INLINE float2 un_m_cross2f(float2 a);
-extern void un_m_normalize2f(f32 *v, f32 *a);
-extern void un_m_magnitude2f(f32 *v, f32 *a);
-extern void un_m_magnitude_sqr2f(f32 *v, f32 *a);
-extern void un_m_distance2f(f32 *v, f32 *a, f32 *b);
-extern void un_m_distance_sqr2f(f32 *v, f32 *a, f32 *b);
+extern UN_INLINE float2 un_m_normalize2f(float2 a);
+extern UN_INLINE float un_m_magnitude2f(float2 a);
+extern UN_INLINE float un_m_magnitude_sqr2f(float2 a);
+extern UN_INLINE float un_m_distance2f(float2 a, float2 b);
+extern UN_INLINE float un_m_distance_sqr2f(float2 a, float2 b);
-/* 3d f32 */
-extern void un_m_add3f(f32 *v, f32 *a, f32 *b);
-extern void un_m_sub3f(f32 *v, f32 *a, f32 *b);
-extern void un_m_add_scalar3f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_sub_scalar3f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_mul_scalar3f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_div_scalar3f(f32 *v, f32 *a, f32 scalar);
+/* 3d float */
+extern UN_INLINE float3 un_m_add3f(float3 a, float3 b);
+extern UN_INLINE float3 un_m_sub3f(float3 a, float3 b);
+extern UN_INLINE float3 un_m_add_scalar3f(float3 a, float scalar);
+extern UN_INLINE float3 un_m_sub_scalar3f(float3 a, float scalar);
+extern UN_INLINE float3 un_m_mul_scalar3f(float3 a, float scalar);
+extern UN_INLINE float3 un_m_div_scalar3f(float3 a, float scalar);
-extern void un_m_dot3f(f32 *v, f32 *a, f32 *b);
-extern void un_m_hadamard3f(f32 *v, f32 *a, f32 *b);
-extern void un_m_project3f(f32 *v, f32 *a, f32 *onto);
-extern void un_m_reflect3f(f32 *v, f32 *a, f32 *normal);
-extern void un_m_cross3f(f32 *v, f32 *a, f32 *b);
+extern UN_INLINE float un_m_dot3f(float3 a, float3 b);
+extern UN_INLINE float3 un_m_hadamard3f(float3 a, float3 b);
+extern UN_INLINE float3 un_m_project3f(float3 a, float3 onto);
+extern UN_INLINE float3 un_m_reflect3f(float3 a, float3 normal);
+extern UN_INLINE float3 un_m_cross3f(float3 a, float3 b);
-extern void un_m_normalize3f(f32 *v, f32 *a);
-extern void un_m_magnitude3f(f32 *v, f32 *a);
-extern void un_m_magnitude_sqr3f(f32 *v, f32 *a);
-extern void un_m_distance3f(f32 *v, f32 *a, f32 *b);
-extern void un_m_distance_sqr3f(f32 *v, f32 *a, f32 *b);
+extern UN_INLINE float3 un_m_normalize3f(float3 a);
+extern UN_INLINE float un_m_magnitude3f(float3 a);
+extern UN_INLINE float un_m_magnitude_sqr3f(float3 a);
+extern UN_INLINE float un_m_distance3f(float3 a, float3 b);
+extern UN_INLINE float un_m_distance_sqr3f(float3 a, float3 b);
-/* 4d f32 */
-extern void un_m_add4f(f32 *v, f32 *a, f32 *b);
-extern void un_m_sub4f(f32 *v, f32 *a, f32 *b);
-extern void un_m_add_scalar4f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_sub_scalar4f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_mul_scalar4f(f32 *v, f32 *a, f32 scalar);
-extern void un_m_div_scalar4f(f32 *v, f32 *a, f32 scalar);
+/* 4d float */
+extern UN_INLINE float4 un_m_add4f(float4 a, float4 b);
+extern UN_INLINE float4 un_m_sub4f(float4 a, float4 b);
+extern UN_INLINE float4 un_m_add_scalar4f(float4 a, float scalar);
+extern UN_INLINE float4 un_m_sub_scalar4f(float4 a, float scalar);
+extern UN_INLINE float4 un_m_mul_scalar4f(float4 a, float scalar);
+extern UN_INLINE float4 un_m_div_scalar4f(float4 a, float scalar);
-extern void un_m_dot4f(f32 *v, f32 *a, f32 *b);
-extern void un_m_hadamard4f(f32 *v, f32 *a, f32 *b);
-extern void un_m_project4f(f32 *v, f32 *a, f32 *onto);
-extern void un_m_reflect4f(f32 *v, f32 *a, f32 *normal);
+extern UN_INLINE float un_m_dot4f(float4 a, float4 b);
+extern UN_INLINE float4 un_m_hadamard4f(float4 a, float4 b);
+extern UN_INLINE float4 un_m_project4f(float4 a, float4 onto);
+extern UN_INLINE float4 un_m_reflect4f(float4 a, float4 normal);
-extern void un_m_normalize4f(f32 *v, f32 *a);
-extern void un_m_magnitude4f(f32 *v, f32 *a);
-extern void un_m_magnitude_sqr4f(f32 *v, f32 *a);
-extern void un_m_distance4f(f32 *v, f32 *a, f32 *b);
-extern void un_m_distance_sqr4f(f32 *v, f32 *a, f32 *b);
+extern UN_INLINE float4 un_m_normalize4f(float4 a);
+extern UN_INLINE float un_m_magnitude4f(float4 a);
+extern UN_INLINE float un_m_magnitude_sqr4f(float4 a);
+extern UN_INLINE float un_m_distance4f(float4 a, float4 b);
+extern UN_INLINE float un_m_distance_sqr4f(float4 a, float4 b);
+/* 2d double */
+extern UN_INLINE double2 un_m_add2d(double2 a, double2 b);
+extern UN_INLINE double2 un_m_sub2d(double2 a, double2 b);
-/* 2d f64 */
-extern void un_m_add2d(f64 *v, f64 *a, f64 *b);
-extern void un_m_sub2d(f64 *v, f64 *a, f64 *b);
+extern UN_INLINE double2 un_m_add_scalar2d(double2 a, double scalar);
+extern UN_INLINE double2 un_m_sub_scalar2d(double2 a, double scalar);
+extern UN_INLINE double2 un_m_mul_scalar2d(double2 a, double scalar);
+extern UN_INLINE double2 un_m_div_scalar2d(double2 a, double scalar);
-extern void un_m_add_scalar2d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_sub_scalar2d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_mul_scalar2d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_div_scalar2d(f64 *v, f64 *a, f64 scalar);
+extern UN_INLINE double un_m_dot2d(double2 a, double2 b);
+extern UN_INLINE double2 un_m_hadamard2d(double2 a, double2 b);
+extern UN_INLINE double2 un_m_project2d(double2 a, double2 onto);
+extern UN_INLINE double2 un_m_reflect2d(double2 a, double2 normal);
+extern UN_INLINE double2 un_m_cross2d(double2 a);
-extern void un_m_dot2d(f64 *v, f64 *a, f64 *b);
-extern void un_m_hadamard2d(f64 *v, f64 *a, f64 *b);
-extern void un_m_project2d(f64 *v, f64 *a, f64 *onto);
-extern void un_m_reflect2d(f64 *v, f64 *a, f64 *normal);
-extern void un_m_cross2d(f64 *v, f64 *a);
+extern UN_INLINE double2 un_m_normalize2d(double2 a);
+extern UN_INLINE double un_m_magnitude2d(double2 a);
+extern UN_INLINE double un_m_magnitude_sqr2d(double2 a);
+extern UN_INLINE double un_m_distance2d(double2 a, double2 b);
+extern UN_INLINE double un_m_distance_sqr2d(double2 a, double2 b);
-extern void un_m_normalize2d(f64 *v, f64 *a);
-extern void un_m_magnitude2d(f64 *v, f64 *a);
-extern void un_m_magnitude_sqr2d(f64 *v, f64 *a);
-extern void un_m_distance2d(f64 *v, f64 *a, f64 *b);
-extern void un_m_distance_sqr2d(f64 *v, f64 *a, f64 *b);
+/* 3d double */
+extern UN_INLINE double3 un_m_add3d(double3 a, double3 b);
+extern UN_INLINE double3 un_m_sub3d(double3 a, double3 b);
-/* 3d f64 */
-extern void un_m_add3d(f64 *v, f64 *a, f64 *b);
-extern void un_m_sub3d(f64 *v, f64 *a, f64 *b);
+extern UN_INLINE double3 un_m_add_scalar3d(double3 a, double scalar);
+extern UN_INLINE double3 un_m_sub_scalar3d(double3 a, double scalar);
+extern UN_INLINE double3 un_m_mul_scalar3d(double3 a, double scalar);
+extern UN_INLINE double3 un_m_div_scalar3d(double3 a, double scalar);
-extern void un_m_add_scalar3d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_sub_scalar3d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_mul_scalar3d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_div_scalar3d(f64 *v, f64 *a, f64 scalar);
+extern UN_INLINE double un_m_dot3d(double3 a, double3 b);
+extern UN_INLINE double3 un_m_hadamard3d(double3 a, double3 b);
+extern UN_INLINE double3 un_m_project3d(double3 a, double3 onto);
+extern UN_INLINE double3 un_m_reflect3d(double3 a, double3 normal);
+extern UN_INLINE double3 un_m_cross3d(double3 a, double3 b);
-extern void un_m_dot3d(f64 *v, f64 *a, f64 *b);
-extern void un_m_hadamard3d(f64 *v, f64 *a, f64 *b);
-extern void un_m_project3d(f64 *v, f64 *a, f64 *onto);
-extern void un_m_reflect3d(f64 *v, f64 *a, f64 *normal);
-extern void un_m_cross3d(f64 *v, f64 *a, f64 *b);
+extern UN_INLINE double3 un_m_normalize3d(double3 a);
+extern UN_INLINE double un_m_magnitude3d(double3 a);
+extern UN_INLINE double un_m_magnitude_sqr3d(double3 a);
+extern UN_INLINE double un_m_distance3d(double3 a, double3 b);
+extern UN_INLINE double un_m_distance_sqr3d(double3 a, double3 b);
-extern void un_m_normalize3d(f64 *v, f64 *a);
-extern void un_m_magnitude3d(f64 *v, f64 *a);
-extern void un_m_magnitude_sqr3d(f64 *v, f64 *a);
-extern void un_m_distance3d(f64 *v, f64 *a, f64 *b);
-extern void un_m_distance_sqr3d(f64 *v, f64 *a, f64 *b);
+/* 4d double */
+extern UN_INLINE double4 un_m_add4d(double4 a, double4 b);
+extern UN_INLINE double4 un_m_sub4d(double4 a, double4 b);
-/* 4d f64 */
-extern void un_m_add4d(f64 *v, f64 *a, f64 *b);
-extern void un_m_sub4d(f64 *v, f64 *a, f64 *b);
+extern UN_INLINE double4 un_m_add_scalar4d(double4 a, double scalar);
+extern UN_INLINE double4 un_m_sub_scalar4d(double4 a, double scalar);
+extern UN_INLINE double4 un_m_mul_scalar4d(double4 a, double scalar);
+extern UN_INLINE double4 un_m_div_scalar4d(double4 a, double scalar);
-extern void un_m_add_scalar4d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_sub_scalar4d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_mul_scalar4d(f64 *v, f64 *a, f64 scalar);
-extern void un_m_div_scalar4d(f64 *v, f64 *a, f64 scalar);
+extern UN_INLINE double un_m_dot4d(double4 a, double4 b);
+extern UN_INLINE double4 un_m_hadamard4d(double4 a, double4 b);
+extern UN_INLINE double4 un_m_project4d(double4 a, double4 onto);
+extern UN_INLINE double4 un_m_reflect4d(double4 a, double4 normal);
-extern void un_m_dot4d(f64 *v, f64 *a, f64 *b);
-extern void un_m_hadamard4d(f64 *v, f64 *a, f64 *b);
-extern void un_m_project4d(f64 *v, f64 *a, f64 *onto);
-extern void un_m_reflect4d(f64 *v, f64 *a, f64 *normal);
-
-extern void un_m_normalize4d(f64 *v, f64 *a);
-extern void un_m_magnitude4d(f64 *v, f64 *a);
-extern void un_m_magnitude_sqr4d(f64 *v, f64 *a);
-extern void un_m_distance4d(f64 *v, f64 *a, f64 *b);
-extern void un_m_distance_sqr4d(f64 *v, f64 *a, f64 *b);
+extern UN_INLINE double4 un_m_normalize4d(double4 a);
+extern UN_INLINE double un_m_magnitude4d(double4 a);
+extern UN_INLINE double un_m_magnitude_sqr4d(double4 a);
+extern UN_INLINE double un_m_distance4d(double4 a, double4 b);
+extern UN_INLINE double un_m_distance_sqr4d(double4 a, double4 b);
#if defined(UN_DOUBLE_PRECISION)
@@ -505,13 +527,13 @@ extern void un_m_distance_sqr4d(f64 *v, f64 *a, f64 *b);
#define un_m_complex_addf un_m_add2f
#define un_m_complex_subf un_m_sub2f
-extern void un_m_complex_divf(f32 *v, f32 *a, f32 *b);
-extern void un_m_complex_mulf(f32 *v, f32 *a, f32 *b);
+extern float2 un_m_complex_divf(float2 a, float2 b);
+extern float2 un_m_complex_mulf(float2 a, float2 b);
#define un_m_complex_addd un_m_add2d
#define un_m_complex_subd un_m_sub2d
-extern void un_m_complex_divd(f64 *v, f64 *a, f64 *b);
-extern void un_m_complex_muld(f64 *v, f64 *a, f64 *b);
+extern double2 un_m_complex_divd(double2 a, double2 b);
+extern double2 un_m_complex_muld(double2 a, double2 b);
#define un_m_complex_magnitudef un_m_magnitude2f
#define un_m_complex_magnituded un_m_magnitude2d
@@ -532,15 +554,15 @@ extern void un_m_complex_muld(f64 *v, f64 *a, f64 *b);
/* ---- splines ---- */
-void un_m_bezierf(f32 *v, f32 a, f32 q0, f32 q1, f32 b, f32 t);
-void un_m_bezier2f(f32 *v, f32 *a, f32 *q0, f32 *q1, f32 *b, f32 t);
-void un_m_bezier3f(f32 *v, f32 *a, f32 *q0, f32 *q1, f32 *b, f32 t);
-void un_m_bezier4f(f32 *v, f32 *a, f32 *q0, f32 *q1, f32 *b, f32 t);
-
-void un_m_bezierd(f64 *v, f64 a, f64 q0, f64 q1, f64 b, f64 t);
-void un_m_bezier2d(f64 *v, f64 *a, f64 *q0, f64 *q1, f64 *b, f64 t);
-void un_m_bezier3d(f64 *v, f64 *a, f64 *q0, f64 *q1, f64 *b, f64 t);
-void un_m_bezier4d(f64 *v, f64 *a, f64 *q0, f64 *q1, f64 *b, f64 t);
+extern UN_INLINE float un_m_bezierf(float a, float q0, float q1, float b, float t);
+extern UN_INLINE float2 un_m_bezier2f(float2 a, float2 q0, float2 q1, float2 b, float t);
+extern UN_INLINE float3 un_m_bezier3f(float3 a, float3 q0, float3 q1, float3 b, float t);
+extern UN_INLINE float4 un_m_bezier4f(float4 a, float4 q0, float4 q1, float4 b, float t);
+
+extern UN_INLINE double un_m_bezierd(double a, double q0, double q1, double b, double t);
+extern UN_INLINE double2 un_m_bezier2d(double2 a, double2 q0, double2 q1, double2 b, double t);
+extern UN_INLINE double3 un_m_bezier3d(double3 a, double3 q0, double3 q1, double3 b, double t);
+extern UN_INLINE double4 un_m_bezier4d(double4 a, double4 q0, double4 q1, double4 b, double t);
#if defined(UN_DOUBLE_PRECISION)
#define un_m_bezierr un_m_bezierd
@@ -556,19 +578,19 @@ void un_m_bezier4d(f64 *v, f64 *a, f64 *q0, f64 *q1, f64 *b, f64 t);
/* ---- easing ---- */
-extern f32 un_m_ease_isinef(f32 t);
-extern f32 un_m_ease_iosinef(f32 t);
-extern f32 un_m_ease_osinef(f32 t);
-extern f32 un_m_ease_iquadf(f32 t);
-extern f32 un_m_ease_ioquadf(f32 t);
-extern f32 un_m_ease_oquadf(f32 t);
-
-extern f64 un_m_ease_isined(f64 t);
-extern f64 un_m_ease_iosined(f64 t);
-extern f64 un_m_ease_osined(f64 t);
-extern f64 un_m_ease_iquadd(f64 t);
-extern f64 un_m_ease_ioquadd(f64 t);
-extern f64 un_m_ease_oquadd(f64 t);
+extern UN_INLINE float un_m_ease_isinef(float t);
+extern UN_INLINE float un_m_ease_iosinef(float t);
+extern UN_INLINE float un_m_ease_osinef(float t);
+extern UN_INLINE float un_m_ease_iquadf(float t);
+extern UN_INLINE float un_m_ease_ioquadf(float t);
+extern UN_INLINE float un_m_ease_oquadf(float t);
+
+extern UN_INLINE double un_m_ease_isined(double t);
+extern UN_INLINE double un_m_ease_iosined(double t);
+extern UN_INLINE double un_m_ease_osined(double t);
+extern UN_INLINE double un_m_ease_iquadd(double t);
+extern UN_INLINE double un_m_ease_ioquadd(double t);
+extern UN_INLINE double un_m_ease_oquadd(double t);
#if defined(UN_DOUBLE_PRECISION)
#define un_m_ease_isiner un_m_ease_isined
@@ -594,8 +616,8 @@ extern f64 un_m_ease_oquadd(f64 t);
#define UN_MATRIX_SIZE (16)
#define UN_MATRIX_STRIPE (4)
-extern void un_m_mat_mulf(f32 *v, f32 *left, f32 *right);
-extern void un_m_mat_identityf(f32 *v);
+extern void un_m_mat_mulf(float *v, float *left, float *right);
+extern void un_m_mat_identityf(float *v);
#if defined(__cplusplus)
}