// sets all bits to true within the given range private static void set(JsArrayInteger array, int fromIndex, int toIndex) { int first = wordIndex(fromIndex); int last = wordIndex(toIndex); int startBit = bitOffset(fromIndex); int endBit = bitOffset(toIndex); if (first == last) { // set the bits in between first and last maskInWord(array, first, startBit, endBit); } else { // set the bits from fromIndex to the next 32 bit boundary if (startBit != 0) { maskInWord(array, first++, startBit, 32); } // set the bits from the last 32 bit boundary to the toIndex if (endBit != 0) { maskInWord(array, last, 0, endBit); } // // set everything in between // for (int i = first; i < last; i++) { array.set(i, 0xffffffff); } } }