1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 01:22:30 +00:00

Do not assume that "long" is the size of a register.

Fixes aclib compilation on mingw64 (with --enable-runtime-cpudetection).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30177 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2010-01-03 09:20:01 +00:00
parent 4a981bf09a
commit 485b17cc7d
2 changed files with 10 additions and 8 deletions

View File

@ -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

View File

@ -100,7 +100,7 @@ If you have questions please contact with me: Nick Kurshev: nickols_k@mail.ru.
/* 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 * to, const void * from, size_t len)
#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 * to, const void * from, size_t len)
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 * to, const void * from, size_t len)
}
#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 * to, const void * from, size_t len)
"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 * to, const void * from, size_t len)
#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;