2ed885df76
* gnu/gcj/awt/BitMaskExtent.java, gnu/gcj/awt/Buffers.java, gnu/gcj/awt/ComponentDataBlitOp.java, gnu/gcj/awt/GLightweightPeer.java, java/awt/Graphics2D.java, java/awt/RenderingHints.java, java/awt/color/ColorSpace.java, java/awt/color/ICC_ColorSpace.java, java/awt/color/ICC_Profile.java, java/awt/image/BufferedImage.java, java/awt/image/ColorModel.java, java/awt/image/ComponentColorModel.java, java/awt/image/ComponentSampleModel.java, java/awt/image/DataBuffer.java, java/awt/image/DataBufferByte.java, java/awt/image/DataBufferInt.java, java/awt/image/DataBufferUShort.java, java/awt/image/DirectColorModel.java, java/awt/image/IndexColorModel.java, java/awt/image/PackedColorModel.java, java/awt/image/Raster.java, java/awt/image/RasterOp.java, java/awt/image/SampleModel.java, java/awt/image/SinglePixelPackedSampleModel.java, java/awt/image/WritableRaster.java, java/util/zip/ZipFile.java: Removed Latin-1 copyright symbols. * java/util/zip/ZipFile.java: Indentation fixes. From-SVN: r36027
52 lines
1.3 KiB
Java
52 lines
1.3 KiB
Java
/* Copyright (C) 2000 Free Software Foundation
|
|
|
|
This file is part of libgcj.
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
details. */
|
|
|
|
package gnu.gcj.awt;
|
|
|
|
/**
|
|
* Simple transparent utility class that can be used to perform bit
|
|
* mask extent calculations.
|
|
*/
|
|
public final class BitMaskExtent
|
|
{
|
|
/** The number of the least significant bit of the bit mask extent. */
|
|
public byte leastSignificantBit;
|
|
|
|
/** The number of bits in the bit mask extent. */
|
|
public byte bitWidth;
|
|
|
|
/**
|
|
* Set the bit mask. This will calculate and set the leastSignificantBit
|
|
* and bitWidth fields.
|
|
*
|
|
* @see #leastSignificantBit
|
|
* @see #bitWidth
|
|
*/
|
|
public void setMask(long mask)
|
|
{
|
|
leastSignificantBit = 0;
|
|
bitWidth = 0;
|
|
if (mask == 0) return;
|
|
long shiftMask = mask;
|
|
for (; (shiftMask&1) == 0; shiftMask >>>=1) leastSignificantBit++;
|
|
for (; (shiftMask&1) != 0; shiftMask >>>=1) bitWidth++;
|
|
|
|
if (shiftMask != 0)
|
|
throw new IllegalArgumentException("mask must be continuous");
|
|
}
|
|
|
|
/**
|
|
* Calculate the bit mask based on the values of the
|
|
* leastSignificantBit and bitWidth fields.
|
|
*/
|
|
public long toMask()
|
|
{
|
|
return ((1<<bitWidth)-1) << leastSignificantBit;
|
|
}
|
|
}
|