Swap Endianness for int64 - CSharp System

CSharp examples for System:DateTime Calculate

Description

Swap Endianness for int64

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.Linq;
using System.Collections.Generic;
using System;/*from   ww w . j  a  va  2 s  .c om*/

public class Main{
        static uint SwapEndianness(ulong x)
        {
            return (uint)(((x & 0x000000ff) << 24) +
                           ((x & 0x0000ff00) << 8) +
                           ((x & 0x00ff0000) >> 8) +
                           ((x & 0xff000000) >> 24));
        }
}

Related Tutorials