Blender  V3.3
BLI_smallhash.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
4 #pragma once
5 
10 #include "BLI_compiler_attrs.h"
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 typedef struct {
18  void *val;
20 
25 #define SMSTACKSIZE 131
26 typedef struct SmallHash {
27  unsigned int nbuckets;
28  unsigned int nentries;
29  unsigned int cursize;
30 
34 
35 typedef struct {
36  const SmallHash *sh;
37  unsigned int i;
39 
40 void BLI_smallhash_init_ex(SmallHash *sh, unsigned int nentries_reserve) ATTR_NONNULL(1);
46 void BLI_smallhash_insert(SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1);
54 bool BLI_smallhash_reinsert(SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1);
56 void *BLI_smallhash_lookup(const SmallHash *sh, uintptr_t key)
58 void **BLI_smallhash_lookup_p(const SmallHash *sh, uintptr_t key)
66 void *BLI_smallhash_iternew(const SmallHash *sh, SmallHashIter *iter, uintptr_t *key)
70 /* void BLI_smallhash_print(SmallHash *sh); */ /* UNUSED */
71 
72 #ifdef DEBUG
79 double BLI_smallhash_calc_quality(SmallHash *sh);
80 #endif
81 
82 #ifdef __cplusplus
83 }
84 #endif
#define ATTR_WARN_UNUSED_RESULT
#define ATTR_NONNULL(...)
#define SMSTACKSIZE
Definition: BLI_smallhash.h:25
void ** BLI_smallhash_iternew_p(const SmallHash *sh, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:320
void * BLI_smallhash_iternext(SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:298
bool BLI_smallhash_haskey(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1)
Definition: smallhash.c:269
void BLI_smallhash_init(SmallHash *sh) ATTR_NONNULL(1)
Definition: smallhash.c:196
struct SmallHash SmallHash
void ** BLI_smallhash_lookup_p(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:262
void ** BLI_smallhash_iternext_p(SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:305
void BLI_smallhash_insert(SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1)
Definition: smallhash.c:208
void BLI_smallhash_release(SmallHash *sh) ATTR_NONNULL(1)
Definition: smallhash.c:201
void * BLI_smallhash_lookup(const SmallHash *sh, uintptr_t key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:255
bool BLI_smallhash_reinsert(SmallHash *sh, uintptr_t key, void *item) ATTR_NONNULL(1)
Definition: smallhash.c:225
int BLI_smallhash_len(const SmallHash *sh) ATTR_NONNULL(1)
Definition: smallhash.c:276
void * BLI_smallhash_iternew(const SmallHash *sh, SmallHashIter *iter, uintptr_t *key) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
Definition: smallhash.c:312
bool BLI_smallhash_remove(SmallHash *sh, uintptr_t key) ATTR_NONNULL(1)
void BLI_smallhash_init_ex(SmallHash *sh, unsigned int nentries_reserve) ATTR_NONNULL(1)
Definition: smallhash.c:175
ccl_gpu_kernel_postfix ccl_global float int int int int sh
_W64 unsigned int uintptr_t
Definition: stdint.h:119
uintptr_t key
Definition: BLI_smallhash.h:17
unsigned int i
Definition: BLI_smallhash.h:37
const SmallHash * sh
Definition: BLI_smallhash.h:36
unsigned int cursize
Definition: BLI_smallhash.h:29
unsigned int nentries
Definition: BLI_smallhash.h:28
SmallHashEntry * buckets
Definition: BLI_smallhash.h:31
SmallHashEntry buckets_stack[SMSTACKSIZE]
Definition: BLI_smallhash.h:32
unsigned int nbuckets
Definition: BLI_smallhash.h:27