221#if !defined(RC_INVOKED)
230#pragma warning(disable: 4514)
231#pragma warning(disable: 4710)
233#if !defined (_SAFEINT_DEFAULT_ERROR_POLICY)
234#define _SAFEINT_DEFAULT_ERROR_POLICY SafeIntErrorPolicy_SafeIntException
237#if !defined (_SAFEINT_SHIFT_ASSERT)
238#define _SAFEINT_SHIFT_ASSERT(x) _ASSERTE(x)
241#if !defined (_SAFEINT_BINARY_ASSERT)
242#define _SAFEINT_BINARY_ASSERT(x) _ASSERTE(x)
245#if !defined (_SAFEINT_EXCEPTION_ASSERT)
246#define _SAFEINT_EXCEPTION_ASSERT()
252#if !defined (_SAFEINT_UNSIGNED_NEGATION_BEHAVIOR)
253#define _SAFEINT_UNSIGNED_NEGATION_BEHAVIOR()
258#if !defined (_SAFEINT_USE_ANSI_CONVERSIONS)
259#define _SAFEINT_USE_ANSI_CONVERSIONS 0
262#pragma pack(push, _CRT_PACKING)
334template <
typename T,
typename U >
341template <
typename T,
typename U >
347template <
typename T,
typename U >
353template <
typename T,
typename U >
359template <
typename T,
typename U >
365template <
typename T,
typename U >
371template <
typename T,
typename U >
377template <
typename T,
typename U >
383template <
typename T,
typename U >
390template <
typename T,
typename U >
397template <
typename T,
typename U >
404template <
typename T,
typename U >
412template <
typename T,
typename E = _SAFEINT_DEFAULT_ERROR_POLICY >
439 template <
typename U >
446 template <
typename U >
458 template <
typename U >
475 template <
typename U >
574#ifdef _NATIVE_WCHAR_T_DEFINED
617 E::SafeIntOnOverflow();
628 E::SafeIntOnOverflow();
644 E::SafeIntOnOverflow();
656 E::SafeIntOnOverflow();
706 template <
typename U >
722 template <
typename U >
729 template <
typename U >
737 template <
typename U >
759 template <
typename U >
766 template <
typename U >
774 template <
typename U >
818 template <
typename U >
833 template <
typename U >
840 template <
typename U >
848 template <
typename U >
870 template <
typename U >
877 template <
typename U >
889 template <
typename U >
901 template <
typename U >
913 template <
typename U >
925 template <
typename U >
937 template <
typename U >
946 return (
m_int == 0 ?
false :
true ) == rhs;
952 template <
typename U >
960 return (
m_int == 0 ?
false :
true ) !=
b;
973 template <
typename U >
982 template <
typename U >
993 template <
typename U >
1003 template <
typename U >
1014 template <
typename U >
1023 template <
typename U >
1033 template <
typename U >
1043 template <
typename U >
1063 template <
typename U >
1088 template <
typename U >
1095 template <
typename U >
1108 template <
typename U >
1125 template <
typename U >
1132 template <
typename U >
1145 template <
typename U >
1158 template <
typename U >
1165 template <
typename U >
1182 return tmp > upper ? upper : tmp;
1192 template <
int bits >
1208 const T AlignValue = ( (
T)1 <<
bits ) - 1;
1210 m_int = (
m_int + AlignValue ) & ~AlignValue;
1213 E::SafeIntOnOverflow();
1231template <
typename T,
typename U,
typename E >
1237template <
typename T,
typename U,
typename E >
1244template <
typename T,
typename U,
typename E >
1250template <
typename T,
typename U,
typename E >
1257template <
typename T,
typename U,
typename E >
1263template <
typename T,
typename U,
typename E >
1270template <
typename T,
typename U,
typename E >
1276template <
typename T,
typename U,
typename E >
1284template <
typename T,
typename E >
1287 return lhs == ( (
T)rhs == 0 ?
false :
true );
1290template <
typename T,
typename U,
typename E >
1296template <
typename T,
typename U,
typename E >
1303template <
typename T,
typename U,
typename E >
1309template <
typename T,
typename E >
1312 return ( (
T)rhs == 0 ?
false :
true ) != lhs;
1315template <
typename T,
typename U,
typename E >
1322template <
typename T,
typename U,
typename E >
1331#pragma warning(suppress:4127 6326)
1342 E::SafeIntOnDivZero();
1349template <
typename T,
typename U,
typename E >
1360#pragma warning(push)
1361#pragma warning(disable: 4127 4146 4307 4310 6326)
1371 if(
sizeof(
U ) >= 4 &&
sizeof(
T ) <=
sizeof(
U ) )
1377 if(
sizeof(
T) == 4 )
1378 tmp = lhs/(
U)(
unsigned __int32)( -(
T)rhs );
1380 tmp = lhs/(
U)( -(
T)rhs );
1392 E::SafeIntOnOverflow();
1398 E::SafeIntOnDivZero();
1408 if(
sizeof(
U ) <
sizeof(
T ) )
1414 E::SafeIntOnOverflow();
1426template <
typename T,
typename U,
typename E >
1435template <
typename T,
typename U,
typename E >
1447template <
typename T,
typename U,
typename E >
1456template <
typename T,
typename U,
typename E >
1465template <
typename T,
typename U,
typename E >
1474template <
typename T,
typename U,
typename E >
1483template <
typename T,
typename U,
typename E >
1492template <
typename T,
typename U,
typename E >
1499template <
typename T,
typename U,
typename E >
1506template <
typename T,
typename U,
typename E >
1513template <
typename T,
typename U,
typename E >
1520template <
typename T,
typename U,
typename E >
1531template <
typename T,
typename U,
typename E >
1544template <
typename T,
typename U,
typename E >
1554template <
typename T,
typename U,
typename E >
1561template <
typename T,
typename U,
typename E >
1568template <
typename T,
typename U,
typename E >
1575template <
typename T,
typename U,
typename E >
1582template <
typename T,
typename U,
typename E >
1589template <
typename T,
typename U,
typename E >
1596template <
typename T,
typename U,
typename E >
1603template <
typename T,
typename U,
typename E >
1614template <
typename T,
typename U,
typename E >
1620 return SafeInt< U, E >( (
U)( lhs << (
T)
bits ) );
1624template <
typename T,
typename U,
typename E >
1638template <
typename T,
typename U,
typename E >
1645template <
typename T,
typename U,
typename E >
1652template <
typename T,
typename U,
typename E >
SafeIntException(SafeIntError code)
SafeInt< T, E > Max(SafeInt< T, E > test, SafeInt< T, E > upper=SafeInt< T, E >(details::IntTraits< T >::maxInt)) const
SafeInt< T, E > operator|(SafeInt< T, E > rhs) const
SafeInt< T, E > operator&(SafeInt< T, E > rhs) const
SafeInt< T, E > operator<<(U bits) const
bool operator>(U rhs) const
SafeInt< T, E > operator^(SafeInt< T, E > rhs) const
bool operator>=(U rhs) const
SafeInt< T, E > operator>>(U bits) const
SafeInt< T, E > & operator&=(SafeInt< T, E > rhs)
SafeInt< T, E > operator~() const
SafeInt< T, E > & operator|=(SafeInt< T, E > rhs)
SafeInt< T, E > & operator*=(SafeInt< T, E > rhs)
SafeInt< T, E > & operator+=(SafeInt< T, E > rhs)
SafeInt< T, E > & operator<<=(U bits)
SafeInt< T, E > & operator-=(SafeInt< T, E > rhs)
SafeInt< T, E > operator*(U rhs) const
const SafeInt< T, E > & Align32()
const SafeInt< T, E > & Align4()
bool operator!=(U rhs) const
const SafeInt< T, E > & operator+() const
const SafeInt< T, E > & Align64()
void Swap(SafeInt< T, E > &with)
SafeInt< T, E > & operator%=(U rhs)
SafeInt< T, E > & operator=(const U &rhs)
SafeInt< T, E > & operator++()
SafeInt< T, E > & operator/=(SafeInt< T, E > i)
bool operator<(U rhs) const
SafeInt< T, E > & operator>>=(U bits)
const SafeInt< T, E > & Align2()
const SafeInt< T, E > & Align()
SafeInt< T, E > & operator--()
SafeInt< T, E > operator-() const
SafeInt< T, E > operator/(U rhs) const
SafeInt< T, E > Min(SafeInt< T, E > test, SafeInt< T, E > floor=SafeInt< T, E >(details::IntTraits< T >::minInt)) const
bool operator==(U rhs) const
SafeInt< T, E > & operator^=(SafeInt< T, E > rhs)
const SafeInt< T, E > & Align8()
bool operator<=(U rhs) const
SafeInt< T, E > operator%(U rhs) const
const SafeInt< T, E > & Align16()
SafeInt(const SafeInt< U, E > &u)
result_buffer_count char *const _In_ int const _In_ bool const _In_ unsigned const _In_ STRFLT const _In_ bool const _Inout_ __crt_cached_ptd_host &ptd throw()
__kernel_ptrdiff_t ptrdiff_t
GLboolean GLboolean GLboolean b
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)
@ DivisionState_UnsignedSigned
@ SafeIntArithmeticOverflow
SafeInt< U, E > operator>>(U lhs, SafeInt< T, E > bits)
bool SafeDivide(T t, U u, T &result)
T & operator<<=(T &lhs, SafeInt< U, E > rhs)
bool SafeModulus(const T &t, const U &u, T &result)
SafeInt< T, E > operator+(U lhs, SafeInt< T, E > rhs)
bool SafeSubtract(T t, U u, T &result)
bool operator==(bool lhs, SafeInt< T, E > rhs)
bool SafeGreaterThanEquals(const T t, const U u)
bool SafeMultiply(T t, U u, T &result)
SafeInt< T, E > operator|(U lhs, SafeInt< T, E > rhs)
bool operator<(U lhs, SafeInt< T, E > rhs)
SafeInt< T, E > operator-(U lhs, SafeInt< T, E > rhs)
bool SafeAdd(T t, U u, T &result)
T & operator>>=(T &lhs, SafeInt< U, E > rhs)
bool SafeEquals(const T t, const U u)
T & operator^=(T &lhs, SafeInt< U, E > rhs)
SafeInt< U, E > operator<<(U lhs, SafeInt< T, E > bits)
SafeInt< T, E > operator%(U lhs, SafeInt< T, E > rhs)
SafeInt< T, E > operator^(U lhs, SafeInt< T, E > rhs)
T & operator|=(T &lhs, SafeInt< U, E > rhs)
bool SafeNotEquals(const T t, const U u)
bool SafeGreaterThan(const T t, const U u)
T & operator-=(T &lhs, SafeInt< U, E > rhs)
bool SafeCast(const T From, U &To)
T & operator&=(T &lhs, SafeInt< U, E > rhs)
T & operator/=(T &lhs, SafeInt< U, E > rhs)
bool SafeLessThanEquals(const T t, const U u)
bool operator!=(U lhs, SafeInt< T, E > rhs)
SafeInt< T, E > operator*(U lhs, SafeInt< T, E > rhs)
T & operator%=(T &lhs, SafeInt< U, E > rhs)
T & operator+=(T &lhs, SafeInt< U, E > rhs)
SafeInt< T, E > operator/(U lhs, SafeInt< T, E > rhs)
bool operator<=(U lhs, SafeInt< T, E > rhs)
bool SafeLessThan(const T t, const U u)
T & operator*=(T &lhs, SafeInt< U, E > rhs)
bool operator>=(U lhs, SafeInt< T, E > rhs)
SafeInt< T, E > operator&(U lhs, SafeInt< T, E > rhs)
bool operator>(U lhs, SafeInt< T, E > rhs)
#define _SAFEINT_EXCEPTION_ASSERT()
#define _SAFEINT_SHIFT_ASSERT(x)
static __declspec(noreturn) void SafeIntOnDivZero()
static __declspec(noreturn) void SafeIntOnOverflow()
static __declspec(noreturn) void SafeIntOnDivZero()
static __declspec(noreturn) void SafeIntOnOverflow()
#define _CRT_SECURE_INVALID_PARAMETER(expr)