-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathassembly.d.ts
96 lines (80 loc) · 3.02 KB
/
assembly.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
/** An 8-bit signed integer. */
declare type sbyte = number;
/** An 8-bit unsigned integer. */
declare type byte = number;
/** A 16-bit signed integer. */
declare type short = number;
/** A 16-bit unsigned integer. */
declare type ushort = number;
/** A 32-bit signed integer. */
declare type int = number;
/** A 32-bit unsigned integer. */
declare type uint = number;
/** A 64-bit signed integer. */
declare type long = number;
/** A 64-bit unsigned integer. */
declare type ulong = number;
/** A 1-bit unsigned integer.*/
declare type bool = boolean;
/** A 32-bit float. */
declare type float = number;
/** A 64-bit float. */
declare type double = number;
/** A 32-bit unsigned integer when targeting WASM32 respectively a 64-bit unsigned integer when targeting WASM64. */
declare type uintptr = number;
/** A class describing a pointer to a data structure. */
declare class Ptr<T extends number | object> {
public offset: uintptr;
public value: T;
constructor(offset: uintptr);
public increment(diff: uintptr): this;
public decrement(diff: uintptr): this;
}
/** Retrieves the byte size of a data structure. */
declare function sizeof<T>(): uintptr;
declare function sizeof<byte>() : 1;
declare function sizeof<sbyte>() : 1;
declare function sizeof<short>() : 2;
declare function sizeof<ushort>() : 2;
declare function sizeof<int>() : 4;
declare function sizeof<uint>() : 4;
declare function sizeof<long>() : 8;
declare function sizeof<ulong>() : 8;
declare function sizeof<float>() : 4;
declare function sizeof<double>() : 8;
// Fillers for TypeScript complaining about missing types with 'nolib'
interface Array<T> { }
interface Boolean { }
interface Function { }
interface IArguments { }
interface Number { }
interface Object { }
interface RegExp { }
interface String { }
// Builtins
declare function rotl(value: int, shift: int): int;
declare function rotll(value: long, shift: long): long;
declare function rotr(value: int, shift: int): int;
declare function rotrl(value: long, shift: long): long;
declare function clz(value: int): int;
declare function clzl(value: long): long;
declare function ctz(value: int): int;
declare function ctzl(value: long): long;
declare function popcnt(value: int): int;
declare function popcntl(value: long): long;
declare function abs(value: double): double;
declare function absf(value: float): float;
declare function ceil(value: double): double;
declare function ceilf(value: float): float;
declare function floor(value: double): double;
declare function floorf(value: float): float;
declare function sqrt(value: double): double;
declare function sqrtf(value: float): float;
declare function trunc(value: double): double;
declare function truncf(value: float): float;
declare function nearest(value: double): double;
declare function nearestf(value: float): float;
declare function min(left: double, right: double): double;
declare function minf(left: float, right: float): float;
declare function max(left: double, right: double): double;
declare function maxf(left: float, right: float): float;