From 6a7073e5f262db9a4578ff00b5b28e34335564ce Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 23 May 2024 19:54:55 +0300 Subject: improve id handling + The number of allowed threads running at the same time is limited to num_tids, but each thread's ID can be any larger than that. This should make ID reuse a lot more rare, and probably makes certain kinds of time-of-check-to-time-of-use attacks more difficult --- include/kmi/bits.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/kmi/bits.h b/include/kmi/bits.h index 738f1d5..5fe438c 100644 --- a/include/kmi/bits.h +++ b/include/kmi/bits.h @@ -379,4 +379,6 @@ uint64_t __bswap64(uint64_t u); #endif +#define is_powerof2(x) (((x) & ((x) - 1)) == 0) + #endif /* KMI_BITS_H */ -- cgit v1.3