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

SwabShort() public static method

Swaps the bytes in a single 16-bit item.
public static SwabShort ( short &value ) : void
value short The value to swap bytes in.
return void
        public static void SwabShort(ref short value)
        {
            byte[] bytes = new byte[2];
            bytes[0] = (byte)value;
            bytes[1] = (byte)(value >> 8);

            byte temp = bytes[1];
            bytes[1] = bytes[0];
            bytes[0] = temp;

            value = (short)(bytes[0] & 0xFF);
            value += (short)((bytes[1] & 0xFF) << 8);
        }
Tiff