buffer: simplify ReadFloatGeneric offset checks
This commit is contained in:
parent
ef0926ce42
commit
36ebff0470
@ -396,12 +396,11 @@ static inline void Swizzle(char* start, unsigned int len) {
|
|||||||
|
|
||||||
template <typename T, enum Endianness endianness>
|
template <typename T, enum Endianness endianness>
|
||||||
Handle<Value> ReadFloatGeneric(const Arguments& args) {
|
Handle<Value> ReadFloatGeneric(const Arguments& args) {
|
||||||
double offset_tmp = args[0]->NumberValue();
|
size_t offset = args[0]->Uint32Value();
|
||||||
int64_t offset = static_cast<int64_t>(offset_tmp);
|
|
||||||
bool doAssert = !args[1]->BooleanValue();
|
bool doAssert = !args[1]->BooleanValue();
|
||||||
|
|
||||||
if (doAssert) {
|
if (doAssert) {
|
||||||
if (offset_tmp != offset || offset < 0)
|
if (!args[0]->IsUint32())
|
||||||
return ThrowTypeError("offset is not uint");
|
return ThrowTypeError("offset is not uint");
|
||||||
size_t len = static_cast<size_t>(
|
size_t len = static_cast<size_t>(
|
||||||
args.This()->GetIndexedPropertiesExternalArrayDataLength());
|
args.This()->GetIndexedPropertiesExternalArrayDataLength());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user