porffor 0.0.0-425ea20 → 0.0.0-48403fd

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.
@@ -8,7 +8,8 @@ const source = fs.readFileSync(file, 'utf8');
8
8
  const { wasm } = await compile(source);
9
9
 
10
10
  // const out = `(async () => { const print = str => process.stdout.write(str); (await WebAssembly.instantiate(Uint8Array.from([${wasm.toString()}]), {'': { p: i => print(i.toString()), c: i => print(String.fromCharCode(i))}})).instance.exports.m()})()`;
11
- const out = `new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([${wasm.toString()}])),{'':{p:i=>process.stdout.write(i.toString())}}).exports.m()`;
11
+ // const out = `new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([${wasm.toString()}])),{'':{p:i=>process.stdout.write(i.toString())}}).exports.m()`;
12
+ const out = `const a=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([${wasm.toString()}])));const b=a.exports.m();console.log(Array.from(new Uint16Array(a.exports.$.buffer,b+4,new Int32Array(a.exports.$.buffer,b,1))).map(x=>String.fromCharCode(x)).join(''))`;
12
13
 
13
14
  console.log(out);
14
15
  eval(out);
package/tmp.c ADDED
@@ -0,0 +1,61 @@
1
+ #ifdef _WIN32
2
+ #include <windows.h>
3
+ #else
4
+ #include <time.h>
5
+ #endif
6
+
7
+ #include <stdio.h>
8
+
9
+ long long state0 = 1028798103;
10
+ long long state1 = 477374377;
11
+ double t = 0;
12
+
13
+ double inline __Math_random() {
14
+ long long s1 = 0;
15
+ long long s0 = 0;
16
+
17
+ s1 = state0;
18
+ state0 = (s0 = state1);
19
+ state1 = ((((s1 = (s1 ^ (s1 << 23)))) ^ s0) ^ (s1 >> 17)) ^ (s0 >> 26);
20
+ return ((double)((state1 + s0) & 2097151) / 2.097152e+6);
21
+ }
22
+
23
+ double randoms(double max) {
24
+ double sum = 0;
25
+ double i = 0;
26
+
27
+ sum = 0e+0;
28
+ i = 0e+0;
29
+ while (i < max) {
30
+ sum = sum + __Math_random();
31
+ i = i + 1e+0;
32
+ }
33
+ return sum;
34
+ }
35
+
36
+ double inline __performance_now() {
37
+ double _time_out;
38
+ #ifdef _WIN32
39
+ LARGE_INTEGER _time_freq, _time_t;
40
+ QueryPerformanceFrequency(&_time_freq);
41
+ QueryPerformanceCounter(&_time_t);
42
+ _time_out = ((double)_time_t.QuadPart / _time_freq.QuadPart) * 1000.;
43
+ #else
44
+ struct timespec _time;
45
+ clock_gettime(CLOCK_MONOTONIC, &_time);
46
+ _time_out = _time.tv_nsec / 1000000. + _time.tv_sec * 1000.;
47
+ #endif
48
+ return _time_out;
49
+ }
50
+
51
+ void inline __console_log(double x) {
52
+ printf("%f\n", x);
53
+ printf("%c", (int)(1e+1));
54
+ }
55
+
56
+ int main() {
57
+ t = __performance_now();
58
+ randoms(1e+5);
59
+ __console_log(__performance_now() - t);
60
+ }
61
+
package/t.js DELETED
@@ -1,31 +0,0 @@
1
- let assert = Object();
2
-
3
- assert._isSameValue = function (a, b) {
4
- if (a === b) {
5
- // Handle +/-0 vs. -/+0
6
- return a !== 0 || 1 / a === 1 / b;
7
- }
8
-
9
- // Handle NaN vs. NaN
10
- return a !== a && b !== b;
11
-
12
- // return a === b;
13
- };
14
-
15
- assert.sameValue = function (actual, expected) {
16
- /* try {
17
- if (assert._isSameValue(actual, expected)) {
18
- return;
19
- }
20
- } catch (error) {
21
- throw new Test262Error('_isSameValue operation threw');
22
- } */
23
-
24
- if (assert._isSameValue(actual, expected)) {
25
- return;
26
- }
27
-
28
- throw new Test262Error('assert.sameValue failed');
29
- };
30
-
31
- assert.sameValue("lego".charAt(), "l");