src/ucx.c

changeset 273
9c1591b3c4a4
parent 270
3d80d425543b
child 331
3b985a4eb05b
equal deleted inserted replaced
272:2def28b65328 273:9c1591b3c4a4
47 47
48 #ifndef UCX_MUL_BUILTIN 48 #ifndef UCX_MUL_BUILTIN
49 int ucx_szmul(size_t a, size_t b, size_t *result) { 49 int ucx_szmul(size_t a, size_t b, size_t *result) {
50 if(a == 0 || b == 0) { 50 if(a == 0 || b == 0) {
51 *result = 0; 51 *result = 0;
52 return 1; 52 return 0;
53 } 53 }
54 size_t r = a * b; 54 size_t r = a * b;
55 if(r / b == a) { 55 if(r / b == a) {
56 *result = r; 56 *result = r;
57 return 0; 57 return 0;
59 *result = 0; 59 *result = 0;
60 return 1; 60 return 1;
61 } 61 }
62 } 62 }
63 #endif 63 #endif
64

mercurial