Skip to content

Commit

Permalink
Fix TypedArrayTemp::set function templates
Browse files Browse the repository at this point in the history
  • Loading branch information
sablib committed Nov 7, 2024
1 parent b4cebf2 commit 719d33b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions native/cocos/core/TypedArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ template <typename T>
template <typename SrcType>
typename std::enable_if_t<std::is_same<T, SrcType>::value, void> TypedArrayTemp<T>::set(const TypedArrayTemp<SrcType> &array, uint32_t offset) {
CC_ASSERT(_buffer);
uint32_t dstByteOffset = offset * BYTES_PER_ELEMENT;
uint32_t dstByteOffset = _byteOffset + offset * BYTES_PER_ELEMENT;
uint32_t srcByteOffset = array.byteOffset();
uint32_t srcCount = array.length();
CC_ASSERT(dstByteOffset + srcCount * TypedArrayTemp<SrcType>::BYTES_PER_ELEMENT <= _byteEndPos);
Expand All @@ -302,7 +302,7 @@ template <typename T>
template <typename SrcType>
typename std::enable_if_t<!std::is_same<T, SrcType>::value, void> TypedArrayTemp<T>::set(const TypedArrayTemp<SrcType> &array, uint32_t offset) {
CC_ASSERT(_buffer);
uint32_t dstByteOffset = offset * BYTES_PER_ELEMENT;
uint32_t dstByteOffset = _byteOffset + offset * BYTES_PER_ELEMENT;
uint32_t srcByteOffset = array.byteOffset();
uint32_t srcCount = array.length();
uint32_t remainCount = (_byteEndPos - dstByteOffset) / BYTES_PER_ELEMENT;
Expand Down

0 comments on commit 719d33b

Please sign in to comment.