private static void swab64BitData(byte[] buffer, int offset, int count)
{
Debug.Assert((count & 7) == 0);
int doubleCount = count / 8;
double[] doubles = new double[doubleCount];
int byteOffset = offset;
for (int i = 0; i < doubleCount; i++)
{
doubles[i] = BitConverter.ToDouble(buffer, byteOffset);
byteOffset += 8;
}
SwabArrayOfDouble(doubles, doubleCount);
byteOffset = offset;
for (int i = 0; i < doubleCount; i++)
{
byte[] bytes = BitConverter.GetBytes(doubles[i]);
Buffer.BlockCopy(bytes, 0, buffer, byteOffset, bytes.Length);
byteOffset += bytes.Length;
}
}