Update zimcheck.cpp

Added an optimized version of redundancy checks.