--- a/src/ucx.c Tue Jan 02 17:00:21 2018 +0100 +++ b/src/ucx.c Sun Jan 21 10:13:21 2018 +0100 @@ -44,3 +44,20 @@ */ #include "ucx/ucx.h" + +#ifndef UCX_MUL_BUILTIN +int ucx_szmul(size_t a, size_t b, size_t *result) { + if(a == 0 || b == 0) { + *result = 0; + return 1; + } + size_t r = a * b; + if(r / b == a) { + *result = r; + return 0; + } else { + *result = 0; + return 1; + } +} +#endif