Left bit shift with overflow checking.
Synopsis
Declared in <util/overflow.h>
template<std::integral T>
constexpr
std::optional<T>
CheckedLeftShift(
T input,
unsigned int shift) noexcept;
Return Value
(input * 2ˆshift) or nullopt if it would not fit in the return type.
Parameters
Name |
Description |
input |
The input value to be left shifted. |
shift |
The number of bits to left shift. |
Created with MrDocs