-
Notifications
You must be signed in to change notification settings - Fork 1
/
macros.h
45 lines (35 loc) · 1.14 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
#ifndef __MACROS_H__
#define __MACROS_H__
// Defines a byte array (although it uses 4 bytes per element)
WX_DEFINE_ARRAY_INT(wxByte, wxByteArray);
// Defines a word array (although it uses 4 bytes per element)
WX_DEFINE_ARRAY_INT(wxWord, wxWordArray);
// Little-endian based LONG/WORD/BYTE macros
#ifndef MAKEWORD
#define MAKEWORD(a, b) ((wxWord)(((wxByte)((wxUint32)(a) & 0xff)) | ((wxWord)((wxByte)((wxUint32)(b) & 0xff))) << 8))
#endif
#ifndef MAKELONG
#define MAKELONG(a, b) ((wxUint32)(((wxWord)((wxUint32)(a) & 0xffff)) | ((wxUint32)((wxWord)((wxUint32)(b) & 0xffff))) << 16))
#endif
#ifndef LOWORD
#define LOWORD(l) ((wxWord)((wxUint32)(l) & 0xffff))
#endif
#ifndef HIWORD
#define HIWORD(l) ((wxWord)((wxUint32)(l) >> 16))
#endif
#ifndef LOBYTE
#define LOBYTE(w) ((wxByte)((wxUint32)(w) & 0xff))
#endif
#ifndef HIBYTE
#define HIBYTE(w) ((wxByte)((wxUint32)(w) >> 8))
#endif
// min/max macros
#ifndef NOMINMAX
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#endif
#endif