Добавление 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

@ -58,6 +58,32 @@ static inline void bg_fp64_vector2_copy(const BgFP64Vector2* from, BgFP64Vector2
to->x2 = from->x2;
}
// ==================== Swap ==================== //
static inline void bg_fp32_vector2_swap(BgFP32Vector2* vector1, BgFP32Vector2* vector2)
{
const float x1 = vector2->x1;
const float x2 = vector2->x2;
vector2->x1 = vector1->x1;
vector2->x2 = vector1->x2;
vector1->x1 = x1;
vector1->x2 = x2;
}
static inline void bg_fp64_vector2_swap(BgFP64Vector2* vector1, BgFP64Vector2* vector2)
{
const double x1 = vector2->x1;
const double x2 = vector2->x2;
vector2->x1 = vector1->x1;
vector2->x2 = vector1->x2;
vector1->x1 = x1;
vector1->x2 = x2;
}
// ============= Copy to twin type ============== //
static inline void bg_fp32_vector2_set_from_fp64(const BgFP64Vector2* from, BgFP32Vector2* to)