small optimization to max_name_hash function