[MPlayer-cvslog] r30177 - in trunk/libvo: aclib.c aclib_template.c

reimar subversion at mplayerhq.hu
Sun Jan 3 10:20:02 CET 2010


Author: reimar
Date: Sun Jan  3 10:20:01 2010
New Revision: 30177

Log:
Do not assume that "long" is the size of a register.
Fixes aclib compilation on mingw64 (with --enable-runtime-cpudetection).

Modified:
   trunk/libvo/aclib.c
   trunk/libvo/aclib_template.c

Modified: trunk/libvo/aclib.c
==============================================================================
--- trunk/libvo/aclib.c	Sun Jan  3 10:11:20 2010	(r30176)
+++ trunk/libvo/aclib.c	Sun Jan  3 10:20:01 2010	(r30177)
@@ -23,9 +23,11 @@
 
 #include "config.h"
 #include <stddef.h>
+#include <stdint.h>
 #include <string.h>
 #include "cpudetect.h"
 #include "fastmemcpy.h"
+#include "libavutil/x86_cpu.h"
 #undef memcpy
 
 #define BLOCK_SIZE 4096

Modified: trunk/libvo/aclib_template.c
==============================================================================
--- trunk/libvo/aclib_template.c	Sun Jan  3 10:11:20 2010	(r30176)
+++ trunk/libvo/aclib_template.c	Sun Jan  3 10:20:01 2010	(r30177)
@@ -100,7 +100,7 @@ If you have questions please contact wit
 /* for small memory blocks (<256 bytes) this version is faster */
 #define small_memcpy(to,from,n)\
 {\
-register unsigned long int dummy;\
+register x86_reg dummy;\
 __asm__ volatile(\
 	"rep; movsb"\
 	:"=&D"(to), "=&S"(from), "=&c"(dummy)\
@@ -180,9 +180,9 @@ static void * RENAME(fast_memcpy)(void *
 #endif
         if(len >= MIN_LEN)
 	{
-	  register unsigned long int delta;
+	  register x86_reg delta;
           /* Align destinition to MMREG_SIZE -boundary */
-          delta = ((unsigned long int)to)&(MMREG_SIZE-1);
+          delta = ((intptr_t)to)&(MMREG_SIZE-1);
           if(delta)
 	  {
 	    delta=MMREG_SIZE-delta;
@@ -201,7 +201,7 @@ static void * RENAME(fast_memcpy)(void *
            processor's decoders, but it's not always possible.
         */
 #if HAVE_SSE /* Only P3 (may be Cyrix3) */
-	if(((unsigned long)from) & 15)
+	if(((intptr_t)from) & 15)
 	/* if SRC is misaligned */
 	for(; i>0; i--)
 	{
@@ -243,7 +243,7 @@ static void * RENAME(fast_memcpy)(void *
 	}
 #else
 	// Align destination at BLOCK_SIZE boundary
-	for(; ((int)to & (BLOCK_SIZE-1)) && i>0; i--)
+	for(; ((intptr_t)to & (BLOCK_SIZE-1)) && i>0; i--)
 	{
 		__asm__ volatile (
 #ifndef HAVE_ONLY_MMX1
@@ -328,7 +328,7 @@ static void * RENAME(fast_memcpy)(void *
 			"cmp %4, %2		\n\t"
 			" jae 1b		\n\t"
 				: "+r" (from), "+r" (to), "+r" (i)
-				: "r" ((long)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((long)CONFUSION_FACTOR)
+				: "r" ((x86_reg)BLOCK_SIZE), "i" (BLOCK_SIZE/64), "i" ((x86_reg)CONFUSION_FACTOR)
 				: "%"REG_a, "%ecx"
 		);
 
@@ -400,9 +400,9 @@ static void * RENAME(mem2agpcpy)(void * 
 #endif
         if(len >= MIN_LEN)
 	{
-	  register unsigned long int delta;
+	  register x86_reg delta;
           /* Align destinition to MMREG_SIZE -boundary */
-          delta = ((unsigned long int)to)&7;
+          delta = ((intptr_t)to)&7;
           if(delta)
 	  {
 	    delta=8-delta;


More information about the MPlayer-cvslog mailing list