Ejemplo n.º 1
0
 /// <summary>
 ///     Determines whether the bytes of a signed integer have to be
 ///     swapped according to the used transfer syntax. There is
 ///     considered the endian type of underlying machine and transfer
 ///     syntax.
 /// </summary>
 /// <param name="value">
 ///     Signed integer to process.
 /// </param>
 /// <returns>
 ///     Signed integer with or without bytes swapped.
 /// </returns>
 public int CorrectByteOrdering(int value)
 {
     if ((IsMachineLittleEndian && !IsLittleEndian) ||
         (!IsMachineLittleEndian && IsLittleEndian))
     {
         return(ByteConvert.SwapBytes(value));
     }
     else
     {
         return(value);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///     Determines whether the bytes of an array have to be swapped
 ///     according to the used transfer syntax. This method only is
 ///     relevant to numeric representations as byte arrays. There is
 ///     considered the endian type of underlying machine and transfer
 ///     syntax.
 /// </summary>
 /// <param name="bytes">
 ///     Byte array to process.
 /// </param>
 /// <returns>
 ///     Byte array with or without bytes swapped.
 /// </returns>
 public byte[] CorrectByteOrdering(byte[] bytes)
 {
     if ((IsMachineLittleEndian && !IsLittleEndian) ||
         (!IsMachineLittleEndian && IsLittleEndian))
     {
         return(ByteConvert.SwapBytes(bytes));
     }
     else
     {
         return(bytes);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     Determines whether the bytes of a signed word have to be
 ///     swapped according to the used transfer syntax. There is
 ///     considered the endian type of underlying machine and transfer
 ///     syntax.
 /// </summary>
 /// <param name="word">
 ///     Signed word to process.
 /// </param>
 /// <returns>
 ///     Signed word with or without bytes swapped.
 /// </returns>
 public short CorrectByteOrdering(short word)
 {
     if ((IsMachineLittleEndian && !IsLittleEndian) ||
         (!IsMachineLittleEndian && IsLittleEndian))
     {
         return(ByteConvert.SwapBytes(word));
     }
     else
     {
         return(word);
     }
 }