mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-22 23:15:20 +00:00
@@ -79,33 +79,5 @@ namespace SharpCompress.Compressor.LZMA
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#if !PORTABLE && !NETFX_CORE
|
||||
public static unsafe uint Update(uint crc, byte* buffer, int length)
|
||||
{
|
||||
while (length > 0 && ((int) buffer & 3) != 0)
|
||||
{
|
||||
crc = Update(crc, *buffer);
|
||||
buffer++;
|
||||
length--;
|
||||
}
|
||||
|
||||
while (length >= 4)
|
||||
{
|
||||
crc = Update(crc, *(uint*) buffer);
|
||||
buffer += 4;
|
||||
length -= 4;
|
||||
}
|
||||
|
||||
while (length > 0)
|
||||
{
|
||||
crc = Update(crc, *buffer);
|
||||
length--;
|
||||
}
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -199,21 +199,11 @@ namespace SharpCompress
|
||||
/// </param>
|
||||
/// <param name="value">the value to write
|
||||
/// </param>
|
||||
#if PORTABLE || NETFX_CORE
|
||||
public static void WriteLittleEndian(byte[] array, int pos, short value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
#else
|
||||
public static unsafe void WriteLittleEndian(byte[] array, int pos, short value)
|
||||
{
|
||||
fixed (byte* numRef = &(array[pos]))
|
||||
{
|
||||
*((short*)numRef) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary> Increment a short value at the specified position by the specified amount
|
||||
/// (little endian).
|
||||
@@ -241,21 +231,11 @@ namespace SharpCompress
|
||||
/// </param>
|
||||
/// <param name="value">the value to write
|
||||
/// </param>
|
||||
#if PORTABLE || NETFX_CORE
|
||||
public static void WriteLittleEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
byte[] newBytes = BitConverter.GetBytes(value);
|
||||
Array.Copy(newBytes, 0, array, pos, newBytes.Length);
|
||||
}
|
||||
#else
|
||||
public static unsafe void WriteLittleEndian(byte[] array, int pos, int value)
|
||||
{
|
||||
fixed (byte* numRef = &(array[pos]))
|
||||
{
|
||||
*((int*)numRef) = value;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static void Initialize<T>(this T[] array, Func<T> func)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user