Добавление swap функций для векторов, кватернионов и матриц / Swap functions have been added for vectors, quaternions and matrixes

This commit is contained in:
Andrey Pokidov 2024-11-27 16:49:58 +07:00
parent a30629df67
commit 5fd14e4627
10 changed files with 363 additions and 12 deletions

View file

@ -105,6 +105,50 @@ static inline void bg_fp64_matrix2x2_copy(const BgFP64Matrix2x2* from, BgFP64Mat
to->r2c2 = from->r2c2;
}
// ==================== Swap ==================== //
static inline void bg_fp32_matrix2x2_swap(BgFP32Matrix2x2* matrix1, BgFP32Matrix2x2* matrix2)
{
const float r1c1 = matrix2->r1c1;
const float r1c2 = matrix2->r1c2;
const float r2c1 = matrix2->r2c1;
const float r2c2 = matrix2->r2c2;
matrix2->r1c1 = matrix1->r1c1;
matrix2->r1c2 = matrix1->r1c2;
matrix2->r2c1 = matrix1->r2c1;
matrix2->r2c2 = matrix1->r2c2;
matrix1->r1c1 = r1c1;
matrix1->r1c2 = r1c2;
matrix1->r2c1 = r2c1;
matrix1->r2c2 = r2c2;
}
static inline void bg_fp64_matrix2x2_swap(BgFP64Matrix2x2* matrix1, BgFP64Matrix2x2* matrix2)
{
const double r1c1 = matrix2->r1c1;
const double r1c2 = matrix2->r1c2;
const double r2c1 = matrix2->r2c1;
const double r2c2 = matrix2->r2c2;
matrix2->r1c1 = matrix1->r1c1;
matrix2->r1c2 = matrix1->r1c2;
matrix2->r2c1 = matrix1->r2c1;
matrix2->r2c2 = matrix1->r2c2;
matrix1->r1c1 = r1c1;
matrix1->r1c2 = r1c2;
matrix1->r2c1 = r2c1;
matrix1->r2c2 = r2c2;
}
// ============= Copy to twin type ============== //
static inline void bg_fp32_matrix2x2_set_from_fp64(const BgFP64Matrix2x2* from, BgFP32Matrix2x2* to)