• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
4  * All rights reserved.
5  *
6  * Purpose: define basic common types and macros
7  *
8  * Author: Tevin Chen
9  *
10  * Date: May 21, 1996
11  *
12  */
13 
14 #ifndef __TMACRO_H__
15 #define __TMACRO_H__
16 
17 /****** Common helper macros ***********************************************/
18 
19 #if !defined(LOBYTE)
20 #define LOBYTE(w)           ((unsigned char)(w))
21 #endif
22 #if !defined(HIBYTE)
23 #define HIBYTE(w)           ((unsigned char)(((unsigned short)(w) >> 8) & 0xFF))
24 #endif
25 
26 #if !defined(LOWORD)
27 #define LOWORD(d)           ((unsigned short)(d))
28 #endif
29 #if !defined(HIWORD)
30 #define HIWORD(d)           ((unsigned short)((((unsigned long)(d)) >> 16) & 0xFFFF))
31 #endif
32 
33 #define LODWORD(q)          ((q).u.dwLowDword)
34 #define HIDWORD(q)          ((q).u.dwHighDword)
35 
36 #if !defined(MAKEWORD)
37 #define MAKEWORD(lb, hb)    ((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
38 #endif
39 #if !defined(MAKEDWORD)
40 #define MAKEDWORD(lw, hw)   ((unsigned long)(((unsigned short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16)))
41 #endif
42 
43 #endif /* __TMACRO_H__ */
44