More notes on the possible min/max method.
[pachi/pachi-r6144.git] / debug.h
blob13916eeeda240128ada4777985cb6ee3f7d0e4df
1 #ifndef PACHI_DEBUG_H
2 #define PACHI_DEBUG_H
4 #include <stdbool.h>
6 #ifdef DEBUG
7 #define DEBUGL_(l, n) (unlikely((l) > (n)))
8 #define DEBUG_MODE (true)
9 #else
10 #define DEBUGL_(l, n) (false)
11 #define DEBUG_MODE (false)
12 #endif
14 extern int debug_level;
15 extern bool debug_boardprint;
17 #define DEBUGL(n) DEBUGL_(debug_level, n)
19 /* The distributed engine can be _very_ verbose so use DEBUGV
20 * to keep only the first N verbose logs. */
21 #ifndef MAX_VERBOSE_LOGS
22 # define MAX_VERBOSE_LOGS 100000
23 #endif
24 extern long verbose_logs;
25 #define DEBUGV(verbose, n) (DEBUGL(n) && (!(verbose) || ++verbose_logs < MAX_VERBOSE_LOGS))
26 #define DEBUGVV(n) DEBUGV(true, (n))
28 #endif