diff options
author | Keith Whitwell <keith@tungstengraphics.com> | 2008-05-09 13:11:48 +0100 |
---|---|---|
committer | Keith Whitwell <keith@tungstengraphics.com> | 2008-05-09 13:11:48 +0100 |
commit | 2f9b1b9cc20f079cb46bbbcc9db09880070e4de9 (patch) | |
tree | a0f00b9b9ea5e47549ca4e56fcc66464a3a752d3 /src/gallium/auxiliary/translate/translate.h | |
parent | 54777e124c38812e5e80319048b6c71009bcf9dd (diff) | |
parent | 1a03812fb57e956b438cd42ac68978facb49a99d (diff) |
Merge commit 'origin/gallium-0.1' into gallium-tex-surfaces
Diffstat (limited to 'src/gallium/auxiliary/translate/translate.h')
-rw-r--r-- | src/gallium/auxiliary/translate/translate.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/translate/translate.h b/src/gallium/auxiliary/translate/translate.h index de6f09d18a..b8210af50c 100644 --- a/src/gallium/auxiliary/translate/translate.h +++ b/src/gallium/auxiliary/translate/translate.h @@ -95,6 +95,27 @@ struct translate *translate_lookup_or_create( struct translate_context *tctx, struct translate *translate_create( const struct translate_key *key ); +static INLINE int translate_keysize( const struct translate_key *key ) +{ + return 2 * sizeof(int) + key->nr_elements * sizeof(struct translate_element); +} + +static INLINE int translate_key_compare( const struct translate_key *a, + const struct translate_key *b ) +{ + int keysize = translate_keysize(a); + return memcmp(a, b, keysize); +} + + +static INLINE void translate_key_sanitize( struct translate_key *a ) +{ + int keysize = translate_keysize(a); + char *ptr = (char *)a; + memset(ptr + keysize, 0, sizeof(*a) - keysize); +} + + /******************************************************************************* * Private: */ |