diff -r c55016431358 -r 0a7b44b10206 symport/e32/common/mem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/symport/e32/common/mem.cpp Thu Jun 25 15:59:54 2009 +0100 @@ -0,0 +1,241 @@ +// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Symbian Foundation License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32\common\mem.cpp +// +// + +#include "common.h" + +//This is used in heap.cpp and it is defined here, as a requirement for patchdata +EXPORT_D extern const TInt KHeapMinCellSize = 0; +EXPORT_D extern const TInt KHeapShrinkHysRatio = RHeap::EShrinkRatioDflt; +//NOTE - if these values are changed then the WINS test case value must be updated + +#ifndef __MEM_MACHINE_CODED__ + +extern "C" { + +// See header file e32cmn.h for the in-source documentation. +EXPORT_C TAny* memcpy(TAny* aTrg, const TAny* aSrc, unsigned int aLength) + { + return memmove(aTrg, aSrc, aLength); + } + + + +// See header file e32cmn.h for the in-source documentation. +EXPORT_C TAny* memmove(TAny* aTrg, const TAny* aSrc, unsigned int aLength) + { + if (aLength==0) + return((TUint8*)aTrg); + TInt aLen32=0; + TUint32* pT32=(TUint32*)aTrg; + const TUint32* pS32=(TUint32 *)aSrc; + if (((TInt)pT32&3)==0 && ((TInt)pS32&3)==0) + aLen32=aLength>>2; + TInt aLen8=aLength-(aLen32<<2); + TUint32* pE32=pT32+aLen32; + TUint8* pT; + TUint8* pE; + TUint8* pS; + if (aTrgaSrc) + { + pT=(TUint8*)(pT32+aLen32); + pE=pT+aLen8; + pS=(TUint8*)aSrc+aLength; + while (pE>pT) + *--pE=(*--pS); + pS32=(TUint32*)pS; + while (pE32>pT32) + *--pE32=(*--pS32); + } + return aTrg; + } + + + +// See header file e32cmn.h for the in-source documentation. +EXPORT_C TAny* memclr(TAny* aTrg, unsigned int aLength) + { + return memset(aTrg, 0, aLength); + } + + + +// See header file e32cmn.h for the in-source documentation. +EXPORT_C TAny* memset(TAny* aTrg, TInt aValue, unsigned int aLength) + { + TInt aLen32=0; + TUint32 *pM32=(TUint32 *)aTrg; + if (((TInt)aTrg&3)==0) + { + aLen32=aLength>>2; + TUint32 *pE32=pM32+aLen32; + TUint c = aValue & 0xff; + TUint32 fillChar=c+(c<<8)+(c<<16)+(c<<24); + while (pM32>2; + TUint32* pT=(TUint32*)aTrg; + const TUint32* pS=(const TUint32*)aSrc; + const TUint32* pE=pS+len; + if (pTpS) + { + pT+=len; + while (pE>pS) + *--pT=(*--pE); + } + return aTrg; + } + + + + +// See header file e32cmn.h for the in-source documentation. +EXPORT_C TInt memcompare(const TUint8* aLeft, TInt aLeftL, const TUint8* aRight, TInt aRightL) + { + + __ASSERT_DEBUG(aLeftL>=0,Panic(EMemLeftNegative)); + __ASSERT_DEBUG(aRightL>=0,Panic(EMemRightNegative)); + const TUint8 *pE=aLeft+Min(aLeftL,aRightL); + while (aLeft