tmacro.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. #ifndef __TMACRO_H__
  16. #define __TMACRO_H__
  17. /****** Common helper macros ***********************************************/
  18. #if !defined(LOBYTE)
  19. #define LOBYTE(w) ((unsigned char)(w))
  20. #endif
  21. #if !defined(HIBYTE)
  22. #define HIBYTE(w) ((unsigned char)(((unsigned short)(w) >> 8) & 0xFF))
  23. #endif
  24. #if !defined(LOWORD)
  25. #define LOWORD(d) ((unsigned short)(d))
  26. #endif
  27. #if !defined(HIWORD)
  28. #define HIWORD(d) ((unsigned short)((((unsigned long)(d)) >> 16) & 0xFFFF))
  29. #endif
  30. #define LODWORD(q) ((q).u.dwLowDword)
  31. #define HIDWORD(q) ((q).u.dwHighDword)
  32. #if !defined(MAKEWORD)
  33. #define MAKEWORD(lb, hb) ((unsigned short)(((unsigned char)(lb)) | (((unsigned short)((unsigned char)(hb))) << 8)))
  34. #endif
  35. #if !defined(MAKEDWORD)
  36. #define MAKEDWORD(lw, hw) ((unsigned long)(((unsigned short)(lw)) | (((unsigned long)((unsigned short)(hw))) << 16)))
  37. #endif
  38. #endif /* __TMACRO_H__ */