#include <iostream>
int main()
{
unsigned int N = 1024;
unsigned int M = 21;
unsigned int i = 2, j = 6;
unsigned int temp = ~0;
unsigned int left = temp >> (32 - i);
std::cout << "left: " << left << std::endl;
unsigned int right = temp << (j + 1);
std::cout << "right: " << right << std::endl;
unsigned int res = (N & (left | right)) | (M << i);
std::cout << "result: " << res << std::endl;
return 0;
}