Eliminated usage of default parameters.
This commit is contained in:
@@ -96,7 +96,7 @@ namespace OpenRA.FileFormats
|
|||||||
/// <returns>
|
/// <returns>
|
||||||
/// The calculated checksum.
|
/// The calculated checksum.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
public static uint Calculate(byte[] data, uint polynomal = 0xFFFFFFFF)
|
public static uint Calculate(byte[] data, uint polynomal)
|
||||||
{
|
{
|
||||||
uint crc = polynomal;
|
uint crc = polynomal;
|
||||||
for (int i = 0; i < data.Length; i++)
|
for (int i = 0; i < data.Length; i++)
|
||||||
@@ -104,6 +104,10 @@ namespace OpenRA.FileFormats
|
|||||||
crc ^= polynomal;
|
crc ^= polynomal;
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
public static uint Calculate(byte[] data)
|
||||||
|
{
|
||||||
|
return Calculate(data, 0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A fast (native) CRC32 implementation that can be used on a pinned byte array using
|
/// A fast (native) CRC32 implementation that can be used on a pinned byte array using
|
||||||
@@ -113,7 +117,7 @@ namespace OpenRA.FileFormats
|
|||||||
/// <param name="len"> The length of the data data.</param>
|
/// <param name="len"> The length of the data data.</param>
|
||||||
/// <param name="polynomal">The polynomal to xor with.</param>
|
/// <param name="polynomal">The polynomal to xor with.</param>
|
||||||
/// <returns>The calculated checksum.</returns>
|
/// <returns>The calculated checksum.</returns>
|
||||||
public static unsafe uint Calculate(byte* data, uint len, uint polynomal = 0xFFFFFFFF)
|
public static unsafe uint Calculate(byte* data, uint len, uint polynomal)
|
||||||
{
|
{
|
||||||
uint crc = polynomal;
|
uint crc = polynomal;
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
@@ -121,5 +125,9 @@ namespace OpenRA.FileFormats
|
|||||||
crc ^= polynomal;
|
crc ^= polynomal;
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
public static unsafe uint Calculate(byte* data, uint len)
|
||||||
|
{
|
||||||
|
return Calculate(data, len, 0xFFFFFFFF);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user