From 47643d2ec517ceb8f7ce180142262e393c4d8e89 Mon Sep 17 00:00:00 2001 From: Dean McNamee Date: Sat, 13 Oct 2012 01:24:25 +0200 Subject: [PATCH] typed arrays: remove unnecessary special-casing Uint32Value() on undefined is equal to 0, no need to special case it. --- src/v8_typed_array.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/v8_typed_array.cc b/src/v8_typed_array.cc index d8a8c28b8fb..64045ff7769 100644 --- a/src/v8_typed_array.cc +++ b/src/v8_typed_array.cc @@ -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.");