aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/census/intrusive_hash_map.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ext/census/intrusive_hash_map.c')
-rw-r--r--src/core/ext/census/intrusive_hash_map.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/core/ext/census/intrusive_hash_map.c b/src/core/ext/census/intrusive_hash_map.c
index e64e8086ca..7930486963 100644
--- a/src/core/ext/census/intrusive_hash_map.c
+++ b/src/core/ext/census/intrusive_hash_map.c
@@ -1,17 +1,19 @@
/*
- * Copyright 2017 Google Inc.
+ *
+ * Copyright 2017 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
*/
#include "src/core/ext/census/intrusive_hash_map.h"
@@ -20,7 +22,7 @@
extern bool hm_index_compare(const hm_index *A, const hm_index *B);
/* Simple hashing function that takes lower 32 bits. */
-static inline uint32_t chunked_vector_hasher(uint64_t key) {
+static __inline uint32_t chunked_vector_hasher(uint64_t key) {
return (uint32_t)key;
}
@@ -28,8 +30,8 @@ static inline uint32_t chunked_vector_hasher(uint64_t key) {
static const size_t VECTOR_CHUNK_SIZE = (1 << 20) / sizeof(void *);
/* Helper functions which return buckets from the chunked vector. */
-static inline void **get_mutable_bucket(const chunked_vector *buckets,
- uint32_t index) {
+static __inline void **get_mutable_bucket(const chunked_vector *buckets,
+ uint32_t index) {
if (index < VECTOR_CHUNK_SIZE) {
return &buckets->first_[index];
}
@@ -37,7 +39,8 @@ static inline void **get_mutable_bucket(const chunked_vector *buckets,
return &buckets->rest_[rest_index][index % VECTOR_CHUNK_SIZE];
}
-static inline void *get_bucket(const chunked_vector *buckets, uint32_t index) {
+static __inline void *get_bucket(const chunked_vector *buckets,
+ uint32_t index) {
if (index < VECTOR_CHUNK_SIZE) {
return buckets->first_[index];
}
@@ -46,7 +49,7 @@ static inline void *get_bucket(const chunked_vector *buckets, uint32_t index) {
}
/* Helper function. */
-static inline size_t RestSize(const chunked_vector *vec) {
+static __inline size_t RestSize(const chunked_vector *vec) {
return (vec->size_ <= VECTOR_CHUNK_SIZE)
? 0
: (vec->size_ - VECTOR_CHUNK_SIZE - 1) / VECTOR_CHUNK_SIZE + 1;
@@ -205,9 +208,9 @@ hm_item *intrusive_hash_map_erase(intrusive_hash_map *hash_map, uint64_t key) {
* array_size-1. Returns true if it is a new hm_item and false if the hm_item
* already existed.
*/
-static inline bool intrusive_hash_map_internal_insert(chunked_vector *buckets,
- uint32_t hash_mask,
- hm_item *item) {
+static __inline bool intrusive_hash_map_internal_insert(chunked_vector *buckets,
+ uint32_t hash_mask,
+ hm_item *item) {
const uint64_t key = item->key;
uint32_t index = chunked_vector_hasher(key) & hash_mask;
hm_item **slot = (hm_item **)get_mutable_bucket(buckets, index);