[Mplayer-cvslog] CVS: main/liba52 bitstream.h,1.7,1.8

Alex Beregszaszi alex at mplayerhq.hu
Mon Jul 28 01:03:01 CEST 2003


Update of /cvsroot/mplayer/main/liba52
In directory mail:/var/tmp.root/cvs-serv19249

Modified Files:
	bitstream.h 
Log Message:
Changed swab32 from macro to inline function, this fixes compilation on alpha (with gcc2.95). Based on patch by KotH

Index: bitstream.h
===================================================================
RCS file: /cvsroot/mplayer/main/liba52/bitstream.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- bitstream.h	20 Jun 2003 13:10:42 -0000	1.7
+++ bitstream.h	27 Jul 2003 23:02:58 -0000	1.8
@@ -21,6 +21,13 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
+/* code from ffmpeg/libavcodec */
+#if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC_ == 3 && __GNUC_MINOR__ > 0)
+#    define always_inline __attribute__((always_inline)) inline
+#else
+#    define always_inline inline
+#endif
+
 #if defined(__sparc__) || defined(hpux)
 /*
  * the alt bitstream reader performs unaligned memory accesses; that doesn't work
@@ -36,7 +43,7 @@
 #    define unaligned32(a) (*(uint32_t*)(a))
 #else
 #    ifdef __GNUC__
-static inline uint32_t unaligned32(const void *v) {
+static always_inline uint32_t unaligned32(const void *v) {
     struct Unaligned {
 	uint32_t i;
     } __attribute__((packed));
@@ -66,7 +73,7 @@
 #	if defined (__i386__)
 
 #	define swab32(x) __i386_swab32(x)
-	static inline const uint32_t __i386_swab32(uint32_t x)
+	static always_inline const uint32_t __i386_swab32(uint32_t x)
 	{
 		__asm__("bswap %0" : "=r" (x) : "0" (x));
 		return x;
@@ -74,10 +81,12 @@
 
 #	else
 
-#	define swab32(x)\
-((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) |  \
- (((uint8_t*)&x)[2] << 8)  | (((uint8_t*)&x)[3]))
-
+#	define swab32(x) __generic_swab32(x)
+	static always_inline const uint32_t __generic_swab32(uint32_t x)
+	{
+		return ((((uint8_t*)&x)[0] << 24) | (((uint8_t*)&x)[1] << 16) |
+		 (((uint8_t*)&x)[2] << 8)  | (((uint8_t*)&x)[3]));
+	}
 #	endif
 #endif
 



More information about the MPlayer-cvslog mailing list