{
public class uint160 : base_uint
{
- new protected readonly int nWidth = 5;
+ new protected int nWidth
+ {
+ get { return base.nWidth; }
+ private set { base.nWidth = value; }
+ }
+ new protected uint[] pn
+ {
+ get { return base.pn; }
+ private set { base.pn = value; }
+ }
public uint160()
{
- base.nWidth = nWidth;
+ nWidth = 5;
pn = new uint[nWidth];
-
- for (int i = 0; i < nWidth; i++)
- {
- pn[i] = 0;
- }
}
- public uint160(uint160 b)
+ public uint160(uint160 b) : this()
{
- base.nWidth = nWidth;
- pn = new uint[nWidth];
-
for (int i = 0; i < nWidth; i++)
{
pn[i] = b.pn[i];
}
- public uint160(ulong n)
+ public uint160(ulong n) : this()
{
- base.nWidth = nWidth;
- pn = new uint[nWidth];
-
pn[0] = (uint)n;
pn[1] = (uint)(n >> 32);
for (int i = 2; i < nWidth; i++)
}
}
- public uint160(byte[] bytes)
+ public uint160(byte[] bytes) : this()
{
Contract.Requires<ArgumentException>(bytes.Length == 20, "Incorrect array length");
-
- base.nWidth = nWidth;
pn = Interop.ToUInt32Array(bytes);
}
- public uint160(string hex)
+ public uint160(string hex) : this()
{
Contract.Requires<ArgumentException>(hex.Length == 40, "Incorrect string");
-
- base.nWidth = nWidth;
var bytes = Interop.ReverseBytes(Interop.HexToArray(hex));
pn = Interop.ToUInt32Array(bytes);
}
{
public class uint256 : base_uint
{
- new public readonly int nWidth = 8;
+ new protected int nWidth {
+ get { return base.nWidth; }
+ private set { base.nWidth = value; }
+ }
+ new protected uint[] pn {
+ get { return base.pn; }
+ private set { base.pn = value; }
+ }
public uint256()
{
- base.nWidth = nWidth;
+ nWidth = 8;
pn = new uint[nWidth];
-
- for (int i = 0; i < nWidth; i++)
- {
- pn[i] = 0;
- }
}
- public uint256(uint256 b)
+ public uint256(uint256 b) : this()
{
- base.nWidth = nWidth;
- pn = new uint[nWidth];
-
for (int i = 0; i < nWidth; i++)
{
pn[i] = b.pn[i];
}
}
-
- public uint256(ulong n)
+ public uint256(ulong n) : this()
{
- base.nWidth = nWidth;
- pn = new uint[nWidth];
-
pn[0] = (uint)n;
pn[1] = (uint)(n >> 32);
for (int i = 2; i < nWidth; i++)
}
}
- public uint256(byte[] bytes)
+ public uint256(byte[] bytes) : this()
{
Contract.Requires<ArgumentException>(bytes.Length == 32, "Incorrect array length");
- base.nWidth = nWidth;
pn = Interop.ToUInt32Array(bytes);
}
- public uint256(string hex)
+ public uint256(string hex) : this()
{
Contract.Requires<ArgumentException>(hex.Length == 64, "Incorrect string");
- base.nWidth = nWidth;
var bytes = Interop.ReverseBytes(Interop.HexToArray(hex));
pn = Interop.ToUInt32Array(bytes);
}