Remove usage of SkIsPow2

We plan to remove this from the public API

Change-Id: Iaea539884e24fe27b1c3a61cbaa719b5f4570132
Bug: skbug.com/13983
This commit is contained in:
Kevin Lubick
2023-01-09 18:50:53 +00:00
parent fb0ae75c0f
commit 468038bb70

View File

@@ -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);