summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/hwui/RecordingCanvas.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/hwui/RecordingCanvas.cpp b/libs/hwui/RecordingCanvas.cpp
index 3f21940d35a7..5b6fff158f10 100644
--- a/libs/hwui/RecordingCanvas.cpp
+++ b/libs/hwui/RecordingCanvas.cpp
@@ -605,12 +605,17 @@ public:
};
}
+static constexpr inline bool is_power_of_two(int value) {
+ return (value & (value - 1)) == 0;
+}
+
template <typename T, typename... Args>
void* DisplayListData::push(size_t pod, Args&&... args) {
size_t skip = SkAlignPtr(sizeof(T) + pod);
SkASSERT(skip < (1 << 24));
if (fUsed + skip > fReserved) {
- static_assert(SkIsPow2(SKLITEDL_PAGE), "This math needs updating for non-pow2.");
+ static_assert(is_power_of_two(SKLITEDL_PAGE),
+ "This math needs updating for non-pow2.");
// Next greater multiple of SKLITEDL_PAGE.
fReserved = (fUsed + skip + SKLITEDL_PAGE) & ~(SKLITEDL_PAGE - 1);
fBytes.realloc(fReserved);