Split Math.c into smaller files
Friend said that Math.c was too big and complicated.
This commit is contained in:
89
src/Math/Vec4i.c
Normal file
89
src/Math/Vec4i.c
Normal file
@@ -0,0 +1,89 @@
|
||||
#include <BH/Math.h>
|
||||
|
||||
|
||||
void BH_Vec4iAdd(const int *a,
|
||||
const int *b,
|
||||
int *out)
|
||||
{
|
||||
out[0] = a[0] + b[0];
|
||||
out[1] = a[1] + b[1];
|
||||
out[2] = a[2] + b[2];
|
||||
out[3] = a[3] + b[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iSub(const int *a,
|
||||
const int *b,
|
||||
int *out)
|
||||
{
|
||||
out[0] = a[0] - b[0];
|
||||
out[1] = a[1] - b[1];
|
||||
out[2] = a[2] - b[2];
|
||||
out[3] = a[3] - b[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iMul(const int *a,
|
||||
const int *b,
|
||||
int *out)
|
||||
{
|
||||
out[0] = a[0] * b[0];
|
||||
out[1] = a[1] * b[1];
|
||||
out[2] = a[2] * b[2];
|
||||
out[3] = a[3] * b[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iScale(const int *a,
|
||||
int b,
|
||||
int *out)
|
||||
{
|
||||
out[0] = a[0] * b;
|
||||
out[1] = a[1] * b;
|
||||
out[2] = a[2] * b;
|
||||
out[3] = a[3] * b;
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iMulAdd(const int *a,
|
||||
const int *b,
|
||||
const int *c,
|
||||
int *out)
|
||||
{
|
||||
out[0] = a[0] * b[0] + c[0];
|
||||
out[1] = a[1] * b[1] + c[1];
|
||||
out[2] = a[2] * b[2] + c[2];
|
||||
out[3] = a[3] * b[3] + c[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iNegate(const int *in,
|
||||
int *out)
|
||||
{
|
||||
out[0] = -in[0];
|
||||
out[1] = -in[1];
|
||||
out[2] = -in[2];
|
||||
out[3] = -in[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iMin(const int *a,
|
||||
const int *b,
|
||||
int *out)
|
||||
{
|
||||
if (a[0] < b[0]) out[0] = a[0]; else out[0] = b[0];
|
||||
if (a[1] < b[1]) out[1] = a[1]; else out[1] = b[1];
|
||||
if (a[2] < b[2]) out[2] = a[2]; else out[2] = b[2];
|
||||
if (a[3] < b[3]) out[3] = a[3]; else out[3] = b[3];
|
||||
}
|
||||
|
||||
|
||||
void BH_Vec4iMax(const int *a,
|
||||
const int *b,
|
||||
int *out)
|
||||
{
|
||||
if (a[0] > b[0]) out[0] = a[0]; else out[0] = b[0];
|
||||
if (a[1] > b[1]) out[1] = a[1]; else out[1] = b[1];
|
||||
if (a[2] > b[2]) out[2] = a[2]; else out[2] = b[2];
|
||||
if (a[3] > b[3]) out[3] = a[3]; else out[3] = b[3];
|
||||
}
|
||||
Reference in New Issue
Block a user