[PATCH] D73936: scudo: Simplify getClassIdBySize() logic. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 09:35:39 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7de7084f4a2: scudo: Simplify getClassIdBySize() logic. NFCI. (authored by pcc).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73936/new/
https://reviews.llvm.org/D73936
Files:
compiler-rt/lib/scudo/standalone/size_class_map.h
Index: compiler-rt/lib/scudo/standalone/size_class_map.h
===================================================================
--- compiler-rt/lib/scudo/standalone/size_class_map.h
+++ compiler-rt/lib/scudo/standalone/size_class_map.h
@@ -66,11 +66,11 @@
DCHECK_LE(Size, MaxSize);
if (Size <= MidSize)
return (Size + MinSize - 1) >> MinSizeLog;
+ Size -= 1;
const uptr L = getMostSignificantSetBitIndex(Size);
- const uptr HBits = (Size >> (L - S)) & M;
- const uptr LBits = Size & ((1UL << (L - S)) - 1);
- const uptr L1 = L - MidSizeLog;
- return MidClass + (L1 << S) + HBits + (LBits > 0);
+ const uptr LBits = (Size >> (L - S)) - (1 << S);
+ const uptr HBits = (L - MidSizeLog) << S;
+ return MidClass + 1 + HBits + LBits;
}
static u32 getMaxCachedHint(uptr Size) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73936.242357.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200204/4e405125/attachment-0001.bin>
More information about the llvm-commits
mailing list