Skip to content

Commit

Permalink
Fix copying of BigInt64Array and BigUint64Array (#452)
Browse files Browse the repository at this point in the history
  • Loading branch information
y-exp authored Jan 24, 2024
1 parent be71d25 commit 1598f02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/external_copy/external_copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ auto ExternalCopy::Copy(Local<Value> value, bool transfer_out, ArrayRange transf
} else if (view->IsFloat64Array()) {
type = ViewType::Float64;
} else if (view->IsBigInt64Array()) {
type = ViewType::BigInt64Array;
type = ViewType::BigInt64;
} else if (view->IsBigUint64Array()) {
type = ViewType::BigUint64Array;
type = ViewType::BigUint64;
} else if (view->IsDataView()) {
type = ViewType::DataView;
} else {
Expand Down Expand Up @@ -486,6 +486,10 @@ auto NewTypedArrayView(Local<T> buffer, ExternalCopyArrayBufferView::ViewType ty
return Float32Array::New(buffer, byte_offset, byte_length >> 2);
case ExternalCopyArrayBufferView::ViewType::Float64:
return Float64Array::New(buffer, byte_offset, byte_length >> 3);
case ExternalCopyArrayBufferView::ViewType::BigInt64:
return BigInt64Array::New(buffer, byte_offset, byte_length >> 3);
case ExternalCopyArrayBufferView::ViewType::BigUint64:
return BigUint64Array::New(buffer, byte_offset, byte_length >> 3);
case ExternalCopyArrayBufferView::ViewType::DataView:
return DataView::New(buffer, byte_offset, byte_length);
default:
Expand Down
2 changes: 1 addition & 1 deletion src/external_copy/external_copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ExternalCopySharedArrayBuffer : public ExternalCopyAnyBuffer {
*/
class ExternalCopyArrayBufferView : public ExternalCopy {
public:
enum class ViewType { Uint8, Uint8Clamped, Int8, Uint16, Int16, Uint32, Int32, Float32, Float64, BigInt64Array, BigUint64Array, DataView };
enum class ViewType { Uint8, Uint8Clamped, Int8, Uint16, Int16, Uint32, Int32, Float32, Float64, BigInt64, BigUint64, DataView };

private:
std::unique_ptr<ExternalCopyAnyBuffer> buffer;
Expand Down

0 comments on commit 1598f02

Please sign in to comment.