ucx/ucx/ucx.h

changeset 162
18892c0a9adc
parent 157
0b33b9396851
equal deleted inserted replaced
161:b1eac0878ce7 162:18892c0a9adc
38 38
39 /** Major UCX version as integer constant. */ 39 /** Major UCX version as integer constant. */
40 #define UCX_VERSION_MAJOR 2 40 #define UCX_VERSION_MAJOR 2
41 41
42 /** Minor UCX version as integer constant. */ 42 /** Minor UCX version as integer constant. */
43 #define UCX_VERSION_MINOR 0 43 #define UCX_VERSION_MINOR 1
44 44
45 /** Version constant which ensures to increase monotonically. */ 45 /** Version constant which ensures to increase monotonically. */
46 #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR) 46 #define UCX_VERSION (((UCX_VERSION_MAJOR)<<16)|UCX_VERSION_MINOR)
47 47
48 #include <stdlib.h> 48 #include <stdlib.h>
168 168
169 #else /* no GNUC or clang bultin */ 169 #else /* no GNUC or clang bultin */
170 170
171 /** 171 /**
172 * Performs a multiplication of size_t values and checks for overflow. 172 * Performs a multiplication of size_t values and checks for overflow.
173 * 173 *
174 * @param a first operand
175 * @param b second operand
176 * @param result a pointer to a size_t, where the result should
177 * be stored
178 * @return zero, if no overflow occurred and the result is correct, non-zero
179 * otherwise
180 */
181 #define ucx_szmul(a, b, result) ucx_szmul_impl(a, b, result)
182
183 /**
184 * Performs a multiplication of size_t values and checks for overflow.
185 *
174 * This is a custom implementation in case there is no compiler builtin 186 * This is a custom implementation in case there is no compiler builtin
175 * available. 187 * available.
176 * 188 *
177 * @param a first operand 189 * @param a first operand
178 * @param b second operand 190 * @param b second operand
179 * @param result a pointer to a size_t, where the result should 191 * @param result a pointer to a size_t where the result should be stored
180 * be stored 192 * @return zero, if no overflow occurred and the result is correct, non-zero
181 * @return zero, if no overflow occurred and the result is correct, non-zero 193 * otherwise
182 * otherwise 194 */
183 */
184 #define ucx_szmul(a, b, result) ucx_szmul_impl(a, b, result)
185
186 int ucx_szmul_impl(size_t a, size_t b, size_t *result); 195 int ucx_szmul_impl(size_t a, size_t b, size_t *result);
187 196
188 #endif 197 #endif
189 198
190 #ifdef __cplusplus 199 #ifdef __cplusplus

mercurial