1#ifndef CLICK_ALGORITHM_HH
2#define CLICK_ALGORITHM_HH
6inline T *find(T *begin, T *end,
const T &val)
8 while (begin < end && *begin != val)
14inline const T *find(
const T *begin,
const T *end,
const T &val)
16 while (begin < end && *begin != val)
22inline void ignore_result(T result)
32inline void click_swap(T &a, T &b)
44inline void clear_by_swap(T &x)
54template <
typename T,
typename V>
55inline void assign_consume(T &x,
const V &y)
65 min(
const _Tp& __a,
const _Tp& __b)
76 max(
const _Tp& __a,
const _Tp& __b)
84template <
typename T,
typename U =
void>
struct do_nothing;
87template <
typename T,
typename U>
89 typedef T first_argument_type;
90 typedef U second_argument_type;
91 typedef void result_type;
92 void operator()(
const T &,
const U &) {
99 typedef T argument_type;
100 typedef void result_type;
101 void operator()(
const T &) {
108 typedef T first_argument_type;
109 typedef T second_argument_type;
110 typedef bool result_type;
111 bool operator()(
const T &x,
const T &y) {
119#define is_pow2(n) (((n) & ((n) - 1)) == 0)
124inline unsigned char next_msb(uint64_t x) {
125 return x <= 1 ? 1 : (64-__builtin_clzl(x-1));
132inline uint64_t next_pow2(uint64_t x) {
133 return x == 1 ? 1 : 1<<(64-__builtin_clzl(x-1));
136inline unsigned cantor(
unsigned a,
unsigned b) {
137 return ((a + b) * (a + b + 1))/2 + b;
Binary function object that does nothing when called.
Definition algorithm.hh:88
Function object that encapsulates operator<().
Definition algorithm.hh:107