Changeset 745 for soft


Ignore:
Timestamp:
Dec 15, 2015, 12:16:20 PM (8 years ago)
Author:
alain
Message:

Fix a bug in memcpy() when both buffers are word aligned,
but the size is not a multiple of 4 bytes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_common/utils.c

    r734 r745  
    722722    unsigned int* isrc = (unsigned int*)source;
    723723
    724     // word-by-word copy
     724    // word-by-word copy if both buffers are word aligned
    725725    if (!((unsigned int) idst & 3) && !((unsigned int) isrc & 3))
    726726    {
     
    732732    }
    733733
    734     unsigned char* cdst = (unsigned char*)dest;
    735     unsigned char* csrc = (unsigned char*)source;
    736 
    737     /* byte-by-byte copy */
    738     while (size--)
     734    unsigned char* cdst = (unsigned char*)idst;
     735    unsigned char* csrc = (unsigned char*)isrc;
     736
     737    // byte-by-byte copy if size not multiple of 4 bytes
     738    while (size)
    739739    {
    740740        *cdst++ = *csrc++;
    741     }
     741        size--;
     742    }
     743
    742744    return dest;
    743745}
Note: See TracChangeset for help on using the changeset viewer.