This commit is contained in:
parent
9d8423c51a
commit
6b1c8efb64
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: mem.c 164 2008-04-24 13:21:17Z baconevi $
|
* $Id: mem.c 165 2008-04-24 13:34:17Z baconevi $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -34,11 +34,12 @@ void* ase_memcpy (void* dst, const void* src, ase_size_t n)
|
|||||||
ase_size_t* du = (ase_size_t*)dst;
|
ase_size_t* du = (ase_size_t*)dst;
|
||||||
ase_size_t* su = (ase_size_t*)src;
|
ase_size_t* su = (ase_size_t*)src;
|
||||||
|
|
||||||
while (n >= ASE_SIZEOF(ase_size_t))
|
do
|
||||||
{
|
{
|
||||||
*du++ = *su++;
|
*du++ = *su++;
|
||||||
n -= ASE_SIZEOF(ase_size_t);
|
n -= ASE_SIZEOF(ase_size_t);
|
||||||
}
|
}
|
||||||
|
while (n >= ASE_SIZEOF(ase_size_t));
|
||||||
|
|
||||||
d = (ase_byte_t*)du;
|
d = (ase_byte_t*)du;
|
||||||
s = (ase_byte_t*)su;
|
s = (ase_byte_t*)su;
|
||||||
@ -81,7 +82,7 @@ void* ase_memset (void* dst, int val, ase_size_t n)
|
|||||||
ase_byte_t* d = (ase_byte_t*)dst;
|
ase_byte_t* d = (ase_byte_t*)dst;
|
||||||
|
|
||||||
do { *d++ = (ase_byte_t)val; }
|
do { *d++ = (ase_byte_t)val; }
|
||||||
while (n-- > 0 && ++rem <= ASE_SIZEOF(v16));
|
while (n-- > 0 && ++rem < ASE_SIZEOF(v16));
|
||||||
|
|
||||||
vd = (vector unsigned char*)d;
|
vd = (vector unsigned char*)d;
|
||||||
}
|
}
|
||||||
@ -110,15 +111,13 @@ void* ase_memset (void* dst, int val, ase_size_t n)
|
|||||||
if (rem > 0)
|
if (rem > 0)
|
||||||
{
|
{
|
||||||
d = (ase_byte_t*)dst;
|
d = (ase_byte_t*)dst;
|
||||||
do { *d++ = (ase_byte_t)val;
|
do { *d++ = (ase_byte_t)val; }
|
||||||
printf ("unaligned...\n");
|
while (n-- > 0 && ++rem < ASE_SIZEOF(ase_size_t));
|
||||||
}
|
|
||||||
while (n-- > 0 && ++rem <= ASE_SIZEOF(ase_size_t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n >= ASE_SIZEOF(ase_size_t))
|
if (n >= ASE_SIZEOF(ase_size_t))
|
||||||
{
|
{
|
||||||
ase_size_t* u = d;
|
ase_size_t* u = (ase_size_t*)d;
|
||||||
ase_size_t uv = 0;
|
ase_size_t uv = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -128,17 +127,17 @@ printf ("unaligned...\n");
|
|||||||
uv = (uv << 8) | (ase_byte_t)val;
|
uv = (uv << 8) | (ase_byte_t)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (n >= ASE_SIZEOF(ase_size_t))
|
ASE_ASSERT (IS_ALIGNED(u));
|
||||||
|
do
|
||||||
{
|
{
|
||||||
printf ("block...\n");
|
|
||||||
*u++ = uv;
|
*u++ = uv;
|
||||||
n -= ASE_SIZEOF(ase_size_t);
|
n -= ASE_SIZEOF(ase_size_t);
|
||||||
}
|
}
|
||||||
|
while (n >= ASE_SIZEOF(ase_size_t));
|
||||||
|
|
||||||
d = (ase_byte_t*)u;
|
d = (ase_byte_t*)u;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("unaligned %lld...\n", (long long)n);
|
|
||||||
while (n-- > 0) *d++ = (ase_byte_t)val;
|
while (n-- > 0) *d++ = (ase_byte_t)val;
|
||||||
return dst;
|
return dst;
|
||||||
|
|
||||||
@ -183,12 +182,13 @@ int ase_memcmp (const void* s1, const void* s2, ase_size_t n)
|
|||||||
const ase_size_t* u1 = (const ase_size_t*)s1;
|
const ase_size_t* u1 = (const ase_size_t*)s1;
|
||||||
const ase_size_t* u2 = (const ase_size_t*)s2;
|
const ase_size_t* u2 = (const ase_size_t*)s2;
|
||||||
|
|
||||||
while (n >= ASE_SIZEOF(ase_size_t))
|
do
|
||||||
{
|
{
|
||||||
if (*u1 != *u2) break;
|
if (*u1 != *u2) break;
|
||||||
u1++; u2++;
|
u1++; u2++;
|
||||||
n -= ASE_SIZEOF(ase_size_t);
|
n -= ASE_SIZEOF(ase_size_t);
|
||||||
}
|
}
|
||||||
|
while (n >= ASE_SIZEOF(ase_size_t));
|
||||||
|
|
||||||
b1 = (const ase_byte_t*)u1;
|
b1 = (const ase_byte_t*)u1;
|
||||||
b2 = (const ase_byte_t*)u2;
|
b2 = (const ase_byte_t*)u2;
|
||||||
|
Loading…
Reference in New Issue
Block a user