In order to avoid potential integer overflow change the comparison and make sure to use the same unsigned type for both elements.