converting patch distance func to use unsigned long long values