1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/bench/t_rxfnc.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,124 @@
1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\bench\t_rxfnc.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32std.h>
1.22 +#include <e32std_private.h>
1.23 +#include <e32math.h>
1.24 +
1.25 +const TRealX Zero(0);
1.26 +const TRealX One(1);
1.27 +const TRealX Two(2);
1.28 +const TRealX Ten(10);
1.29 +const TRealX Pi(3.14159265358979323846);
1.30 +const TRealX TenPoint01(10.01);
1.31 +
1.32 +GLREF_D volatile TInt count;
1.33 +
1.34 +TRealX AntiOptimization[16] = {0.1, 1, Pi, 10.01,
1.35 + 2.7, 3, 27.2, 11.23,
1.36 + 76.1, 9, 56.1, 1/9,
1.37 + 1/3, 22, 99.7, 42};
1.38 +
1.39 +
1.40 +TInt TRealXAddition(TAny*)
1.41 + {
1.42 +
1.43 + TRealX r(0);
1.44 +
1.45 + FOREVER
1.46 + {
1.47 + r=AntiOptimization[count & 0xf];
1.48 + r+=One;
1.49 + r+=One;
1.50 + r+=One;
1.51 + r+=One;
1.52 + r+=One;
1.53 + r+=One;
1.54 + r+=One;
1.55 + r+=One;
1.56 + r+=One;
1.57 + r+=One;
1.58 + count++;
1.59 + }
1.60 + }
1.61 +
1.62 +TInt TRealXSubtraction(TAny*)
1.63 + {
1.64 +
1.65 + TRealX r;
1.66 +
1.67 + FOREVER
1.68 + {
1.69 + r=AntiOptimization[count & 0xf];
1.70 + r=TenPoint01-Ten;
1.71 + r=TenPoint01-Ten;
1.72 + r=TenPoint01-Ten;
1.73 + r=TenPoint01-Ten;
1.74 + r=TenPoint01-Ten;
1.75 + r=TenPoint01-Ten;
1.76 + r=TenPoint01-Ten;
1.77 + r=TenPoint01-Ten;
1.78 + r=TenPoint01-Ten;
1.79 + r=TenPoint01-Ten;
1.80 + count++;
1.81 + }
1.82 + }
1.83 +
1.84 +TInt TRealXMultiplication(TAny*)
1.85 + {
1.86 +
1.87 + TRealX r;
1.88 +
1.89 + FOREVER
1.90 + {
1.91 + r=AntiOptimization[count & 0xf];
1.92 + r=Pi*Pi;
1.93 + r=Pi*Pi;
1.94 + r=Pi*Pi;
1.95 + r=Pi*Pi;
1.96 + r=Pi*Pi;
1.97 + r=Pi*Pi;
1.98 + r=Pi*Pi;
1.99 + r=Pi*Pi;
1.100 + r=Pi*Pi;
1.101 + r=Pi*Pi;
1.102 + count++;
1.103 + }
1.104 + }
1.105 +
1.106 +TInt TRealXDivision(TAny*)
1.107 + {
1.108 +
1.109 + TRealX r;
1.110 +
1.111 + FOREVER
1.112 + {
1.113 + r=AntiOptimization[count & 0xf];
1.114 + r=One/Ten;
1.115 + r=One/Ten;
1.116 + r=One/Ten;
1.117 + r=One/Ten;
1.118 + r=One/Ten;
1.119 + r=One/Ten;
1.120 + r=One/Ten;
1.121 + r=One/Ten;
1.122 + r=One/Ten;
1.123 + r=One/Ten;
1.124 + count++;
1.125 + }
1.126 + }
1.127 +