Empathy Empathy - 6 months ago 9
Java Question

How to move bitshift to other side of equation

if I have this:

var5 = (this.unknownInt1900 >> 4) - 1;


and I know the value of
var5


how do I solve for
unknownInt1900
?

E.g.
unknownInt1900 = var5 + 1
(and I don't know what do with the bitshift here)

Answer

It's not reversible if you had data in the lower 4 bits. If you know that those bits are empty, just add and left shift:

unknownInt1900 = (var5 + 1) << 4;