src/ucx.c

changeset 270
3d80d425543b
parent 263
3ff0abc49ed5
child 273
9c1591b3c4a4
equal deleted inserted replaced
269:591473851c95 270:3d80d425543b
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43 * POSSIBILITY OF SUCH DAMAGE. 43 * POSSIBILITY OF SUCH DAMAGE.
44 */ 44 */
45 45
46 #include "ucx/ucx.h" 46 #include "ucx/ucx.h"
47
48 #ifndef UCX_MUL_BUILTIN
49 int ucx_szmul(size_t a, size_t b, size_t *result) {
50 if(a == 0 || b == 0) {
51 *result = 0;
52 return 1;
53 }
54 size_t r = a * b;
55 if(r / b == a) {
56 *result = r;
57 return 0;
58 } else {
59 *result = 0;
60 return 1;
61 }
62 }
63 #endif

mercurial