From 78e4e867eb759cedf864ebf6e8c2b75585d2bf1d Mon Sep 17 00:00:00 2001 From: Recep Aslantas Date: Thu, 6 Oct 2016 16:54:08 +0300 Subject: [PATCH] unaligned matrix duplication --- include/cglm-mat.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/cglm-mat.h b/include/cglm-mat.h index 10d8047..7bdde93 100644 --- a/include/cglm-mat.h +++ b/include/cglm-mat.h @@ -26,6 +26,21 @@ /* for C only */ #define GLM_MAT4_IDENTITY (mat4)GLM_MAT4_IDENTITY_INIT +/*! + * @brief copy all members of [mat] to [dest] + * + * matrix may not be aligned, u stands for unaligned, this may be useful when + * copying a matrix from external source e.g. asset importer... + * + * @param[in] mat source + * @param[out] dest destination + */ +CGLM_INLINE +void +glm_mat4_udup(mat4 mat, mat4 dest) { + glm__memcpy(float, dest, mat, sizeof(mat4)); +} + /*! * @brief copy all members of [mat] to [dest] * @@ -44,7 +59,7 @@ glm_mat4_dup(mat4 mat, mat4 dest) { _mm_store_ps(dest[2], _mm_load_ps(mat[2])); _mm_store_ps(dest[3], _mm_load_ps(mat[3])); #else - glm__memcpy(float, dest, mat, sizeof(mat4)); + glm_mat4_udup(mat, dest); #endif }