19#include "pw_preprocessor/compiler.h"
41template <
typename A,
typename B,
typename T>
42[[nodiscard]]
constexpr bool CheckedAdd(A a, B b, T& result) {
65template <
typename T,
typename A,
typename B>
66[[nodiscard]]
constexpr std::optional<T>
CheckedAdd(A a, B b) {
87template <
typename T,
typename Inc>
107template <
typename A,
typename B,
typename T>
108[[nodiscard]]
constexpr bool CheckedSub(A a, B b, T& result) {
131template <
typename T,
typename A,
typename B>
132[[nodiscard]]
constexpr std::optional<T>
CheckedSub(A a, B b) {
153template <
typename T,
typename Dec>
173template <
typename A,
typename B,
typename T>
174[[nodiscard]]
constexpr bool CheckedMul(A a, B b, T& result) {
197template <
typename T,
typename A,
typename B>
198[[nodiscard]]
constexpr std::optional<T>
CheckedMul(A a, B b) {
constexpr bool CheckedDecrement(T &base, Dec dec)
Definition: checked_arithmetic.h:154
constexpr bool CheckedIncrement(T &base, Inc inc)
Definition: checked_arithmetic.h:88
constexpr bool CheckedAdd(A a, B b, T &result)
Definition: checked_arithmetic.h:42
constexpr bool CheckedMul(A a, B b, T &result)
Definition: checked_arithmetic.h:174
constexpr bool CheckedSub(A a, B b, T &result)
Definition: checked_arithmetic.h:108
#define PW_SUB_OVERFLOW(a, b, out)
Definition: compiler.h:294
#define PW_ADD_OVERFLOW(a, b, out)
Definition: compiler.h:282
#define PW_MUL_OVERFLOW(a, b, out)
Definition: compiler.h:304
Provides basic helpers for reading and writing UTF-8 encoded strings.
Definition: alignment.h:27