[sanitizer] Revert rL324263

Summary:
The 32-bit division  breaks SizeClassAllocator64PopulateFreeListOOM which uses
Primary that has a maximum size > 32-bit.

Reviewers: alekseyshl

Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits

Differential Revision: https://reviews.llvm.org/D42928

llvm-svn: 324268
This commit is contained in:
Kostya Kortchinsky 2018-02-05 20:17:24 +00:00
parent 1c84dd9a8f
commit 02f6845095
1 changed files with 2 additions and 3 deletions

View File

@ -163,7 +163,7 @@ class SizeClassMap {
return (size + kMinSize - 1) >> kMinSizeLog;
uptr l = MostSignificantSetBitIndex(size);
uptr hbits = (size >> (l - S)) & M;
uptr lbits = size & ((1U << (l - S)) - 1);
uptr lbits = size & ((1 << (l - S)) - 1);
uptr l1 = l - kMidSizeLog;
return kMidClass + (l1 << S) + hbits + (lbits > 0);
}
@ -176,8 +176,7 @@ class SizeClassMap {
return 16;
if (UNLIKELY(class_id == 0))
return 0;
const uptr n =
(1U << kMaxBytesCachedLog) / static_cast<u32>(Size(class_id));
uptr n = (1UL << kMaxBytesCachedLog) / Size(class_id);
return Max<uptr>(1, Min(kMaxNumCachedHint, n));
}