You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
typedef ([EnforceRange] unsigned long or bigint) IndexValue;
574
+
typedef any IndexValue;
573
575
574
576
dictionary ModuleExportDescriptor {
575
577
required USVString name;
@@ -1356,20 +1358,19 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
1356
1358
</div>
1357
1359
1358
1360
<div algorithm>
1359
-
The algorithm <dfn>IndexValueToU64</dfn>(|v|, |indextype|) asserts that a JavaScript value is the appropriate variant of {{IndexValue}}for an {{IndexType}}, and ensures that its value is in [=u64=]range for WebAssembly embedding operations, by performing the following steps:
1361
+
The algorithm <dfn>IndexValueToU64</dfn>(|v|, |indextype|) converts a JavaScript value to a WebAssembly [=u64=]for use in embedding operations. It is designed to act like [=[EnforceRange]=][=unsigned long=]for {{IndexType}} "i32", and to extend these semantics to {{IndexType}} "i64", by performing the following steps:
1360
1362
1361
1363
1. If |indextype| is "i32",
1362
-
1. If |v| [=is a Number=],
1363
-
1. Assert: Due to WebIDL types and [=[EnforceRange]=], 0 ≤ [=ℝ=](|v|) < 2<sup>64</sup>.
1364
-
1. Return [=ℝ=](|v|) as a WebAssembly [=u64=].
1365
-
1. Otherwise, [=throw=] a {{TypeError}}.
1366
-
1. Else if |indextype| is "i64",
1367
-
1. If |v| [=is a BigInt=],
1368
-
1. If |v| is not equal to [=!=][$ToBigUint64$](|v|), [=throw=] a {{TypeError}}.
1369
-
1370
-
Note: This operation is designed to mirror [=[EnforceRange]=], which [=throws=] a {{TypeError}} for out-of-range numeric values.
1371
-
1. Return [=ℝ=](|v|) as a WebAssembly [=u64=].
1372
-
1. Otherwise, [=throw=] a {{TypeError}}.
1364
+
1. Let |n| be [=?=][$ConvertToInt$](|v|, 32, "unsigned"), where the destination type is associated with [=[EnforceRange]=].
1365
+
1366
+
Note: This is equivalent to the [=js-unsigned-long|JS conversion rules=] for [=[EnforceRange]=][=unsigned long=].
1367
+
1. Return [=ℝ=](|n|) as a WebAssembly [=u64=].
1368
+
1. If |indextype| is "i64",
1369
+
1. Let |n| be [=?=][$ToBigInt$](|v|).
1370
+
1. If |n| < 0 or |n| > 2<sup>64</sup> − 1, [=throw=] a {{TypeError}}.
1371
+
1372
+
Note: This operation is designed to emulate [=[EnforceRange]=].
0 commit comments