VirtualBox

Changeset 96 in vbox


Ignore:
Timestamp:
Jan 17, 2007 1:22:21 PM (18 years ago)
Author:
vboxsync
Message:

RTAvlGCPtr.

Location:
trunk
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/avl.h

    r92 r96  
    260260
    261261
     262/** AVL tree of RTGCPTRs.
     263 * @{
     264 */
     265
     266/**
     267 * AVL Core node.
     268 */
     269typedef struct _AVLGCPtrNodeCore
     270{
     271    /** Key value. */
     272    RTGCPTR             Key;
     273    /** Pointer to the left node. */
     274    struct _AVLGCPtrNodeCore *pLeft;
     275    /** Pointer to the right node. */
     276    struct _AVLGCPtrNodeCore *pRight;
     277    /** Height of this tree: max(height(left), height(right)) + 1 */
     278    unsigned char       uchHeight;
     279} AVLGCPTRNODECORE, *PAVLGCPTRNODECORE, **PPAVLGCPTRNODECORE;
     280
     281/** A tree of RTGCPTR keys. */
     282typedef PAVLGCPTRNODECORE     AVLGCPTRTREE;
     283/** Pointer to a tree of RTGCPTR keys. */
     284typedef PPAVLGCPTRNODECORE    PAVLGCPTRTREE;
     285
     286/** Callback function for RTAvlroGCPtrDoWithAll(). */
     287typedef DECLCALLBACK(int)   AVLGCPTRCALLBACK(PAVLGCPTRNODECORE pNode, void *pvUser);
     288/** Pointer to callback function for RTAvlroGCPtrDoWithAll(). */
     289typedef AVLGCPTRCALLBACK *PAVLGCPTRCALLBACK;
     290
     291RTDECL(bool)                    RTAvlGCPtrInsert(PAVLGCPTRTREE pTree, PAVLGCPTRNODECORE pNode);
     292RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrRemove(PAVLGCPTRTREE pTree, RTGCPTR Key);
     293RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrGet(PAVLGCPTRTREE pTree, RTGCPTR Key);
     294RTDECL(int)                     RTAvlGCPtrDoWithAll(PAVLGCPTRTREE pTree, int fFromLeft, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
     295RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrGetBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
     296RTDECL(PAVLGCPTRNODECORE)       RTAvlGCPtrRemoveBestFit(PAVLGCPTRTREE ppTree, RTGCPTR Key, bool fAbove);
     297RTDECL(int)                     RTAvlGCPtrDestroy(PAVLGCPTRTREE pTree, PAVLGCPTRCALLBACK pfnCallBack, void *pvParam);
     298
     299/** @} */
     300
     301
    262302/** AVL tree of RTGCPTRs - using relative offsets internally.
    263303 * @{
  • trunk/src/VBox/Runtime/Makefile

    r26 r96  
    123123        assert.cpp \
    124124        table/avlhcphys.cpp \
     125        table/avlgcptr.cpp \
    125126        table/avlogcphys.cpp \
    126127        table/avlogcptr.cpp \
     
    465466        assert.cpp \
    466467        table/avlhcphys.cpp \
     468        table/avlgcptr.cpp \
    467469        table/avlogcphys.cpp \
    468470        table/avlohcphys.cpp \
  • trunk/src/VBox/Runtime/table/avlgcptr.cpp

    r23 r96  
    11/* $Id$ */
    22/** @file
    3  * InnoTek Portable Runtime - AVL tree, void *, unique keys.
     3 * InnoTek Portable Runtime - AVL tree, RTGCPTR, unique keys.
    44 */
    55
     
    3030 * AVL configuration.
    3131 */
    32 #define KAVL_FN(a)                  RTAvlPV##a
     32#define KAVL_FN(a)                  RTAvlGCPtr##a
    3333#define KAVL_MAX_STACK              27  /* Up to 2^24 nodes. */
    3434#define KAVL_CHECK_FOR_EQUAL_INSERT 1   /* No duplicate keys! */
    35 #define KAVLNODECORE                AVLPVNODECORE
    36 #define PKAVLNODECORE               PAVLPVNODECORE
    37 #define PPKAVLNODECORE              PPAVLPVNODECORE
    38 #define KAVLKEY                     AVLPVKEY
    39 #define PKAVLKEY                    PAVLPVKEY
    40 #define KAVLENUMDATA                AVLPVENUMDATA
    41 #define PKAVLENUMDATA               PAVLPVENUMDATA
    42 #define PKAVLCALLBACK               PAVLPVCALLBACK
     35#define KAVLNODECORE                AVLGCPTRNODECORE
     36#define PKAVLNODECORE               PAVLGCPTRNODECORE
     37#define PPKAVLNODECORE              PPAVLGCPTRNODECORE
     38#define KAVLKEY                     RTGCPTR
     39#define PKAVLKEY                    PRTGCPTR
     40#define KAVLENUMDATA                AVLGCPTRENUMDATA
     41#define PKAVLENUMDATA               PAVLGCPTRENUMDATA
     42#define PKAVLCALLBACK               PAVLGCPTRCALLBACK
    4343
    4444
     
    4646 * AVL Compare macros
    4747 */
    48 #define KAVL_G(key1, key2)          ( (const char*)(key1) >  (const char*)(key2) )
    49 #define KAVL_E(key1, key2)          ( (const char*)(key1) == (const char*)(key2) )
    50 #define KAVL_NE(key1, key2)         ( (const char*)(key1) != (const char*)(key2) )
     48#define KAVL_G(key1, key2)          ( (RTGCUINTPTR)(key1) >  (RTGCUINTPTR)(key2) )
     49#define KAVL_E(key1, key2)          ( (RTGCUINTPTR)(key1) == (RTGCUINTPTR)(key2) )
     50#define KAVL_NE(key1, key2)         ( (RTGCUINTPTR)(key1) != (RTGCUINTPTR)(key2) )
    5151
    5252
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette