forked from hoshir/zebra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
macros.h
63 lines (37 loc) · 1.06 KB
/
macros.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
File: macros.h
Created: May 31, 1998
Modified: November 14, 2005
Author: Gunnar Andersson ([email protected])
Contents: Some globally used macros.
*/
#ifndef MACROS_H
#define MACROS_H
#ifdef __cplusplus
extern "C" {
#endif
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define SQR(a) ((a) * (a))
/* Convert index to square, e.g. 27 -> g2 */
#define TO_SQUARE(index) 'a'+(index % 10)-1,'0'+(index / 10)
/* Define the inline directive when available */
#if defined( __GNUC__ )&& !defined( __cplusplus )
#define INLINE
#else
#define INLINE
#endif
/* Define function attributes directive when available */
#if __GNUC__ >= 3
#define REGPARM(num) __attribute__((regparm(num)))
#else
#if defined (_MSC_VER) || defined(__BORLANDC__)
#define REGPARM(num) __fastcall
#else
#define REGPARM(num)
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* MACROS_H */