| OLD | NEW |
| (Empty) | |
| 1 /* |
| 2 * Copyright 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 #ifndef NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_ |
| 8 #define NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_ |
| 9 |
| 10 #include "native_client/src/include/nacl_base.h" |
| 11 #include "native_client/src/include/portability.h" |
| 12 |
| 13 #include "native_client/src/trusted/generic_container/container.h" |
| 14 |
| 15 EXTERN_C_BEGIN |
| 16 |
| 17 struct NaClContainerHashTblEntry { |
| 18 int flags; |
| 19 void *datum; |
| 20 }; |
| 21 |
| 22 #define NACL_CHTE_USED (1<<0) |
| 23 /* slot occupied, so keep probing */ |
| 24 |
| 25 #define NACL_CHTE_DELETED (1<<1) |
| 26 /* slot occupied but deleted, keep probing */ |
| 27 |
| 28 struct NaClContainerHashTbl { |
| 29 struct NaClContainer base; |
| 30 struct NaClHashFunctor *hash_functor; |
| 31 size_t num_buckets; |
| 32 size_t num_entries; |
| 33 struct NaClContainerHashTblEntry *bucket; |
| 34 }; |
| 35 |
| 36 int NaClContainerHashTblCtor(struct NaClContainerHashTbl *self, |
| 37 struct NaClHashFunctor *hash_functor, |
| 38 size_t num_buckets); |
| 39 |
| 40 int NaClContainerHashTblInsert(struct NaClContainer *vself, |
| 41 void *obj); |
| 42 |
| 43 struct NaClContainerIter *NaClContainerHashTblFind( |
| 44 struct NaClContainer *vself, |
| 45 void *key, |
| 46 struct NaClContainerIter *out); |
| 47 |
| 48 void NaClContainerHashTblDtor(struct NaClContainer *vself); |
| 49 |
| 50 struct NaClContainerHashTblIter { |
| 51 struct NaClContainerIter base; |
| 52 struct NaClContainerHashTbl *htbl; |
| 53 uintptr_t idx; |
| 54 }; |
| 55 |
| 56 int NaClContainerHashTblIterCtor(struct NaClContainer *vself, |
| 57 struct NaClContainerIter *viter); |
| 58 |
| 59 EXTERN_C_END |
| 60 |
| 61 #endif /* NATIVE_CLIENT_SRC_TRUSTED_GENERIC_CONTAINER_CONTAINER_HASH_TABLE_H_ */ |
| OLD | NEW |