From 87639c6bdfa976f673d37c067e28fc89c1dfaa5e Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 15 Mar 2022 14:35:30 +1100 Subject: [PATCH] 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) --- doc/internal/man3/OSSL_SAFE_MATH_SIGNED.pod | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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. -- 2.47.3