On 5/11/07, Chris Frey <[EMAIL PROTECTED]> wrote:
>
>         bswap_16()
>         bswap_32()
>         bswap_64()

I see numerous Google hits that it's GNU non-portable, and indeed I
can't find it on any of the OS X boxes I peeked at (then again, they
might not have Xcode installed for all I know). I found one thread
from a guy who wrote his own:

http://www.netstumbler.org/showpost.php?s=79764fd1526e4653d5cb4432225da6ee&p=190494&postcount=29

...the extracted byteswap.h from the tarball:

== cut here ==
#ifndef _BYTESWAP_H
#define _BYTESWAP_H

//#warning "byteswap.h is an unportable GNU extension!  Don't use!"

static inline unsigned short bswap_16(unsigned short x) {
  return (x>>8) | (x<<8);
}

static inline unsigned int bswap_32(unsigned int x) {
  return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16));
}

static inline unsigned long long bswap_64(unsigned long long x) {
  return (((unsigned long long)bswap_32(x&0xffffffffull))<<32) |
(bswap_32(x>>32));
}

#endif
== cut here ==

I presume that would be copyright "Joshua Wright
<[EMAIL PROTECTED]>", it's GPL code (COPYING incl. in tarball).

hth,
-te

-- 
In every generation there is a Resistance,and
in every generation it's the only place to be.
- Leonard Cohen

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Barry-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to