diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 21:20:02 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-12-21 21:20:02 +0000 |
commit | 675cc66a3a20c219eee05919bec5580f1b3c0c2c (patch) | |
tree | 26a2279877aa52f21fba4ae120751143f5815a44 /gcc/pointer-set.c | |
parent | f4dc4c794dc64dda19ab8bf99fe9a9c964111ec8 (diff) | |
download | gcc-675cc66a3a20c219eee05919bec5580f1b3c0c2c.tar.gz |
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/18984
* pointer-set.c (pointer_set_contains): Add back.
* pointer-set.h (pointer_set_contains): Add back.
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR c++/18984
* cp-gimplify.c (cp_genericize_r): Don't insert first but instead
check to see if contains the pointer. Insert the statement before
returning.
2004-12-21 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/18984
* g++.dg/eh/ctor3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92470 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/pointer-set.c')
-rw-r--r-- | gcc/pointer-set.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/pointer-set.c b/gcc/pointer-set.c index 3f79cc2bfa7..266cccfef8a 100644 --- a/gcc/pointer-set.c +++ b/gcc/pointer-set.c @@ -90,6 +90,29 @@ void pointer_set_destroy (struct pointer_set_t *pset) XDELETE (pset); } +/* Returns nonzero if PSET contains P. P must be nonnull. + + Collisions are resolved by linear probing. */ +int +pointer_set_contains (struct pointer_set_t *pset, void *p) +{ + size_t n = hash1 (p, pset->n_slots, pset->log_slots); + + while (true) + { + if (pset->slots[n] == p) + return 1; + else if (pset->slots[n] == 0) + return 0; + else + { + ++n; + if (n == pset->n_slots) + n = 0; + } + } +} + /* Subroutine of pointer_set_insert. Inserts P into an empty element of SLOTS, an array of length N_SLOTS. Returns nonzero if P was already present in N_SLOTS. */ |