Fix signed/unsigned comparision warning

Cast signed value to uint64_t before comparision, since it's already
known that it is >=0.