src/ucx/ucx.h

changeset 373
6f63f5ed3cab
parent 363
8175ba2b3bcb
equal deleted inserted replaced
372:a3e494af5c09 373:6f63f5ed3cab
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