-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcommon.h
50 lines (35 loc) · 757 Bytes
/
common.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
#ifndef COMMON_H__
#define COMMON_H__
//#define NDEBUG
#define X86
//#define WINDOWS
#include "types.h"
#include <assert.h>
#include <stdio.h>
#ifdef WINDOWS
#include <windows.h>
#pragma warning (disable: 4786)
#include "G:\\Debug\\include\\BugslayerUtil.h"
#else
#define _MAX max
#define _MIN min
#ifdef NDEBUG
#define ASSERT(x) { if (!(x)) perror("Last error"); assert(x); }
#define TRACE printf
#else
#define ASSERT(x)
#endif //NDEBUG
#endif //WINDOWS
#define MSB_MASK (0x80000000)
#define UPPER_LIMIT (~0x0)
const DWORD g_dwMagic = 0x68746542;
#define MSB(x) (x >> ((sizeof(x) * 8) - 1))
#define M2SB(x) ((x >> ((sizeof(x) * 8) - 2)) & 0x1)
#define LSB(x) (x & 0x0001)
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
#endif