Update include.hh
This commit is contained in:
parent
71a4b31b53
commit
2955fa8327
14
include.hh
14
include.hh
|
@ -43,7 +43,7 @@ constexpr ull MDL2 = 87825;
|
|||
#define lsp(x) (__builtin_ctzll(ll(x)))
|
||||
|
||||
/* arithmetic operations */
|
||||
#define mod(x, y) (((x) + (y)) % (y))
|
||||
#define mod(x, y) (((x) % (y) + (y)) % (y))
|
||||
|
||||
/* fast pairs */
|
||||
#define upair ull
|
||||
|
@ -93,18 +93,6 @@ struct safe_hash {
|
|||
}
|
||||
};
|
||||
|
||||
struct pair_hash {
|
||||
template <typename T, typename U>
|
||||
size_t operator()(const pair<T, U>& a) const {
|
||||
auto hash1 = safe_hash()(a.first);
|
||||
auto hash2 = safe_hash()(a.second);
|
||||
if (hash1 != hash2) {
|
||||
return hash1 ^ hash2;
|
||||
}
|
||||
return hash1;
|
||||
}
|
||||
};
|
||||
|
||||
/* build data structures */
|
||||
#define unordered_counter(from, to) __AS_PROCEDURE(unordered_map<__as_typeof(from), size_t, safe_hash> to; for (auto&& x : from) ++to[x];)
|
||||
#define counter(from, to, cmp) __AS_PROCEDURE(map<__as_typeof(from), size_t, cmp> to; for (auto&& x : from) ++to[x];)
|
||||
|
|
Loading…
Reference in New Issue