For example I want to do: I have 1 it is 00000001 in binary. and when I shift like 1<<3 I'll take 8 it is 00001000. So, I need that I take 00001111 after 1<<3. I wish you understand if something wrong add unclear ask about it please. I want to do shorter this part:
for(int i=1;h>0;h--,i*=2) hr+=i;
As I understand, you want