mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-24 20:04:13 +08:00
(Binary.Rotate): added ulong methods.
(Crc32.UpdateCrc): method made public.
This commit is contained in:
parent
c9ab33addf
commit
410d40313e
@ -114,6 +114,18 @@ namespace GameRes.Utility
|
|||||||
return v << count | v >> (32-count);
|
return v << count | v >> (32-count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ulong RotR (ulong v, int count)
|
||||||
|
{
|
||||||
|
count &= 0x3F;
|
||||||
|
return v >> count | v << (64-count);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ulong RotL (ulong v, int count)
|
||||||
|
{
|
||||||
|
count &= 0x3F;
|
||||||
|
return v << count | v >> (64-count);
|
||||||
|
}
|
||||||
|
|
||||||
public static byte RotByteR (byte v, int count)
|
public static byte RotByteR (byte v, int count)
|
||||||
{
|
{
|
||||||
count &= 7;
|
count &= 7;
|
||||||
@ -254,7 +266,7 @@ namespace GameRes.Utility
|
|||||||
should be initialized to all 1's, and the transmitted value
|
should be initialized to all 1's, and the transmitted value
|
||||||
is the 1's complement of the final running CRC (see the
|
is the 1's complement of the final running CRC (see the
|
||||||
crc() routine below)). */
|
crc() routine below)). */
|
||||||
static uint UpdateCrc (uint crc, byte[] buf, int pos, int len)
|
public static uint UpdateCrc (uint crc, byte[] buf, int pos, int len)
|
||||||
{
|
{
|
||||||
uint c = crc;
|
uint c = crc;
|
||||||
for (int n = 0; n < len; n++)
|
for (int n = 0; n < len; n++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user