Source code of Windows XP (NT5)
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.

94 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1995 Microsoft Corporation
  3. Module Name:
  4. redblack.c
  5. Abstract:
  6. This module implements red/black trees.
  7. Author:
  8. 16-Jun-1995 t-orig
  9. Revision History:
  10. --*/
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include "entrypt.h"
  16. #include "redblack.h"
  17. #include "stdio.h"
  18. #include "stdlib.h"
  19. // Disable warnings about MACRO redefinitions. I'm redefining MACROS on
  20. // purpose...
  21. #pragma warning (disable:4005)
  22. //*************************************************************
  23. //The Intel Section:
  24. //*************************************************************
  25. //Intel MACROS
  26. #define START(x) x->ep.intelStart
  27. #define END(x) x->ep.intelEnd
  28. #define KEY(x) x->ep.intelStart
  29. #define RIGHT(x) x->intelRight
  30. #define LEFT(x) x->intelLeft
  31. #define PARENT(x) x->intelParent
  32. #define COLOR(x) x->intelColor
  33. #define RB_INSERT insertNodeIntoIntelTree
  34. #define FIND findIntel
  35. #define CONTAINSRANGE intelContainsRange
  36. #define REMOVE deleteNodeFromIntelTree
  37. #define LEFT_ROTATE intelLeftRotate
  38. #define RIGHT_ROTATE intelRightRotate
  39. #define TREE_INSERT intelTreeInsert
  40. #define TREE_SUCCESSOR intelTreeSuccessor
  41. #define RB_DELETE intelRBDelete
  42. #define RB_DELETE_FIXUP intelRBDeleteFixup
  43. #define FINDNEXT findIntelNext
  44. #include "redblack.fnc"
  45. #ifdef BOTH
  46. //*************************************************************
  47. //The RISC Section:
  48. //*************************************************************
  49. //RISC MACROS
  50. #define START(x) x->ep.nativeStart
  51. #define END(x) x->ep.nativeEnd
  52. #define KEY(x) x->ep.nativeStart
  53. #define RIGHT(x) x->nativeRight
  54. #define LEFT(x) x->nativeLeft
  55. #define PARENT(x) x->nativeParent
  56. #define COLOR(x) x->nativeColor
  57. #define RB_INSERT insertNodeIntoNativeTree
  58. #define FIND findNative
  59. #define CONTAINSRANGE nativeContainsRange
  60. #define REMOVE deleteNodeFromNativeTree
  61. #define LEFT_ROTATE nativeLeftRotate
  62. #define RIGHT_ROTATE nativeRightRotate
  63. #define TREE_INSERT nativeTreeInsert
  64. #define TREE_SUCCESSOR nativeTreeSuccessor
  65. #define RB_DELETE nativeRBDelete
  66. #define RB_DELETE_FIXUP nativeRBDeleteFixup
  67. #define FINDNEXT findNativeNext
  68. #include "redblack.fnc"
  69. #endif