At Thu, 09 May 2002 07:10:03 -0400, Paul Davis wrote: > > >> i am reading a little endian unsigned long long (64 bit integer) as > >> two LE 32 bit units. i know how to do this on a LE host. can someone > >> tell me how to byte swap and OR them together to form the correct > >> value if the host is bigendian? > > > >Working and tested (x86 Linux and Sparc Solaris) code: > > thanks. however, i found it simpler to do: > > #include <byteswap.h> > ... > bswap_64(val) > > i knew about byteswap.h, and was using bswap_32 - i just hadn't > bothered to look to see if it included bswap_64, and it does.
additional notes: for using swab thingies on the device driver, you'll need to include <asm/byteorder.h> instead of <byteswap.h>. include standard header files are prohibited. Takashi
