Lidgren.Network.NetUtility.SwapByteOrder C# (CSharp) Méthode

SwapByteOrder() static private méthode

static private SwapByteOrder ( UInt32 value ) : UInt32
value System.UInt32
Résultat System.UInt32
		internal static UInt32 SwapByteOrder(UInt32 value)
		{
			return
				((value & 0xff000000) >> 24) |
				((value & 0x00ff0000) >> 8) |
				((value & 0x0000ff00) << 8) |
				((value & 0x000000ff) << 24);
		}

Same methods

NetUtility::SwapByteOrder ( System.UInt64 value ) : System.UInt64

Usage Example

        //
        // Floating point
        //
#if UNSAFE
        /// <summary>
        /// Writes a 32 bit floating point value
        /// </summary>
        public unsafe void Write(float source)
        {
            uint val = *((uint *)&source);

#if BIGENDIAN
            val = NetUtility.SwapByteOrder(val);
#endif
            Write(val);
        }
All Usage Examples Of Lidgren.Network.NetUtility::SwapByteOrder