TokenSet (IElementType @NotNull ... types) { short min = Short.MAX_VALUE; short max = 0; for (IElementType type : types) { if (type != null) { final short index = type.getIndex(); assert index >= 0 : "Unregistered elements are not allowed here: " + objectInfo(type); if (min > index) min = index; if (max < index) max = index; } } short shift = (short)(min >> 6); TokenSet set = new TokenSet(shift, max, null); for (IElementType type : types) { if (type != null) { final short index = type.getIndex(); final int wordIndex = (index >> 6) - shift; set.myWords[wordIndex] |= 1L << index; } } return set; }