c-template
safe_math.c File Reference
#include <limits.h>
#include <stdbool.h>
#include "../../include/utils/safe_math.h"
Include dependency graph for safe_math.c:

Go to the source code of this file.

Functions

int safe_add_int (int x, int y, bool *passed)
 
int safe_sub_int (int x, int y, bool *passed)
 
int safe_div_int (int x, int y, bool *passed)
 
int safe_mod_int (int x, int y, bool *passed)
 
unsigned int safe_sub_uint (unsigned int x, unsigned int y, bool *passed)
 
unsigned int safe_add_uint (unsigned int x, unsigned int y, bool *passed)
 
unsigned int safe_div_uint (unsigned int x, unsigned int y, bool *passed)
 
unsigned int safe_mod_uint (unsigned int x, unsigned int y, bool *passed)
 
unsigned int safe_mul_uint (unsigned int x, unsigned int y, bool *passed)
 

Function Documentation

◆ safe_add_int()

int safe_add_int ( int  x,
int  y,
bool *  passed 
)

Definition at line 5 of file safe_math.c.

◆ safe_add_uint()

unsigned int safe_add_uint ( unsigned int  x,
unsigned int  y,
bool *  passed 
)

Definition at line 54 of file safe_math.c.

Here is the caller graph for this function:

◆ safe_div_int()

int safe_div_int ( int  x,
int  y,
bool *  passed 
)

Definition at line 25 of file safe_math.c.

◆ safe_div_uint()

unsigned int safe_div_uint ( unsigned int  x,
unsigned int  y,
bool *  passed 
)

Definition at line 64 of file safe_math.c.

◆ safe_mod_int()

int safe_mod_int ( int  x,
int  y,
bool *  passed 
)

Definition at line 35 of file safe_math.c.

◆ safe_mod_uint()

unsigned int safe_mod_uint ( unsigned int  x,
unsigned int  y,
bool *  passed 
)

Definition at line 74 of file safe_math.c.

◆ safe_mul_uint()

unsigned int safe_mul_uint ( unsigned int  x,
unsigned int  y,
bool *  passed 
)

Definition at line 84 of file safe_math.c.

◆ safe_sub_int()

int safe_sub_int ( int  x,
int  y,
bool *  passed 
)

Definition at line 15 of file safe_math.c.

◆ safe_sub_uint()

unsigned int safe_sub_uint ( unsigned int  x,
unsigned int  y,
bool *  passed 
)

Definition at line 44 of file safe_math.c.

Here is the caller graph for this function: