* Added Utils.UInt64ToBytesBig()

git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@3422 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
John Hurliman
2010-08-13 23:51:06 +00:00
parent dfd53af1f3
commit cd2f33e653

View File

@@ -509,12 +509,27 @@ namespace OpenMetaverse
return bytes;
}
public static byte[] UInt64ToBytesBig(ulong value)
{
byte[] bytes = BitConverter.GetBytes(value);
if (BitConverter.IsLittleEndian)
Array.Reverse(bytes);
return bytes;
}
public static void UInt64ToBytes(ulong value, byte[] dest, int pos)
{
byte[] bytes = UInt64ToBytes(value);
Buffer.BlockCopy(bytes, 0, dest, pos, 8);
}
public static void UInt64ToBytesBig(ulong value, byte[] dest, int pos)
{
byte[] bytes = UInt64ToBytesBig(value);
Buffer.BlockCopy(bytes, 0, dest, pos, 8);
}
/// <summary>
/// Convert a floating point value to four bytes in little endian
/// ordering