21a2390f4c
This utility was already duplicated in two places and planned to be used more. While we should usually avoid creating arrays the size of the indexed array (rather than the size of the mask), sometimes it does seem to be the best option, and we're helped by the fact that most memory stays unintialized for a small mask (allocating but not writing to memory pages at all generally isn't too expensive). Pull Request: https://projects.blender.org/blender/blender/pulls/115491