From: Pauli Date: Tue, 15 Mar 2022 03:35:30 +0000 (+1100) Subject: document the safe_div_round_up_TYPE functions X-Git-Tag: openssl-3.2.0-alpha1~2806 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87639c6bdfa976f673d37c067e28fc89c1dfaa5e;p=thirdparty%2Fopenssl.git document the safe_div_round_up_TYPE functions Reviewed-by: Matt Caswell Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/17884) --- diff --git a/doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod b/doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod index 43f9ab34cc8..976b866c556 100644 --- a/doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod +++ b/doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod @@ -4,7 +4,7 @@ OSSL_SAFE_MATH_SIGNED, OSSL_SAFE_MATH_UNSIGNED, safe_add_TYPE, safe_sub_TYPE, safe_mul_TYPE, safe_div_TYPE, safe_mod_TYPE, -safe_neg_TYPE +safe_div_round_up_TYPE, safe_neg_TYPE - create helper functions to safely perform non-overflowing integer operations =head1 SYNOPSIS @@ -21,6 +21,7 @@ safe_neg_TYPE TYPE safe_mul_TYPE(TYPE a, TYPE b, int *err); TYPE safe_div_TYPE(TYPE a, TYPE b, int *err); TYPE safe_mod_TYPE(TYPE a, TYPE b, int *err); + TYPE safe_div_round_up_TYPE(TYPE a, TYPE b, int *err); TYPE safe_muldiv_TYPE(TYPE a, TYPE b, TYPE c, int *err); TYPE safe_neg_TYPE(TYPE a, int *err); TYPE safe_abs_TYPE(TYPE a, int *err); @@ -49,6 +50,10 @@ safe_div_TYPE() divides I by I. safe_mod_TYPE() calculates the remainder when I is divided by I. +safe_div_round_up_TYPE() calculates I / I + (I % I != 0). +I.e. it computes the quotient of I and I rounding any remainder towards +positive infinity. + safe_muldiv_TYPE() multiplies I and I together and divides the result by I.