mirror of
https://github.com/crskycode/GARbro.git
synced 2024-12-23 19:34:15 +08:00
(BigEndian): added Pack methods.
This commit is contained in:
parent
7562aa5449
commit
c785beecc0
@ -176,6 +176,41 @@ namespace GameRes.Utility
|
||||
{
|
||||
return (int)ToUInt32 (value, index);
|
||||
}
|
||||
|
||||
public static void Pack (ushort value, byte[] buf, int index)
|
||||
{
|
||||
buf[index] = (byte)(value >> 8);
|
||||
buf[index+1] = (byte)(value);
|
||||
}
|
||||
|
||||
public static void Pack (uint value, byte[] buf, int index)
|
||||
{
|
||||
buf[index] = (byte)(value >> 24);
|
||||
buf[index+1] = (byte)(value >> 16);
|
||||
buf[index+2] = (byte)(value >> 8);
|
||||
buf[index+3] = (byte)(value);
|
||||
}
|
||||
|
||||
public static void Pack (ulong value, byte[] buf, int index)
|
||||
{
|
||||
Pack ((uint)(value >> 32), buf, index);
|
||||
Pack ((uint)value, buf, index+4);
|
||||
}
|
||||
|
||||
public static void Pack (short value, byte[] buf, int index)
|
||||
{
|
||||
Pack ((ushort)value, buf, index);
|
||||
}
|
||||
|
||||
public static void Pack (int value, byte[] buf, int index)
|
||||
{
|
||||
Pack ((uint)value, buf, index);
|
||||
}
|
||||
|
||||
public static void Pack (long value, byte[] buf, int index)
|
||||
{
|
||||
Pack ((ulong)value, buf, index);
|
||||
}
|
||||
}
|
||||
|
||||
public static class LittleEndian
|
||||
|
Loading…
x
Reference in New Issue
Block a user