From 1598f025a88de3c8147d81c7f87d080d699fae17 Mon Sep 17 00:00:00 2001 From: y-exp <8601420+y-exp@users.noreply.github.com> Date: Wed, 24 Jan 2024 21:57:04 +0100 Subject: [PATCH] Fix copying of BigInt64Array and BigUint64Array (#452) --- src/external_copy/external_copy.cc | 8 ++++++-- src/external_copy/external_copy.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/external_copy/external_copy.cc b/src/external_copy/external_copy.cc index b651e098..bded7b6b 100644 --- a/src/external_copy/external_copy.cc +++ b/src/external_copy/external_copy.cc @@ -151,9 +151,9 @@ auto ExternalCopy::Copy(Local 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 { @@ -486,6 +486,10 @@ auto NewTypedArrayView(Local 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: diff --git a/src/external_copy/external_copy.h b/src/external_copy/external_copy.h index bf2a95dd..62a4f1b2 100644 --- a/src/external_copy/external_copy.h +++ b/src/external_copy/external_copy.h @@ -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 buffer;