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
35
36
37
38
#ifndef _delay_hpp_INCLUDED
#define _delay_hpp_INCLUDED
#include <cstdint>
#include <limits>
namespace CaDiCaL {
struct Delay {
unsigned count;
unsigned current;
Delay () : count (0), current (0) {}
bool delay () {
if (count) {
--count;
return true;
} else {
return false;
}
}
void bump_delay () {
current += current < std::numeric_limits<unsigned>::max ();
count = current;
}
void reduce_delay () {
if (!current)
return;
current /= 2;
count = current;
}
};
} // namespace CaDiCaL
#endif