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

Commit 538df5d3 authored by Kevin Lubick's avatar Kevin Lubick Committed by Android (Google) Code Review
Browse files

Merge "Remove usage of SkIsPow2"

parents fbee7df3 468038bb
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);