1//! @file arithmetic.hpp
2//! @author ryftchen
3//! @brief The declarations (arithmetic) in the numeric module.
4//! @version 0.1.0
5//! @copyright Copyright (c) 2022-2025 ryftchen. All rights reserved.
6
7#pragma once
8
9#include <cstdint>
10
11//! @brief The numeric module.
12namespace numeric // NOLINT(modernize-concat-nested-namespaces)
13{
14//! @brief Arithmetic-related functions in the numeric module.
15namespace arithmetic
16{
17//! @brief Brief function description.
18//! @return function description (module_function)
19inline static const char* description() noexcept
20{
21 return "NUM_ARITHMETIC";
22}
23extern const char* version() noexcept;
24
25//! @brief Arithmetic methods.
26class Arithmetic
27{
28public:
29 //! @brief Addition.
30 //! @param augend - augend of addition
31 //! @param addend - addend of addition
32 //! @return sum
33 static std::int32_t addition(const std::int32_t augend, const std::int32_t addend);
34 //! @brief Subtraction.
35 //! @param minuend - minuend of subtraction
36 //! @param subtrahend - subtrahend of subtraction
37 //! @return difference
38 static std::int32_t subtraction(const std::int32_t minuend, const std::int32_t subtrahend);
39 //! @brief Multiplication.
40 //! @param multiplier - multiplier of multiplication
41 //! @param multiplicand - multiplicand of multiplication
42 //! @return product
43 static std::int32_t multiplication(const std::int32_t multiplier, const std::int32_t multiplicand);
44 //! @brief Division.
45 //! @param dividend - dividend of division
46 //! @param divisor - divisor of division
47 //! @return quotient
48 static std::int32_t division(const std::int32_t dividend, const std::int32_t divisor);
49
50private:
51 //! @brief Bitwise operation for add.
52 //! @param a - augend
53 //! @param b - augend
54 //! @return sum
55 static std::int32_t bitAdd(const std::int32_t a, const std::int32_t b);
56 //! @brief Bitwise operation for subtract.
57 //! @param a - minuend
58 //! @param b - subtrahend
59 //! @return difference
60 static std::int32_t bitSub(const std::int32_t a, const std::int32_t b);
61 //! @brief Bitwise operation for absolute value.
62 //! @param a - value
63 //! @return absolute value
64 static std::int32_t bitAbs(const std::int32_t a);
65};
66} // namespace arithmetic
67} // namespace numeric
68