cvs commit: src/sys/sys endian.h src/share/man/man9 byteorder.9

M. Warner Losh imp at bsdimp.com
Fri Apr 4 15:09:39 PST 2003


In message: <20030404085200.GA1765 at sunbay.com>
            Ruslan Ermilov <ru at FreeBSD.org> writes:
: +#define	BSWAP64(x)	(uint64_t) \
: +	(((x) >> 56) | (((x) >> 40) & 0xff00) | (((x) >> 24) & 0xff0000) | \
: +	(((x) >> 8) & 0xff000000) | (((x) << 8) & ((uint64_t)0xff << 32)) | \
: +	(((x) << 24) & ((uint64_t)0xff << 40)) | \
: +	(((x) << 40) & ((uint64_t)0xff << 48)) | (((x) << 56)))

0xffull or 0xffULL might be better than the casts here.  This does
assume that 0ull == (uint64_t)0, which does hold for all our
architectures...

Warner


More information about the cvs-src mailing list