2
Name:
Anonymous
2009-06-17 13:24
memcpy .
Glad I could help you with your homework.
3
Name:
Anonymous
2009-06-17 13:26
inlined memcpy tends to get optimized really well.
4
Name:
Anonymous
2009-06-17 13:31
memmove involves a temporary buffer, of course memcpy is faster. look at the man pages you idort
5
Name:
Anonymous
2009-06-17 14:56
Their both aliased to bcopy. Sorry for the real answer.
7
Name:
Anonymous
2009-06-17 15:10
>>5
What about those peoples both aliased?
8
Name:
Anonymous
2009-06-17 17:47
>>7
you're gay and cats like milk
9
Name:
Anonymous
2009-06-17 17:54
Sagefault (thread bumped.)
11
Name:
Anonymous
2009-06-17 19:35
>>8
My cat is homophobic and lactose intolerant.
13
Name:
Anonymous
2009-06-17 20:57
>>10
good implementations use
REP MOVSD to move in groups of dwords, then do an "and _rest_reg,3" (mod 4) to calculate the remaining size, and rep movsb the rest if any.
15
Name:
C-man!
2009-06-18 0:18
/* Lets compare them! */
void * __cdecl memmove (
void * dst,
const void * src,
size_t count
)
{
void * ret = dst;
#if defined (_M_IA64)
{
extern void RtlMoveMemory( void *, const void *, size_t count );
RtlMoveMemory( dst, src, count );
}
#else /* defined (_M_IA64) */
if (dst <= src || (char *)dst >= ((char *)src + count)) {
/*
* Non-Overlapping Buffers
* copy from lower addresses to higher addresses
*/
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
}
else {
/*
* Overlapping Buffers
* copy from higher addresses to lower addresses
*/
dst = (char *)dst + count - 1;
src = (char *)src + count - 1;
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst - 1;
src = (char *)src - 1;
}
}
#endif /* defined (_M_IA64) */
return(ret);
}
/**************************************************/
void * __cdecl memcpy (
void * dst,
const void * src,
size_t count
)
{
void * ret = dst;
#if defined (_M_IA64)
{
extern void RtlMoveMemory( void *, const void *, size_t count );
RtlMoveMemory( dst, src, count );
}
#else /* defined (_M_IA64) */
/*
* copy from lower addresses to higher addresses
*/
while (count--) {
*(char *)dst = *(char *)src;
dst = (char *)dst + 1;
src = (char *)src + 1;
}
#endif /* defined (_M_IA64) */
return(ret);
}
16
Name:
Anonymous
2009-06-18 3:27
>>13
Actually, the best results seem to be obtained with REP MOVSB followed by MOVSW if(count&2), and then MOVSB if(count&1).
17
Name:
Anonymous
2009-06-18 14:02
>>13
Enjoy your unaligned access penalties.
19
Name:
Anonymous
2009-06-18 15:59
>>5
>Their both aliased to bcopy
Whose?
"both" belonging to who?
Your sentence is incomplete.
20
Name:
Anonymous
2009-06-18 16:23
>>19
I am sentence is incomplete? Maybe you should learn English buddy.