aboutsummaryrefslogtreecommitdiff
path: root/src/debug.h
diff options
context:
space:
mode:
authorPjotr Prins2017-12-07 09:16:25 +0000
committerPjotr Prins2017-12-07 09:16:25 +0000
commit87223540e63f6da7ea085c1379deacc23b6ba5dc (patch)
tree2a1e1991afed471748e8212c75e13c11e756008c /src/debug.h
parent29df576cca8052e4aa9142ce1bb0ab490b864976 (diff)
downloadpangemma-87223540e63f6da7ea085c1379deacc23b6ba5dc.tar.gz
Some more overflow checks
Diffstat (limited to 'src/debug.h')
-rw-r--r--src/debug.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/debug.h b/src/debug.h
index 69b0a7c..e58c1d5 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -25,6 +25,10 @@ bool is_quiet_mode();
bool is_issue(uint issue);
bool is_legacy_mode();
+#define check_int_mult_overflow(m,n) \
+ { auto x = m * n; \
+ enforce_msg(x / m == n, "multiply integer overflow"); }
+
gsl_matrix *gsl_matrix_safe_alloc(size_t rows,size_t cols);
int gsl_matrix_safe_memcpy (gsl_matrix *dest, const gsl_matrix *src);
void gsl_matrix_safe_free (gsl_matrix *v);