31 lines
440 B
C++
31 lines
440 B
C++
#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;
|
|
}
|