src/ucx/ucx.c

branch
config
changeset 254
4784c14aa639
parent 135
471e28cca288
equal deleted inserted replaced
253:ddfead6ea863 254:4784c14aa639
1 /** 1 /**
2 * @mainpage UAP Common Extensions 2 * @mainpage UAP Common Extensions
3 * Library with common and useful functions, macros and data structures. 3 * Library with common and useful functions, macros and data structures.
4 * <p> 4 * <p>
5 * Latest available source:<br/> 5 * Latest available source:<br>
6 * <a href="https://sourceforge.net/projects/ucx/files/">
7 * https://sourceforge.net/projects/ucx/files/</a>
8 * </p>
9 *
10 * <p>
11 * Repositories:<br>
12 * <a href="https://sourceforge.net/p/ucx/code">
13 * https://sourceforge.net/p/ucx/code</a>
14 * -&nbsp;or&nbsp;-
6 * <a href="https://develop.uap-core.de/hg/ucx"> 15 * <a href="https://develop.uap-core.de/hg/ucx">
7 * https://develop.uap-core.de/hg/ucx</a> 16 * https://develop.uap-core.de/hg/ucx</a>
8 * </p> 17 * </p>
9 * 18 *
10 * <h2>LICENCE</h2> 19 * <h2>LICENCE</h2>
11 * 20 *
12 * Copyright 2016 Olaf Wintermann. All rights reserved. 21 * Copyright 2017 Mike Becker, Olaf Wintermann All rights reserved.
13 * 22 *
14 * Redistribution and use in source and binary forms, with or without 23 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met: 24 * modification, are permitted provided that the following conditions are met:
16 * 25 *
17 * 1. Redistributions of source code must retain the above copyright 26 * 1. Redistributions of source code must retain the above copyright
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 41 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * 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
34 * POSSIBILITY OF SUCH DAMAGE. 43 * POSSIBILITY OF SUCH DAMAGE.
35 */ 44 */
36 45
37 #include "ucx.h" 46 #include "ucx/ucx.h"
47
48 int ucx_szmul_impl(size_t a, size_t b, size_t *result) {
49 if(a == 0 || b == 0) {
50 *result = 0;
51 return 0;
52 }
53 size_t r = a * b;
54 if(r / b == a) {
55 *result = r;
56 return 0;
57 } else {
58 *result = 0;
59 return 1;
60 }
61 }
62

mercurial