Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.Collections/BitArray.cs')
-rw-r--r--mcs/class/corlib/System.Collections/BitArray.cs100
1 files changed, 50 insertions, 50 deletions
diff --git a/mcs/class/corlib/System.Collections/BitArray.cs b/mcs/class/corlib/System.Collections/BitArray.cs
index 1ecb765c932..3093b07bde5 100644
--- a/mcs/class/corlib/System.Collections/BitArray.cs
+++ b/mcs/class/corlib/System.Collections/BitArray.cs
@@ -39,8 +39,8 @@ namespace System.Collections {
#endif
[Serializable]
public sealed class BitArray : ICollection, ICloneable {
- int [] m_array;
- int m_length;
+ int [] _array;
+ int _length;
int _version = 0;
#region Constructors
@@ -49,10 +49,10 @@ namespace System.Collections {
if (bits == null)
throw new ArgumentNullException ("bits");
- m_length = bits.m_length;
- m_array = new int [(m_length + 31) / 32];
+ _length = bits._length;
+ _array = new int [(_length + 31) / 32];
- Array.Copy(bits.m_array, m_array, m_array.Length);
+ Array.Copy(bits._array, _array, _array.Length);
}
public BitArray (bool [] values)
@@ -60,8 +60,8 @@ namespace System.Collections {
if (values == null)
throw new ArgumentNullException ("values");
- m_length = values.Length;
- m_array = new int [(m_length + 31) / 32];
+ _length = values.Length;
+ _array = new int [(_length + 31) / 32];
for (int i = 0; i < values.Length; i++)
this [i] = values [i];
@@ -72,8 +72,8 @@ namespace System.Collections {
if (bytes == null)
throw new ArgumentNullException ("bytes");
- m_length = bytes.Length * 8;
- m_array = new int [(m_length + 31) / 32];
+ _length = bytes.Length * 8;
+ _array = new int [(_length + 31) / 32];
for (int i = 0; i < bytes.Length; i++)
setByte (i, bytes [i]);
@@ -85,9 +85,9 @@ namespace System.Collections {
throw new ArgumentNullException ("values");
int arrlen = values.Length;
- m_length = arrlen*32;
- m_array = new int [arrlen];
- Array.Copy (values, m_array, arrlen);
+ _length = arrlen*32;
+ _array = new int [arrlen];
+ Array.Copy (values, _array, arrlen);
}
public BitArray (int length)
@@ -95,22 +95,22 @@ namespace System.Collections {
if (length < 0)
throw new ArgumentOutOfRangeException ("length");
- m_length = length;
- m_array = new int [(m_length + 31) / 32];
+ _length = length;
+ _array = new int [(_length + 31) / 32];
}
public BitArray (int length, bool defaultValue) : this (length)
{
if (defaultValue) {
- for (int i = 0; i < m_array.Length; i++)
- m_array[i] = ~0;
+ for (int i = 0; i < _array.Length; i++)
+ _array[i] = ~0;
}
}
private BitArray (int [] array, int length)
{
- m_array = array;
- m_length = length;
+ _array = array;
+ _length = length;
}
#endregion
#region Utility Methods
@@ -120,7 +120,7 @@ namespace System.Collections {
int index = byteIndex / 4;
int shift = (byteIndex % 4) * 8;
- int theByte = m_array [index] & (0xff << shift);
+ int theByte = _array [index] & (0xff << shift);
return (byte)((theByte >> shift) & 0xff);
}
@@ -131,9 +131,9 @@ namespace System.Collections {
int shift = (byteIndex % 4) * 8;
// clear the byte
- m_array [index] &= ~(0xff << shift);
+ _array [index] &= ~(0xff << shift);
// or in the new byte
- m_array [index] |= value << shift;
+ _array [index] |= value << shift;
_version++;
}
@@ -142,13 +142,13 @@ namespace System.Collections {
{
if (operand == null)
throw new ArgumentNullException ();
- if (operand.m_length != m_length)
+ if (operand._length != _length)
throw new ArgumentException ();
}
#endregion
public int Count {
- get { return m_length; }
+ get { return _length; }
}
public bool IsReadOnly {
@@ -165,21 +165,21 @@ namespace System.Collections {
}
public int Length {
- get { return m_length; }
+ get { return _length; }
set {
if (value < 0)
throw new ArgumentOutOfRangeException ();
int newLen = value;
- if (m_length != newLen) {
+ if (_length != newLen) {
int numints = (newLen + 31) / 32;
int [] newArr = new int [numints];
- int copylen = (numints > m_array.Length) ? m_array.Length : numints;
- Array.Copy (m_array, newArr, copylen);
+ int copylen = (numints > _array.Length) ? _array.Length : numints;
+ Array.Copy (_array, newArr, copylen);
// set the internal state
- m_array = newArr;
- m_length = newLen;
+ _array = newArr;
+ _length = newLen;
_version++;
}
}
@@ -211,17 +211,17 @@ namespace System.Collections {
// in each case, check to make sure enough space in array
if (array is bool []) {
- if (array.Length - index < m_length)
+ if (array.Length - index < _length)
throw new ArgumentException ();
bool [] barray = (bool []) array;
// Copy the bits into the array
- for (int i = 0; i < m_length; i++)
+ for (int i = 0; i < _length; i++)
barray[index + i] = this [i];
} else if (array is byte []) {
- int numbytes = (m_length + 7) / 8;
+ int numbytes = (_length + 7) / 8;
if ((array.Length - index) < numbytes)
throw new ArgumentException ();
@@ -233,7 +233,7 @@ namespace System.Collections {
} else if (array is int []) {
- Array.Copy (m_array, 0, array, index, (m_length + 31) / 32);
+ Array.Copy (_array, 0, array, index, (_length + 31) / 32);
} else {
throw new ArgumentException ("array", "Unsupported type");
@@ -242,9 +242,9 @@ namespace System.Collections {
public BitArray Not ()
{
- int ints = (m_length + 31) / 32;
+ int ints = (_length + 31) / 32;
for (int i = 0; i < ints; i++)
- m_array [i] = ~m_array [i];
+ _array [i] = ~_array [i];
_version++;
return this;
@@ -254,9 +254,9 @@ namespace System.Collections {
{
checkOperand (value);
- int ints = (m_length + 31) / 32;
+ int ints = (_length + 31) / 32;
for (int i = 0; i < ints; i++)
- m_array [i] &= value.m_array [i];
+ _array [i] &= value._array [i];
_version++;
return this;
@@ -266,9 +266,9 @@ namespace System.Collections {
{
checkOperand (value);
- int ints = (m_length + 31) / 32;
+ int ints = (_length + 31) / 32;
for (int i = 0; i < ints; i++)
- m_array [i] |= value.m_array [i];
+ _array [i] |= value._array [i];
_version++;
return this;
@@ -278,9 +278,9 @@ namespace System.Collections {
{
checkOperand (value);
- int ints = (m_length + 31) / 32;
+ int ints = (_length + 31) / 32;
for (int i = 0; i < ints; i++)
- m_array [i] ^= value.m_array [i];
+ _array [i] ^= value._array [i];
_version++;
return this;
@@ -288,21 +288,21 @@ namespace System.Collections {
public bool Get (int index)
{
- if (index < 0 || index >= m_length)
+ if (index < 0 || index >= _length)
throw new ArgumentOutOfRangeException ();
- return (m_array [index >> 5] & (1 << (index & 31))) != 0;
+ return (_array [index / 32] & (1 << (index % 32))) != 0;
}
public void Set (int index, bool value)
{
- if (index < 0 || index >= m_length)
+ if (index < 0 || index >= _length)
throw new ArgumentOutOfRangeException ();
if (value)
- m_array [index >> 5] |= (1 << (index & 31));
+ _array [index / 32] |= (1 << (index % 32));
else
- m_array [index >> 5] &= ~(1 << (index & 31));
+ _array [index / 32] &= ~(1 << (index % 32));
_version++;
}
@@ -310,11 +310,11 @@ namespace System.Collections {
public void SetAll (bool value)
{
if (value) {
- for (int i = 0; i < m_array.Length; i++)
- m_array[i] = ~0;
+ for (int i = 0; i < _array.Length; i++)
+ _array[i] = ~0;
}
else
- Array.Clear (m_array, 0, m_array.Length);
+ Array.Clear (_array, 0, _array.Length);
_version++;
}
@@ -338,7 +338,7 @@ namespace System.Collections {
{
_index = -1;
_bitArray = ba;
- _max = ba.m_length;
+ _max = ba._length;
_version = ba._version;
}