1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibJS: Compare types instead of sizes in %TypedArray%.prototype.set

Just checking for a matching size is not enough, since floats and ints
have the same size, but are represented completely differently.
This commit is contained in:
Idan Horowitz 2022-02-08 22:24:58 +02:00 committed by Linus Groh
parent c7a8902746
commit 13aee1b780

View file

@ -725,7 +725,7 @@ JS_DEFINE_NATIVE_FUNCTION(TypedArrayPrototype::set)
auto limit = checked_limit.value();
// 24. If srcType is the same as targetType, then
if (source_typed_array.element_size() == typed_array->element_size()) {
if (source_typed_array.element_name() == typed_array->element_name()) {
// a. NOTE: If srcType and targetType are the same, the transfer must be performed in a manner that preserves the bit-level encoding of the source data.
// b. Repeat, while targetByteIndex < limit,
// i. Let value be GetValueFromBuffer(srcBuffer, srcByteIndex, Uint8, true, Unordered).