Last change
on this file since 101 was
81,
checked in by rosiere, 17 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <iostream> |
---|
2 | #include "../include/Endianness.h" |
---|
3 | |
---|
4 | using namespace std; |
---|
5 | using namespace environment; |
---|
6 | using namespace environment::endianness; |
---|
7 | |
---|
8 | #ifdef SYSTEMC |
---|
9 | int sc_main (int argc, char * argv[]) |
---|
10 | #else |
---|
11 | int main (int argc, char * argv[]) |
---|
12 | #endif |
---|
13 | { |
---|
14 | cout << "<main> Begin" << endl; |
---|
15 | |
---|
16 | cout << "hostEndianness : " << hostEndianness() << endl; |
---|
17 | cout << "cpuEndianness : " << cpuEndianness (0) << endl; |
---|
18 | cout << "same ? : " << isSameEndianness (0) << endl; |
---|
19 | |
---|
20 | char * str = new char [16]; |
---|
21 | |
---|
22 | str [0] = 'a'; |
---|
23 | for (uint32_t i=1; i<16; i++) |
---|
24 | str [i] = str[i-1]+1; |
---|
25 | |
---|
26 | cout << "str : "; |
---|
27 | for (uint32_t i=0; i<16; i++) |
---|
28 | cout << str [i]; |
---|
29 | cout << endl; |
---|
30 | |
---|
31 | str = swapBytes (str, 16, 4); |
---|
32 | |
---|
33 | cout << "str : "; |
---|
34 | for (uint32_t i=0; i<16; i++) |
---|
35 | cout << str [i]; |
---|
36 | cout << endl; |
---|
37 | |
---|
38 | str = swapBytes (str, 16, 1); |
---|
39 | |
---|
40 | cout << "str : "; |
---|
41 | for (uint32_t i=0; i<16; i++) |
---|
42 | cout << str [i]; |
---|
43 | cout << endl; |
---|
44 | |
---|
45 | str = swapBytes (str, 16, 8); |
---|
46 | |
---|
47 | cout << "str : "; |
---|
48 | for (uint32_t i=0; i<16; i++) |
---|
49 | cout << str [i]; |
---|
50 | cout << endl; |
---|
51 | |
---|
52 | str = swapBytes (str, 16, 4); |
---|
53 | |
---|
54 | cout << "str : "; |
---|
55 | for (uint32_t i=0; i<16; i++) |
---|
56 | cout << str [i]; |
---|
57 | cout << endl; |
---|
58 | |
---|
59 | delete [] str; |
---|
60 | |
---|
61 | |
---|
62 | cout << "<main> End" << endl; |
---|
63 | |
---|
64 | return EXIT_SUCCESS; |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.