X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fcso_cache%2Fcso_hash.h;h=d6eeb04f1ac8e3e966b8cfa80c855ed4e5733043;hb=f52cdaa517b0bea142a273acb5b48f359b73982b;hp=5891c325fa567ee027540611e7561326bef58ca3;hpb=61d3a66456852642ed8fdc1106dc0012e4b89779;p=mesa.git diff --git a/src/gallium/auxiliary/cso_cache/cso_hash.h b/src/gallium/auxiliary/cso_cache/cso_hash.h index 5891c325fa5..d6eeb04f1ac 100644 --- a/src/gallium/auxiliary/cso_cache/cso_hash.h +++ b/src/gallium/auxiliary/cso_cache/cso_hash.h @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,7 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -38,7 +38,7 @@ * had the same key (e.g. memcmp could be used on the data to check * that) * - * @author Zack Rusin + * @author Zack Rusin */ #ifndef 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 }