Changeset 7a255e69 in mainline


Ignore:
Timestamp:
2006-02-26T11:58:27Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7cb53f62
Parents:
a0c732e
Message:

Improved version of generic memcpy().
Should improve frame buffer impression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • generic/src/lib/memstr.c

    ra0c732e r7a255e69  
    3030#include <arch/types.h>
    3131
    32 
    3332/** Copy block of memory
    3433 *
    3534 * Copy cnt bytes from src address to dst address.
    36  * The copying is done byte-by-byte. The source
    37  * and destination memory areas cannot overlap.
     35 * The copying is done word-by-word and then byte-by-byte.
     36 * The source and destination memory areas cannot overlap.
    3837 *
    3938 * @param src Origin address to copy from.
     
    4443void *_memcpy(void * dst, const void *src, size_t cnt)
    4544{
    46         int i;
     45        int i, j;
    4746       
    48         for (i=0; i<cnt; i++)
    49                 *((__u8 *) (dst + i)) = *((__u8 *) (src + i));
     47        for (i = 0; i < cnt/sizeof(__native); i++)
     48                ((__native *) dst)[i] = ((__native *) src)[i];
     49               
     50        for (j = 0; j < cnt%sizeof(__native); j++)
     51                ((__u8 *)(((__native *) dst) + i))[j] = ((__u8 *)(((__native *) src) + i))[j];
    5052               
    5153        return (char *)src;
Note: See TracChangeset for help on using the changeset viewer.