On Thu, Jul 19, 2012, at 06:46 AM, Bron Gondwana wrote: > On Thu, Jul 19, 2012, at 12:02 PM, Greg Banks wrote: > > > > /* http://stackoverflow.com/a/4410728/94253 */ > > [...] > > > > That could do with some improvement. > > Looks like stackoverflow might indeed be full of it. I guess we should > really test for each of those in configure.in and then #define the right > inline instruction.
I guess - except that it's hard in configure to tell the difference between a slow and a fast ntohl() provided by libc. Configure is really good at telling you if something is available, not whether it's fast. Perhaps you could test for the availability, in order, of 1. __builtin_bswap32() from gcc, or 2. ntohl() from libc, or 3. be32toh() from libc and then do the same sequence again for the 64b versions, but add 4. fallback to Cyrus' own code > > The <endian.h> on my desktop defines a be64toh(). The same header on > > ci.cyrusimap.org doesn't. > > Yeah, damn. Is it really ancient, or 32 bit, or something? Ancient. It doesn't have be32toh() either. -- Greg.