OpenTTD Source  20241109-master-g5e4f8db7d6
overflowsafe_type.hpp File Reference

An overflow safe integer-like type. More...

#include "math_func.hpp"

Go to the source code of this file.

Data Structures

class  OverflowSafeInt< T >
 Overflow safe template for integers, i.e. More...
 

Typedefs

typedef OverflowSafeInt< int64_t > OverflowSafeInt64
 
typedef OverflowSafeInt< int32_t > OverflowSafeInt32
 

Functions

template<class T >
constexpr OverflowSafeInt< T > operator+ (const int64_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator- (const int64_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator* (const int64_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator/ (const int64_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator+ (const int a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator- (const int a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator* (const int a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator/ (const int a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator+ (const uint a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator- (const uint a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator* (const uint a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator/ (const uint a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator+ (const uint8_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator- (const uint8_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator* (const uint8_t a, const OverflowSafeInt< T > b)
 
template<class T >
constexpr OverflowSafeInt< T > operator/ (const uint8_t a, const OverflowSafeInt< T > b)
 
template<typename To , typename From >
constexpr To ClampTo (OverflowSafeInt< From > value)
 

Detailed Description

An overflow safe integer-like type.

Definition in file overflowsafe_type.hpp.