-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.h
More file actions
34 lines (28 loc) · 759 Bytes
/
common.h
File metadata and controls
34 lines (28 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef RIR_COMMON_H
#define RIR_COMMON_H
#include <cassert>
#include <cstdint>
extern void printCBacktrace();
extern void printRBacktrace();
extern void printBacktrace();
#ifdef ENABLE_SLOWASSERT
#define SLOWASSERT(what) assert(what)
#else
#define SLOWASSERT(what) \
{}
#endif
// from boost
#include <functional>
template <class T>
inline std::size_t hash_combine(std::size_t seed, const T& v) {
std::hash<T> hasher;
return hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}
struct pairhash {
public:
template <typename T, typename U>
std::size_t operator()(const std::pair<T, U>& x) const {
return hash_combine(hash_combine(0, x.first), x.second);
}
};
#endif