SafeShifter< true > Struct Reference

Shifts a value in the presence of overflow. More...

`#include <misc.h>`

## Static Public Member Functions

template<class T>
static T | RightShift (T value, unsigned int bits)
| Right shifts a value that overflows.
template<class T>
static T | LeftShift (T value, unsigned int bits)
| Left shifts a value that overflows.

## Detailed Description

Shifts a value in the presence of overflow.

the true template parameter indicates overflow would occur. In this case, SafeShifter clamps the value and returns 0.

Definition at line 3099 of file misc.h.

## Member Function Documentation

## RightShift()

template<class T>

T SafeShifter< true >::RightShift | ( | T | value,
|  | unsigned int | bits )

inline static

Right shifts a value that overflows.

Template Parameters

  T | class or type

Returns
  0

Since overflow == true, the value 0 is always returned.

See also
  SafeLeftShift

Definition at line 3107 of file misc.h.

## LeftShift()

template<class T>

T SafeShifter< true >::LeftShift | ( | T | value,
|  | unsigned int | bits )

inline static

Left shifts a value that overflows.

Template Parameters

  T | class or type

Returns
  0

Since overflow == true, the value 0 is always returned.

See also
  SafeRightShift

Definition at line 3119 of file misc.h.

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

- misc.h