[compiler-rt] [scudo] Add a method to use a hard-coded page size (PR #106646)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 4 14:27:45 PDT 2024


================
@@ -133,18 +133,39 @@ inline void computePercentage(uptr Numerator, uptr Denominator, uptr *Integral,
 
 // Platform specific functions.
 
+#if defined(SCUDO_PAGE_SIZE)
+
+inline constexpr uptr getPageSizeCached() { return SCUDO_PAGE_SIZE; }
+
+inline constexpr uptr getPageSizeSlow() { return getPageSizeCached(); }
+
+inline constexpr uptr getPageSizeLogCached() {
+  return static_cast<uptr>(__builtin_ctzl(SCUDO_PAGE_SIZE));
----------------
ChiaHungDuan wrote:

How about using `getLog2()`?

https://github.com/llvm/llvm-project/pull/106646


More information about the llvm-commits mailing list