From e897b41dcf36148f61ce5ab7e4ec60ab5dae15ce Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 25 Aug 2017 09:53:07 +0300 Subject: [PATCH] Simplify THREAD_TABLE_INDEX expression for Win32/64 (fix commit 85fce54) Windows thread Id rarely has non-zero highest half of DWORD, so it is OK to use only the lowest one for hash value computation. * win32_threads.c (THREAD_TABLE_INDEX): Remove (id>>16) from the expression. --- win32_threads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32_threads.c b/win32_threads.c index 7befb9b..3cbdc22 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -321,7 +321,7 @@ STATIC volatile LONG GC_max_thread_index = 0; # define THREAD_TABLE_SZ 256 /* Power of 2 (for speed). */ #endif #define THREAD_TABLE_INDEX(id) /* id is of DWORD type */ \ - (int)((((id) >> 16) ^ ((id) >> 8) ^ (id)) % THREAD_TABLE_SZ) + (int)((((id) >> 8) ^ (id)) % THREAD_TABLE_SZ) STATIC GC_thread GC_threads[THREAD_TABLE_SZ]; /* It may not be safe to allocate when we register the first thread. */ -- 2.7.4