I have UINT64 variable. In start it is initialized to 0xF. Now I want this to change on runtime depending on some input. Its value will increase on runtime. But what I want is that it should change from F to FF, from FF to FFF, one F should be appended to it.
Now here is my code.
UINT64 mapFileSize = 0xF;
while (mapFileSize < someUserInput)
// add one F to mapFileSize;
What should I write there. I am trying left shift operator but it is not working fine.
mapFileSize <<= 1;
I am doing this but this does not give me desired result.
A more succinct way of doing it:
Or if you can’t guarantee that the original value always ends in 0xf: