diff options
author | Lukáš Ondráček <lukas.ondracek@nic.cz> | 2024-10-31 15:03:30 +0100 |
---|---|---|
committer | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-11-04 14:39:13 +0100 |
commit | f8848df0ef5f4fe649aee6d93781a4c210e804f7 (patch) | |
tree | eea90ea672c79159db36c7eb9af84c8832a0c75c /lib | |
parent | daemon/ratelimiting: polish (diff) | |
download | knot-resolver-f8848df0ef5f4fe649aee6d93781a4c210e804f7.tar.xz knot-resolver-f8848df0ef5f4fe649aee6d93781a4c210e804f7.zip |
lib/kru: improve code formatting
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kru.inc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/kru.inc.c b/lib/kru.inc.c index 078c8f06..2272adab 100644 --- a/lib/kru.inc.c +++ b/lib/kru.inc.c @@ -112,7 +112,8 @@ struct kru { struct load_cl load_cls[][TABLE_COUNT]; }; -inline static uint64_t rand_bits(unsigned int bits) { +inline static uint64_t rand_bits(unsigned int bits) +{ static _Thread_local uint64_t state = 3723796604792068981ull; const uint64_t prime1 = 11737314301796036329ull; const uint64_t prime2 = 3107264277052274849ull; @@ -137,7 +138,7 @@ static inline void update_time(struct load_cl *l, const uint32_t time_now, const struct decay_config *decay) { uint32_t ticks; - uint32_t time_last = atomic_load_explicit(&l->time,memory_order_relaxed); + uint32_t time_last = atomic_load_explicit(&l->time, memory_order_relaxed); do { ticks = time_now - time_last; if (__builtin_expect(!ticks, true)) // we optimize for time not advancing @@ -272,7 +273,6 @@ static inline void kru_limited_prefetch(struct kru *kru, uint32_t time_now, uint ctx->id = hash; } - /// Phase 1/3 of a query -- hash, prefetch, ctx init. Based on a bit prefix of one 16-byte key. static inline void kru_limited_prefetch_prefix(struct kru *kru, uint32_t time_now, uint8_t namespace, uint8_t key[static 16], uint8_t prefix, kru_price_t price, struct query_ctx *ctx) { |