GNU Linux-libre 4.14.266-gnu1
[releases.git] / drivers / staging / vt6655 / tmacro.h
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * File: tmacro.h
16  *
17  * Purpose: define basic common types and macros
18  *
19  * Author: Tevin Chen
20  *
21  * Date: May 21, 1996
22  *
23  */
24
25 #ifndef __TMACRO_H__
26 #define __TMACRO_H__
27
28 /****** Common helper macros ***********************************************/
29
30 #if !defined(LOBYTE)
31 #define LOBYTE(w)           ((unsigned char)(w))
32 #endif
33 #if !defined(HIBYTE)
34 #define HIBYTE(w)           ((unsigned char)(((unsigned short)(w) >> 8) & 0xFF))
35 #endif
36
37 #if !defined(LOWORD)
38 #define LOWORD(d)           ((unsigned short)(d))
39 #endif
40 #if !defined(HIWORD)
41 #define HIWORD(d)           ((unsigned short)((((unsigned long)(d)) >> 16) & 0xFFFF))
42 #endif
43
44 #define LODWORD(q)          ((q).u.dwLowDword)
45 #define HIDWORD(q)          ((q).u.dwHighDword)
46
47 #if !defined(MAKEWORD)
48 #define MAKEWORD(lb, hb)    ((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
49 #endif
50 #if !defined(MAKEDWORD)
51 #define MAKEDWORD(lw, hw)   ((unsigned long)(((unsigned short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16)))
52 #endif
53
54 #endif /* __TMACRO_H__ */