From 4a5970595f7fff9ee1523d16d3618ed836be29fe Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 25 Sep 2023 14:54:46 +0200 Subject: [PATCH] math: document add and mul Signed-off-by: Simon Rozman --- include/stdex/math.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/stdex/math.hpp b/include/stdex/math.hpp index 0331dbf68..2f3f25dc7 100644 --- a/include/stdex/math.hpp +++ b/include/stdex/math.hpp @@ -11,6 +11,14 @@ namespace stdex { + /// + /// Multiplies two numbers and throws on overflow + /// + /// \param[in] a First operand + /// \param[in] b Second operand + /// + /// \return a * b + /// inline size_t mul(size_t a, size_t b) { #if _MSC_VER >= 1300 @@ -30,6 +38,14 @@ namespace stdex throw std::invalid_argument("multiply overflow"); } + /// + /// Adds two numbers and throws on overflow + /// + /// \param[in] a First operand + /// \param[in] b Second operand + /// + /// \return a + b + /// inline size_t add(size_t a, size_t b) { #if _MSC_VER >= 1300