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