Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 468038bb authored by Kevin Lubick's avatar Kevin Lubick
Browse files

Remove usage of SkIsPow2

We plan to remove this from the public API

Change-Id: Iaea539884e24fe27b1c3a61cbaa719b5f4570132
Bug: skbug.com/13983
parent fb0ae75c
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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);