The way your equation is written it will require floating point math. If you change your equation to this:
Y = Y1 + ((Y2 - Y1)*(X - X1))/(X2 - X1)
You will get the same results, but you can implement it with integer math thus avoiding floating point arithmetic.
If the difference between X2 and X1 can always be 2^n (2 to the n power), then you can simply shift right to perform the division. Same with Y2-Y1, just shift left to multiply.
Does X1, X2, Y1, Y2 represent a viewport into the map to which the Y and X values are relative? For example if you have zoomed in on the map.
Dan East