On 2/15/07, Trent Piepho <[EMAIL PROTECTED]> wrote:
> On Wed, 14 Feb 2007, Alan wrote:
> > > > My comment is not very good, in fact on some cameras I need to swap the 
> > > > bytes
> > > > to have correct JPEG data (so this is not an endianness issue I think).
> > > > Maybe there is a macro to swap bytes in a buffer? I cannot find it.
> > >
> > > Sorry, there's a swab32, but no swab16. I misremembered.
> >
> > Its just called "swab" for 16bit values and is a gcc builtin/string
> > function.
>
> The C library function swab() isn't usable in the kernel, as it's not part
> of the kernel's C lib.
>
> Gcc doesn't have a builtin swab/bswap16 yet, maybe it will someday:
> http://gcc.gnu.org/ml/gcc-patches/2006-07/msg00496.html
>
> The kernel does have swab64, swab32, and yes, swab16 macros!  They're all
> defined in the same place in asm/byteorder.h.  There are architecture
> optimized versions for some cases, but not for x86 and swab16 as gcc
> supposedly does ok (or does it? *).
>
> There are three versions of the swabXX functions, a normal one, one that
> takes a pointer to the data, and one that swaps the data in-place.  The
> more specialized versions might be faster in some cases.  I don't see any
> version of that swaps an array of data, like C-lib swab(), which be a lot
> more useful that swab16 vs swab16p vs swab16s, IMHO.


Additionally we have some bswap* functions in dvb-apps, if it helps in some way

http://linuxtv.org/hg/dvb-apps?f=15989fca7c14;file=lib/libucsi/endianops.h;style=gitweb


Manu

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to