mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-05 13:37:47 +02:00
* Take into account byteoffset/length
This commit is contained in:
parent
fa88ecbe08
commit
bc95a7dc7f
@ -1495,13 +1495,18 @@ begin
|
||||
end;
|
||||
|
||||
function SharedToNonShared(aArray : TJSTypedArray; aWordSized : Boolean = False): TJSTypedArray;
|
||||
var
|
||||
Buf : TJSSharedArrayBuffer;
|
||||
|
||||
begin
|
||||
if HaveSharedArrayBuffer and (aArray.bufferObj is TJSSharedArrayBuffer) then
|
||||
begin
|
||||
Buf:=TJSSharedArrayBuffer(aArray.bufferObj).slice(aArray.byteOffset,aArray.byteLength);
|
||||
if aWordSized then
|
||||
Result:=TJSUInt16Array.New(SharedToNonShared(aArray.bufferObj))
|
||||
Result:=TJSUInt16Array.New(SharedToNonShared(Buf))
|
||||
else
|
||||
Result:=TJSUInt8Array.New(SharedToNonShared(aArray.bufferObj))
|
||||
Result:=TJSUInt8Array.New(SharedToNonShared(Buf))
|
||||
end
|
||||
else
|
||||
Result:=aArray;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user