9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 package sun.jvm.hotspot.utilities; 26 27 /** A BitMap implementing the BitMapInterface. */ 28 public class BitMapSegmented implements BitMapInterface { 29 private static final int SegmentSizeBits = 30; 30 private static final int SegmentSize = 1 << (SegmentSizeBits - 1); 31 32 public BitMapSegmented(long sizeInBits) { 33 this.size = sizeInBits; 34 35 if (sizeInBits == 0) { 36 segmentBitMaps = new BitMap[0]; 37 return; 38 } 39 40 int lastSegmentSize = (int)(sizeInBits % SegmentSize); 41 42 int segments = segmentIndex(sizeInBits - 1) + 1; 43 int completeSegments = segments - ((lastSegmentSize != 0) ? 1 : 0); 44 45 segmentBitMaps = new BitMap[segments]; 46 47 for (int i = 0; i < completeSegments; i++) { 48 segmentBitMaps[i] = new BitMap(SegmentSize); 49 } 50 | 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 package sun.jvm.hotspot.utilities; 26 27 /** A BitMap implementing the BitMapInterface. */ 28 public class BitMapSegmented implements BitMapInterface { 29 public static final int SegmentSizeBits = 4; 30 public static final int SegmentSize = 1 << (SegmentSizeBits - 1); 31 32 public BitMapSegmented(long sizeInBits) { 33 this.size = sizeInBits; 34 35 if (sizeInBits == 0) { 36 segmentBitMaps = new BitMap[0]; 37 return; 38 } 39 40 int lastSegmentSize = (int)(sizeInBits % SegmentSize); 41 42 int segments = segmentIndex(sizeInBits - 1) + 1; 43 int completeSegments = segments - ((lastSegmentSize != 0) ? 1 : 0); 44 45 segmentBitMaps = new BitMap[segments]; 46 47 for (int i = 0; i < completeSegments; i++) { 48 segmentBitMaps[i] = new BitMap(SegmentSize); 49 } 50 |