X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=src%2Fcommon.h;h=48b2a7e70e3994d8dfda327a09f2c167979fca20;hb=526e78e9379fb1cf98186f4195e8f52866e80063;hp=4ebd816df11c9b900f705b580e730880b585a3cf;hpb=d46ee65a6767e2016cab629220a60c3e39b366f1;p=satune.git diff --git a/src/common.h b/src/common.h index 4ebd816..48b2a7e 100644 --- a/src/common.h +++ b/src/common.h @@ -18,20 +18,21 @@ #include "config.h" #include "time.h" -/* - extern int model_out; - extern int model_err; - extern int switch_alloc; - #define model_dprintf(fd, fmt, ...) do { switch_alloc = 1; dprintf(fd, fmt, ## __VA_ARGS__); switch_alloc = 0; } while (0) +#if 0 +extern int model_out; +extern int model_err; +extern int switch_alloc; - #define model_print(fmt, ...) do { model_dprintf(model_out, fmt, ## __VA_ARGS__); } while (0) +#define model_dprintf(fd, fmt, ...) do { int oldsw = switch_alloc; switch_alloc = 1; dprintf(fd, fmt, ## __VA_ARGS__); switch_alloc = oldsw; } while (0) - #define model_print_err(fmt, ...) do { model_dprintf(model_err, fmt, ## __VA_ARGS__); } while (0) +#define model_print(fmt, ...) do { model_dprintf(model_out, fmt, ## __VA_ARGS__); } while (0) +#define model_print_err(fmt, ...) do { model_dprintf(model_err, fmt, ## __VA_ARGS__); } while (0) +#else +#define model_print printf +#endif - */ -#define model_print printf #define NEXTPOW2(x) ((x == 1) ? 1 : (1 << (sizeof(uint) * 8 - __builtin_clz(x - 1)))) #define NUMBITS(x) ((x == 0) ? 0 : 8 * sizeof(x) - __builtin_clz(x))