OpenTTD Source 20261129-master-g72a8bdc861
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

using OverflowSafeInt64 = OverflowSafeInt<int64_t>
 A 64-bit overflow safe type.
using OverflowSafeInt32 = OverflowSafeInt<int32_t>
 A 32-bit overflow safe type.

Functions

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.

Typedef Documentation

◆ OverflowSafeInt32

A 32-bit overflow safe type.

Definition at line 278 of file overflowsafe_type.hpp.

◆ OverflowSafeInt64

A 64-bit overflow safe type.

Definition at line 275 of file overflowsafe_type.hpp.

Function Documentation

◆ ClampTo()

template<typename To, typename From>
To ClampTo ( OverflowSafeInt< From > value)
constexpr

Definition at line 288 of file overflowsafe_type.hpp.