Left bit shift with safe minimum and maximum values.
Synopsis
Declared in <util/overflow.h>
template<std::integral T>
constexpr
T
SaturatingLeftShift(
T input,
unsigned int shift) noexcept;
Return Value
(input * 2ˆshift) clamped to fit between the lowest and highest representable values of the type T.
Parameters
Name |
Description |
input |
The input value to be left shifted. |
shift |
The number of bits to left shift. |
Created with MrDocs