Merge pull request #2 from AlexVestin/patch-1

Use size of the typed array instead of underlying bufffer
This commit is contained in:
Luis Blanco 2020-04-23 10:31:36 +04:00 committed by GitHub
commit ebdf6d780c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -338,7 +338,7 @@ inline Type* getArrayData(
size_t offset = ta.ByteOffset();
Napi::ArrayBuffer arr = ta.ArrayBuffer();
if (num) {
*num = arr.ByteLength() / sizeof(Type);
*num = ta.ByteLength() / sizeof(Type);
}
uint8_t *base = reinterpret_cast<uint8_t *>(arr.Data());
out = reinterpret_cast<Type *>(base + offset);