* byteswap.h: Un 64bit ism
@ 2000-12-26 14:31 Dave Gilbert
0 siblings, 0 replies; only message in thread
From: Dave Gilbert @ 2000-12-26 14:31 UTC (permalink / raw)
To: axp-list; +Cc: debian-alpha
Hi,
In /usr/include/bits/byteswap.h is the following macro:
# define __bswap_64(x) \
(__extension__ \
({ union { unsigned long long int __ll; \
unsigned long int __l[2]; } __v, __r; \
__v.__ll = (x); \
__r.__l[0] = __bswap_32 (__v.__l[1]); \
__r.__l[1] = __bswap_32 (__v.__l[0]); \
__r.__ll; }))
It is supposed to do a byte swap on a 64 bit value by swapping the two 32
bit quantities and then byteswapping each of those.
Unfortunatly you'll notice that the union uses a union of an unsigned long
long and unsigned long int; both 64 bit on Alpha. I've changed this in my
installation to :
# define __bswap_64(x) \
(__extension__ \
({ union { uint64_t __ll; \
uint32_t __l[2]; } __v, __r; \
__v.__ll = (x); \
__r.__l[0] = __bswap_32 (__v.__l[1]); \
__r.__l[1] = __bswap_32 (__v.__l[0]); \
__r.__ll; }))
I found this while debugging the Xine DVD/MPEG/VCD player; which now does
a passable attempt at playing a DVD on Linux/Alpha - although its dropping
frames all over. I haven't got the 'Xv' video extension working so its
doing everything in software.
(That construct is in libac3/bswap.h in the xine distribution).
Share & Enjoy,
Dave
--
---------------- Have a happy GNU millennium! ----------------------
/ Dr. David Alan Gilbert | Running GNU/Linux on | Happy \
\ gro.gilbert @ treblig.org | Alpha, x86, ARM and SPARC | In Hex /
\ ___________________________|___ http://www.treblig.org |________/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-12-26 14:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-12-26 14:31 byteswap.h: Un 64bit ism Dave Gilbert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox