1 /* 2 * PROJECT: ReactOS Runtime Library 3 * LICENSE: BSD - See COPYING.ARM in the top level directory 4 * FILE: lib/rtl/rtlavl.h 5 * PURPOSE: RTL AVL Glue 6 * PROGRAMMERS: ReactOS Portable Systems Group 7 */ 8 9 /* INCLUDES ******************************************************************/ 10 11 /* 12 * This is the glue code for the AVL package in the RTL meant for external callers. 13 * It's not very exciting, it just uses the RTL-defined fields without any magic, 14 * unlike the Mm version which has special handling for balances and parents, and 15 * does not implement custom comparison callbacks. 16 */ 17 #define MI_ASSERT(x) 18 #define RtlLeftChildAvl(x) (PRTL_BALANCED_LINKS)(RtlLeftChild(x)) 19 #define RtlRightChildAvl(x) (PRTL_BALANCED_LINKS)(RtlRightChild(x)) 20 #define RtlParentAvl(x) (PRTL_BALANCED_LINKS)(RtlParent(x)) 21 #define RtlRealPredecessorAvl(x) (PRTL_BALANCED_LINKS)(RtlRealPredecessor((PRTL_SPLAY_LINKS)(x))) 22 #define RtlRealSuccessorAvl(x) (PRTL_BALANCED_LINKS)(RtlRealSuccessor((PRTL_SPLAY_LINKS)(x))) 23 #define RtlInsertAsRightChildAvl RtlInsertAsRightChild 24 #define RtlInsertAsLeftChildAvl RtlInsertAsLeftChild 25 #define RtlIsLeftChildAvl RtlIsLeftChild 26 27 FORCEINLINE 28 VOID 29 RtlpCopyAvlNodeData(IN PRTL_BALANCED_LINKS Node1, 30 IN PRTL_BALANCED_LINKS Node2) 31 { 32 *Node1 = *Node2; 33 } 34 35 FORCEINLINE 36 RTL_GENERIC_COMPARE_RESULTS 37 RtlpAvlCompareRoutine(IN PRTL_AVL_TABLE Table, 38 IN PVOID Buffer, 39 IN PVOID UserData) 40 { 41 /* Do the compare */ 42 return Table->CompareRoutine(Table, 43 Buffer, 44 UserData); 45 } 46 47 FORCEINLINE 48 VOID 49 RtlSetParent(IN PRTL_BALANCED_LINKS Node, 50 IN PRTL_BALANCED_LINKS Parent) 51 { 52 Node->Parent = Parent; 53 } 54 55 FORCEINLINE 56 VOID 57 RtlSetBalance(IN PRTL_BALANCED_LINKS Node, 58 IN CHAR Balance) 59 { 60 Node->Balance = Balance; 61 } 62 63 FORCEINLINE 64 CHAR 65 RtlBalance(IN PRTL_BALANCED_LINKS Node) 66 { 67 return Node->Balance; 68 } 69 70 /* EOF */ 71