toilscript 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "imports": {
3
- "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.5/dist/toilscript.js",
4
- "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.5/dist/cli.js",
3
+ "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.6/dist/toilscript.js",
4
+ "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.6/dist/cli.js",
5
5
  "binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
6
6
  "long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
7
7
  }
package/dist/web.js CHANGED
@@ -1,8 +1,8 @@
1
- var ASSEMBLYSCRIPT_VERSION = "0.1.5";
1
+ var ASSEMBLYSCRIPT_VERSION = "0.1.6";
2
2
  var ASSEMBLYSCRIPT_IMPORTMAP = {
3
3
  "imports": {
4
- "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.5/dist/toilscript.js",
5
- "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.5/dist/cli.js",
4
+ "toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.6/dist/toilscript.js",
5
+ "toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.6/dist/cli.js",
6
6
  "binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
7
7
  "long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
8
8
  }
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "toilscript",
9
9
  "wasm"
10
10
  ],
11
- "version": "0.1.5",
11
+ "version": "0.1.6",
12
12
  "author": "Daniel Wirtz <dcode+assemblyscript@dcode.io>",
13
13
  "license": "Apache-2.0",
14
14
  "homepage": "https://github.com/dacely-cloud/toilscript",
@@ -1,13 +1,7 @@
1
1
  The files in this directory (integer/, fixed/, globals.ts, utils.ts, index.ts)
2
- are vendored verbatim, without modification, from:
2
+ are an audited 128/256-bit integer implementation, licensed Apache-2.0 (see
3
+ ./LICENSE). They are bundled into the toilscript standard library so the
4
+ big-integer types are available natively.
3
5
 
4
- @btc-vision/as-bignum version 1.0.0
5
- License: Apache-2.0 (see ./LICENSE)
6
-
7
- They are bundled into the toilscript standard library so that the 128/256-bit
8
- integer types are available natively. The parent ../bignum.ts is the only
9
- toilscript-authored addition: it re-exports u128/i128/u256 from a top-level
10
- library entry so they are promoted to global types.
11
-
12
- To refresh, re-copy the package's `assembly/` tree here (excluding `__tests__/`)
13
- and keep ../bignum.ts in sync.
6
+ ../bignum.ts is the toilscript globalizer: it re-exports u128/i128/u256/i256
7
+ from a top-level library entry so they are promoted to global types.
@@ -1,5 +1,5 @@
1
- // Big integer types (u128 / i128 / u256), vendored verbatim from
2
- // @btc-vision/as-bignum v1.0.0 (Apache-2.0) under ./bignum. See ./bignum/LICENSE.
1
+ // Big integer types (u128 / i128 / u256), implemented under ./bignum
2
+ // (Apache-2.0; see ./bignum/LICENSE).
3
3
  //
4
4
  // This file is a top-level standard-library entry, so toilscript globalizes its
5
5
  // named re-exports the same way it does Array/Map/String. That makes u128, i128
@@ -4,7 +4,7 @@
4
4
  *//***/
5
5
 
6
6
  /// <reference no-default-lib="true"/>
7
- /// <reference path="./toilscript.ts" />
7
+ /// <reference path="./toilscript.d.ts" />
8
8
 
9
9
  // Types
10
10
 
