Go to the documentation of this file.
3 #include "../../include/utils/safe_math.h"
44 unsigned int safe_sub_uint(
unsigned int x,
unsigned int y,
bool *passed) {
54 unsigned int safe_add_uint(
unsigned int x,
unsigned int y,
bool *passed) {
55 if (x + y < x || x + y < y) {
64 unsigned int safe_div_uint(
unsigned int x,
unsigned int y,
bool *passed) {
74 unsigned int safe_mod_uint(
unsigned int x,
unsigned int y,
bool *passed) {
84 unsigned int safe_mul_uint(
unsigned int x,
unsigned int y,
bool *passed) {
85 if (x == 0 || y == 0) {
89 unsigned int z = x * y;
unsigned int safe_mul_uint(unsigned int x, unsigned int y, bool *passed)
unsigned int safe_mod_uint(unsigned int x, unsigned int y, bool *passed)
int safe_add_int(int x, int y, bool *passed)
int safe_sub_int(int x, int y, bool *passed)
unsigned int safe_div_uint(unsigned int x, unsigned int y, bool *passed)
unsigned int safe_add_uint(unsigned int x, unsigned 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)