public function toTypedArray($baseArray, $bit32, $unsigned)
{
try {
$typedArrayTemp = $bit32 ? $unsigned ? new Uint32Array(count($baseArray)) : new Int32Array(count($baseArray)) : new Uint8Array(count($baseArray));
for ($address = 0; $address < count($baseArray); ++$address) {
$typedArrayTemp[$address] = $baseArray[$address];
}
return $typedArrayTemp;
} catch (\Exception $error) {
echo 'Could not convert an array to a typed array' . PHP_EOL;
return $baseArray;
}
}