Empathy Empathy - 1 year ago 46
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

how do I solve for

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

Answer Source

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;