Skip to content

Commit 4f0cdcd

Browse files
authored
Inline usage of SkIsPow2 (flutter#38722)
* Inline usage of SkIsPow2 * static
1 parent b6720a5 commit 4f0cdcd

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

display_list/display_list_builder.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@ static void CopyV(void* dst, const S* src, int n, Rest&&... rest) {
2626
CopyV(SkTAddOffset<void>(dst, n * sizeof(S)), std::forward<Rest>(rest)...);
2727
}
2828

29+
static constexpr inline bool is_power_of_two(int value) {
30+
return (value & (value - 1)) == 0;
31+
}
32+
2933
template <typename T, typename... Args>
3034
void* DisplayListBuilder::Push(size_t pod, int render_op_inc, Args&&... args) {
3135
size_t size = SkAlignPtr(sizeof(T) + pod);
3236
FML_DCHECK(size < (1 << 24));
3337
if (used_ + size > allocated_) {
34-
static_assert(SkIsPow2(DL_BUILDER_PAGE),
38+
static_assert(is_power_of_two(DL_BUILDER_PAGE),
3539
"This math needs updating for non-pow2.");
3640
// Next greater multiple of DL_BUILDER_PAGE.
3741
allocated_ = (used_ + size + DL_BUILDER_PAGE) & ~(DL_BUILDER_PAGE - 1);

0 commit comments

Comments
 (0)