Math: Make it possible to use vector for both input and output

Avoids nasty code all over where such math is required, and
compilers can easily deal with such situation.

Don't prefer questionable micro-optimization which comes with
a cost of nasty actual logic code.
This commit is contained in:
2019-01-17 15:41:27 +01:00
parent 91697b0fa0
commit cb5302f962
3 changed files with 55 additions and 17 deletions

View File

@@ -142,12 +142,6 @@ MINLINE void copy_v4_v4_char(char r[4], const char a[4])
}
/* short */
MINLINE void zero_v3_int(int r[3])
{
r[0] = 0;
r[1] = 0;
r[2] = 0;
}
MINLINE void copy_v2_v2_short(short r[2], const short a[2])
{
@@ -171,6 +165,13 @@ MINLINE void copy_v4_v4_short(short r[4], const short a[4])
}
/* int */
MINLINE void zero_v3_int(int r[3])
{
r[0] = 0;
r[1] = 0;
r[2] = 0;
}
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
{
r[0] = a[0];
@@ -192,6 +193,35 @@ MINLINE void copy_v4_v4_int(int r[4], const int a[4])
r[3] = a[3];
}
/* double */
MINLINE void zero_v3_db(double r[3])
{
r[0] = 0.0;
r[1] = 0.0;
r[2] = 0.0;
}
MINLINE void copy_v2_v2_db(double r[2], const double a[2])
{
r[0] = a[0];
r[1] = a[1];
}
MINLINE void copy_v3_v3_db(double r[3], const double a[3])
{
r[0] = a[0];
r[1] = a[1];
r[2] = a[2];
}
MINLINE void copy_v4_v4_db(double r[4], const double a[4])
{
r[0] = a[0];
r[1] = a[1];
r[2] = a[2];
r[3] = a[3];
}
/* int <-> float */
MINLINE void round_v2i_v2fl(int r[2], const float a[2])
{