@@ -2890,260 +2890,3 @@ declare namespace external {
2890
2890
 
2891
2891
  /** Annotates a global for lazy compilation. */
2892
2892
  declare function lazy(...args: any[]): any;
2893
-
2894
- // Big integers — native globals implemented in std/assembly/bignum (vendored
2895
- // from @btc-vision/as-bignum). The arithmetic/bitwise/comparison operators
2896
- // (+ - * / % & | ^ << >> == != < > <= >=) are operator overloads resolved by
2897
- // the compiler; the equivalent static methods are listed for tooling.
2898
-
2899
- /** A 128-bit unsigned integer. */
2900
- declare class u128 {
2901
- lo: u64;
2902
- hi: u64;
2903
- constructor(lo?: u64, hi?: u64);
2904
-
2905
- static readonly Zero: u128;
2906
- static readonly One: u128;
2907
- static readonly Min: u128;
2908
- static readonly Max: u128;
2909
-
2910
- static fromString(value: string, radix?: i32): u128;
2911
- static fromI256(value: i256): u128;
2912
- static fromU256(value: u256): u128;
2913
- static fromI128(value: i128): u128;
2914
- static fromU128(value: u128): u128;
2915
- static fromI64(value: i64): u128;
2916
- static fromU64(value: u64): u128;
2917
- static fromF64(value: f64): u128;
2918
- static fromF32(value: f32): u128;
2919
- static fromI32(value: i32): u128;
2920
- static fromU32(value: u32): u128;
2921
- static fromBool(value: bool): u128;
2922
- static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128;
2923
- static fromBytes<T>(array: T, bigEndian?: bool): u128;
2924
- static fromBytesLE(array: u8[]): u128;
2925
- static fromBytesBE(array: u8[]): u128;
2926
- static fromUint8ArrayLE(array: Uint8Array): u128;
2927
- static fromUint8ArrayBE(array: Uint8Array): u128;
2928
- static from<T>(value: T): u128;
2929
-
2930
- static isEmpty(value: u128): bool;
2931
- static or(a: u128, b: u128): u128;
2932
- static xor(a: u128, b: u128): u128;
2933
- static and(a: u128, b: u128): u128;
2934
- static shl(value: u128, shift: i32): u128;
2935
- static shr(value: u128, shift: i32): u128;
2936
- static shr_u(value: u128, shift: i32): u128;
2937
- static rotl(value: u128, shift: i32): u128;
2938
- static rotr(value: u128, shift: i32): u128;
2939
- static add(a: u128, b: u128): u128;
2940
- static sub(a: u128, b: u128): u128;
2941
- static mul(a: u128, b: u128): u128;
2942
- static div(a: u128, b: u128): u128;
2943
- static rem(a: u128, b: u128): u128;
2944
- static div10(value: u128): u128;
2945
- static rem10(value: u128): u128;
2946
- static pow(base: u128, exponent: i32): u128;
2947
- static sqrt(value: u128): u128;
2948
- static sqr(value: u128): u128;
2949
- static muldiv(a: u128, b: u128, c: u128): u128;
2950
- static eq(a: u128, b: u128): bool;
2951
- static ne(a: u128, b: u128): bool;
2952
- static lt(a: u128, b: u128): bool;
2953
- static gt(a: u128, b: u128): bool;
2954
- static le(a: u128, b: u128): bool;
2955
- static ge(a: u128, b: u128): bool;
2956
- static ord(a: u128, b: u128): i32;
2957
- static popcnt(value: u128): i32;
2958
- static clz(value: u128): i32;
2959
- static ctz(value: u128): i32;
2960
-
2961
- set(value: u128): this;
2962
- setI64(value: i64): this;
2963
- setU64(value: u64): this;
2964
- setI32(value: i32): this;
2965
- setU32(value: u32): this;
2966
- isZero(): bool;
2967
- not(): u128;
2968
- neg(): u128;
2969
- pos(): u128;
2970
- sqr(): this;
2971
- preInc(): this;
2972
- preDec(): this;
2973
- postInc(): u128;
2974
- postDec(): u128;
2975
- clone(): u128;
2976
- as<T>(): T;
2977
- toI64(): i64;
2978
- toU64(): u64;
2979
- toI32(): i32;
2980
- toU32(): u32;
2981
- toBool(): bool;
2982
- toF64(): f64;
2983
- toF32(): f32;
2984
- toI128(): i128;
2985
- toU128(): this;
2986
- toI256(): i256;
2987
- toU256(): u256;
2988
- toBytes(bigEndian?: bool): u8[];
2989
- toStaticBytes(bigEndian?: bool): StaticArray<u8>;
2990
- toUint8Array(bigEndian?: bool): Uint8Array;
2991
- toString(radix?: i32): string;
2992
- }
2993
-
2994
- /** A 128-bit signed integer. */
2995
- declare class i128 {
2996
- lo: u64;
2997
- hi: i64;
2998
- constructor(lo?: u64, hi?: i64);
2999
-
3000
- static readonly Zero: i128;
3001
- static readonly One: i128;
3002
- static readonly Min: i128;
3003
- static readonly Max: i128;
3004
-
3005
- static fromString(value: string, radix?: i32): i128;
3006
- static fromI256(value: i256): i128;
3007
- static fromU256(value: u256): i128;
3008
- static fromI128(value: i128): i128;
3009
- static fromU128(value: u128): i128;
3010
- static fromI64(value: i64): i128;
3011
- static fromU64(value: u64): i128;
3012
- static fromF64(value: f64): i128;
3013
- static fromF32(value: f32): i128;
3014
- static fromI32(value: i32): i128;
3015
- static fromU32(value: u32): i128;
3016
- static fromBits(lo1: i32, lo2: i32, hi1: i32, hi2: i32): i128;
3017
- static fromBytes<T>(array: T, bigEndian?: bool): i128;
3018
- static fromBytesLE(array: u8[]): i128;
3019
- static fromBytesBE(array: u8[]): i128;
3020
- static fromUint8ArrayLE(array: Uint8Array): i128;
3021
- static fromUint8ArrayBE(array: Uint8Array): i128;
3022
- static from<T>(value: T): i128;
3023
-
3024
- static isEmpty(value: i128): bool;
3025
- static or(a: i128, b: i128): i128;
3026
- static xor(a: i128, b: i128): i128;
3027
- static and(a: i128, b: i128): i128;
3028
- static shl(value: i128, shift: i32): i128;
3029
- static shr_u(value: i128, shift: i32): i128;
3030
- static add(a: i128, b: i128): i128;
3031
- static sub(a: i128, b: i128): i128;
3032
- static eq(a: i128, b: i128): bool;
3033
- static ne(a: i128, b: i128): bool;
3034
- static lt(a: i128, b: i128): bool;
3035
- static gt(a: i128, b: i128): bool;
3036
- static le(a: i128, b: i128): bool;
3037
- static ge(a: i128, b: i128): bool;
3038
- static ord(a: i128, b: i128): i32;
3039
- static popcnt(value: i128): i32;
3040
- static clz(value: i128): i32;
3041
- static ctz(value: i128): i32;
3042
- static abs(value: i128): i128;
3043
-
3044
- isNeg(): bool;
3045
- isPos(): bool;
3046
- isZero(): bool;
3047
- not(): i128;
3048
- neg(): i128;
3049
- pos(): i128;
3050
- toBytes(bigEndian?: bool): u8[];
3051
- toStaticBytes(bigEndian?: bool): StaticArray<u8>;
3052
- toUint8Array(bigEndian?: bool): Uint8Array;
3053
- }
3054
-
3055
- /** A 256-bit unsigned integer. */
3056
- declare class u256 {
3057
- lo1: u64;
3058
- lo2: u64;
3059
- hi1: u64;
3060
- hi2: u64;
3061
- constructor(lo1?: u64, lo2?: u64, hi1?: u64, hi2?: u64);
3062
-
3063
- static readonly Zero: u256;
3064
- static readonly One: u256;
3065
- static readonly Min: u256;
3066
- static readonly Max: u256;
3067
-
3068
- static fromU256(value: u256): u256;
3069
- static fromU128(value: u128): u256;
3070
- static fromU64(value: u64): u256;
3071
- static fromI64(value: i64): u256;
3072
- static fromU32(value: u32): u256;
3073
- static fromI32(value: i32): u256;
3074
- static fromBits(l0: u32, l1: u32, l2: u32, l3: u32, h0: u32, h1: u32, h2: u32, h3: u32): u256;
3075
- static fromBytes<T>(array: T, bigEndian?: bool): u256;
3076
- static fromBytesLE(array: u8[]): u256;
3077
- static fromBytesBE(array: u8[]): u256;
3078
- static fromUint8ArrayLE(array: Uint8Array): u256;
3079
- static fromUint8ArrayBE(array: Uint8Array): u256;
3080
- static fromF64(value: f64): u256;
3081
- static fromF32(value: f32): u256;
3082
- static from<T>(value: T): u256;
3083
- static fromString(str: string, radix?: i32): u256;
3084
-
3085
- static isEmpty(value: u256): bool;
3086
- static add(a: u256, b: u256): u256;
3087
- static sub(a: u256, b: u256): u256;
3088
- static mul(a: u256, b: u256): u256;
3089
- static or(a: u256, b: u256): u256;
3090
- static xor(a: u256, b: u256): u256;
3091
- static and(a: u256, b: u256): u256;
3092
- static shr(value: u256, shift: i32): u256;
3093
- static shr_u(value: u256, shift: i32): u256;
3094
- static eq(a: u256, b: u256): bool;
3095
- static ne(a: u256, b: u256): bool;
3096
- static lt(a: u256, b: u256): bool;
3097
- static gt(a: u256, b: u256): bool;
3098
- static le(a: u256, b: u256): bool;
3099
- static ge(a: u256, b: u256): bool;
3100
- static popcnt(value: u256): i32;
3101
- static clz(value: u256): i32;
3102
- static ctz(value: u256): i32;
3103
-
3104
- set(value: u256): this;
3105
- setI64(value: i64): this;
3106
- setU64(value: u64): this;
3107
- setI32(value: i32): this;
3108
- setU32(value: u32): this;
3109
- setU128(value: u128): this;
3110
- isZero(): bool;
3111
- not(): u256;
3112
- neg(): u256;
3113
- pos(): u256;
3114
- postInc(): u256;
3115
- postDec(): u256;
3116
- clone(): u256;
3117
- as<T>(): T;
3118
- toI64(): i64;
3119
- toU64(): u64;
3120
- toI32(): i32;
3121
- toU32(): u32;
3122
- toBool(): bool;
3123
- toI128(): i128;
3124
- toU128(): u128;
3125
- toU256(): this;
3126
- toBytes(bigEndian?: bool): u8[];
3127
- toStaticBytes(bigEndian?: bool): StaticArray<u8>;
3128
- toUint8Array(bigEndian?: bool): Uint8Array;
3129
- toString(radix?: i32): string;
3130
- }
3131
-
3132
- /** A 256-bit signed integer (backs the signed conversions of the family). */
3133
- declare class i256 {
3134
- lo1: i64;
3135
- lo2: i64;
3136
- hi1: i64;
3137
- hi2: i64;
3138
- constructor(lo1?: i64, lo2?: i64, hi1?: i64, hi2?: i64);
3139
-
3140
- static readonly Zero: i256;
3141
- static readonly One: i256;
3142
- static readonly Min: i256;
3143
- static readonly Max: i256;
3144
-
3145
- static isEmpty(value: i256): bool;
3146
-
3147
- isNeg(): bool;
3148
- isZero(): bool;
3149
- }
@@ -0,0 +1,273 @@
1
+ /**
2
+ * ToilScript-native ambient declarations.
3
+ *
4
+ * Zero-import natives the ToilScript compiler provides directly: the `@main`
5
+ * entry decorator and the big-integer global types (u128 / i128 / u256 / i256,
6
+ * implemented in std/assembly/bignum). They live in this ambient `.d.ts`
7
+ * (referenced from index.d.ts) so editors and type-checking recognize them; the
8
+ * compiler handles `@main` and resolves the real bignum classes on its own.
9
+ */
10
+
11
+ /**
12
+ * Marks a single top-level function as the module entry point. The compiler
13
+ * exports it as the WebAssembly export `main` — no `export` keyword needed.
14
+ * Exactly one `@main` is allowed per module.
15
+ */
16
+ declare function main(): void;
17
+
18
+ // Big integers — native globals implemented in std/assembly/bignum. The
19
+ // arithmetic/bitwise/comparison operators
20
+ // (+ - * / % & | ^ << >> == != < > <= >=) are operator overloads resolved by
21
+ // the compiler; the equivalent static methods are listed for tooling.
22
+
23
+ /** A 128-bit unsigned integer. */
24
+ declare class u128 {
25
+ lo: u64;
26
+ hi: u64;
27
+ constructor(lo?: u64, hi?: u64);
28
+
29
+ static readonly Zero: u128;
30
+ static readonly One: u128;
31
+ static readonly Min: u128;
32
+ static readonly Max: u128;
33
+
34
+ static fromString(value: string, radix?: i32): u128;
35
+ static fromI256(value: i256): u128;
36
+ static fromU256(value: u256): u128;
37
+ static fromI128(value: i128): u128;
38
+ static fromU128(value: u128): u128;
39
+ static fromI64(value: i64): u128;
40
+ static fromU64(value: u64): u128;
41
+ static fromF64(value: f64): u128;
42
+ static fromF32(value: f32): u128;
43
+ static fromI32(value: i32): u128;
44
+ static fromU32(value: u32): u128;
45
+ static fromBool(value: bool): u128;
46
+ static fromBits(lo1: u32, lo2: u32, hi1: u32, hi2: u32): u128;
47
+ static fromBytes<T>(array: T, bigEndian?: bool): u128;
48
+ static fromBytesLE(array: u8[]): u128;
49
+ static fromBytesBE(array: u8[]): u128;
50
+ static fromUint8ArrayLE(array: Uint8Array): u128;
51
+ static fromUint8ArrayBE(array: Uint8Array): u128;
52
+ static from<T>(value: T): u128;
53
+
54
+ static isEmpty(value: u128): bool;
55
+ static or(a: u128, b: u128): u128;
56
+ static xor(a: u128, b: u128): u128;
57
+ static and(a: u128, b: u128): u128;
58
+ static shl(value: u128, shift: i32): u128;
59
+ static shr(value: u128, shift: i32): u128;
60
+ static shr_u(value: u128, shift: i32): u128;
61
+ static rotl(value: u128, shift: i32): u128;
62
+ static rotr(value: u128, shift: i32): u128;
63
+ static add(a: u128, b: u128): u128;
64
+ static sub(a: u128, b: u128): u128;
65
+ static mul(a: u128, b: u128): u128;
66
+ static div(a: u128, b: u128): u128;
67
+ static rem(a: u128, b: u128): u128;
68
+ static div10(value: u128): u128;
69
+ static rem10(value: u128): u128;
70
+ static pow(base: u128, exponent: i32): u128;
71
+ static sqrt(value: u128): u128;
72
+ static sqr(value: u128): u128;
73
+ static muldiv(a: u128, b: u128, c: u128): u128;
74
+ static eq(a: u128, b: u128): bool;
75
+ static ne(a: u128, b: u128): bool;
76
+ static lt(a: u128, b: u128): bool;
77
+ static gt(a: u128, b: u128): bool;
78
+ static le(a: u128, b: u128): bool;
79
+ static ge(a: u128, b: u128): bool;
80
+ static ord(a: u128, b: u128): i32;
81
+ static popcnt(value: u128): i32;
82
+ static clz(value: u128): i32;
83
+ static ctz(value: u128): i32;
84
+
85
+ set(value: u128): this;
86
+ setI64(value: i64): this;
87
+ setU64(value: u64): this;
88
+ setI32(value: i32): this;
89
+ setU32(value: u32): this;
90
+ isZero(): bool;
91
+ not(): u128;
92
+ neg(): u128;
93
+ pos(): u128;
94
+ sqr(): this;
95
+ preInc(): this;
96
+ preDec(): this;
97
+ postInc(): u128;
98
+ postDec(): u128;
99
+ clone(): u128;
100
+ as<T>(): T;
101
+ toI64(): i64;
102
+ toU64(): u64;
103
+ toI32(): i32;
104
+ toU32(): u32;
105
+ toBool(): bool;
106
+ toF64(): f64;
107
+ toF32(): f32;
108
+ toI128(): i128;
109
+ toU128(): this;
110
+ toI256(): i256;
111
+ toU256(): u256;
112
+ toBytes(bigEndian?: bool): u8[];
113
+ toStaticBytes(bigEndian?: bool): StaticArray<u8>;
114
+ toUint8Array(bigEndian?: bool): Uint8Array;
115
+ toString(radix?: i32): string;
116
+ }
117
+
118
+ /** A 128-bit signed integer. */
119
+ declare class i128 {
120
+ lo: u64;
121
+ hi: i64;
122
+ constructor(lo?: u64, hi?: i64);
123
+
124
+ static readonly Zero: i128;
125
+ static readonly One: i128;
126
+ static readonly Min: i128;
127
+ static readonly Max: i128;
128
+
129
+ static fromString(value: string, radix?: i32): i128;
130
+ static fromI256(value: i256): i128;
131
+ static fromU256(value: u256): i128;
132
+ static fromI128(value: i128): i128;
133
+ static fromU128(value: u128): i128;
134
+ static fromI64(value: i64): i128;
135
+ static fromU64(value: u64): i128;
136
+ static fromF64(value: f64): i128;
137
+ static fromF32(value: f32): i128;
138
+ static fromI32(value: i32): i128;
139
+ static fromU32(value: u32): i128;
140
+ static fromBits(lo1: i32, lo2: i32, hi1: i32, hi2: i32): i128;
141
+ static fromBytes<T>(array: T, bigEndian?: bool): i128;
142
+ static fromBytesLE(array: u8[]): i128;
143
+ static fromBytesBE(array: u8[]): i128;
144
+ static fromUint8ArrayLE(array: Uint8Array): i128;
145
+ static fromUint8ArrayBE(array: Uint8Array): i128;
146
+ static from<T>(value: T): i128;
147
+
148
+ static isEmpty(value: i128): bool;
149
+ static or(a: i128, b: i128): i128;
150
+ static xor(a: i128, b: i128): i128;
151
+ static and(a: i128, b: i128): i128;
152
+ static shl(value: i128, shift: i32): i128;
153
+ static shr_u(value: i128, shift: i32): i128;
154
+ static add(a: i128, b: i128): i128;
155
+ static sub(a: i128, b: i128): i128;
156
+ static eq(a: i128, b: i128): bool;
157
+ static ne(a: i128, b: i128): bool;
158
+ static lt(a: i128, b: i128): bool;
159
+ static gt(a: i128, b: i128): bool;
160
+ static le(a: i128, b: i128): bool;
161
+ static ge(a: i128, b: i128): bool;
162
+ static ord(a: i128, b: i128): i32;
163
+ static popcnt(value: i128): i32;
164
+ static clz(value: i128): i32;
165
+ static ctz(value: i128): i32;
166
+ static abs(value: i128): i128;
167
+
168
+ isNeg(): bool;
169
+ isPos(): bool;
170
+ isZero(): bool;
171
+ not(): i128;
172
+ neg(): i128;
173
+ pos(): i128;
174
+ toBytes(bigEndian?: bool): u8[];
175
+ toStaticBytes(bigEndian?: bool): StaticArray<u8>;
176
+ toUint8Array(bigEndian?: bool): Uint8Array;
177
+ }
178
+
179
+ /** A 256-bit unsigned integer. */
180
+ declare class u256 {
181
+ lo1: u64;
182
+ lo2: u64;
183
+ hi1: u64;
184
+ hi2: u64;
185
+ constructor(lo1?: u64, lo2?: u64, hi1?: u64, hi2?: u64);
186
+
187
+ static readonly Zero: u256;
188
+ static readonly One: u256;
189
+ static readonly Min: u256;
190
+ static readonly Max: u256;
191
+
192
+ static fromU256(value: u256): u256;
193
+ static fromU128(value: u128): u256;
194
+ static fromU64(value: u64): u256;
195
+ static fromI64(value: i64): u256;
196
+ static fromU32(value: u32): u256;
197
+ static fromI32(value: i32): u256;
198
+ static fromBits(l0: u32, l1: u32, l2: u32, l3: u32, h0: u32, h1: u32, h2: u32, h3: u32): u256;
199
+ static fromBytes<T>(array: T, bigEndian?: bool): u256;
200
+ static fromBytesLE(array: u8[]): u256;
201
+ static fromBytesBE(array: u8[]): u256;
202
+ static fromUint8ArrayLE(array: Uint8Array): u256;
203
+ static fromUint8ArrayBE(array: Uint8Array): u256;
204
+ static fromF64(value: f64): u256;
205
+ static fromF32(value: f32): u256;
206
+ static from<T>(value: T): u256;
207
+ static fromString(str: string, radix?: i32): u256;
208
+
209
+ static isEmpty(value: u256): bool;
210
+ static add(a: u256, b: u256): u256;
211
+ static sub(a: u256, b: u256): u256;
212
+ static mul(a: u256, b: u256): u256;
213
+ static or(a: u256, b: u256): u256;
214
+ static xor(a: u256, b: u256): u256;
215
+ static and(a: u256, b: u256): u256;
216
+ static shr(value: u256, shift: i32): u256;
217
+ static shr_u(value: u256, shift: i32): u256;
218
+ static eq(a: u256, b: u256): bool;
219
+ static ne(a: u256, b: u256): bool;
220
+ static lt(a: u256, b: u256): bool;
221
+ static gt(a: u256, b: u256): bool;
222
+ static le(a: u256, b: u256): bool;
223
+ static ge(a: u256, b: u256): bool;
224
+ static popcnt(value: u256): i32;
225
+ static clz(value: u256): i32;
226
+ static ctz(value: u256): i32;
227
+
228
+ set(value: u256): this;
229
+ setI64(value: i64): this;
230
+ setU64(value: u64): this;
231
+ setI32(value: i32): this;
232
+ setU32(value: u32): this;
233
+ setU128(value: u128): this;
234
+ isZero(): bool;
235
+ not(): u256;
236
+ neg(): u256;
237
+ pos(): u256;
238
+ postInc(): u256;
239
+ postDec(): u256;
240
+ clone(): u256;
241
+ as<T>(): T;
242
+ toI64(): i64;
243
+ toU64(): u64;
244
+ toI32(): i32;
245
+ toU32(): u32;
246
+ toBool(): bool;
247
+ toI128(): i128;
248
+ toU128(): u128;
249
+ toU256(): this;
250
+ toBytes(bigEndian?: bool): u8[];
251
+ toStaticBytes(bigEndian?: bool): StaticArray<u8>;
252
+ toUint8Array(bigEndian?: bool): Uint8Array;
253
+ toString(radix?: i32): string;
254
+ }
255
+
256
+ /** A 256-bit signed integer (backs the signed conversions of the family). */
257
+ declare class i256 {
258
+ lo1: i64;
259
+ lo2: i64;
260
+ hi1: i64;
261
+ hi2: i64;
262
+ constructor(lo1?: i64, lo2?: i64, hi1?: i64, hi2?: i64);
263
+
264
+ static readonly Zero: i256;
265
+ static readonly One: i256;
266
+ static readonly Min: i256;
267
+ static readonly Max: i256;
268
+
269
+ static isEmpty(value: i256): bool;
270
+
271
+ isNeg(): bool;
272
+ isZero(): bool;
273
+ }
@@ -1,16 +0,0 @@
1
- /**
2
- * ToilScript-native declarations.
3
- *
4
- * Compiler-level natives available everywhere with no import. `@main` is handled
5
- * directly by the ToilScript compiler — it exports the decorated top-level
6
- * function as the module's `main` entry — so this declaration exists only so
7
- * editors and type-checking recognize the decorator. Future zero-import toil
8
- * natives (globals/decorators) belong here too.
9
- */
10
-
11
- /**
12
- * Marks a single top-level function as the module entry point. The compiler
13
- * exports it as the WebAssembly export `main` — no `export` keyword needed.
14
- * Exactly one `@main` is allowed per module.
15
- */
16
- declare function main(): void;