Simple math doing my head in - when is an int treated like an int?

Is there a reason you are not dividing by 4 (in other words why 255 and not 256, 1023 and not 1024?)

result = potValue / 4 ;

or with shifting right:

result = potValue >> 2 ;

Or if the slight difference matters, there is a built-in function specifically for this task:

result := map (potValue, 0, 1023, 0, 255) ;