more eval tunings.
[rattatechess.git] / utils.h
blobea89a7ac9c73644fb45459d2797803d201333ea5
1 /***************************************************************************
2 utils.h - some utility funtions
3 -------------------
4 begin : lun ott 24 2005
5 copyright : (C) 2005-2007 by Maurizio Monge
6 email : monge@linuz.sns.it
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef __UTILS_H__
19 #define __UTILS_H__
21 #include <stdio.h>
22 #include <inttypes.h>
23 #include <errno.h>
24 #include "platform.h"
25 #include "compiler.h"
26 #include "array.h"
28 #define SWITCH(a, b) ({ typeof(a) tmp = b; b = a; a = tmp; })
29 #define MAX(a,b) ({ typeof(a) _a=(a); typeof(b) _b=(b); _a > _b ? _a : _b; })
30 #define MIN(a,b) ({ typeof(a) _a=(a); typeof(b) _b=(b); _a < _b ? _a : _b; })
31 #define ABS(a) ({ typeof(a) _a=(a); _a > 0 ? _a : -_a; })
33 #ifdef __x86_64__
34 #define U64F "%lu"
35 #else
36 #define U64F "%llu"
37 #endif
39 #endif //__UTILS_H__