-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsafemath.c
18 lines (16 loc) · 870 Bytes
/
safemath.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "safemath.h"
#include <stdbool.h> // bool
#include <stddef.h> // size_t
#include <stdint.h> // int64_t, uint64_t
extern inline bool i64_add_over(int64_t, int64_t, int64_t *);
extern inline bool u64_add_over(uint64_t, uint64_t, uint64_t *);
extern inline bool size_t_add_over(size_t, size_t, size_t *);
extern inline bool i64_sub_over(int64_t, int64_t, int64_t *);
extern inline bool u64_sub_over(uint64_t, uint64_t, uint64_t *);
extern inline bool size_t_sub_over(size_t, size_t, size_t *);
extern inline bool i64_mul_over(int64_t, int64_t, int64_t *);
extern inline bool u64_mul_over(uint64_t, uint64_t, uint64_t *);
extern inline bool size_t_mul_over(size_t, size_t, size_t *);
extern inline bool i64_div_over(int64_t, int64_t, int64_t *);
extern inline bool i64_mod_over(int64_t, int64_t, int64_t *);
extern inline bool i64_neg_over(int64_t, int64_t *);