racing_game/math.cpp

31 lines
440 B
C++
Raw Permalink Normal View History

2019-05-25 14:24:49 +10:00
#include "math.h"
void zero_out_bytes(char *data, int size)
{
// Loop over the data varible
for(int i=0;i<size;i++)
{
// Fill it with zeros
data[i] = 0x0;
}
}
// Make the input positive
double positive(double n) {
if(n >= 0) return n;
if(n < 0) return -n;
}
// Efficient squaring ( pow(d, 2) )
double squared(double d) {
return d*d;
}
float squaref(float d) {
return d*d;
}
int squarei(int d) {
return d*d;
}