- Notifications
You must be signed in to change notification settings - Fork 670
/
Copy pathindex.d.ts
2712 lines (2619 loc) · 151 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Environment definitions for compiling AssemblyScript to WebAssembly using asc.
* @module std/assembly
*//***/
/// <reference no-default-lib="true"/>
// Types
/** An 8-bit signed integer. */
declaretypei8=number;
/** A 16-bit signed integer. */
declaretypei16=number;
/** A 32-bit signed integer. */
declaretypei32=number;
/** A 64-bit signed integer. */
declaretypei64=number;
/** A 32-bit signed integer when targeting 32-bit WebAssembly or a 64-bit signed integer when targeting 64-bit WebAssembly. */
declaretypeisize=number;
/** An 8-bit unsigned integer. */
declaretypeu8=number;
/** A 16-bit unsigned integer. */
declaretypeu16=number;
/** A 32-bit unsigned integer. */
declaretypeu32=number;
/** A 64-bit unsigned integer. */
declaretypeu64=number;
/** A 32-bit unsigned integer when targeting 32-bit WebAssembly or a 64-bit unsigned integer when targeting 64-bit WebAssembly. */
declaretypeusize=number;
/** A 1-bit unsigned integer. */
declaretypebool=boolean|number;
/** A 32-bit float. */
declaretypef32=number;
/** A 64-bit float. */
declaretypef64=number;
/** A 128-bit vector. */
declaretypev128=object;
/** Non-nullable function reference. */
declaretyperef_func=object;
/** Canonical nullable function reference. */
declaretypefuncref=ref_func|null;
/** Non-nullable external reference. */
declaretyperef_extern=object;
/** Canonical nullable external reference. */
declaretypeexternref=ref_extern|null;
/** Non-nullable any reference. */
declaretyperef_any=object;
/** Canonical nullable any reference. */
declaretypeanyref=ref_any|null;
/** Non-nullable equatable reference. */
declaretyperef_eq=object;
/** Canonical nullable equatable reference. */
declaretypeeqref=ref_eq|null;
/** Non-nullable struct reference. */
declaretyperef_struct=object;
/** Canonical nullable struct reference. */
declaretypestructref=ref_struct|null;
/** Non-nullable array reference. */
declaretyperef_array=object;
/** Canonical nullable array reference. */
declaretypearrayref=ref_array|null;
/** Non-nullable 31-bit integer reference. */
declaretyperef_i31=object;
/** Canonical nullable 31-bit integer reference. */
declaretypei31ref=ref_i31|null;
/** Non-nullable string reference. */
declaretyperef_string=object;
/** Canonical nullable string reference. */
declaretypestringref=ref_string|null;
/** Non-nullable WTF-8 string view. */
declaretyperef_stringview_wtf8=object;
/** Canonical nullable WTF-8 string view. */
declaretypestringview_wtf8=ref_stringview_wtf8|null;
/** Non-nullable WTF-16 string view. */
declaretyperef_stringview_wtf16=object;
/** Canonical nullable WTF-16 string view. */
declaretypestringview_wtf16=ref_stringview_wtf16|null;
/** Non-nullable string iterator. */
declaretyperef_stringview_iter=object;
/** Canonical nullable string iterator. */
declaretypestringview_iter=ref_stringview_iter|null;
// Compiler hints
/** Compiler target. 0 = JS, 1 = WASM32, 2 = WASM64. */
declareconstASC_TARGET: i32;
/** Runtime type. 0 = Stub, 1 = Minimal, 2 = Incremental. */
declareconstASC_RUNTIME: i32;
/** Provided noAssert option. */
declareconstASC_NO_ASSERT: bool;
/** Provided memoryBase option. */
declareconstASC_MEMORY_BASE: i32;
/** Provided tableBase option. */
declareconstASC_TABLE_BASE: i32;
/** Provided optimizeLevel option. */
declareconstASC_OPTIMIZE_LEVEL: i32;
/** Provided shrinkLevel option. */
declareconstASC_SHRINK_LEVEL: i32;
/** Provided lowMemoryLimit option. */
declareconstASC_LOW_MEMORY_LIMIT: i32;
/** Provided noExportRuntime option. */
declareconstASC_NO_EXPORT_RUNTIME: i32;
/** Whether the sign extension feature is enabled. */
declareconstASC_FEATURE_SIGN_EXTENSION: bool;
/** Whether the mutable globals feature is enabled. */
declareconstASC_FEATURE_MUTABLE_GLOBALS: bool;
/** Whether the non-trapping float-to-int feature is enabled. */
declareconstASC_FEATURE_NONTRAPPING_F2I: bool;
/** Whether the bulk memory feature is enabled. */
declareconstASC_FEATURE_BULK_MEMORY: bool;
/** Whether the SIMD feature is enabled. */
declareconstASC_FEATURE_SIMD: bool;
/** Whether the threads feature is enabled. */
declareconstASC_FEATURE_THREADS: bool;
/** Whether the exception handling feature is enabled. */
declareconstASC_FEATURE_EXCEPTION_HANDLING: bool;
/** Whether the tail calls feature is enabled. */
declareconstASC_FEATURE_TAIL_CALLS: bool;
/** Whether the reference types feature is enabled. */
declareconstASC_FEATURE_REFERENCE_TYPES: bool;
/** Whether the multi value types feature is enabled. */
declareconstASC_FEATURE_MULTI_VALUE: bool;
/** Whether the garbage collection feature is enabled. */
declareconstASC_FEATURE_GC: bool;
/** Whether the memory64 feature is enabled. */
declareconstASC_FEATURE_MEMORY64: bool;
/** Whether the relaxed SIMD feature is enabled. */
declareconstASC_FEATURE_RELAXED_SIMD: bool;
/** Whether the extended const expression feature is enabled. */
declareconstASC_FEATURE_EXTENDED_CONST: bool;
/** Whether the string references feature is enabled. */
declareconstASC_FEATURE_STRINGREF: bool;
/** Major version of the compiler. */
declareconstASC_VERSION_MAJOR: i32;
/** Minor version of the compiler. */
declareconstASC_VERSION_MINOR: i32;
/** Patch version of the compiler. */
declareconstASC_VERSION_PATCH: i32;
// Builtins
/** Performs the sign-agnostic reverse bytes **/
declarefunctionbswap<Textendsi8|u8|i16|u16|i32|u32|i64|u64|isize|usize>(value: T): T;
/** Performs the sign-agnostic count leading zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered leading if the value is zero. */
declarefunctionclz<Textendsi32|i64>(value: T): T;
/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit or 64-bit integer. All zero bits are considered trailing if the value is zero. */
declarefunctionctz<Textendsi32|i64>(value: T): T;
/** Performs the sign-agnostic count number of one bits operation on a 32-bit or 64-bit integer. */
declarefunctionpopcnt<Textendsi32|i64>(value: T): T;
/** Performs the sign-agnostic rotate left operation on a 32-bit or 64-bit integer. */
declarefunctionrotl<Textendsi32|i64>(value: T,shift: T): T;
/** Performs the sign-agnostic rotate right operation on a 32-bit or 64-bit integer. */
declarefunctionrotr<Textendsi32|i64>(value: T,shift: T): T;
/** Computes the absolute value of an integer or float. */
declarefunctionabs<Textendsi32|i64|f32|f64>(value: T): T;
/** Determines the maximum of two integers or floats. If either operand is `NaN`, returns `NaN`. */
declarefunctionmax<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Determines the minimum of two integers or floats. If either operand is `NaN`, returns `NaN`. */
declarefunctionmin<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Performs the ceiling operation on a 32-bit or 64-bit float. */
declarefunctionceil<Textendsf32|f64>(value: T): T;
/** Composes a 32-bit or 64-bit float from the magnitude of `x` and the sign of `y`. */
declarefunctioncopysign<Textendsf32|f64>(x: T,y: T): T;
/** Performs the floor operation on a 32-bit or 64-bit float. */
declarefunctionfloor<Textendsf32|f64>(value: T): T;
/** Rounds to the nearest integer tied to even of a 32-bit or 64-bit float. */
declarefunctionnearest<Textendsf32|f64>(value: T): T;
/** Reinterprets the bits of the specified value as type `T`. Valid reinterpretations are u32/i32 to/from f32 and u64/i64 to/from f64. */
declarefunctionreinterpret<Textendsi32|i64|f32|f64>(value: number): T;
/** Selects one of two pre-evaluated values depending on the condition. */
declarefunctionselect<T>(ifTrue: T,ifFalse: T,condition: bool): T;
/** Calculates the square root of a 32-bit or 64-bit float. */
declarefunctionsqrt<Textendsf32|f64>(value: T): T;
/** Rounds to the nearest integer towards zero of a 32-bit or 64-bit float. */
declarefunctiontrunc<Textendsf32|f64>(value: T): T;
/** Computes the sum of two integers or floats. */
declarefunctionadd<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Computes the difference of two integers or floats. */
declarefunctionsub<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Computes the product of two integers or floats. */
declarefunctionmul<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Computes the quotient of two integers or floats. */
declarefunctiondiv<Textendsi32|i64|f32|f64>(left: T,right: T): T;
/** Return 1 if two numbers are equal to each other, 0 otherwise. */
declarefunctioneq<Textendsi32|i64|f32|f64>(left: T,right: T): i32;
/** Return 0 if two numbers are equal to each other, 1 otherwise. */
declarefunctionne<Textendsi32|i64|f32|f64>(left: T,right: T): i32;
/** Computes the remainder of two integers. */
declarefunctionrem<Textendsi32|i64>(left: T,right: T): T;
/** Loads a value of the specified type from memory. Equivalent to dereferncing a pointer in other languages. */
declarefunctionload<T>(ptr: usize,immOffset?: usize,immAlign?: usize): T;
/** Stores a value of the specified type to memory. Equivalent to dereferencing a pointer in other languages when assigning a value. */
declarefunctionstore<T>(ptr: usize,value: T,immOffset?: usize,immAlign?: usize): void;
/** Emits an unreachable operation that results in a runtime error when executed. Both a statement and an expression. */
declarefunctionunreachable(): never;
/** NaN (not a number) as a 32-bit or 64-bit float depending on context. */
declareconstNaN: f32|f64;
/** Positive infinity as a 32-bit or 64-bit float depending on context. */
declareconstInfinity: f32|f64;
/** Data end offset. */
declareconst__data_end: usize;
/** Stack pointer offset. */
declarelet__stack_pointer: usize;
/** Heap base offset. */
declareconst__heap_base: usize;
/** Determines the byte size of the specified underlying core type. Compiles to a constant. */
declarefunctionsizeof<T>(): usize;
/** Determines the alignment (log2) of the specified underlying core type. Compiles to a constant. */
declarefunctionalignof<T>(): usize;
/** Determines the end offset of the given class type. Compiles to a constant. */
declarefunctionoffsetof<T>(): usize;
/** Determines the offset of the specified field within the given class type. Compiles to a constant. */
declarefunctionoffsetof<T>(fieldName: keyofT|string): usize;
/** Determines the offset of the specified field within the given class type. Returns the class type's end offset if field name has been omitted. Compiles to a constant. */
declarefunctionoffsetof<T>(fieldName?: string): usize;
/** Determines the name of a given type. */
declarefunctionnameof<T>(value?: T): string;
/** Determines the unique runtime id of a class type. Compiles to a constant. */
declarefunctionidof<T>(): u32;
/** Changes the type of any value of `usize` kind to another one of `usize` kind. Useful for casting class instances to their pointer values and vice-versa. Beware that this is unsafe.*/
declarefunctionchangetype<T>(value: any): T;
/** Explicitly requests no bounds checks on the provided expression. Useful for array accesses. */
declarefunctionunchecked<T>(value: T): T;
/** Emits a `call_indirect` instruction, calling the specified function in the function table by index with the specified arguments. Does result in a runtime error if the arguments do not match the called function. */
declarefunctioncall_indirect<T>(index: u32, ...args: unknown[]): T;
/** Instantiates a new instance of `T` using the specified constructor arguments. */
declarefunctioninstantiate<T>(...args: any[]): T;
/** Tests if a 32-bit or 64-bit float is `NaN`. */
declarefunctionisNaN<Textendsf32|f64>(value: T): bool;
/** Tests if a 32-bit or 64-bit float is finite, that is not `NaN` or +/-`Infinity`. */
declarefunctionisFinite<Textendsf32|f64>(value: T): bool;
/** Tests if the specified type *or* expression is of a boolean type. */
declarefunctionisBoolean<T>(value?: any): value is number;
/** Tests if the specified type *or* expression is of an integer type and not a reference. Compiles to a constant. */
declarefunctionisInteger<T>(value?: any): value is number;
/** Tests if the specified type *or* expression can represent negative numbers. Compiles to a constant. */
declarefunctionisSigned<T>(value?: any): value is number;
/** Tests if the specified type *or* expression is of a float type. Compiles to a constant. */
declarefunctionisFloat<T>(value?: any): value is number;
/** Tests if the specified type *or* expression is of a v128 type. Compiles to a constant. */
declarefunctionisVector<T>(value?: any): value is v128;
/** Tests if the specified type *or* expression is of a reference type. Compiles to a constant. */
declarefunctionisReference<T>(value?: any): value is object|string;
/** Tests if the specified type *or* expression can be used as a string. Compiles to a constant. */
declarefunctionisString<T>(value?: any): value is string|String;
/** Tests if the specified type *or* expression can be used as an array. Compiles to a constant. */
declarefunctionisArray<T>(value?: any): value is Array<any>;
/** Tests if the specified type *or* expression can be used as an array like object. Compiles to a constant. */
declarefunctionisArrayLike<T>(value?: any): value is ArrayLike<any>;
/** Tests if the specified type *or* expression is of a function type. Compiles to a constant. */
declarefunctionisFunction<T>(value?: any): value is (...args: any)=>any;
/** Tests if the specified type *or* expression is of a nullable reference type. Compiles to a constant. */
declarefunctionisNullable<T>(value?: any): bool;
/** Tests if the specified expression resolves to a defined element. Compiles to a constant. */
declarefunctionisDefined(expression: any): bool;
/** Tests if the specified expression evaluates to a constant value. Compiles to a constant. */
declarefunctionisConstant(expression: any): bool;
/** Tests if the specified type *or* expression is of a managed type. Compiles to a constant. */
declarefunctionisManaged<T>(value?: any): bool;
/** Tests if the specified type is void. Compiles to a constant. */
declarefunctionisVoid<T>(): bool;
/** Traps if the specified value is not true-ish, otherwise returns the (non-nullable) value. */
declarefunctionassert<T>(isTrueish: T,message?: string): T&(object|string|number);// any better way to model `: T != null`?
/** Parses an integer string to a 64-bit float. */
declarefunctionparseInt(str: string,radix?: i32): f64;
/** Parses a string to a 64-bit float. */
declarefunctionparseFloat(str: string): f64;
/** Returns the 64-bit floating-point remainder of `x/y`. */
declarefunctionfmod(x: f64,y: f64): f64;
/** Returns the 32-bit floating-point remainder of `x/y`. */
declarefunctionfmodf(x: f32,y: f32): f32;
/** Returns the number of parameters in the given function signature type. */
declarefunctionlengthof<Textends(...args: any[])=>any>(func?: T): i32;
/** Encodes a text string as a valid Uniform Resource Identifier (URI). */
declarefunctionencodeURI(str: string): string;
/** Encodes a text string as a valid component of a Uniform Resource Identifier (URI). */
declarefunctionencodeURIComponent(str: string): string;
/** Decodes a Uniform Resource Identifier (URI) previously created by encodeURI. */
declarefunctiondecodeURI(str: string): string;
/** Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent. */
declarefunctiondecodeURIComponent(str: string): string;
/** Atomic operations. */
declarenamespaceatomic{
/** Atomically loads an integer value from memory and returns it. */
exportfunctionload<T>(ptr: usize,immOffset?: usize): T;
/** Atomically stores an integer value to memory. */
exportfunctionstore<T>(ptr: usize,value: T,immOffset?: usize): void;
/** Atomically adds an integer value in memory. */
exportfunctionadd<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically subtracts an integer value in memory. */
exportfunctionsub<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically performs a bitwise AND operation on an integer value in memory. */
exportfunctionand<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically performs a bitwise OR operation on an integer value in memory. */
exportfunctionor<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically performs a bitwise XOR operation on an integer value in memory. */
exportfunctionxor<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically exchanges an integer value in memory. */
exportfunctionxchg<T>(ptr: usize,value: T,immOffset?: usize): T;
/** Atomically compares and exchanges an integer value in memory if the condition is met. */
exportfunctioncmpxchg<T>(ptr: usize,expected: T,replacement: T,immOffset?: usize): T;
/** Performs a wait operation on an address in memory suspending this agent if the integer condition is met. */
exportfunctionwait<T>(ptr: usize,expected: T,timeout?: i64): AtomicWaitResult;
/** Performs a notify operation on an address in memory waking up suspended agents. */
exportfunctionnotify(ptr: usize,count?: i32): i32;
/** Performs a fence operation, preserving synchronization guarantees of higher level languages. */
exportfunctionfence(): void;
}
/** Describes the result of an atomic wait operation. */
declareenumAtomicWaitResult{
/** Woken by another agent. */
OK,
/** Loaded value did not match the expected value. */
NOT_EQUAL,
/** Not woken before the timeout expired. */
TIMED_OUT
}
/** Converts any other numeric value to an 8-bit signed integer. */
declarefunctioni8(value: any): i8;
declarenamespacei8{
/** Smallest representable value. */
exportconstMIN_VALUE: i8;
/** Largest representable value. */
exportconstMAX_VALUE: i8;
/** Parses a string as an i8. */
exportfunctionparse(value: string,radix?: i32): i8;
}
/** Converts any other numeric value to a 16-bit signed integer. */
declarefunctioni16(value: any): i16;
declarenamespacei16{
/** Smallest representable value. */
exportconstMIN_VALUE: i16;
/** Largest representable value. */
exportconstMAX_VALUE: i16;
/** Parses a string as an i16. */
exportfunctionparse(value: string,radix?: i32): i16;
}
/** Converts any other numeric value to a 32-bit signed integer. */
declarefunctioni32(value: any): i32;
declarenamespacei32{
/** Smallest representable value. */
exportconstMIN_VALUE: i32;
/** Largest representable value. */
exportconstMAX_VALUE: i32;
/** Parses a string as an i32. */
exportfunctionparse(value: string,radix?: i32): i32;
/** Loads an 8-bit signed integer value from memory and returns it as a 32-bit integer. */
exportfunctionload8_s(ptr: usize,immOffset?: usize,immAlign?: usize): i32;
/** Loads an 8-bit unsigned integer value from memory and returns it as a 32-bit integer. */
exportfunctionload8_u(ptr: usize,immOffset?: usize,immAlign?: usize): i32;
/** Loads a 16-bit signed integer value from memory and returns it as a 32-bit integer. */
exportfunctionload16_s(ptr: usize,immOffset?: usize,immAlign?: usize): i32;
/** Loads a 16-bit unsigned integer value from memory and returns it as a 32-bit integer. */
exportfunctionload16_u(ptr: usize,immOffset?: usize,immAlign?: usize): i32;
/** Loads a 32-bit integer value from memory. */
exportfunctionload(ptr: usize,immOffset?: usize,immAlign?: usize): i32;
/** Stores a 32-bit integer value to memory as an 8-bit integer. */
exportfunctionstore8(ptr: usize,value: i32,immOffset?: usize,immAlign?: usize): void;
/** Stores a 32-bit integer value to memory as a 16-bit integer. */
exportfunctionstore16(ptr: usize,value: i32,immOffset?: usize,immAlign?: usize): void;
/** Stores a 32-bit integer value to memory. */
exportfunctionstore(ptr: usize,value: i32,immOffset?: usize,immAlign?: usize): void;
/** Performs the sign-agnostic count leading zero bits operation on a 32-bit integer. All zero bits are considered leading if the value is zero. */
exportfunctionclz(value: i32): i32;
/** Performs the sign-agnostic count tailing zero bits operation on a 32-bit integer. All zero bits are considered trailing if the value is zero. */
exportfunctionctz(value: i32): i32;
/** Performs the sign-agnostic count number of one bits operation on a 32-bit integer. */
exportfunctionpopcnt(value: i32): i32;
/** Performs the sign-agnostic rotate left operation on a 32-bit integer. */
exportfunctionrotl(value: i32,shift: i32): i32;
/** Performs the sign-agnostic rotate right operation on a 32-bit integer. */
exportfunctionrotr(value: i32,shift: i32): i32;
/** Reinterprets the bits of the specified 32-bit float as a 32-bit integer. */
exportfunctionreinterpret_f32(value: f32): i32;
/** Computes the sum of two 32-bit integers. */
exportfunctionadd(left: i32,right: i32): i32;
/** Computes the difference of two 32-bit integers. */
exportfunctionsub(left: i32,right: i32): i32;
/** Computes the product of two 32-bit integers. */
exportfunctionmul(left: i32,right: i32): i32;
/** Computes the signed quotient of two 32-bit integers. */
exportfunctiondiv_s(left: i32,right: i32): i32;
/** Computes the unsigned quotient of two 32-bit integers. */
exportfunctiondiv_u(left: i32,right: i32): i32;
/** Return 1 if two 32-bit integers are equal to each other, 0 otherwise. */
exportfunctioneq(left: i32,right: i32): i32;
/** Return 0 if two 32-bit integers are equal to each other, 1 otherwise. */
exportfunctionne(left: i32,right: i32): i32;
/** Computes the signed remainder of two 32-bit integers. */
exportfunctionrem_s(left: i32,right: i32): i32;
/** Computes the unsigned remainder of two 32-bit integers. */
exportfunctionrem_u(left: u32,right: u32): u32;
/** Atomic 32-bit integer operations. */
exportnamespaceatomic{
/** Atomically loads an 8-bit unsigned integer value from memory and returns it as a 32-bit integer. */
exportfunctionload8_u(ptr: usize,immOffset?: usize): i32;
/** Atomically loads a 16-bit unsigned integer value from memory and returns it as a 32-bit integer. */
exportfunctionload16_u(ptr: usize,immOffset?: usize): i32;
/** Atomically loads a 32-bit integer value from memory and returns it. */
exportfunctionload(ptr: usize,immOffset?: usize): i32;
/** Atomically stores a 32-bit integer value to memory as an 8-bit integer. */
exportfunctionstore8(ptr: usize,value: i32,immOffset?: usize): void;
/** Atomically stores a 32-bit integer value to memory as a 16-bit integer. */
exportfunctionstore16(ptr: usize,value: i32,immOffset?: usize): void;
/** Atomically stores a 32-bit integer value to memory. */
exportfunctionstore(ptr: usize,value: i32,immOffset?: usize): void;
/** Atomic 32-bit integer read-modify-write operations on 8-bit values. */
exportnamespacermw8{
/** Atomically adds an 8-bit unsigned integer value in memory. */
exportfunctionadd_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically subtracts an 8-bit unsigned integer value in memory. */
exportfunctionsub_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise AND operation an 8-bit unsigned integer value in memory. */
exportfunctionand_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise OR operation an 8-bit unsigned integer value in memory. */
exportfunctionor_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise XOR operation an 8-bit unsigned integer value in memory. */
exportfunctionxor_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically exchanges an 8-bit unsigned integer value in memory. */
exportfunctionxchg_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically compares and exchanges an 8-bit unsigned integer value in memory if the condition is met. */
exportfunctioncmpxchg_u(ptr: usize,expected: i32,replacement: i32,immOffset?: usize): i32;
}
/** Atomic 32-bit integer read-modify-write operations on 16-bit values. */
exportnamespacermw16{
/** Atomically adds a 16-bit unsigned integer value in memory. */
exportfunctionadd_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically adds a 16-bit unsigned integer value in memory. */
exportfunctionsub_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise AND operation a 16-bit unsigned integer value in memory. */
exportfunctionand_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise OR operation a 16-bit unsigned integer value in memory. */
exportfunctionor_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise XOR operation a 16-bit unsigned integer value in memory. */
exportfunctionxor_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically exchanges a 16-bit unsigned integer value in memory. */
exportfunctionxchg_u(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically compares and exchanges a 16-bit unsigned integer value in memory if the condition is met. */
exportfunctioncmpxchg_u(ptr: usize,expected: i32,replacement: i32,immOffset?: usize): i32;
}
/** Atomic 32-bit integer read-modify-write operations. */
exportnamespacermw{
/** Atomically adds a 32-bit integer value in memory. */
exportfunctionadd(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically subtracts a 32-bit integer value in memory. */
exportfunctionsub(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise AND operation a 32-bit integer value in memory. */
exportfunctionand(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise OR operation a 32-bit integer value in memory. */
exportfunctionor(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically performs a bitwise XOR operation a 32-bit integer value in memory. */
exportfunctionxor(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically exchanges a 32-bit integer value in memory. */
exportfunctionxchg(ptr: usize,value: i32,immOffset?: usize): i32;
/** Atomically compares and exchanges a 32-bit integer value in memory if the condition is met. */
exportfunctioncmpxchg(ptr: usize,expected: i32,replacement: i32,immOffset?: usize): i32;
}
}
}
/** Converts any other numeric value to a 64-bit signed integer. */
declarefunctioni64(value: any): i64;
declarenamespacei64{
/** Smallest representable value. */
exportconstMIN_VALUE: i64;
/** Largest representable value. */
exportconstMAX_VALUE: i64;
/** Parses a string as an i64. */
exportfunctionparse(value: string,radix?: i32): i64;
/** Loads an 8-bit signed integer value from memory and returns it as a 64-bit integer. */
exportfunctionload8_s(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads an 8-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload8_u(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads a 16-bit signed integer value from memory and returns it as a 64-bit integer. */
exportfunctionload16_s(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads a 16-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload16_u(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads a 32-bit signed integer value from memory and returns it as a 64-bit integer. */
exportfunctionload32_s(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads a 32-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload32_u(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Loads a 64-bit unsigned integer value from memory. */
exportfunctionload(ptr: usize,immOffset?: usize,immAlign?: usize): i64;
/** Stores a 64-bit integer value to memory as an 8-bit integer. */
exportfunctionstore8(ptr: usize,value: i64,immOffset?: usize,immAlign?: usize): void;
/** Stores a 64-bit integer value to memory as a 16-bit integer. */
exportfunctionstore16(ptr: usize,value: i64,immOffset?: usize,immAlign?: usize): void;
/** Stores a 64-bit integer value to memory as a 32-bit integer. */
exportfunctionstore32(ptr: usize,value: i64,immOffset?: usize,immAlign?: usize): void;
/** Stores a 64-bit integer value to memory. */
exportfunctionstore(ptr: usize,value: i64,immOffset?: usize,immAlign?: usize): void;
/** Performs the sign-agnostic count leading zero bits operation on a 64-bit integer. All zero bits are considered leading if the value is zero. */
exportfunctionclz(value: i64): i64;
/** Performs the sign-agnostic count tailing zero bits operation on a 64-bit integer. All zero bits are considered trailing if the value is zero. */
exportfunctionctz(value: i64): i64;
/** Performs the sign-agnostic count number of one bits operation on a 64-bit integer. */
exportfunctionpopcnt(value: i64): i64;
/** Performs the sign-agnostic rotate left operation on a 64-bit integer. */
exportfunctionrotl(value: i64,shift: i64): i64;
/** Performs the sign-agnostic rotate right operation on a 64-bit integer. */
exportfunctionrotr(value: i64,shift: i64): i64;
/** Reinterprets the bits of the specified 64-bit float as a 64-bit integer. */
exportfunctionreinterpret_f64(value: f64): i64;
/** Computes the sum of two 64-bit integers. */
exportfunctionadd(left: i64,right: i64): i64;
/** Computes the difference of two 64-bit integers. */
exportfunctionsub(left: i64,right: i64): i64;
/** Computes the product of two 64-bit integers. */
exportfunctionmul(left: i64,right: i64): i64;
/** Computes the signed quotient of two 64-bit integers. */
exportfunctiondiv_s(left: i64,right: i64): i64;
/** Computes the unsigned quotient of two 64-bit integers. */
exportfunctiondiv_u(left: i64,right: i64): i64;
/** Return 1 if two 64-bit integers are equal to each other, 0 otherwise. */
exportfunctioneq(left: i64,right: i64): i32;
/** Return 0 if two 64-bit integers are equal to each other, 1 otherwise. */
exportfunctionne(left: i64,right: i64): i32;
/** Computes the signed remainder of two 64-bit integers. */
exportfunctionrem_s(left: i64,right: i64): i64;
/** Computes the unsigned remainder of two 64-bit integers. */
exportfunctionrem_u(left: u64,right: u64): u64;
/** Atomic 64-bit integer operations. */
exportnamespaceatomic{
/** Atomically loads an 8-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload8_u(ptr: usize,immOffset?: usize): i64;
/** Atomically loads a 16-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload16_u(ptr: usize,immOffset?: usize): i64;
/** Atomically loads a 32-bit unsigned integer value from memory and returns it as a 64-bit integer. */
exportfunctionload32_u(ptr: usize,immOffset?: usize): i64;
/** Atomically loads a 64-bit integer value from memory and returns it. */
exportfunctionload(ptr: usize,immOffset?: usize): i64;
/** Atomically stores a 64-bit integer value to memory as an 8-bit integer. */
exportfunctionstore8(ptr: usize,value: i64,immOffset?: usize): void;
/** Atomically stores a 64-bit integer value to memory as a 16-bit integer. */
exportfunctionstore16(ptr: usize,value: i64,immOffset?: usize): void;
/** Atomically stores a 64-bit integer value to memory as a 32-bit integer. */
exportfunctionstore32(ptr: usize,value: i64,immOffset?: usize): void;
/** Atomically stores a 64-bit integer value to memory. */
exportfunctionstore(ptr: usize,value: i64,immOffset?: usize): void;
/** Atomic 64-bit integer read-modify-write operations on 8-bit values. */
exportnamespacermw8{
/** Atomically adds an 8-bit unsigned integer value in memory. */
exportfunctionadd_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically subtracts an 8-bit unsigned integer value in memory. */
exportfunctionsub_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise AND operation on an 8-bit unsigned integer value in memory. */
exportfunctionand_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise OR operation on an 8-bit unsigned integer value in memory. */
exportfunctionor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise XOR operation on an 8-bit unsigned integer value in memory. */
exportfunctionxor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically exchanges an 8-bit unsigned integer value in memory. */
exportfunctionxchg_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically compares and exchanges an 8-bit unsigned integer value in memory if the condition is met. */
exportfunctioncmpxchg_u(ptr: usize,expected: i64,replacement: i64,immOffset?: usize): i64;
}
/** Atomic 64-bit integer read-modify-write operations on 16-bit values. */
exportnamespacermw16{
/** Atomically adds a 16-bit unsigned integer value in memory. */
exportfunctionadd_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically subtracts a 16-bit unsigned integer value in memory. */
exportfunctionsub_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise AND operation on a 16-bit unsigned integer value in memory. */
exportfunctionand_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise OR operation on a 16-bit unsigned integer value in memory. */
exportfunctionor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise XOR operation on a 16-bit unsigned integer value in memory. */
exportfunctionxor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically exchanges a 16-bit unsigned integer value in memory. */
exportfunctionxchg_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically compares and exchanges a 16-bit unsigned integer value in memory if the condition is met. */
exportfunctioncmpxchg_u(ptr: usize,expected: i64,replacement: i64,immOffset?: usize): i64;
}
/** Atomic 64-bit integer read-modify-write operations on 32-bit values. */
exportnamespacermw32{
/** Atomically adds a 32-bit unsigned integer value in memory. */
exportfunctionadd_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically subtracts a 32-bit unsigned integer value in memory. */
exportfunctionsub_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise AND operation on a 32-bit unsigned integer value in memory. */
exportfunctionand_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise OR operation on a 32-bit unsigned integer value in memory. */
exportfunctionor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise XOR operation on a 32-bit unsigned integer value in memory. */
exportfunctionxor_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically exchanges a 32-bit unsigned integer value in memory. */
exportfunctionxchg_u(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically compares and exchanges a 32-bit unsigned integer value in memory if the condition is met. */
exportfunctioncmpxchg_u(ptr: usize,expected: i64,replacement: i64,immOffset?: usize): i64;
}
/** Atomic 64-bit integer read-modify-write operations. */
exportnamespacermw{
/** Atomically adds a 64-bit integer value in memory. */
exportfunctionadd(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically subtracts a 64-bit integer value in memory. */
exportfunctionsub(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise AND operation on a 64-bit integer value in memory. */
exportfunctionand(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise OR operation on a 64-bit integer value in memory. */
exportfunctionor(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically performs a bitwise XOR operation on a 64-bit integer value in memory. */
exportfunctionxor(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically exchanges a 64-bit integer value in memory. */
exportfunctionxchg(ptr: usize,value: i64,immOffset?: usize): i64;
/** Atomically compares and exchanges a 64-bit integer value in memory if the condition is met. */
exportfunctioncmpxchg(ptr: usize,expected: i64,replacement: i64,immOffset?: usize): i64;
}
}
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) signed integer. */
declareletisize: typeofi32|typeofi64;
/** Converts any other numeric value to an 8-bit unsigned integer. */
declarefunctionu8(value: any): u8;
declarenamespaceu8{
/** Smallest representable value. */
exportconstMIN_VALUE: u8;
/** Largest representable value. */
exportconstMAX_VALUE: u8;
/** Parses a string as an u8. */
exportfunctionparse(value: string,radix?: i32): u8;
}
/** Converts any other numeric value to a 16-bit unsigned integer. */
declarefunctionu16(value: any): u16;
declarenamespaceu16{
/** Smallest representable value. */
exportconstMIN_VALUE: u16;
/** Largest representable value. */
exportconstMAX_VALUE: u16;
/** Parses a string as an u16. */
exportfunctionparse(value: string,radix?: i32): u16;
}
/** Converts any other numeric value to a 32-bit unsigned integer. */
declarefunctionu32(value: any): u32;
declarenamespaceu32{
/** Smallest representable value. */
exportconstMIN_VALUE: u32;
/** Largest representable value. */
exportconstMAX_VALUE: u32;
/** Parses a string as an u32. */
exportfunctionparse(value: string,radix?: i32): u32;
}
/** Converts any other numeric value to a 64-bit unsigned integer. */
declarefunctionu64(value: any): u64;
declarenamespaceu64{
/** Smallest representable value. */
exportconstMIN_VALUE: u64;
/** Largest representable value. */
exportconstMAX_VALUE: u64;
/** Parses a string as an u64. */
exportfunctionparse(value: string,radix?: i32): u64;
}
/** Converts any other numeric value to a 32-bit (in WASM32) respectivel 64-bit (in WASM64) unsigned integer. */
declareletusize: typeofu32|typeofu64;
/** Converts any other numeric value to a 1-bit unsigned integer. */
declarefunctionbool(value: any): bool;
declarenamespacebool{
/** Smallest representable value. */
exportconstMIN_VALUE: bool;
/** Largest representable value. */
exportconstMAX_VALUE: bool;
/** Parses a string as a bool. */
exportfunctionparse(value: string): bool;
}
/** Converts any other numeric value to a 32-bit float. */
declarefunctionf32(value: any): f32;
declarenamespacef32{
/** Smallest representable value. */
exportconstMIN_VALUE: f32;
/** Largest representable value. */
exportconstMAX_VALUE: f32;
/** Smallest normalized positive value. */
exportconstMIN_NORMAL_VALUE: f32;
/** Smallest safely representable integer value. */
exportconstMIN_SAFE_INTEGER: f32;
/** Largest safely representable integer value. */
exportconstMAX_SAFE_INTEGER: f32;
/** Positive infinity value. */
exportconstPOSITIVE_INFINITY: f32;
/** Negative infinity value. */
exportconstNEGATIVE_INFINITY: f32;
/** Not a number value. */
exportconstNaN: f32;
/** Difference between 1 and the smallest representable value greater than 1. */
exportconstEPSILON: f32;
/** Parses a string as an f32. */
exportfunctionparse(value: string): f32;
/** Loads a 32-bit float from memory. */
exportfunctionload(ptr: usize,immOffset?: usize,immAlign?: usize): f32;
/** Stores a 32-bit float to memory. */
exportfunctionstore(ptr: usize,value: f32,immOffset?: usize,immAlign?: usize): void;
/** Computes the sum of two 32-bit floats. */
exportfunctionadd(left: f32,right: f32): f32;
/** Computes the difference of two 32-bit floats. */
exportfunctionsub(left: f32,right: f32): f32;
/** Computes the product of two 32-bit floats. */
exportfunctionmul(left: f32,right: f32): f32;
/** Computes the quotient of two 32-bit floats. */
exportfunctiondiv(left: f32,right: f32): f32;
/** Return 1 two 32-bit floats are equal to each other, 0 otherwise. */
exportfunctioneq(left: f32,right: f32): i32;
/** Return 0 two 32-bit floats are equal to each other, 1 otherwise. */
exportfunctionne(left: f32,right: f32): i32;
/** Computes the absolute value of a 32-bit float. */
exportfunctionabs(value: f32): f32;
/** Determines the maximum of two 32-bit floats. If either operand is `NaN`, returns `NaN`. */
exportfunctionmax(left: f32,right: f32): f32;
/** Determines the minimum of two 32-bit floats. If either operand is `NaN`, returns `NaN`. */
exportfunctionmin(left: f32,right: f32): f32;
/** Performs the ceiling operation on a 32-bit float. */
exportfunctionceil(value: f32): f32;
/** Composes a 32-bit float from the magnitude of `x` and the sign of `y`. */
exportfunctioncopysign(x: f32,y: f32): f32;
/** Performs the floor operation on a 32-bit float. */
exportfunctionfloor(value: f32): f32;
/** Rounds to the nearest integer tied to even of a 32-bit float. */
exportfunctionnearest(value: f32): f32;
/** Reinterprets the bits of the specified 32-bit integer as a 32-bit float. */
exportfunctionreinterpret_i32(value: i32): f32;
/** Calculates the square root of a 32-bit float. */
exportfunctionsqrt(value: f32): f32;
/** Rounds to the nearest integer towards zero of a 32-bit float. */
exportfunctiontrunc(value: f32): f32;
}
/** Converts any other numeric value to a 64-bit float. */
declarefunctionf64(value: any): f64;
declarenamespacef64{
/** Smallest representable value. */
exportconstMIN_VALUE: f64;
/** Largest representable value. */
exportconstMAX_VALUE: f64;
/** Smallest normalized positive value. */
exportconstMIN_NORMAL_VALUE: f64;
/** Smallest safely representable integer value. */
exportconstMIN_SAFE_INTEGER: f64;
/** Largest safely representable integer value. */
exportconstMAX_SAFE_INTEGER: f64;
/** Positive infinity value. */
exportconstPOSITIVE_INFINITY: f64;
/** Negative infinity value. */
exportconstNEGATIVE_INFINITY: f64;
/** Not a number value. */
exportconstNaN: f64;
/** Difference between 1 and the smallest representable value greater than 1. */
exportconstEPSILON: f64;
/** Parses a string as an f64. */
exportfunctionparse(value: string): f64;
/** Loads a 64-bit float from memory. */
exportfunctionload(ptr: usize,immOffset?: usize,immAlign?: usize): f64;
/** Stores a 64-bit float to memory. */
exportfunctionstore(ptr: usize,value: f64,immOffset?: usize,immAlign?: usize): void;
/** Computes the sum of two 64-bit floats. */
exportfunctionadd(left: f64,right: f64): f64;
/** Computes the difference of two 64-bit floats. */
exportfunctionsub(left: f64,right: f64): f64;
/** Computes the product of two 64-bit floats. */
exportfunctionmul(left: f64,right: f64): f64;
/** Computes the quotient of two 64-bit floats. */
exportfunctiondiv(left: f64,right: f64): f64;
/** Return 1 two 64-bit floats are equal to each other, 0 otherwise. */
exportfunctioneq(left: f64,right: f64): i32;
/** Return 0 two 32-bit floats are equal to each other, 1 otherwise. */
exportfunctionne(left: f64,right: f64): i32;
/** Computes the absolute value of a 64-bit float. */
exportfunctionabs(value: f64): f64;
/** Determines the maximum of two 64-bit floats. If either operand is `NaN`, returns `NaN`. */
exportfunctionmax(left: f64,right: f64): f64;
/** Determines the minimum of two 64-bit floats. If either operand is `NaN`, returns `NaN`. */
exportfunctionmin(left: f64,right: f64): f64;
/** Performs the ceiling operation on a 64-bit float. */
exportfunctionceil(value: f64): f64;
/** Composes a 64-bit float from the magnitude of `x` and the sign of `y`. */
exportfunctioncopysign(x: f64,y: f64): f64;
/** Performs the floor operation on a 64-bit float. */
exportfunctionfloor(value: f64): f64;
/** Rounds to the nearest integer tied to even of a 64-bit float. */
exportfunctionnearest(value: f64): f64;
/** Reinterprets the bits of the specified 64-bit integer as a 64-bit float. */
exportfunctionreinterpret_i64(value: i64): f64;
/** Calculates the square root of a 64-bit float. */
exportfunctionsqrt(value: f64): f64;
/** Rounds to the nearest integer towards zero of a 64-bit float. */
exportfunctiontrunc(value: f64): f64;
}
/** Initializes a 128-bit vector from sixteen 8-bit integer values. Arguments must be compile-time constants. */
declarefunctionv128(a: i8,b: i8,c: i8,d: i8,e: i8,f: i8,g: i8,h: i8,i: i8,j: i8,k: i8,l: i8,m: i8,n: i8,o: i8,p: i8): v128;
declarenamespacev128{
/** Creates a vector with identical lanes. */
exportfunctionsplat<T>(x: T): v128;
/** Extracts one lane as a scalar. idx argument needs to be compile time constant. */
exportfunctionextract_lane<T>(x: v128,idx: u8): T;
/** Replaces one lane. idx argument needs to be compile time constant.*/
exportfunctionreplace_lane<T>(x: v128,idx: u8,value: T): v128;
/** Selects lanes from either vector according to the specified lane indexes. */
exportfunctionshuffle<T>(a: v128,b: v128, ...lanes: u8[]): v128;
/** Selects 8-bit lanes from the first vector according to the indexes [0-15] specified by the 8-bit lanes of the second vector. */
exportfunctionswizzle(a: v128,s: v128): v128;
/** Loads a vector from memory. */
exportfunctionload(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Creates a vector by loading the lanes of the specified type and extending each to the next larger type. */
exportfunctionload_ext<TFrom>(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Creates a vector by loading a value of the specified type into the lowest bits and initializing all other bits of the vector to zero. */
exportfunctionload_zero<TFrom>(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads a single lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
exportfunctionload_lane<T>(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): v128;
/** Stores the single lane at the specified index of the given vector to memory. */
exportfunctionstore_lane<T>(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): void;
/** Creates a vector with eight 16-bit integer lanes by loading and sign extending eight 8-bit integers. */
exportfunctionload8x8_s(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with eight 16-bit integer lanes by loading and zero extending eight 8-bit integers. */
exportfunctionload8x8_u(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with four 32-bit integer lanes by loading and sign extending four 16-bit integers. */
exportfunctionload16x4_s(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with four 32-bit integer lanes by loading and zero extending four 16-bit integers. */
exportfunctionload16x4_u(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with two 64-bit integer lanes by loading and sign extending two 32-bit integers. */
exportfunctionload32x2_s(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with two 64-bit integer lanes by loading and zero extending two 32-bit integers. */
exportfunctionload32x2_u(ptr: usize,immOffset?: u32,immAlign?: u32): v128;
/** Creates a vector with identical lanes by loading the splatted value. */
exportfunctionload_splat<T>(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads an 8-bit integer and splats it sixteen times forming a new vector. */
exportfunctionload8_splat(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads a 16-bit integer and splats it eight times forming a new vector. */
exportfunctionload16_splat(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads a 32-bit integer and splats it four times forming a new vector. */
exportfunctionload32_splat(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads a 64-bit integer and splats it two times forming a new vector. */
exportfunctionload64_splat(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Creates a vector by loading a 32-bit value into the lowest bits and initializing all other bits of the vector to zero. */
exportfunctionload32_zero(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Creates a vector by loading a 64-bit value into the lowest bits and initializing all other bits of the vector to zero. */
exportfunctionload64_zero(ptr: usize,immOffset?: usize,immAlign?: usize): v128;
/** Loads a single 8-bit lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
exportfunctionload8_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): v128;
/** Loads a single 16-bit lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
exportfunctionload16_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): v128;
/** Loads a single 32-bit lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
exportfunctionload32_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): v128;
/** Loads a single 64-bit lane from memory into the specified lane of the given vector. Other lanes are bypassed as is. */
exportfunctionload64_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): v128;
/** Stores the 8-bit lane at the specified lane of the given vector to memory. */
exportfunctionstore8_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): void;
/** Stores the 16-bit lane at the specified lane of the given vector to memory. */
exportfunctionstore16_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): void;
/** Stores the 32-bit lane at the specified lane of the given vector to memory. */
exportfunctionstore32_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): void;
/** Stores the 64-bit lane at the specified lane of the given vector to memory. */
exportfunctionstore64_lane(ptr: usize,vec: v128,idx: u8,immOffset?: usize,immAlign?: usize): void;
/** Stores a vector to memory. */
exportfunctionstore(ptr: usize,value: v128,immOffset?: usize,immAlign?: usize): void;
/** Adds each lane. */
exportfunctionadd<T>(a: v128,b: v128): v128;
/** Subtracts each lane. */
exportfunctionsub<T>(a: v128,b: v128): v128;
/** Multiplies each lane. */
exportfunctionmul<T>(a: v128,b: v128): v128;// except i64
/** Divides each lane. */
exportfunctiondiv<Textendsf32|f64>(a: v128,b: v128): v128;
/** Negates each lane of a vector. */
exportfunctionneg<T>(a: v128): v128;
/** Adds each lane using saturation. */
exportfunctionadd_sat<T>(a: v128,b: v128): v128;
/** Subtracts each lane using saturation. */
exportfunctionsub_sat<T>(a: v128,b: v128): v128;
/** Performs a bitwise left shift on each lane of a vector by a scalar. */
exportfunctionshl<T>(a: v128,b: i32): v128;
/** Performs a bitwise right shift on each lane of a vector by a scalar. */
exportfunctionshr<T>(a: v128,b: i32): v128;
/** Performs the bitwise AND operation on two vectors. */
exportfunctionand(a: v128,b: v128): v128;
/** Performs the bitwise OR operation on two vectors. */
exportfunctionor(a: v128,b: v128): v128;
/** Performs the bitwise XOR operation on two vectors. */
exportfunctionxor(a: v128,b: v128): v128;
/** Performs the bitwise ANDNOT operation on two vectors. */
exportfunctionandnot(a: v128,b: v128): v128;
/** Performs the bitwise NOT operation on a vector. */
exportfunctionnot(a: v128): v128;
/** Selects bits of either vector according to the specified mask. Selects from `v1` if the bit in `mask` is `1`, otherwise from `v2`. */
exportfunctionbitselect(v1: v128,v2: v128,mask: v128): v128;
/** Reduces a vector to a scalar indicating whether any lane is considered `true`. */
exportfunctionany_true(a: v128): bool;
/** Reduces a vector to a scalar indicating whether all lanes are considered `true`. */
exportfunctionall_true<T>(a: v128): bool;
/** Extracts the high bit of each lane and produces a scalar mask with all bits concatenated. */
exportfunctionbitmask<T>(a: v128): i32;
/** Counts the number of bits set to one within each lane. */
exportfunctionpopcnt<T>(a: v128): v128;
/** Computes the minimum of each lane. */
exportfunctionmin<T>(a: v128,b: v128): v128;
/** Computes the maximum of each lane. */
exportfunctionmax<T>(a: v128,b: v128): v128;
/** Computes the pseudo-minimum of each lane. */
exportfunctionpmin<Textendsf32|f64>(a: v128,b: v128): v128;
/** Computes the pseudo-maximum of each lane. */
exportfunctionpmax<Textendsf32|f64>(a: v128,b: v128): v128;
/** Computes the dot product of two lanes each, yielding lanes one size wider than the input. */
exportfunctiondot<Textendsi16>(a: v128,b: v128): v128;
/** Computes the average of each lane. */
exportfunctionavgr<Textendsu8|u16>(a: v128,b: v128): v128;
/** Computes the absolute value of each lane. */
exportfunctionabs<Textendsf32|f64>(a: v128): v128;
/** Computes the square root of each lane. */
exportfunctionsqrt<Textendsf32|f64>(a: v128): v128;
/** Performs the ceiling operation on each lane. */
exportfunctionceil<Textendsf32|f64>(a: v128): v128;
/** Performs the floor operation on each lane. */
exportfunctionfloor<Textendsf32|f64>(a: v128): v128;
/** Rounds to the nearest integer towards zero of each lane. */
exportfunctiontrunc<Textendsf32|f64>(a: v128): v128;
/** Rounds to the nearest integer tied to even of each lane. */
exportfunctionnearest<Textendsf32|f64>(a: v128): v128;
/** Computes which lanes are equal. */
exportfunctioneq<T>(a: v128,b: v128): v128;
/** Computes which lanes are not equal. */
exportfunctionne<T>(a: v128,b: v128): v128;
/** Computes which lanes of the first vector are less than those of the second. */
exportfunctionlt<T>(a: v128,b: v128): v128;
/** Computes which lanes of the first vector are less than or equal those of the second. */
exportfunctionle<T>(a: v128,b: v128): v128;
/** Computes which lanes of the first vector are greater than those of the second. */
exportfunctiongt<T>(a: v128,b: v128): v128;
/** Computes which lanes of the first vector are greater than or equal those of the second. */
exportfunctionge<T>(a: v128,b: v128): v128;
/** Converts each lane of a vector from integer to single-precision floating point. */
exportfunctionconvert<TFromextendsi32|u32>(a: v128): v128;
/** Converts the low lanes of a vector from integer to double-precision floating point. */
exportfunctionconvert_low<TFromextendsi32|u32>(a: v128): v128;
/** Truncates each lane of a vector from single-precision floating point to integer with saturation. Takes the target type. */
exportfunctiontrunc_sat<TToextendsi32|u32>(a: v128): v128;
/** Truncates each lane of a vector from double-precision floating point to integer with saturation. Takes the target type. */
exportfunctiontrunc_sat_zero<TToextendsi32|u32>(a: v128): v128;
/** Narrows each lane to their respective narrower lanes. */
exportfunctionnarrow<TFromextendsi16|i32>(a: v128,b: v128): v128;
/** Extends the low lanes of a vector to their respective wider lanes. */
exportfunctionextend_low<TFromextendsi8|u8|i16|u16|i32|u32>(a: v128): v128;
/** Extends the high lanes of a vector to their respective wider lanes. */
exportfunctionextend_high<TFromextendsi8|u8|i16|u16|i32|u32>(a: v128): v128;
/** Adds lanes pairwise producing twice wider extended results. */
exportfunctionextadd_pairwise<TFromextendsi8|u8|i16|u16>(a: v128): v128;
/** Demotes each float lane to lower precision. The higher lanes of the result are initialized to zero. */
exportfunctiondemote_zero<Textendsf64=f64>(a: v128): v128;
/** Promotes the lower float lanes to higher precision. */
exportfunctionpromote_low<Textendsf32=f32>(a: v128): v128;
/** Performs the line-wise saturating rounding multiplication in Q15 format (`(a[i] * b[i] + (1 << (Q - 1))) >> Q` where `Q=15`). */
exportfunctionq15mulr_sat<Textendsi16>(a: v128,b: v128): v128;
/** Performs the lane-wise integer extended multiplication of the lower lanes producing a twice wider result than the inputs. */
exportfunctionextmul_low<Textendsi8|u8|i16|u16|i32|u32>(a: v128,b: v128): v128;
/** Performs the lane-wise integer extended multiplication of the higher lanes producing a twice wider result than the inputs. */
exportfunctionextmul_high<Textendsi8|u8|i16|u16|i32|u32>(a: v128,b: v128): v128;
/**
* Selects 8-bit lanes from `a` using indices in `s`. Indices in the range [0-15] select the i-th element of `a`.
*
* Unlike {@link v128.swizzle}, the result of an out of bounds index is implementation-defined, depending on hardware
* capabilities: Either `0` or `a[s[i]%16]`.
*/
exportfunctionrelaxed_swizzle(a: v128,s: v128): v128;
/**
* Truncates each lane of a vector from 32-bit floating point to a 32-bit signed or unsigned integer as indicated by
* `T`.
*
* Unlike {@link v128.trunc_sat}, the result of lanes out of bounds of the target type is implementation defined,
* depending on hardware capabilities:
* - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
* - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
* saturatated result or maximum integer value.
*/
exportfunctionrelaxed_trunc<Textendsi32|u32>(a: v128): v128;
/**
* Truncates each lane of a vector from 64-bit floating point to a 32-bit signed or unsigned integer as indicated by
* `T`. Unused higher integer lanes of the result are initialized to zero.
*
* Unlike {@link v128.trunc_sat_zero}, the result of lanes out of bounds of the target type is implementation defined,
* depending on hardware capabilities:
* - If the input lane contains `NaN`, the result is either `0` or the respective maximum integer value.
* - If the input lane contains a value otherwise out of bounds of the target type, the result is either the
* saturatated result or maximum integer value.
*/
exportfunctionrelaxed_trunc_zero<Textendsi32|u32>(a: v128): v128;
/**
* Performs the fused multiply-add operation (`a * b + c`) on 32- or 64-bit floating point lanes as indicated by
* `T`.
*
* The result is implementation defined, depending on hardware capabilities:
* - Either `a * b` is rounded once and the final result rounded again, or
* - The expression is evaluated with higher precision and only rounded once
*/
exportfunctionrelaxed_madd<T>(a: v128,b: v128,c: v128): v128;
/**
* Performs the fused negative multiply-add operation (`-(a * b) + c`) on 32- or 64-bit floating point lanes as
* indicated by `T`.
*
* The result is implementation defined, depending on hardware capabilities:
* - Either `a * b` is rounded once and the final result rounded again, or
* - The expression is evaluated with higher precision and only rounded once