C++ examples for Operator:Bit Operator
Using the << operator to shift a value from the lower 16 bits of a int into the upper 16 bits.
#include <iostream> using namespace std; int main(int argc, char* argv[]) { const int maskBits{ 16 }; int leftShifted{ 0x00001010 << maskBits }; cout << showbase << hex; cout << "Left shifted: " << leftShifted << endl; return 0;/* ww w .ja v a2 s . c om*/ }