buffer: simplify ReadFloatGeneric offset checks

This commit is contained in:
Ben Noordhuis 2013-05-26 21:41:20 +02:00
parent ef0926ce42
commit 36ebff0470

View File

@ -396,12 +396,11 @@ static inline void Swizzle(char* start, unsigned int len) {
template <typename T, enum Endianness endianness>
Handle<Value> ReadFloatGeneric(const Arguments& args) {
double offset_tmp = args[0]->NumberValue();
int64_t offset = static_cast<int64_t>(offset_tmp);
size_t offset = args[0]->Uint32Value();
bool doAssert = !args[1]->BooleanValue();
if (doAssert) {
if (offset_tmp != offset || offset < 0)
if (!args[0]->IsUint32())
return ThrowTypeError("offset is not uint");
size_t len = static_cast<size_t>(
args.This()->GetIndexedPropertiesExternalArrayDataLength());