libstdc++
stdckdint.h File Reference

Go to the source code of this file.

Namespaces

namespace  __gnu_cxx

Macros

#define __STDC_VERSION_STDCKDINT_H__

Functions

template<typename _Tp1, typename _Tp2, typename _Tp3>
bool ckd_add (_Tp1 *__result, _Tp2 __a, _Tp3 __b)
template<typename _Tp1, typename _Tp2, typename _Tp3>
bool ckd_mul (_Tp1 *__result, _Tp2 __a, _Tp3 __b)
template<typename _Tp1, typename _Tp2, typename _Tp3>
bool ckd_sub (_Tp1 *__result, _Tp2 __a, _Tp3 __b)
template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_add (_Tp1 *__result, _Tp2 __a, _Tp3 __b)
template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_mul (_Tp1 *__result, _Tp2 __a, _Tp3 __b)
template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_sub (_Tp1 *__result, _Tp2 __a, _Tp3 __b)

Detailed Description

This is a Standard C++ Library header.

Definition in file stdckdint.h.

Macro Definition Documentation

◆ __STDC_VERSION_STDCKDINT_H__

#define __STDC_VERSION_STDCKDINT_H__

Definition at line 36 of file stdckdint.h.

Function Documentation

◆ ckd_add()

template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_add ( _Tp1 * __result,
_Tp2 __a,
_Tp3 __b )
inline

Checked integer arithmetic

Performs arithmetic on __a and __b and stores the result in *__result, with overflow detection. The arithmetic is performed in infinite signed precision, without overflow, then converted to the result type, _Tp1. If the converted result is not equal to the infinite precision result, the stored result is wrapped to the width of _Tp1 and true is returned. Otherwise, the stored result is correct and false is returned.

Parameters
__resultA pointer to a signed or unsigned integer type.
__aA signed or unsigned integer type.
__bA signed or unsigned integer type.
Returns
True if overflow occurred, false otherwise.
Since
C++26

Definition at line 63 of file stdckdint.h.

◆ ckd_mul()

template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_mul ( _Tp1 * __result,
_Tp2 __a,
_Tp3 __b )
inline

Definition at line 83 of file stdckdint.h.

◆ ckd_sub()

template<typename _Tp1, typename _Tp2, typename _Tp3>
bool __gnu_cxx::ckd_sub ( _Tp1 * __result,
_Tp2 __a,
_Tp3 __b )
inline

Definition at line 73 of file stdckdint.h.