mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
typed arrays: remove unnecessary special-casing
Uint32Value() on undefined is equal to 0, no need to special case it.
This commit is contained in:
1 parent
93efc7f78d
commit
47643d2ec5
1 file changed
+2
-3
@@ -210,7 +210,7 @@ class TypedArray {
|
||||
|
||||
if (!args[1]->IsUndefined() && args[1]->Int32Value() < 0)
|
||||
return ThrowRangeError("Byte offset out of range.");
|
||||
byte_offset = args[1]->IsUndefined() ? 0 : args[1]->Uint32Value();
|
||||
byte_offset = args[1]->Uint32Value();
|
||||
|
||||
if (args.Length() > 2) {
|
||||
if (args[2]->Int32Value() < 0)
|
||||
@@ -596,8 +596,7 @@ class DataView {
|
||||
|
||||
unsigned int byte_length =
|
||||
buffer->GetIndexedPropertiesExternalArrayDataLength();
|
||||
unsigned int byte_offset =
|
||||
args[1]->IsUndefined() ? 0 : args[1]->Uint32Value();
|
||||
unsigned int byte_offset = args[1]->Uint32Value();
|
||||
|
||||
if (args[1]->Int32Value() < 0 || byte_offset >= byte_length)
|
||||
return ThrowRangeError("byteOffset out of range.");
|
||||
|
||||
Reference in new issue
Block a user