Is it possible to find possible parameters for a bitshift operation?

that is, forcan I apply some bitwise operation to find a value for "variable" given a result and literal.Code:int literal = 0xf0; int result = literal << variable;

It's easy enough to do in my head (just count the least significant digits until I get a 1), but what's the best way to do this with code?