optimize minimap.cpp

by moving a call out of the loop.