BitMiracle.LibTiff.Classic.Tiff.SwabDouble C# (CSharp) Method

SwabDouble() public static method

Swaps the bytes in a single double-precision floating-point number.
public static SwabDouble ( double &value ) : void
value double The value to swap bytes in.
return void
        public static void SwabDouble(ref double value)
        {
            byte[] bytes = BitConverter.GetBytes(value);
            int[] ints = new int[2];
            ints[0] = BitConverter.ToInt32(bytes, 0);
            ints[0] = BitConverter.ToInt32(bytes, sizeof(int));

            SwabArrayOfLong(ints, 2);

            int temp = ints[0];
            ints[0] = ints[1];
            ints[1] = temp;

            Buffer.BlockCopy(BitConverter.GetBytes(ints[0]), 0, bytes, 0, sizeof(int));
            Buffer.BlockCopy(BitConverter.GetBytes(ints[1]), 0, bytes, sizeof(int), sizeof(int));
            value = BitConverter.ToDouble(bytes, 0);
        }
Tiff