mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-12 05:13:50 +08:00
Re-indent in preparation for diff.
From-SVN: r37115
This commit is contained in:
parent
db50e427f6
commit
e2d7960734
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
|
/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
|
||||||
|
|
||||||
This file is part of libgcj.
|
This file is part of libgcj.
|
||||||
|
|
||||||
This software is copyrighted work licensed under the terms of the
|
This software is copyrighted work licensed under the terms of the
|
||||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||||
details. */
|
details. */
|
||||||
|
|
||||||
package java.util;
|
package java.util;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -22,9 +22,9 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
public final class BitSet implements Cloneable, Serializable
|
public final class BitSet implements Cloneable, Serializable
|
||||||
{
|
{
|
||||||
public void and (BitSet bs)
|
public void and(BitSet bs)
|
||||||
{
|
{
|
||||||
int max = Math.min (bits.length, bs.bits.length);
|
int max = Math.min(bits.length, bs.bits.length);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < max; ++i)
|
for (i = 0; i < max; ++i)
|
||||||
bits[i] &= bs.bits[i];
|
bits[i] &= bs.bits[i];
|
||||||
@ -32,44 +32,44 @@ public final class BitSet implements Cloneable, Serializable
|
|||||||
bits[i] = 0;
|
bits[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitSet ()
|
public BitSet()
|
||||||
{
|
{
|
||||||
this (64);
|
this(64);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitSet (int nbits)
|
public BitSet(int nbits)
|
||||||
{
|
{
|
||||||
if (nbits < 0)
|
if (nbits < 0)
|
||||||
throw new NegativeArraySizeException ();
|
throw new NegativeArraySizeException();
|
||||||
int length = nbits / 64;
|
int length = nbits / 64;
|
||||||
if (nbits % 64 != 0)
|
if (nbits % 64 != 0)
|
||||||
++length;
|
++length;
|
||||||
bits = new long[length];
|
bits = new long[length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear (int pos)
|
public void clear(int pos)
|
||||||
{
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
throw new IndexOutOfBoundsException ();
|
throw new IndexOutOfBoundsException();
|
||||||
int bit = pos % 64;
|
int bit = pos % 64;
|
||||||
int offset = pos / 64;
|
int offset = pos / 64;
|
||||||
ensure (offset);
|
ensure(offset);
|
||||||
bits[offset] &= ~(1L << bit);
|
bits[offset] &= ~(1L << bit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object clone ()
|
public Object clone()
|
||||||
{
|
{
|
||||||
BitSet bs = new BitSet (bits.length * 64);
|
BitSet bs = new BitSet(bits.length * 64);
|
||||||
System.arraycopy (bits, 0, bs.bits, 0, bits.length);
|
System.arraycopy(bits, 0, bs.bits, 0, bits.length);
|
||||||
return bs;
|
return bs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals (Object obj)
|
public boolean equals(Object obj)
|
||||||
{
|
{
|
||||||
if (!(obj instanceof BitSet))
|
if (!(obj instanceof BitSet))
|
||||||
return false;
|
return false;
|
||||||
BitSet bs = (BitSet) obj;
|
BitSet bs = (BitSet) obj;
|
||||||
int max = Math.min (bits.length, bs.bits.length);
|
int max = Math.min(bits.length, bs.bits.length);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < max; ++i)
|
for (i = 0; i < max; ++i)
|
||||||
if (bits[i] != bs.bits[i])
|
if (bits[i] != bs.bits[i])
|
||||||
@ -84,10 +84,10 @@ public final class BitSet implements Cloneable, Serializable
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean get (int pos)
|
public boolean get(int pos)
|
||||||
{
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
throw new IndexOutOfBoundsException ();
|
throw new IndexOutOfBoundsException();
|
||||||
|
|
||||||
int bit = pos % 64;
|
int bit = pos % 64;
|
||||||
int offset = pos / 64;
|
int offset = pos / 64;
|
||||||
@ -98,7 +98,7 @@ public final class BitSet implements Cloneable, Serializable
|
|||||||
return (bits[offset] & (1L << bit)) == 0 ? false : true;
|
return (bits[offset] & (1L << bit)) == 0 ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode ()
|
public int hashCode()
|
||||||
{
|
{
|
||||||
long h = 1234;
|
long h = 1234;
|
||||||
for (int i = bits.length - 1; i >= 0; --i)
|
for (int i = bits.length - 1; i >= 0; --i)
|
||||||
@ -106,32 +106,32 @@ public final class BitSet implements Cloneable, Serializable
|
|||||||
return (int) ((h >> 32) ^ h);
|
return (int) ((h >> 32) ^ h);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void or (BitSet bs)
|
public void or(BitSet bs)
|
||||||
{
|
{
|
||||||
ensure (bs.bits.length - 1);
|
ensure(bs.bits.length - 1);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bs.bits.length; ++i)
|
for (i = 0; i < bs.bits.length; ++i)
|
||||||
bits[i] |= bs.bits[i];
|
bits[i] |= bs.bits[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set (int pos)
|
public void set(int pos)
|
||||||
{
|
{
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
throw new IndexOutOfBoundsException ();
|
throw new IndexOutOfBoundsException();
|
||||||
int bit = pos % 64;
|
int bit = pos % 64;
|
||||||
int offset = pos / 64;
|
int offset = pos / 64;
|
||||||
ensure (offset);
|
ensure(offset);
|
||||||
bits[offset] |= 1L << bit;
|
bits[offset] |= 1L << bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int size ()
|
public int size()
|
||||||
{
|
{
|
||||||
return bits.length * 64;
|
return bits.length * 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString ()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer result = new StringBuffer ("{");
|
StringBuffer result = new StringBuffer("{");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (int i = 0; i < bits.length; ++i)
|
for (int i = 0; i < bits.length; ++i)
|
||||||
{
|
{
|
||||||
@ -142,32 +142,32 @@ public final class BitSet implements Cloneable, Serializable
|
|||||||
if ((word & bit) != 0)
|
if ((word & bit) != 0)
|
||||||
{
|
{
|
||||||
if (!first)
|
if (!first)
|
||||||
result.append (", ");
|
result.append(", ");
|
||||||
result.append (64 * i + j);
|
result.append(64 * i + j);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
bit <<= 1;
|
bit <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.append ("}").toString ();
|
return result.append("}").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void xor (BitSet bs)
|
public void xor(BitSet bs)
|
||||||
{
|
{
|
||||||
ensure (bs.bits.length - 1);
|
ensure(bs.bits.length - 1);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < bs.bits.length; ++i)
|
for (i = 0; i < bs.bits.length; ++i)
|
||||||
bits[i] ^= bs.bits[i];
|
bits[i] ^= bs.bits[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the vector is big enough.
|
// Make sure the vector is big enough.
|
||||||
private final void ensure (int lastElt)
|
private final void ensure(int lastElt)
|
||||||
{
|
{
|
||||||
if (lastElt + 1 > bits.length)
|
if (lastElt + 1 > bits.length)
|
||||||
{
|
{
|
||||||
long[] nd = new long[lastElt + 1];
|
long[] nd = new long[lastElt + 1];
|
||||||
System.arraycopy (bits, 0, nd, 0, bits.length);
|
System.arraycopy(bits, 0, nd, 0, bits.length);
|
||||||
bits = nd;
|
bits = nd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user