ReactOS 0.4.16-dev-927-g467dec4
msl::utilities::SafeInt< T, E > Class Template Reference

#include <safeint.h>

Public Member Functions

 SafeInt () throw ()
 
 SafeInt (const T &i) throw ()
 
 SafeInt (bool b) throw ()
 
template<typename U >
 SafeInt (const SafeInt< U, E > &u)
 
template<typename U >
 SafeInt (const U &i)
 
template<typename U >
SafeInt< T, E > & operator= (const U &rhs)
 
SafeInt< T, E > & operator= (const T &rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator= (const SafeInt< U, E > &rhs)
 
SafeInt< T, E > & operator= (const SafeInt< T, E > &rhs) throw ()
 
 operator bool () const throw ()
 
 operator char () const
 
 operator signed char () const
 
 operator unsigned char () const
 
 operator __int16 () const
 
 operator unsigned __int16 () const
 
 operator __int32 () const
 
 operator unsigned __int32 () const
 
 operator long () const
 
 operator unsigned long () const
 
 operator __int64 () const
 
 operator unsigned __int64 () const
 
TPtr () throw ()
 
const TPtr () const throw ()
 
const TRef () const throw ()
 
bool operator! () const throw ()
 
const SafeInt< T, E > & operator+ () const throw ()
 
SafeInt< T, Eoperator- () const
 
SafeInt< T, E > & operator++ ()
 
SafeInt< T, E > & operator-- ()
 
SafeInt< T, Eoperator++ (int)
 
SafeInt< T, Eoperator-- (int)
 
SafeInt< T, Eoperator~ () const throw ()
 
template<typename U >
SafeInt< T, Eoperator% (U rhs) const
 
SafeInt< T, Eoperator% (SafeInt< T, E > rhs) const
 
template<typename U >
SafeInt< T, E > & operator%= (U rhs)
 
template<typename U >
SafeInt< T, E > & operator%= (SafeInt< U, E > rhs)
 
template<typename U >
SafeInt< T, Eoperator* (U rhs) const
 
SafeInt< T, Eoperator* (SafeInt< T, E > rhs) const
 
SafeInt< T, E > & operator*= (SafeInt< T, E > rhs)
 
template<typename U >
SafeInt< T, E > & operator*= (U rhs)
 
template<typename U >
SafeInt< T, E > & operator*= (SafeInt< U, E > rhs)
 
template<typename U >
SafeInt< T, Eoperator/ (U rhs) const
 
SafeInt< T, Eoperator/ (SafeInt< T, E > rhs) const
 
SafeInt< T, E > & operator/= (SafeInt< T, E > i)
 
template<typename U >
SafeInt< T, E > & operator/= (U i)
 
template<typename U >
SafeInt< T, E > & operator/= (SafeInt< U, E > i)
 
SafeInt< T, Eoperator+ (SafeInt< T, E > rhs) const
 
template<typename U >
SafeInt< T, Eoperator+ (U rhs) const
 
SafeInt< T, E > & operator+= (SafeInt< T, E > rhs)
 
template<typename U >
SafeInt< T, E > & operator+= (U rhs)
 
template<typename U >
SafeInt< T, E > & operator+= (SafeInt< U, E > rhs)
 
template<typename U >
SafeInt< T, Eoperator- (U rhs) const
 
SafeInt< T, Eoperator- (SafeInt< T, E > rhs) const
 
SafeInt< T, E > & operator-= (SafeInt< T, E > rhs)
 
template<typename U >
SafeInt< T, E > & operator-= (U rhs)
 
template<typename U >
SafeInt< T, E > & operator-= (SafeInt< U, E > rhs)
 
template<typename U >
bool operator< (U rhs) const throw ()
 
bool operator< (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
bool operator>= (U rhs) const throw ()
 
bool operator>= (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
bool operator> (U rhs) const throw ()
 
bool operator> (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
bool operator<= (U rhs) const throw ()
 
bool operator<= (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
bool operator== (U rhs) const throw ()
 
bool operator== (bool rhs) const throw ()
 
bool operator== (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
bool operator!= (U rhs) const throw ()
 
bool operator!= (bool b) const throw ()
 
bool operator!= (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
SafeInt< T, Eoperator<< (U bits) const throw ()
 
template<typename U >
SafeInt< T, Eoperator<< (SafeInt< U, E > bits) const throw ()
 
template<typename U >
SafeInt< T, E > & operator<<= (U bits) throw ()
 
template<typename U >
SafeInt< T, E > & operator<<= (SafeInt< U, E > bits) throw ()
 
template<typename U >
SafeInt< T, Eoperator>> (U bits) const throw ()
 
template<typename U >
SafeInt< T, Eoperator>> (SafeInt< U, E > bits) const throw ()
 
template<typename U >
SafeInt< T, E > & operator>>= (U bits) throw ()
 
template<typename U >
SafeInt< T, E > & operator>>= (SafeInt< U, E > bits) throw ()
 
SafeInt< T, Eoperator& (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
SafeInt< T, Eoperator& (U rhs) const throw ()
 
SafeInt< T, E > & operator&= (SafeInt< T, E > rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator&= (U rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator&= (SafeInt< U, E > rhs) throw ()
 
SafeInt< T, Eoperator^ (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
SafeInt< T, Eoperator^ (U rhs) const throw ()
 
SafeInt< T, E > & operator^= (SafeInt< T, E > rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator^= (U rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator^= (SafeInt< U, E > rhs) throw ()
 
SafeInt< T, Eoperator| (SafeInt< T, E > rhs) const throw ()
 
template<typename U >
SafeInt< T, Eoperator| (U rhs) const throw ()
 
SafeInt< T, E > & operator|= (SafeInt< T, E > rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator|= (U rhs) throw ()
 
template<typename U >
SafeInt< T, E > & operator|= (SafeInt< U, E > rhs) throw ()
 
SafeInt< T, EMin (SafeInt< T, E > test, SafeInt< T, E > floor=SafeInt< T, E >(details::IntTraits< T >::minInt)) const throw ()
 
SafeInt< T, EMax (SafeInt< T, E > test, SafeInt< T, E > upper=SafeInt< T, E >(details::IntTraits< T >::maxInt)) const throw ()
 
void Swap (SafeInt< T, E > &with) throw ()
 
template<int bits>
const SafeInt< T, E > & Align ()
 
const SafeInt< T, E > & Align2 ()
 
const SafeInt< T, E > & Align4 ()
 
const SafeInt< T, E > & Align8 ()
 
const SafeInt< T, E > & Align16 ()
 
const SafeInt< T, E > & Align32 ()
 
const SafeInt< T, E > & Align64 ()
 

Private Attributes

T m_int
 

Detailed Description

template<typename T, typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
class msl::utilities::SafeInt< T, E >

Definition at line 413 of file safeint.h.

Constructor & Destructor Documentation

◆ SafeInt() [1/5]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::SafeInt ( )
throw (
)
inline

Definition at line 416 of file safeint.h.

417 {
418 static_assert( details::NumericType< T >::isInt , "SafeInt<T>: T needs to be an integer type" );
419 m_int = 0;
420 }

◆ SafeInt() [2/5]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::SafeInt ( const T i)
throw (
)
inline

Definition at line 425 of file safeint.h.

426 {
427 static_assert( details::NumericType< T >::isInt , "SafeInt<T>: T needs to be an integer type" );
428 //always safe
429 m_int = i;
430 }
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
Definition: glfuncs.h:248

◆ SafeInt() [3/5]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::SafeInt ( bool  b)
throw (
)
inline

Definition at line 433 of file safeint.h.

434 {
435 static_assert( details::NumericType< T >::isInt , "SafeInt<T>: T needs to be an integer type" );
436 m_int = b ? 1 : 0;
437 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204

◆ SafeInt() [4/5]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
msl::utilities::SafeInt< T, E >::SafeInt ( const SafeInt< U, E > &  u)
inline

Definition at line 440 of file safeint.h.

441 {
442 static_assert( details::NumericType< T >::isInt , "SafeInt<T>: T needs to be an integer type" );
443 *this = SafeInt< T, E >( (U)u );
444 }
#define U(x)
Definition: wordpad.c:45
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
Definition: glfuncs.h:240

◆ SafeInt() [5/5]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
msl::utilities::SafeInt< T, E >::SafeInt ( const U i)
inline

Definition at line 447 of file safeint.h.

448 {
449 static_assert( details::NumericType< T >::isInt , "SafeInt<T>: T needs to be an integer type" );
450 // SafeCast will throw exceptions if i won't fit in type T
451 details::SafeCastHelper< T, U, E >::Cast( i, m_int );
452 }

Member Function Documentation

◆ Align()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<int bits>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align ( )
inline

Definition at line 1193 of file safeint.h.

1194 {
1195 // Zero is always aligned
1196 if( m_int == 0 )
1197 return *this;
1198
1199 // We don't support aligning negative numbers at this time
1200 // Can't align unsigned numbers on bitCount (e.g., 8 bits = 256, unsigned char max = 255)
1201 // or signed numbers on bitCount-1 (e.g., 7 bits = 128, signed char max = 127).
1202 // Also makes no sense to try to align on negative or no bits.
1203
1206 bits >= 0 && ( !details::IntTraits<T>::isSigned || m_int > 0 ) );
1207
1208 const T AlignValue = ( (T)1 << bits ) - 1;
1209
1210 m_int = ( m_int + AlignValue ) & ~AlignValue;
1211
1212 if( m_int <= 0 )
1213 E::SafeIntOnOverflow();
1214
1215 return *this;
1216 }
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define T
Definition: mbstring.h:31
#define _SAFEINT_SHIFT_ASSERT(x)
Definition: safeint.h:238

◆ Align16()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align16 ( )
inline

Definition at line 1222 of file safeint.h.

1222{ return Align< 4 >(); }

◆ Align2()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align2 ( )
inline

Definition at line 1219 of file safeint.h.

1219{ return Align< 1 >(); }

◆ Align32()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align32 ( )
inline

Definition at line 1223 of file safeint.h.

1223{ return Align< 5 >(); }

◆ Align4()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align4 ( )
inline

Definition at line 1220 of file safeint.h.

1220{ return Align< 2 >(); }

◆ Align64()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align64 ( )
inline

Definition at line 1224 of file safeint.h.

1224{ return Align< 6 >(); }

◆ Align8()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::Align8 ( )
inline

Definition at line 1221 of file safeint.h.

1221{ return Align< 3 >(); }

◆ Max()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::Max ( SafeInt< T, E test,
SafeInt< T, E upper = SafeIntTE >( details::IntTraitsT >::maxInt ) 
) const
throw (
)
inline

Definition at line 1179 of file safeint.h.

1180 {
1181 T tmp = test > m_int ? test : m_int;
1182 return tmp > upper ? upper : tmp;
1183 }
#define test
Definition: rosglue.h:37

◆ Min()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::Min ( SafeInt< T, E test,
SafeInt< T, E floor = SafeIntTE >( details::IntTraitsT >::minInt ) 
) const
throw (
)
inline

Definition at line 1173 of file safeint.h.

1174 {
1175 T tmp = test < m_int ? test : m_int;
1176 return tmp < floor ? floor : tmp;
1177 }
_Check_return_ _CRTIMP double __cdecl floor(_In_ double x)

◆ operator __int16()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator __int16 ( ) const
inline

Definition at line 516 of file safeint.h.

517 {
518 __int16 val;
519 details::SafeCastHelper< __int16, T, E >::Cast( m_int, val );
520 return val;
521 }
#define __int16
Definition: basetyps.h:22
GLuint GLfloat * val
Definition: glext.h:7180

◆ operator __int32()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator __int32 ( ) const
inline

Definition at line 530 of file safeint.h.

531 {
532 __int32 val;
533 details::SafeCastHelper< __int32, T, E >::Cast( m_int, val );
534 return val;
535 }
#define __int32
Definition: basetyps.h:19

◆ operator __int64()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator __int64 ( ) const
inline

Definition at line 560 of file safeint.h.

561 {
562 __int64 val;
563 details::SafeCastHelper< __int64, T, E >::Cast( m_int, val );
564 return val;
565 }
#define __int64
Definition: basetyps.h:16

◆ operator bool()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator bool ( ) const
throw (
)
inline

Definition at line 490 of file safeint.h.

491 {
492 return !!m_int;
493 }

◆ operator char()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator char ( ) const
inline

Definition at line 495 of file safeint.h.

496 {
497 char val;
498 details::SafeCastHelper< char, T, E >::Cast( m_int, val );
499 return val;
500 }

◆ operator long()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator long ( ) const
inline

Definition at line 546 of file safeint.h.

547 {
548 long val;
549 details::SafeCastHelper< long, T, E >::Cast( m_int, val );
550 return val;
551 }

◆ operator signed char()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator signed char ( ) const
inline

Definition at line 502 of file safeint.h.

503 {
504 signed char val;
505 details::SafeCastHelper< signed char, T, E >::Cast( m_int, val );
506 return val;
507 }

◆ operator unsigned __int16()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator unsigned __int16 ( ) const
inline

Definition at line 523 of file safeint.h.

524 {
525 unsigned __int16 val;
526 details::SafeCastHelper< unsigned __int16, T, E >::Cast( m_int, val );
527 return val;
528 }

◆ operator unsigned __int32()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator unsigned __int32 ( ) const
inline

Definition at line 537 of file safeint.h.

538 {
539 unsigned __int32 val;
540 details::SafeCastHelper< unsigned __int32, T, E >::Cast( m_int, val );
541 return val;
542 }

◆ operator unsigned __int64()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator unsigned __int64 ( ) const
inline

Definition at line 567 of file safeint.h.

568 {
569 unsigned __int64 val;
570 details::SafeCastHelper< unsigned __int64, T, E >::Cast( m_int, val );
571 return val;
572 }

◆ operator unsigned char()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator unsigned char ( ) const
inline

Definition at line 509 of file safeint.h.

510 {
511 unsigned char val;
512 details::SafeCastHelper< unsigned char, T, E >::Cast( m_int, val );
513 return val;
514 }

◆ operator unsigned long()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
msl::utilities::SafeInt< T, E >::operator unsigned long ( ) const
inline

Definition at line 553 of file safeint.h.

554 {
555 unsigned long val;
556 details::SafeCastHelper< unsigned long, T, E >::Cast( m_int, val );
557 return val;
558 }

◆ operator!()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator! ( ) const
throw (
)
inline

Definition at line 592 of file safeint.h.

592{ return (!m_int) ? true : false; }
#define true
Definition: stdbool.h:36

◆ operator!=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator!= ( bool  b) const
throw (
)
inline

Definition at line 958 of file safeint.h.

959 {
960 return ( m_int == 0 ? false : true ) != b;
961 }
#define b
Definition: ke_i.h:79

◆ operator!=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator!= ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 963 of file safeint.h.

963{ return m_int != (T)rhs; }

◆ operator!=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator!= ( U  rhs) const
throw (
)
inline

Definition at line 953 of file safeint.h.

954 {
955 return !details::EqualityTest< T, U >::IsEquals( m_int, rhs );
956 }

◆ operator%() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator% ( SafeInt< T, E rhs) const
inline

Definition at line 714 of file safeint.h.

715 {
716 T result;
717 details::ModulusHelper< T, T, E >::Modulus( m_int, rhs, result );
718 return SafeInt< T, E >( result );
719 }
GLuint64EXT * result
Definition: glext.h:11304

◆ operator%() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator% ( U  rhs) const
inline

Definition at line 707 of file safeint.h.

708 {
709 T result;
710 details::ModulusHelper< T, U, E >::Modulus( m_int, rhs, result );
711 return SafeInt< T, E >( result );
712 }

◆ operator%=() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator%= ( SafeInt< U, E rhs)
inline

Definition at line 730 of file safeint.h.

731 {
732 details::ModulusHelper< T, U, E >::Modulus( m_int, (U)rhs, m_int );
733 return *this;
734 }

◆ operator%=() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator%= ( U  rhs)
inline

Definition at line 723 of file safeint.h.

724 {
725 details::ModulusHelper< T, U, E >::Modulus( m_int, rhs, m_int );
726 return *this;
727 }

◆ operator&() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator& ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 1058 of file safeint.h.

1059 {
1060 return SafeInt< T, E >( m_int & (T)rhs );
1061 }

◆ operator&() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator& ( U  rhs) const
throw (
)
inline

Definition at line 1064 of file safeint.h.

1065 {
1066 // we want to avoid setting bits by surprise
1067 // consider the case of lhs = int, value = 0xffffffff
1068 // rhs = char, value = 0xff
1069 //
1070 // programmer intent is to get only the lower 8 bits
1071 // normal behavior is to upcast both sides to an int
1072 // which then sign extends rhs, setting all the bits
1073
1074 // If you land in the assert, this is because the bitwise operator
1075 // was causing unexpected behavior. Fix is to properly cast your inputs
1076 // so that it works like you meant, not unexpectedly
1077
1078 return SafeInt< T, E >( details::BinaryAndHelper< T, U >::And( m_int, rhs ) );
1079 }

◆ operator&=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator&= ( SafeInt< T, E rhs)
throw (
)
inline

Definition at line 1082 of file safeint.h.

1083 {
1084 m_int &= (T)rhs;
1085 return *this;
1086 }

◆ operator&=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator&= ( SafeInt< U, E rhs)
throw (
)
inline

Definition at line 1096 of file safeint.h.

1097 {
1098 m_int = details::BinaryAndHelper< T, U >::And( m_int, (U)rhs );
1099 return *this;
1100 }

◆ operator&=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator&= ( U  rhs)
throw (
)
inline

Definition at line 1089 of file safeint.h.

1090 {
1091 m_int = details::BinaryAndHelper< T, U >::And( m_int, rhs );
1092 return *this;
1093 }

◆ operator*() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator* ( SafeInt< T, E rhs) const
inline

Definition at line 745 of file safeint.h.

746 {
747 T ret( 0 );
748 details::MultiplicationHelper< T, T, E >::Multiply( m_int, (T)rhs, ret );
749 return SafeInt< T, E >( ret );
750 }
int ret

◆ operator*() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator* ( U  rhs) const
inline

Definition at line 738 of file safeint.h.

739 {
740 T ret( 0 );
741 details::MultiplicationHelper< T, U, E >::Multiply( m_int, rhs, ret );
742 return SafeInt< T, E >( ret );
743 }

◆ operator*=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator*= ( SafeInt< T, E rhs)
inline

Definition at line 753 of file safeint.h.

754 {
755 details::MultiplicationHelper< T, T, E >::Multiply( m_int, (T)rhs, m_int );
756 return *this;
757 }

◆ operator*=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator*= ( SafeInt< U, E rhs)
inline

Definition at line 767 of file safeint.h.

768 {
769 details::MultiplicationHelper< T, U, E >::Multiply( m_int, rhs.Ref(), m_int );
770 return *this;
771 }

◆ operator*=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator*= ( U  rhs)
inline

Definition at line 760 of file safeint.h.

761 {
762 details::MultiplicationHelper< T, U, E >::Multiply( m_int, rhs, m_int );
763 return *this;
764 }

◆ operator+() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator+ ( ) const
throw (
)
inline

Definition at line 597 of file safeint.h.

597{ return *this; };

◆ operator+() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator+ ( SafeInt< T, E rhs) const
inline

Definition at line 811 of file safeint.h.

812 {
813 T ret( 0 );
814 details::AdditionHelper< T, T, E >::Addition( m_int, (T)rhs, ret );
815 return SafeInt< T, E >( ret );
816 }

◆ operator+() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator+ ( U  rhs) const
inline

Definition at line 819 of file safeint.h.

820 {
821 T ret( 0 );
822 details::AdditionHelper< T, U, E >::Addition( m_int, rhs, ret );
823 return SafeInt< T, E >( ret );
824 }

◆ operator++() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator++ ( )
inline

Definition at line 610 of file safeint.h.

611 {
613 {
614 ++m_int;
615 return *this;
616 }
617 E::SafeIntOnOverflow();
618 }

◆ operator++() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator++ ( int  )
inline

Definition at line 635 of file safeint.h.

636 {
638 {
639 SafeInt< T, E > tmp( m_int );
640
641 m_int++;
642 return tmp;
643 }
644 E::SafeIntOnOverflow();
645 }

◆ operator+=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator+= ( SafeInt< T, E rhs)
inline

Definition at line 827 of file safeint.h.

828 {
829 details::AdditionHelper< T, T, E >::Addition( m_int, (T)rhs, m_int );
830 return *this;
831 }

◆ operator+=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator+= ( SafeInt< U, E rhs)
inline

Definition at line 841 of file safeint.h.

842 {
843 details::AdditionHelper< T, U, E >::Addition( m_int, (U)rhs, m_int );
844 return *this;
845 }

◆ operator+=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator+= ( U  rhs)
inline

Definition at line 834 of file safeint.h.

835 {
836 details::AdditionHelper< T, U, E >::Addition( m_int, rhs, m_int );
837 return *this;
838 }

◆ operator-() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator- ( ) const
inline

Definition at line 600 of file safeint.h.

601 {
602 // Note - unsigned still performs the bitwise manipulation
603 // will warn at level 2 or higher if the value is 32-bit or larger
604 T tmp;
605 details::NegationHelper< T, E, details::IntTraits< T >::isSigned >::Negative( m_int, tmp );
606 return SafeInt< T, E >( tmp );
607 }

◆ operator-() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator- ( SafeInt< T, E rhs) const
inline

Definition at line 856 of file safeint.h.

857 {
858 T ret( 0 );
859 details::SubtractionHelper< T, T, E >::Subtract( m_int, (T)rhs, ret );
860 return SafeInt< T, E >( ret );
861 }

◆ operator-() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator- ( U  rhs) const
inline

Definition at line 849 of file safeint.h.

850 {
851 T ret( 0 );
852 details::SubtractionHelper< T, U, E >::Subtract( m_int, rhs, ret );
853 return SafeInt< T, E >( ret );
854 }

◆ operator--() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator-- ( )
inline

Definition at line 621 of file safeint.h.

622 {
624 {
625 --m_int;
626 return *this;
627 }
628 E::SafeIntOnOverflow();
629 }

◆ operator--() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator-- ( int  )
inline

Definition at line 648 of file safeint.h.

649 {
651 {
652 SafeInt< T, E > tmp( m_int );
653 m_int--;
654 return tmp;
655 }
656 E::SafeIntOnOverflow();
657 }

◆ operator-=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator-= ( SafeInt< T, E rhs)
inline

Definition at line 864 of file safeint.h.

865 {
866 details::SubtractionHelper< T, T, E >::Subtract( m_int, (T)rhs, m_int );
867 return *this;
868 }

◆ operator-=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator-= ( SafeInt< U, E rhs)
inline

Definition at line 878 of file safeint.h.

879 {
880 details::SubtractionHelper< T, U, E >::Subtract( m_int, (U)rhs, m_int );
881 return *this;
882 }

◆ operator-=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator-= ( U  rhs)
inline

Definition at line 871 of file safeint.h.

872 {
873 details::SubtractionHelper< T, U, E >::Subtract( m_int, rhs, m_int );
874 return *this;
875 }

◆ operator/() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator/ ( SafeInt< T, E rhs) const
inline

Definition at line 782 of file safeint.h.

783 {
784 T ret( 0 );
785 details::DivisionHelper< T, T, E >::Divide( m_int, (T)rhs, ret );
786 return SafeInt< T, E >( ret );
787 }

◆ operator/() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator/ ( U  rhs) const
inline

Definition at line 775 of file safeint.h.

776 {
777 T ret( 0 );
778 details::DivisionHelper< T, U, E >::Divide( m_int, rhs, ret );
779 return SafeInt< T, E >( ret );
780 }

◆ operator/=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator/= ( SafeInt< T, E i)
inline

Definition at line 790 of file safeint.h.

791 {
792 details::DivisionHelper< T, T, E >::Divide( m_int, (T)i, m_int );
793 return *this;
794 }

◆ operator/=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator/= ( SafeInt< U, E i)
inline

Definition at line 802 of file safeint.h.

803 {
804 details::DivisionHelper< T, U, E >::Divide( m_int, (U)i, m_int );
805 return *this;
806 }

◆ operator/=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator/= ( U  i)
inline

Definition at line 796 of file safeint.h.

797 {
798 details::DivisionHelper< T, U, E >::Divide( m_int, i, m_int );
799 return *this;
800 }

◆ operator<() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator< ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 895 of file safeint.h.

896 {
897 return m_int < (T)rhs;
898 }

◆ operator<() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator< ( U  rhs) const
throw (
)
inline

Definition at line 890 of file safeint.h.

891 {
892 return details::GreaterThanTest< U, T >::GreaterThan( rhs, m_int );
893 }

◆ operator<<() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator<< ( SafeInt< U, E bits) const
throw (
)
inline

Definition at line 963 of file safeint.h.

984 {
987
988 return SafeInt< T, E >( (T)( m_int << (U)bits ) );
989 }

◆ operator<<() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator<< ( U  bits) const
throw (
)
inline

Definition at line 963 of file safeint.h.

975 {
978
979 return SafeInt< T, E >( (T)( m_int << bits ) );
980 }

◆ operator<<=() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator<<= ( SafeInt< U, E bits)
throw (
)
inline

Definition at line 963 of file safeint.h.

1005 {
1008
1009 m_int <<= (U)bits;
1010 return *this;
1011 }

◆ operator<<=() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator<<= ( U  bits)
throw (
)
inline

Definition at line 963 of file safeint.h.

995 {
998
999 m_int <<= bits;
1000 return *this;
1001 }
#define bits
Definition: infblock.c:15

◆ operator<=() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator<= ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 931 of file safeint.h.

932 {
933 return m_int <= (T)rhs;
934 }

◆ operator<=() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator<= ( U  rhs) const
throw (
)
inline

Definition at line 926 of file safeint.h.

927 {
928 return !details::GreaterThanTest< T, U >::GreaterThan( m_int, rhs );
929 }

◆ operator=() [1/4]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator= ( const SafeInt< T, E > &  rhs)
throw (
)
inline

Definition at line 482 of file safeint.h.

483 {
484 m_int = rhs.m_int;
485 return *this;
486 }

◆ operator=() [2/4]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator= ( const SafeInt< U, E > &  rhs)
inline

Definition at line 476 of file safeint.h.

477 {
478 details::SafeCastHelper< T, U, E >::Cast( rhs.Ref(), m_int );
479 return *this;
480 }

◆ operator=() [3/4]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator= ( const T rhs)
throw (
)
inline

Definition at line 469 of file safeint.h.

470 {
471 m_int = rhs;
472 return *this;
473 }

◆ operator=() [4/4]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator= ( const U rhs)
inline

Definition at line 459 of file safeint.h.

460 {
461 // use constructor to test size
462 // constructor is optimized to do minimal checking based
463 // on whether T can contain U
464 // note - do not change this
465 *this = SafeInt< T, E >( rhs );
466 return *this;
467 }

◆ operator==() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator== ( bool  rhs) const
throw (
)
inline

Definition at line 944 of file safeint.h.

945 {
946 return ( m_int == 0 ? false : true ) == rhs;
947 }

◆ operator==() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator== ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 949 of file safeint.h.

949{ return m_int == (T)rhs; }

◆ operator==() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator== ( U  rhs) const
throw (
)
inline

Definition at line 938 of file safeint.h.

939 {
940 return details::EqualityTest< T, U >::IsEquals( m_int, rhs );
941 }

◆ operator>() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator> ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 919 of file safeint.h.

920 {
921 return m_int > (T)rhs;
922 }

◆ operator>() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator> ( U  rhs) const
throw (
)
inline

Definition at line 914 of file safeint.h.

915 {
916 return details::GreaterThanTest< T, U >::GreaterThan( m_int, rhs );
917 }

◆ operator>=() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
bool msl::utilities::SafeInt< T, E >::operator>= ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 907 of file safeint.h.

908 {
909 return m_int >= (T)rhs;
910 }

◆ operator>=() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
bool msl::utilities::SafeInt< T, E >::operator>= ( U  rhs) const
throw (
)
inline

Definition at line 902 of file safeint.h.

903 {
904 return !details::GreaterThanTest< U, T >::GreaterThan( rhs, m_int );
905 }

◆ operator>>() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator>> ( SafeInt< U, E bits) const
throw (
)
inline

Definition at line 1024 of file safeint.h.

1025 {
1028
1029 return SafeInt< T, E >( (T)(m_int >> (U)bits) );
1030 }

◆ operator>>() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator>> ( U  bits) const
throw (
)
inline

Definition at line 1015 of file safeint.h.

1016 {
1019
1020 return SafeInt< T, E >( (T)( m_int >> bits ) );
1021 }

◆ operator>>=() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator>>= ( SafeInt< U, E bits)
throw (
)
inline

Definition at line 1044 of file safeint.h.

1045 {
1048
1049 m_int >>= (U)bits;
1050 return *this;
1051 }

◆ operator>>=() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator>>= ( U  bits)
throw (
)
inline

Definition at line 1034 of file safeint.h.

1035 {
1038
1039 m_int >>= bits;
1040 return *this;
1041 }

◆ operator^() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator^ ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 1103 of file safeint.h.

1104 {
1105 return SafeInt< T, E >( (T)( m_int ^ (T)rhs ) );
1106 }

◆ operator^() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator^ ( U  rhs) const
throw (
)
inline

Definition at line 1109 of file safeint.h.

1110 {
1111 // If you land in the assert, this is because the bitwise operator
1112 // was causing unexpected behavior. Fix is to properly cast your inputs
1113 // so that it works like you meant, not unexpectedly
1114
1115 return SafeInt< T, E >( details::BinaryXorHelper< T, U >::Xor( m_int, rhs ) );
1116 }

◆ operator^=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator^= ( SafeInt< T, E rhs)
throw (
)
inline

Definition at line 1119 of file safeint.h.

1120 {
1121 m_int ^= (T)rhs;
1122 return *this;
1123 }

◆ operator^=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator^= ( SafeInt< U, E rhs)
throw (
)
inline

Definition at line 1133 of file safeint.h.

1134 {
1135 m_int = details::BinaryXorHelper< T, U >::Xor( m_int, (U)rhs );
1136 return *this;
1137 }

◆ operator^=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator^= ( U  rhs)
throw (
)
inline

Definition at line 1126 of file safeint.h.

1127 {
1128 m_int = details::BinaryXorHelper< T, U >::Xor( m_int, rhs );
1129 return *this;
1130 }

◆ operator|() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator| ( SafeInt< T, E rhs) const
throw (
)
inline

Definition at line 1140 of file safeint.h.

1141 {
1142 return SafeInt< T, E >( (T)( m_int | (T)rhs ) );
1143 }

◆ operator|() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator| ( U  rhs) const
throw (
)
inline

Definition at line 1146 of file safeint.h.

1147 {
1148 return SafeInt< T, E >( details::BinaryOrHelper< T, U >::Or( m_int, rhs ) );
1149 }

◆ operator|=() [1/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator|= ( SafeInt< T, E rhs)
throw (
)
inline

Definition at line 1152 of file safeint.h.

1153 {
1154 m_int |= (T)rhs;
1155 return *this;
1156 }

◆ operator|=() [2/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator|= ( SafeInt< U, E rhs)
throw (
)
inline

Definition at line 1166 of file safeint.h.

1167 {
1168 m_int = details::BinaryOrHelper< T, U >::Or( m_int, (U)rhs );
1169 return *this;
1170 }

◆ operator|=() [3/3]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
template<typename U >
SafeInt< T, E > & msl::utilities::SafeInt< T, E >::operator|= ( U  rhs)
throw (
)
inline

Definition at line 1159 of file safeint.h.

1160 {
1161 m_int = details::BinaryOrHelper< T, U >::Or( m_int, rhs );
1162 return *this;
1163 }

◆ operator~()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
SafeInt< T, E > msl::utilities::SafeInt< T, E >::operator~ ( ) const
throw (
)
inline

Definition at line 662 of file safeint.h.

662{ return SafeInt< T, E >( (T)~m_int ); }

◆ Ptr() [1/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
T * msl::utilities::SafeInt< T, E >::Ptr ( )
throw (
)
inline

Definition at line 587 of file safeint.h.

587{ return &m_int; }

◆ Ptr() [2/2]

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const T * msl::utilities::SafeInt< T, E >::Ptr ( ) const
throw (
)
inline

Definition at line 588 of file safeint.h.

588{ return &m_int; }

◆ Ref()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
const T & msl::utilities::SafeInt< T, E >::Ref ( ) const
throw (
)
inline

◆ Swap()

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
void msl::utilities::SafeInt< T, E >::Swap ( SafeInt< T, E > &  with)
throw (
)
inline

Definition at line 1185 of file safeint.h.

1186 {
1187 T temp( m_int );
1188 m_int = with.m_int;
1189 with.m_int = temp;
1190 }
static calc_node_t temp
Definition: rpn_ieee.c:38

Member Data Documentation

◆ m_int

template<typename T , typename E = _SAFEINT_DEFAULT_ERROR_POLICY>
T msl::utilities::SafeInt< T, E >::m_int
private

Definition at line 1227 of file safeint.h.

Referenced by msl::utilities::SafeInt< T, E >::Align(), msl::utilities::SafeInt< T, E >::Max(), msl::utilities::SafeInt< T, E >::Min(), msl::utilities::SafeInt< T, E >::operator __int16(), msl::utilities::SafeInt< T, E >::operator __int32(), msl::utilities::SafeInt< T, E >::operator __int64(), msl::utilities::SafeInt< T, E >::operator bool(), msl::utilities::SafeInt< T, E >::operator char(), msl::utilities::SafeInt< T, E >::operator long(), msl::utilities::SafeInt< T, E >::operator signed char(), msl::utilities::SafeInt< T, E >::operator unsigned __int16(), msl::utilities::SafeInt< T, E >::operator unsigned __int32(), msl::utilities::SafeInt< T, E >::operator unsigned __int64(), msl::utilities::SafeInt< T, E >::operator unsigned char(), msl::utilities::SafeInt< T, E >::operator unsigned long(), msl::utilities::SafeInt< T, E >::operator!(), msl::utilities::SafeInt< T, E >::operator!=(), msl::utilities::SafeInt< T, E >::operator%(), msl::utilities::SafeInt< T, E >::operator%=(), msl::utilities::SafeInt< T, E >::operator&(), msl::utilities::SafeInt< T, E >::operator&=(), msl::utilities::SafeInt< T, E >::operator*(), msl::utilities::SafeInt< T, E >::operator*=(), msl::utilities::SafeInt< T, E >::operator+(), msl::utilities::SafeInt< T, E >::operator++(), msl::utilities::SafeInt< T, E >::operator+=(), msl::utilities::SafeInt< T, E >::operator-(), msl::utilities::SafeInt< T, E >::operator--(), msl::utilities::SafeInt< T, E >::operator-=(), msl::utilities::SafeInt< T, E >::operator/(), msl::utilities::SafeInt< T, E >::operator/=(), msl::utilities::SafeInt< T, E >::operator<(), msl::utilities::SafeInt< T, E >::operator<=(), msl::utilities::SafeInt< T, E >::operator=(), msl::utilities::SafeInt< T, E >::operator==(), msl::utilities::SafeInt< T, E >::operator>(), msl::utilities::SafeInt< T, E >::operator>=(), msl::utilities::SafeInt< T, E >::operator>>(), msl::utilities::SafeInt< T, E >::operator>>=(), msl::utilities::SafeInt< T, E >::operator^(), msl::utilities::SafeInt< T, E >::operator^=(), msl::utilities::SafeInt< T, E >::operator|(), msl::utilities::SafeInt< T, E >::operator|=(), msl::utilities::SafeInt< T, E >::operator~(), msl::utilities::SafeInt< T, E >::Ptr(), msl::utilities::SafeInt< T, E >::Ref(), msl::utilities::SafeInt< T, E >::SafeInt(), and msl::utilities::SafeInt< T, E >::Swap().


The documentation for this class was generated from the following file: