| 1 |
/* |
| 2 |
* Copyright 2025 Google LLC. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SkSpanPriv_DEFINED |
| 9 |
#define SkSpanPriv_DEFINED |
| 10 |
|
| 11 |
#include "include/core/SkSpan.h" |
| 12 |
#include "include/private/base/SkMalloc.h" |
| 13 |
|
| 14 |
#include <algorithm> |
| 15 |
|
| 16 |
class SkSpanPriv { |
| 17 |
public: |
| 18 |
template <typename T> static bool EQ(SkSpan<T> a, SkSpan<T> b) { |
| 19 |
if (a.size() != b.size()) { |
| 20 |
return false; |
| 21 |
} |
| 22 |
if (a.empty()) { |
| 23 |
return true; |
| 24 |
} |
| 25 |
return (a.data() == b.data()) || std::equal(a.begin(), a.end(), b.begin()); |
| 26 |
} |
| 27 |
|
| 28 |
template <typename T> static void Copy(SkSpan<T> dst, SkSpan<const T> src) { |
| 29 |
SkASSERT(dst.size() == src.size()); |
| 30 |
sk_careful_memcpy(dst.data(), src.data(), src.size_bytes()); |
| 31 |
} |
| 32 |
}; |
| 33 |
|
| 34 |
#endif |