diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2015-06-25 17:06:02 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2015-06-25 17:06:02 +0000 |
commit | 843adf8844d4ec43d13dd05f7269cabc7058c027 (patch) | |
tree | f18fea62ef786d794c92fcf1f2b414c159a14a02 /gcc/hash-traits.h | |
parent | 5ac6389bc1c0729233a88c1ce146a21aa6a3e2ce (diff) | |
download | gcc-843adf8844d4ec43d13dd05f7269cabc7058c027.zip gcc-843adf8844d4ec43d13dd05f7269cabc7058c027.tar.gz gcc-843adf8844d4ec43d13dd05f7269cabc7058c027.tar.bz2 |
gcc/
* hash-traits.h (pointer_hash::mark_deleted, pointer_hash::mark_empty)
(pointer_hash::is_deleted, pointer_hash::is_empty): New functions.
From-SVN: r224956
Diffstat (limited to 'gcc/hash-traits.h')
-rw-r--r-- | gcc/hash-traits.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gcc/hash-traits.h b/gcc/hash-traits.h index 1d1a220..65ed32c 100644 --- a/gcc/hash-traits.h +++ b/gcc/hash-traits.h @@ -66,9 +66,12 @@ struct pointer_hash : typed_noop_remove <Type> typedef Type *compare_type; static inline hashval_t hash (const value_type &); - static inline bool equal (const value_type &existing, const compare_type &candidate); + static inline void mark_deleted (Type *&); + static inline void mark_empty (Type *&); + static inline bool is_deleted (Type *); + static inline bool is_empty (Type *); }; template <typename Type> @@ -88,6 +91,34 @@ pointer_hash <Type>::equal (const value_type &existing, return existing == candidate; } +template <typename Type> +inline void +pointer_hash <Type>::mark_deleted (Type *&e) +{ + e = reinterpret_cast<Type *> (1); +} + +template <typename Type> +inline void +pointer_hash <Type>::mark_empty (Type *&e) +{ + e = NULL; +} + +template <typename Type> +inline bool +pointer_hash <Type>::is_deleted (Type *e) +{ + return e == reinterpret_cast<Type *> (1); +} + +template <typename Type> +inline bool +pointer_hash <Type>::is_empty (Type *e) +{ + return e == NULL; +} + /* Hasher for entry in gc memory. */ template<typename T> |