Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 Apr 2003 16:08:23 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        ru@FreeBSD.org
Cc:        mike@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys endian.h src/share/man/man9 byteorder.9
Message-ID:  <20030404.160823.91026001.imp@bsdimp.com>
In-Reply-To: <20030404085200.GA1765@sunbay.com>
References:  <Pine.BSF.4.21.0304031545540.15187-100000@root.org> <20030403184229.D18209@espresso.bsdmike.org> <20030404085200.GA1765@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20030404085200.GA1765@sunbay.com>
            Ruslan Ermilov <ru@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030404.160823.91026001.imp>