From a86e6975cc293697128a1a4c6968c2298defd1d2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 16 Apr 2017 04:57:45 +0200 Subject: [PATCH] Update --- libretro-common/gfx/math/matrix_4x4.c | 9 --------- libretro-common/include/gfx/math/matrix_4x4.h | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/libretro-common/gfx/math/matrix_4x4.c b/libretro-common/gfx/math/matrix_4x4.c index 6183aa9e8f..d483527769 100644 --- a/libretro-common/gfx/math/matrix_4x4.c +++ b/libretro-common/gfx/math/matrix_4x4.c @@ -26,15 +26,6 @@ #include #include -void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src) -{ - unsigned i, j; - - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - MAT_ELEM_4X4(*dst, i, j) = MAT_ELEM_4X4(*src, i, j); -} - /* * Sets out to the transposed matrix of in */ diff --git a/libretro-common/include/gfx/math/matrix_4x4.h b/libretro-common/include/gfx/math/matrix_4x4.h index 614076ad1f..f19546cc30 100644 --- a/libretro-common/include/gfx/math/matrix_4x4.h +++ b/libretro-common/include/gfx/math/matrix_4x4.h @@ -42,6 +42,24 @@ typedef struct math_matrix_4x4 float data[16]; } math_matrix_4x4; +#define matrix_4x4_copy(dst, src) \ + MAT_ELEM_4X4(dst, 0, 0) = MAT_ELEM_4X4(src, 0, 0); \ + MAT_ELEM_4X4(dst, 0, 1) = MAT_ELEM_4X4(src, 0, 1); \ + MAT_ELEM_4X4(dst, 0, 2) = MAT_ELEM_4X4(src, 0, 2); \ + MAT_ELEM_4X4(dst, 0, 3) = MAT_ELEM_4X4(src, 0, 3); \ + MAT_ELEM_4X4(dst, 1, 0) = MAT_ELEM_4X4(src, 1, 0); \ + MAT_ELEM_4X4(dst, 1, 1) = MAT_ELEM_4X4(src, 1, 1); \ + MAT_ELEM_4X4(dst, 1, 2) = MAT_ELEM_4X4(src, 1, 2); \ + MAT_ELEM_4X4(dst, 1, 3) = MAT_ELEM_4X4(src, 1, 3); \ + MAT_ELEM_4X4(dst, 2, 0) = MAT_ELEM_4X4(src, 2, 0); \ + MAT_ELEM_4X4(dst, 2, 1) = MAT_ELEM_4X4(src, 2, 1); \ + MAT_ELEM_4X4(dst, 2, 2) = MAT_ELEM_4X4(src, 2, 2); \ + MAT_ELEM_4X4(dst, 2, 3) = MAT_ELEM_4X4(src, 2, 3); \ + MAT_ELEM_4X4(dst, 3, 0) = MAT_ELEM_4X4(src, 3, 0); \ + MAT_ELEM_4X4(dst, 3, 1) = MAT_ELEM_4X4(src, 3, 1); \ + MAT_ELEM_4X4(dst, 3, 2) = MAT_ELEM_4X4(src, 3, 2); \ + MAT_ELEM_4X4(dst, 3, 3) = MAT_ELEM_4X4(src, 3, 3) + /* * Sets mat to an identity matrix */ @@ -63,7 +81,6 @@ typedef struct math_matrix_4x4 MAT_ELEM_4X4(mat, 3, 2) = 0.0f; \ MAT_ELEM_4X4(mat, 3, 3) = 1.0f -void matrix_4x4_copy(math_matrix_4x4 *dst, const math_matrix_4x4 *src); void matrix_4x4_transpose(math_matrix_4x4 *out, const math_matrix_4x4 *in); /*