diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-08-07 13:31:23 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 06:49:39 -0500 |
commit | 54d69ea3e123b20303871b0179599f92a39aafdf (patch) | |
tree | 78fe74859862d425dd5fca859771ced1f6b79393 /native | |
parent | 9eb76ebd3e970c3e37ce95ec6e21242a3b0ee0e4 (diff) |
Extract hash map hack from rw-task-fair.cpp
Hashmaps will be needed by the LP code.
Additionally, add definitions for hash maps with uint64_t keys.
This is only relevant for legacy C++ libs as used on Mac OS X.
On Linux, we use the newer C++ '11 STL implementation.
Diffstat (limited to 'native')
-rw-r--r-- | native/include/stl-hashmap.h | 35 | ||||
-rw-r--r-- | native/src/blocking/rw-task-fair.cpp | 12 |
2 files changed, 36 insertions, 11 deletions
diff --git a/native/include/stl-hashmap.h b/native/include/stl-hashmap.h new file mode 100644 index 0000000..2276a4d --- /dev/null +++ b/native/include/stl-hashmap.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef STL_HASHMAP_H_ | ||
2 | #define STL_HASHMAP_H_ | ||
3 | |||
4 | #ifdef CONFIG_USE_0X | ||
5 | #include <unordered_map> | ||
6 | #define hashmap std::unordered_map | ||
7 | #else | ||
8 | #include <ext/hash_map> | ||
9 | |||
10 | namespace __gnu_cxx | ||
11 | { | ||
12 | template<> | ||
13 | struct hash<long long int> | ||
14 | { | ||
15 | size_t operator()(long long int __x) const | ||
16 | { | ||
17 | return __x; | ||
18 | } | ||
19 | }; | ||
20 | |||
21 | template<> | ||
22 | struct hash<unsigned long long int> | ||
23 | { | ||
24 | size_t operator()(unsigned long long int __x) const | ||
25 | { | ||
26 | return __x; | ||
27 | } | ||
28 | }; | ||
29 | |||
30 | }; | ||
31 | |||
32 | #define hashmap __gnu_cxx::hash_map | ||
33 | #endif | ||
34 | |||
35 | #endif | ||
diff --git a/native/src/blocking/rw-task-fair.cpp b/native/src/blocking/rw-task-fair.cpp index bb27c14..f3355c6 100644 --- a/native/src/blocking/rw-task-fair.cpp +++ b/native/src/blocking/rw-task-fair.cpp | |||
@@ -3,17 +3,7 @@ | |||
3 | #include "rw-blocking.h" | 3 | #include "rw-blocking.h" |
4 | 4 | ||
5 | #include "stl-helper.h" | 5 | #include "stl-helper.h" |
6 | 6 | #include "stl-hashmap.h" | |
7 | |||
8 | #ifdef CONFIG_USE_0X | ||
9 | #include <unordered_map> | ||
10 | #define hashmap std::unordered_map | ||
11 | #else | ||
12 | #include <ext/hash_map> | ||
13 | #define hashmap __gnu_cxx::hash_map | ||
14 | #endif | ||
15 | |||
16 | |||
17 | 7 | ||
18 | static Interference bound_blocking_all( | 8 | static Interference bound_blocking_all( |
19 | const TaskInfo* tsk, | 9 | const TaskInfo* tsk, |