Re: [Barry-devel] What is the equivalent to byteswap.h on Mac OS X?

2007-05-12 Thread Chris Frey
Thanks... all signs point to inline functions, so that's probably the
way I'll go.

- Chris


On Sat, May 12, 2007 at 08:59:23AM -0400, Peter Silva wrote:
> googled on linux port darwin bsd byteswap.h, and came up with this...
> This is apparently a common pitfall.   I saw this commit log, which looks
> like it defines the functions inline...
> 
> http://lists.freedesktop.org/archives/xorg-commit/2007-January/010041.html
> 
> 
> 
> On 5/11/07, Chris Frey <[EMAIL PROTECTED]> wrote:
> >
> >Hi folks,
> >
> >One user is attempting to build Barry on Mac OS X, and we're running into
> >the problem where byteswap.h does not exist.  This provides the following
> >functions that Barry needs for byte order swapping:
> >
> >bswap_16()
> >bswap_32()
> >bswap_64()
> >
> >Anyone know what the equivalent header and/or functions are on Mac OS X?
> >I don't have that machine available.
> >
> >Thanks!
> >- Chris
> >
> >
> >-
> >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
> >Barry-devel@lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/barry-devel
> >

> -
> 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
> Barry-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/barry-devel


-
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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel


Re: [Barry-devel] What is the equivalent to byteswap.h on Mac OS X?

2007-05-12 Thread Peter Silva

googled on linux port darwin bsd byteswap.h, and came up with this...
This is apparently a common pitfall.   I saw this commit log, which looks
like it defines the functions inline...

http://lists.freedesktop.org/archives/xorg-commit/2007-January/010041.html



On 5/11/07, Chris Frey <[EMAIL PROTECTED]> wrote:


Hi folks,

One user is attempting to build Barry on Mac OS X, and we're running into
the problem where byteswap.h does not exist.  This provides the following
functions that Barry needs for byte order swapping:

bswap_16()
bswap_32()
bswap_64()

Anyone know what the equivalent header and/or functions are on Mac OS X?
I don't have that machine available.

Thanks!
- Chris


-
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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

-
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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel


Re: [Barry-devel] What is the equivalent to byteswap.h on Mac OS X?

2007-05-11 Thread Chris Frey
On Fri, May 11, 2007 at 03:15:00PM -0700, troy engel wrote:
> 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

Thanks for checking into this.  I found it is GNU-specific too, but
I also found reference to a porting document that recommended I use
endian.h.  endian.h on linux systems is useless for this, as far
as I can see, but perhaps Max OS X has functions of their own in
there.


> 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:

This is simple stuff, so perhaps this is the best route.
It's easier than adding more cruft to autoconf. :-)

Thanks,
- Chris


-
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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel


Re: [Barry-devel] What is the equivalent to byteswap.h on Mac OS X?

2007-05-11 Thread troy engel
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&0x)<<16) | (bswap_16(x>>16));
}

static inline unsigned long long bswap_64(unsigned long long x) {
  return (((unsigned long long)bswap_32(x&0xull))<<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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel


[Barry-devel] What is the equivalent to byteswap.h on Mac OS X?

2007-05-11 Thread Chris Frey
Hi folks,

One user is attempting to build Barry on Mac OS X, and we're running into
the problem where byteswap.h does not exist.  This provides the following
functions that Barry needs for byte order swapping:

bswap_16()
bswap_32()
bswap_64()

Anyone know what the equivalent header and/or functions are on Mac OS X?
I don't have that machine available.

Thanks!
- Chris


-
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
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel