OSDN Git Service

Merge branch 'master' of git.osdn.net:/gitroot/hengband/hengband
[hengband/hengband.git] / src / system / h-define.h
1 /*!
2  * @file h-define.h
3  * @brief 馬鹿馬鹿蛮怒で新しく追加された主要なマクロ定義ヘッダ / Define some simple constants
4  * @date 2014/08/16
5  * @author
6  * 不明(馬鹿馬鹿蛮怒開発チーム?)
7  */
8
9 #ifndef INCLUDED_H_DEFINE_H
10 #define INCLUDED_H_DEFINE_H
11
12 /*
13  * The constants "TRUE" and "FALSE"
14  */
15
16 #undef TRUE
17 #define TRUE    1 /*!< コンパイル環境に定義がない場合のTRUE定義 */
18
19 #undef FALSE
20 #define FALSE   0 /*!< コンパイル環境に定義がない場合のFALSE定義 */
21
22 /**** Simple "Macros" ****/
23 #ifdef JP
24 #define lbtokg(x) ((int)((x)*5)) /*!< 馬鹿馬鹿蛮怒基準のポンド→キログラム変換定義(全体) */
25 #define lbtokg1(x) (lbtokg(x)/100) /*!< 馬鹿馬鹿蛮怒基準のポンド→キログラム変換定義(整数部) */
26 #define lbtokg2(x) ((lbtokg(x)%100)/10)  /*!< 馬鹿馬鹿蛮怒基準のポンド→キログラム変換定義(少数部) */
27 #endif
28
29 /*
30  * Non-typed minimum value macro
31  */
32 #undef MIN
33 #define MIN(a,b)        (((a) > (b)) ? (b)  : (a))
34
35 /*
36  * Non-typed maximum value macro
37  */
38 #undef MAX
39 #define MAX(a,b)        (((a) < (b)) ? (b)  : (a))
40
41 /*
42  * Non-typed absolute value macro
43  */
44 #undef ABS
45 #define ABS(a)          (((a) < 0)   ? (-(a)) : (a))
46
47 /*
48  * Non-typed sign extractor macro
49  */
50 #undef SGN
51 #define SGN(a)          (((a) < 0)   ? (-1) : ((a) != 0))
52
53 /*
54  * Refer to the member at offset of structure
55  */
56 #define atoffset(TYPE, STRUCT_PTR, OFFSET) (*(TYPE*)(((char*)STRUCT_PTR) + (OFFSET)))
57
58 #endif