Blender  V2.93
Classes | Macros | Typedefs | Functions
BLI_smallhash.h File Reference
#include "BLI_compiler_attrs.h"

Go to the source code of this file.

Classes

struct  SmallHashEntry
 
struct  SmallHash
 
struct  SmallHashIter
 

Macros

#define SMSTACKSIZE   131
 

Typedefs

typedef struct SmallHash SmallHash
 

Functions

void BLI_smallhash_init_ex (SmallHash *sh, const unsigned int nentries_reserve) ATTR_NONNULL(1)
 
void BLI_smallhash_init (SmallHash *sh) ATTR_NONNULL(1)
 
void BLI_smallhash_release (SmallHash *sh) ATTR_NONNULL(1)
 
void BLI_smallhash_insert (SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1)
 
bool BLI_smallhash_reinsert (SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1)
 
bool BLI_smallhash_remove (SmallHash *sh, uintptr_t key) ATTR_NONNULL(1)
 
void * BLI_smallhash_lookup (const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 
void ** BLI_smallhash_lookup_p (const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 
bool BLI_smallhash_haskey (const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1)
 
int BLI_smallhash_len (const SmallHash *sh) ATTR_NONNULL(1)
 
void * BLI_smallhash_iternext (SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 
void ** BLI_smallhash_iternext_p (SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 
void * BLI_smallhash_iternew (const SmallHash *sh, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 
void ** BLI_smallhash_iternew_p (const SmallHash *sh, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
 

Macro Definition Documentation

◆ SMSTACKSIZE

#define SMSTACKSIZE   131

Definition at line 39 of file BLI_smallhash.h.

Typedef Documentation

◆ SmallHash

typedef struct SmallHash SmallHash

Function Documentation

◆ BLI_smallhash_haskey()

bool BLI_smallhash_haskey ( const SmallHash sh,
uintptr_t  key 
)

Definition at line 293 of file smallhash.c.

References e, NULL, and smallhash_lookup().

Referenced by BLI_smallhash_insert(), and knife_find_line_hits().

◆ BLI_smallhash_init()

void BLI_smallhash_init ( SmallHash sh)

Definition at line 212 of file smallhash.c.

References BLI_smallhash_init_ex().

Referenced by knife_find_line_hits(), and knife_make_cuts().

◆ BLI_smallhash_init_ex()

void BLI_smallhash_init_ex ( SmallHash sh,
const unsigned int  nentries_reserve 
)

◆ BLI_smallhash_insert()

void BLI_smallhash_insert ( SmallHash sh,
uintptr_t  key,
void *  item 
)

◆ BLI_smallhash_iternew()

void* BLI_smallhash_iternew ( const SmallHash sh,
SmallHashIter iter,
uintptr_t key 
)

Definition at line 336 of file smallhash.c.

References BLI_smallhash_iternext(), SmallHashIter::i, and SmallHashIter::sh.

Referenced by knife_find_line_hits(), and knife_make_cuts().

◆ BLI_smallhash_iternew_p()

void** BLI_smallhash_iternew_p ( const SmallHash sh,
SmallHashIter iter,
uintptr_t key 
)

Definition at line 344 of file smallhash.c.

References BLI_smallhash_iternext_p(), SmallHashIter::i, and SmallHashIter::sh.

Referenced by knife_find_line_hits().

◆ BLI_smallhash_iternext()

void* BLI_smallhash_iternext ( SmallHashIter iter,
uintptr_t key 
)

Definition at line 322 of file smallhash.c.

References e, NULL, and smallhash_iternext().

Referenced by BLI_smallhash_iternew(), knife_find_line_hits(), and knife_make_cuts().

◆ BLI_smallhash_iternext_p()

void** BLI_smallhash_iternext_p ( SmallHashIter iter,
uintptr_t key 
)

Definition at line 329 of file smallhash.c.

References e, NULL, and smallhash_iternext().

Referenced by BLI_smallhash_iternew_p(), and knife_find_line_hits().

◆ BLI_smallhash_len()

int BLI_smallhash_len ( const SmallHash sh)

Definition at line 300 of file smallhash.c.

References SmallHash::nentries.

◆ BLI_smallhash_lookup()

void* BLI_smallhash_lookup ( const SmallHash sh,
uintptr_t  key 
)

Definition at line 279 of file smallhash.c.

References e, NULL, and smallhash_lookup().

Referenced by knife_find_line_hits(), and knife_make_cuts().

◆ BLI_smallhash_lookup_p()

void** BLI_smallhash_lookup_p ( const SmallHash sh,
uintptr_t  key 
)

Definition at line 286 of file smallhash.c.

References e, NULL, and smallhash_lookup().

◆ BLI_smallhash_reinsert()

bool BLI_smallhash_reinsert ( SmallHash sh,
uintptr_t  key,
void *  item 
)

Inserts a new value to a key that may already be in ghash.

Avoids BLI_smallhash_remove, BLI_smallhash_insert calls (double lookups)

Returns
true if a new key has been added.

Definition at line 249 of file smallhash.c.

References BLI_smallhash_insert(), e, and smallhash_lookup().

Referenced by knife_find_line_hits().

◆ BLI_smallhash_release()

void BLI_smallhash_release ( SmallHash sh)

Definition at line 218 of file smallhash.c.

References SmallHash::buckets, SmallHash::buckets_stack, and MEM_freeN.

Referenced by knife_find_line_hits(), and knife_make_cuts().

◆ BLI_smallhash_remove()

bool BLI_smallhash_remove ( SmallHash sh,
uintptr_t  key 
)