PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
IntegerArithmeticChecks.h File Reference

This file provides functions to check for integer arithmetic overflow. More...

#include <concepts>
#include <limits>
#include <stdexcept>

Go to the source code of this file.

Classes

struct  pbat::math::OverflowChecked< Integer >
 Wrapper around integer types that throws when integer overflow is detected. More...
 

Namespaces

namespace  pbat
 The main namespace of the library.
 
namespace  pbat::math
 Math related functionality.
 

Functions

template<std::integral Integer>
bool pbat::math::AddOverflows (Integer a, Integer b)
 Checks if the operation \( a+b \) is not in the range of values representable by the type Integer.
 
template<std::integral Integer>
bool pbat::math::MultiplyOverflows (Integer a, Integer b)
 Checks if the operation \( ab \) is not in the range of values representable by the type of Integer.
 
template<std::integral Integer>
bool pbat::math::NegationOverflows (Integer a)
 Checks if the operation \( -a \) is not in the range of values representable by the type of Integer.
 

Detailed Description

This file provides functions to check for integer arithmetic overflow.

Author
Quoc-Minh Ton-That (tonth.nosp@m.at.q.nosp@m.uocmi.nosp@m.nh@g.nosp@m.mail..nosp@m.com)
Date
2025-02-11