Thanks, but, when I convert I recive a 'c' in the front of my number...

uint reverseBytes(uint val)
{
        import core.bitop : bitswap;

        return bitswap(val);
}

//...
writefln("%x", reverseBytes(0x00402030));
//...

// output: c040200

On Tuesday, 15 July 2014 at 12:16:26 UTC, bearophile wrote:

See also core.bitop.bswap.

Bye,
bearophile

Reply via email to