aboutsummaryrefslogblamecommitdiff
path: root/debug.h
blob: 2f1cbc0e1317d255833d79bf5396b5cf28b49b3e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                
                                                    













                                                                            
#ifndef DEBUG_H
#define DEBUG_H

#include <stdio.h>

#ifndef NDEBUG
# define debug(...) fprintf(stderr, __VA_ARGS__)
#else
# define debug(...)
#endif

static inline char *move_str_buf(const ms_move *m) {
    static const int buf_size = 30;
    static char buf[buf_size];
    static char *buf_p = &buf[0];

    if (m->stock) {
        snprintf(buf_p, buf_size, "stock");
    } else {
        snprintf(buf_p, buf_size, "%2ux %2u->%2u", m->size, m->from, m->to);
    }

    return buf;
}

#endif /* DEBUG_H */