Logo Search packages:      
Sourcecode: virtualbox-ose version File versions  Download package

static void kLdrModLXMemCopyW ( KU8 *  pbDst,
const KU8 *  pbSrc,
int  cb 
) [static]

Special memcpy employed by the iterdata2 algorithm.

Emulate a 16-bit memcpy (copying 16-bit at a time) and the effects this has if src is very close to the destination.

Parameters:
pbDst Destination pointer.
pbSrc Source pointer. Will always be <= pbDst.
cb Amount of data to be copied.
Remarks:
This assumes that unaligned word and dword access is fine.

Definition at line 1795 of file kLdrModLX.c.

Referenced by kldrModLXDoIterData2Unpacking().

{
    switch (pbDst - pbSrc)
    {
        case 0:
        case 1:
        case 2:
        case 3:
            /* 16-bit copy (unaligned) */
            if (cb & 1)
                *pbDst++ = *pbSrc++;
            for (cb >>= 1; cb > 0; cb--, pbDst += 2, pbSrc += 2)
                *(KU16 *)pbDst = *(const KU16 *)pbSrc;
            break;

        default:
            /* 32-bit copy (unaligned) */
            if (cb & 1)
                *pbDst++ = *pbSrc++;
            if (cb & 2)
            {
                *(KU16 *)pbDst = *(const KU16 *)pbSrc;
                pbDst += 2;
                pbSrc += 2;
            }
            for (cb >>= 2; cb > 0; cb--, pbDst += 4, pbSrc += 4)
                *(KU32 *)pbDst = *(const KU32 *)pbSrc;
            break;
    }
}


Generated by  Doxygen 1.6.0   Back to index