fixed comparison to stop integer wrap around
Merge pull request #1870 from es0m:es0m-2.4-imgproc-samplers