private static unsafe byte[] SwapDoubleArrayToLittleEndian(byte[] values, uint count) { fixed(byte *pBytes = values) { ulong *ptr = (ulong *)pBytes; ulong *ptrEnd = ptr + count; while (ptr < ptrEnd) { *ptr = EndianUtil.Swap(*ptr); ptr++; } } return(values); }
private static unsafe byte[] SwapRationalArrayToLittleEndian(byte[] values, uint count) { // A rational value consists of two 4-byte values, a numerator and a denominator. long itemCount = count * 2; fixed(byte *pBytes = values) { uint *ptr = (uint *)pBytes; uint *ptrEnd = ptr + itemCount; while (ptr < ptrEnd) { *ptr = EndianUtil.Swap(*ptr); ptr++; } } return(values); }