0
|
1 |
// Copyright (c) 1997-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".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32test\bench\t_rxfnc.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include <e32std.h>
|
|
19 |
#include <e32std_private.h>
|
|
20 |
#include <e32math.h>
|
|
21 |
|
|
22 |
const TRealX Zero(0);
|
|
23 |
const TRealX One(1);
|
|
24 |
const TRealX Two(2);
|
|
25 |
const TRealX Ten(10);
|
|
26 |
const TRealX Pi(3.14159265358979323846);
|
|
27 |
const TRealX TenPoint01(10.01);
|
|
28 |
|
|
29 |
GLREF_D volatile TInt count;
|
|
30 |
|
|
31 |
TRealX AntiOptimization[16] = {0.1, 1, Pi, 10.01,
|
|
32 |
2.7, 3, 27.2, 11.23,
|
|
33 |
76.1, 9, 56.1, 1/9,
|
|
34 |
1/3, 22, 99.7, 42};
|
|
35 |
|
|
36 |
|
|
37 |
TInt TRealXAddition(TAny*)
|
|
38 |
{
|
|
39 |
|
|
40 |
TRealX r(0);
|
|
41 |
|
|
42 |
FOREVER
|
|
43 |
{
|
|
44 |
r=AntiOptimization[count & 0xf];
|
|
45 |
r+=One;
|
|
46 |
r+=One;
|
|
47 |
r+=One;
|
|
48 |
r+=One;
|
|
49 |
r+=One;
|
|
50 |
r+=One;
|
|
51 |
r+=One;
|
|
52 |
r+=One;
|
|
53 |
r+=One;
|
|
54 |
r+=One;
|
|
55 |
count++;
|
|
56 |
}
|
|
57 |
}
|
|
58 |
|
|
59 |
TInt TRealXSubtraction(TAny*)
|
|
60 |
{
|
|
61 |
|
|
62 |
TRealX r;
|
|
63 |
|
|
64 |
FOREVER
|
|
65 |
{
|
|
66 |
r=AntiOptimization[count & 0xf];
|
|
67 |
r=TenPoint01-Ten;
|
|
68 |
r=TenPoint01-Ten;
|
|
69 |
r=TenPoint01-Ten;
|
|
70 |
r=TenPoint01-Ten;
|
|
71 |
r=TenPoint01-Ten;
|
|
72 |
r=TenPoint01-Ten;
|
|
73 |
r=TenPoint01-Ten;
|
|
74 |
r=TenPoint01-Ten;
|
|
75 |
r=TenPoint01-Ten;
|
|
76 |
r=TenPoint01-Ten;
|
|
77 |
count++;
|
|
78 |
}
|
|
79 |
}
|
|
80 |
|
|
81 |
TInt TRealXMultiplication(TAny*)
|
|
82 |
{
|
|
83 |
|
|
84 |
TRealX r;
|
|
85 |
|
|
86 |
FOREVER
|
|
87 |
{
|
|
88 |
r=AntiOptimization[count & 0xf];
|
|
89 |
r=Pi*Pi;
|
|
90 |
r=Pi*Pi;
|
|
91 |
r=Pi*Pi;
|
|
92 |
r=Pi*Pi;
|
|
93 |
r=Pi*Pi;
|
|
94 |
r=Pi*Pi;
|
|
95 |
r=Pi*Pi;
|
|
96 |
r=Pi*Pi;
|
|
97 |
r=Pi*Pi;
|
|
98 |
r=Pi*Pi;
|
|
99 |
count++;
|
|
100 |
}
|
|
101 |
}
|
|
102 |
|
|
103 |
TInt TRealXDivision(TAny*)
|
|
104 |
{
|
|
105 |
|
|
106 |
TRealX r;
|
|
107 |
|
|
108 |
FOREVER
|
|
109 |
{
|
|
110 |
r=AntiOptimization[count & 0xf];
|
|
111 |
r=One/Ten;
|
|
112 |
r=One/Ten;
|
|
113 |
r=One/Ten;
|
|
114 |
r=One/Ten;
|
|
115 |
r=One/Ten;
|
|
116 |
r=One/Ten;
|
|
117 |
r=One/Ten;
|
|
118 |
r=One/Ten;
|
|
119 |
r=One/Ten;
|
|
120 |
r=One/Ten;
|
|
121 |
count++;
|
|
122 |
}
|
|
123 |
}
|
|
124 |
|