From: Ivan Maidanski Date: Fri, 25 Aug 2017 06:53:07 +0000 (+0300) Subject: Simplify THREAD_TABLE_INDEX expression for Win32/64 X-Git-Tag: v8.0.0~594 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e897b41dcf36148f61ce5ab7e4ec60ab5dae15ce;p=gc 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. --- diff --git a/win32_threads.c b/win32_threads.c index 7befb9bb..3cbdc22c 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. */