changeset 30135:807fce7a4bb3

Do not assume that "long" is the size of a register. Fixes aclib compilation on mingw64 (with --enable-runtime-cpudetection).
author reimar
date Sun, 03 Jan 2010 09:20:01 +0000
parents cc55de3130d9
children dc1d66a20ec2
files libvo/aclib.c libvo/aclib_template.c
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/aclib.c	Sun Jan 03 09:11:20 2010 +0000
+++ b/libvo/aclib.c	Sun Jan 03 09:20:01 2010 +0000
@@ -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
--- a/libvo/aclib_template.c	Sun Jan 03 09:11:20 2010 +0000
+++ b/libvo/aclib_template.c	Sun Jan 03 09:20:01 2010 +0000
@@ -100,7 +100,7 @@
 /* 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 @@
 #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 @@
            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 @@
 	}
 #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 @@
 			"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 @@
 #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;