Commit 22435578 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix ptrdiff_t abuse. Especially in video_filter_invert:

ptrdiff_t is signed so unequality comparison between pointers would
compute wrong when the two operands are within opposite halves of the
memory space.
parent 7e0632d1
......@@ -246,7 +246,7 @@ void * fast_memcpy(void * to, const void * from, size_t len)
}
#else
/* Align destination at BLOCK_SIZE boundary */
for(; ((ptrdiff_t)to & (BLOCK_SIZE-1)) && i>0; i--)
for(; ((uintptr_t)to & (BLOCK_SIZE-1)) && i>0; i--)
{
__asm__ __volatile__ (
#ifndef HAVE_MMX1
......@@ -273,7 +273,7 @@ void * fast_memcpy(void * to, const void * from, size_t len)
to = (void *) (((unsigned char *)to)+64);
}
/* printf(" %p %p\n", (ptrdiff_t)from&1023, (ptrdiff_t)to&1023); */
/* printf(" %p %p\n", (uintptr_t)from&1023, (uintptr_t)to&1023); */
/* Pure Assembly cuz gcc is a bit unpredictable ;) */
# if 0
if(i>=BLOCK_SIZE/64)
......
......@@ -1009,7 +1009,7 @@ static void MergeSSE2( void *_p_dest, const void *_p_s1, const void *_p_s2,
const uint8_t *p_s1 = (const uint8_t *)_p_s1;
const uint8_t *p_s2 = (const uint8_t *)_p_s2;
uint8_t* p_end;
while( (ptrdiff_t)p_s1 % 16 )
while( (uintptr_t)p_s1 % 16 )
{
*p_dest++ = ( (uint16_t)(*p_s1++) + (uint16_t)(*p_s2++) ) >> 1;
}
......
......@@ -151,7 +151,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
p_in64 = (uint64_t*)p_in;
p_out64 = (uint64_t*)p_out;
for( ; (ptrdiff_t)p_in64 < (ptrdiff_t)p_line_end ; )
while( p_in64 < p_line_end )
{
/* Do 64 pixels at a time */
*p_out64++ = ~*p_in64++; *p_out64++ = ~*p_in64++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment