diff options
author | Marek Olšák <marek.olsak@amd.com> | 2017-06-11 01:08:37 +0200 |
---|---|---|
committer | Marek Olšák <marek.olsak@amd.com> | 2017-06-22 01:51:02 +0200 |
commit | c9a16fde807aa6b054758d0e0b62f802096e20dd (patch) | |
tree | 993f1bf809db0c9f2715c51d9497982ea2a80072 /src/gallium/auxiliary/cso_cache/cso_hash.h | |
parent | 0e0fc1ce71317b759f88ce8fd04912f60f767015 (diff) |
cso: inline a few frequently-used functions
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_hash.h')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_hash.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.h b/src/gallium/auxiliary/cso_cache/cso_hash.h index e58981c364b..d6eeb04f1ac 100644 --- a/src/gallium/auxiliary/cso_cache/cso_hash.h +++ b/src/gallium/auxiliary/cso_cache/cso_hash.h @@ -51,9 +51,18 @@ extern "C" { #endif -struct cso_hash; -struct cso_node; +struct cso_node { + struct cso_node *next; + unsigned key; + void *value; +}; +struct cso_hash { + union { + struct cso_hash_data *d; + struct cso_node *e; + } data; +}; struct cso_hash_iter { struct cso_hash *hash; @@ -102,9 +111,7 @@ struct cso_hash_iter cso_hash_find(struct cso_hash *hash, unsigned key); boolean cso_hash_contains(struct cso_hash *hash, unsigned key); -int cso_hash_iter_is_null(struct cso_hash_iter iter); unsigned cso_hash_iter_key(struct cso_hash_iter iter); -void *cso_hash_iter_data(struct cso_hash_iter iter); struct cso_hash_iter cso_hash_iter_next(struct cso_hash_iter iter); @@ -121,6 +128,21 @@ void *cso_hash_find_data_from_template( struct cso_hash *hash, void *templ, int size ); +static inline int +cso_hash_iter_is_null(struct cso_hash_iter iter) +{ + if (!iter.node || iter.node == iter.hash->data.e) + return 1; + return 0; +} + +static inline void * +cso_hash_iter_data(struct cso_hash_iter iter) +{ + if (!iter.node || iter.hash->data.e == iter.node) + return 0; + return iter.node->value; +} #ifdef __cplusplus } |