Faster Entry#is_legal? implementation

Likely still some room for improvement, potentially replacing each of
the HashSets with a 32-bitarray