If A = 1100, and B = 1010, I want to find the positional difference between the first 1 from the left on A, and first 1 from the right on B. In this case the answer would be 10.
In other words, the circuit would find how many times i need to shift B to left, to allign its rightmost 1 to A's leftmost 1.
How could such a circuit be created? Preferably in the best O time?
I could do it with a logic table, but that seems rather tideous for a 32 bit circuit. My example was just 4 bit for simplicity. I am implementing this in logism - a digital logic simulator.