Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove use of SkTAddOffset and sk_careful_memcpy #38977

Merged
merged 1 commit into from
Jan 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions display_list/display_list_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ static void CopyV(void* dst, const S* src, int n, Rest&&... rest) {
FML_DCHECK(((uintptr_t)dst & (alignof(S) - 1)) == 0)
<< "Expected " << dst << " to be aligned for at least " << alignof(S)
<< " bytes.";
sk_careful_memcpy(dst, src, n * sizeof(S));
CopyV(SkTAddOffset<void>(dst, n * sizeof(S)), std::forward<Rest>(rest)...);
// If n is 0, there is nothing to copy into dst from src.
if (n > 0) {
memcpy(dst, src, n * sizeof(S));
dst = reinterpret_cast<void*>(reinterpret_cast<uint8_t*>(dst) +
n * sizeof(S));
}
// Repeat for the next items, if any
CopyV(dst, std::forward<Rest>(rest)...);
}

static constexpr inline bool is_power_of_two(int value) {
Expand Down