Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.3 KiB

  1. /*++
  2. Copyright (c) 2002 Microsoft Corporation
  3. Module Name:
  4. utils.h
  5. Abstract:
  6. Simple macro definitions and utility functions.
  7. Author:
  8. Matthew D Hendel (math) 13-Feb-2001
  9. Revision History:
  10. --*/
  11. #pragma once
  12. #define SET_FLAG(Flags, Bit) ((Flags) |= (Bit))
  13. #define CLEAR_FLAG(Flags, Bit) ((Flags) &= ~(Bit))
  14. #define TEST_FLAG(Flags, Bit) (((Flags) & (Bit)) != 0)
  15. #define min(a,b) (((a) < (b)) ? (a) : (b))
  16. #define max(a,b) (((a) > (b)) ? (a) : (b))
  17. #define ARRAY_COUNT(Array) (sizeof(Array)/sizeof(Array[0]))
  18. #define IN_RANGE(a,b,c) ((a) <= (b) && (b) < (c))
  19. #define INLINE __inline
  20. typedef const GUID *PCGUID;
  21. //
  22. // NT uses a system time measured in 100 nanosecond intervals. define
  23. // conveninent constants for setting the timer.
  24. //
  25. #define MICROSECONDS 10 // 10 nanoseconds
  26. #define MILLISECONDS (MICROSECONDS * 1000)
  27. #define SECONDS (MILLISECONDS * 1000)
  28. #define MINUTES (SECONDS * 60)
  29. #define RELATIVE_TIMEOUT (-1)
  30. //
  31. // The standard definition of RemoveListHead is not an expression, hence
  32. // cannot be used in loops, etc.
  33. //
  34. PLIST_ENTRY
  35. INLINE
  36. _RemoveHeadList(
  37. IN PLIST_ENTRY ListHead
  38. )
  39. {
  40. return RemoveHeadList (ListHead);
  41. }
  42. #undef RemoveHeadList
  43. #define RemoveHeadList _RemoveHeadList