Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\bench\t_memfnc.cpp
19 #include <e32std_private.h>
21 #include <e32base_private.h>
23 const TInt Len64K = 64*1024;
25 volatile extern TInt count;
26 volatile extern TInt iters;
29 extern TInt8 trgoffset;
30 extern TInt8 srcoffset;
33 GLREF_C TInt PurgeCache()
38 purgetrg=(TInt8*)User::Alloc(Len64K);
39 purgesrc=(TInt8*)User::Alloc(Len64K);
41 Mem::Copy(purgetrg,purgesrc,Len64K);
48 TInt MemBaseline(TAny*)
52 for (iters=0; iters<8192; )
54 // eight off, unrolled for accuracy
74 Mem::Copy(trgoffset+trg,srcoffset+src,len);
83 Mem::Fill(trgoffset+trg,len,42);
92 Mem::Swap(trgoffset+trg,srcoffset+src,len);
97 /// For lengths smaller than the allocated size of 64K. Pointers are stepped
98 /// though RAM so that we never hit the cache. Stepping is done backwards to
99 /// foil any automatic preparation for loading of the next cache line.
100 TInt MemCopyUncached(TAny*)
102 TUint step = (len + 31) & (~31); // length rounded up to cache line size
104 TInt8* slimit = src + 2*Len64K - step + srcoffset;
105 TInt8* tlimit = trg + 2*Len64K - step + trgoffset;
124 // See comments for MemCopyUncached above
125 TInt MemFillUncached(TAny*)
127 TUint step = (len + 31) & (~31); // length rounded up to cache line size
129 TInt8* tlimit = trg + 2*Len64K - step + trgoffset;
146 wordmove(trgoffset+trg,srcoffset+src,len);
151 // See comments for MemCopyUncached above
152 TInt WordMoveUncached(TAny*)
154 TUint step = (len + 31) & (~31); // length rounded up to cache line size
156 TInt8* slimit = src + 2*Len64K - step + srcoffset;
157 TInt8* tlimit = trg + 2*Len64K - step + trgoffset;