summaryrefslogtreecommitdiff
path: root/src/pal/src
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2019-03-15 20:32:48 +0100
committerJan Kotas <jkotas@microsoft.com>2019-03-15 12:32:48 -0700
commit66009329a187634dc432854cdd7c893d972156eb (patch)
treedda734856cbf7fe6e891c7065937b82eb93a297a /src/pal/src
parent855f6bef8e00c7aa45f2f14df4e3c18c12e8ab18 (diff)
downloadcoreclr-66009329a187634dc432854cdd7c893d972156eb.tar.gz
coreclr-66009329a187634dc432854cdd7c893d972156eb.tar.bz2
coreclr-66009329a187634dc432854cdd7c893d972156eb.zip
Fix GetFullAffinityMask for cpuCount==64 (#23276)
The function was incorrectly assuming that shifting 64 bit constant 1 by 64 bits to the left gets result 0.
Diffstat (limited to 'src/pal/src')
-rw-r--r--src/pal/src/numa/numa.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pal/src/numa/numa.cpp b/src/pal/src/numa/numa.cpp
index 92ec82f749..8793a09b85 100644
--- a/src/pal/src/numa/numa.cpp
+++ b/src/pal/src/numa/numa.cpp
@@ -166,7 +166,12 @@ the processors enabled.
--*/
KAFFINITY GetFullAffinityMask(int cpuCount)
{
- return ((KAFFINITY)1 << (cpuCount)) - 1;
+ if (cpuCount < sizeof(KAFFINITY) * 8)
+ {
+ return ((KAFFINITY)1 << (cpuCount)) - 1;
+ }
+
+ return ~(KAFFINITY)0;
}
/*++