VirtualBox

Changeset 33268 in vbox for trunk/src


Ignore:
Timestamp:
Oct 20, 2010 3:37:15 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
66828
Message:

IPRT: Added an AVL tree taking void * ranges.

File:
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/table/avlrpv.cpp

    r33145 r33268  
    11/* $Id$ */
    22/** @file
    3  * IPRT - AVL tree, void *, unique keys.
     3 * IPRT - AVL tree, void *, range, unique keys.
    44 */
    55
     
    3535 * AVL configuration.
    3636 */
    37 #define KAVL_FN(a)                  RTAvlPV##a
     37#define KAVL_FN(a)                  RTAvlrPV##a
    3838#define KAVL_MAX_STACK              27  /* Up to 2^24 nodes. */
    3939#define KAVL_CHECK_FOR_EQUAL_INSERT 1   /* No duplicate keys! */
    40 #define KAVLNODECORE                AVLPVNODECORE
    41 #define PKAVLNODECORE               PAVLPVNODECORE
    42 #define PPKAVLNODECORE              PPAVLPVNODECORE
    43 #define KAVLKEY                     AVLPVKEY
    44 #define PKAVLKEY                    PAVLPVKEY
    45 #define KAVLENUMDATA                AVLPVENUMDATA
    46 #define PKAVLENUMDATA               PAVLPVENUMDATA
    47 #define PKAVLCALLBACK               PAVLPVCALLBACK
     40#define KAVLNODECORE                AVLRPVNODECORE
     41#define PKAVLNODECORE               PAVLRPVNODECORE
     42#define PPKAVLNODECORE              PPAVLRPVNODECORE
     43#define KAVLKEY                     AVLRPVKEY
     44#define PKAVLKEY                    PAVLRPVKEY
     45#define KAVLENUMDATA                AVLRPVENUMDATA
     46#define PKAVLENUMDATA               PAVLRPVENUMDATA
     47#define PKAVLCALLBACK               PAVLRPVCALLBACK
     48#define KAVL_RANGE                  1
    4849
    4950
     
    5152 * AVL Compare macros
    5253 */
    53 #define KAVL_G(key1, key2)          ( (const char*)(key1) >  (const char*)(key2) )
    54 #define KAVL_E(key1, key2)          ( (const char*)(key1) == (const char*)(key2) )
    55 #define KAVL_NE(key1, key2)         ( (const char*)(key1) != (const char*)(key2) )
     54#define KAVL_G(key1, key2)          ( (uintptr_t)(key1) >  (uintptr_t)(key2) )
     55#define KAVL_E(key1, key2)          ( (uintptr_t)(key1) == (uintptr_t)(key2) )
     56#define KAVL_NE(key1, key2)         ( (uintptr_t)(key1) != (uintptr_t)(key2) )
     57#define KAVL_R_IS_IDENTICAL(key1B, key2B, key1E, key2E)     ( (uintptr_t)(key1B) == (uintptr_t)(key2B) && (uintptr_t)(key1E) == (uintptr_t)(key2E) )
     58#define KAVL_R_IS_INTERSECTING(key1B, key2B, key1E, key2E)  ( (uintptr_t)(key1B) <= (uintptr_t)(key2E) && (uintptr_t)(key1E) >= (uintptr_t)(key2B) )
     59#define KAVL_R_IS_IN_RANGE(key1B, key1E, key2)              KAVL_R_IS_INTERSECTING(key1B, key2, key1E, key2)
    5660
    5761
     
    7276#include "avl_Get.cpp.h"
    7377#include "avl_GetBestFit.cpp.h"
     78#include "avl_Range.cpp.h"
    7479#include "avl_RemoveBestFit.cpp.h"
    7580#include "avl_DoWithAll.cpp.h"
Note: See TracChangeset for help on using the changeset viewer.

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