CGRA-ME
Util.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * The software programs comprising "CGRA-ME" and the documentation provided
3  * with them are copyright by its authors and the University of Toronto. Only
4  * non-commercial, not-for-profit use of this software is permitted without ex-
5  * plicit permission. This software is provided "as is" with no warranties or
6  * guarantees of support. See the LICENCE for more details. You should have re-
7  * ceived a copy of the full licence along with this software. If not, see
8  * <http://cgra-me.ece.utoronto.ca/license/>.
9  ******************************************************************************/
10 
11 #ifndef __UTIL_H__
12 #define __UTIL_H__
13 
14 #include <string>
15 #include <utility>
16 
17 #define cgrame_msg(m) std::cout << "[INFO] " << m << std::endl
18 #define cgrame_warn(m) std::cout << "[WARNING] " << m << std::endl
19 #define cgrame_label(l) std::cout << "[" << l << "] " << std::endl
20 #define cgrame_cmsg(m) std::cout << "[\033[1;34mINFO\033[0m] " << m << std::endl
21 #define cgrame_cwarn(m) std::cout << "[\033[1;33mWARNING\033[0m] " << m << std::endl
22 #define cgrame_clabel(l) std::cout << "[\033[1;36m" << l << "\033[0m] " << std::endl
23 
24 struct pair_hash {
25  template <class T1, class T2>
26  std::size_t operator () (const std::pair<T1, T2> &p) const {
27  auto h1 = std::hash<T1>{}(p.first);
28  auto h2 = std::hash<T2>{}(p.second);
29 
30  // Based on boost hash_combine function
31  return h1 ^ (h2 + 0x9e3779b9 + (h1 << 6) + (h1 >> 2));
32  }
33 };
34 #endif
pair_hash
Definition: Util.h:24
pair_hash::operator()
std::size_t operator()(const std::pair< T1, T2 > &p) const
Definition: Util.h:26