lordofawesome wrote:
boolean isEqualDimention = (mode1.getWidth() == mode2.getWidth() && mode1.getHeight() == mode2.getHeight()); boolean isEqualDepth = (mode1.getBitDepth() == mode2.getBitDepth()); boolean isEqualRefreshRate = (mode1.getRefreshRate() == mode2.getRefreshRate()); return (isEqualDimention && isEqualDepth && isEqualRefreshRate);
Actually (as a firmware developer), I found the original code quite reasonable. The function was exited as quickly as possible, with as few calculations as possible. The quoted code above performs ALL the calculations before exiting the function, doing a lot of (possibly) unnecessary work.