porffor 0.0.0-8c0bdaa → 0.0.0-a2afb57
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.
- package/README.md +49 -15
- package/c +0 -0
- package/c.exe +0 -0
- package/compiler/2c.js +354 -0
- package/compiler/builtins.js +0 -1
- package/compiler/codeGen.js +710 -159
- package/compiler/decompile.js +3 -3
- package/compiler/embedding.js +9 -5
- package/compiler/encoding.js +4 -2
- package/compiler/index.js +55 -4
- package/compiler/opt.js +49 -23
- package/compiler/parse.js +1 -0
- package/compiler/prototype.js +172 -34
- package/compiler/sections.js +47 -6
- package/compiler/wrap.js +12 -1
- package/cool.exe +0 -0
- package/g +0 -0
- package/g.exe +0 -0
- package/hi.c +37 -0
- package/out +0 -0
- package/out.exe +0 -0
- package/package.json +1 -1
- package/publish.js +3 -1
- package/r.js +39 -0
- package/rhemyn/README.md +37 -0
- package/rhemyn/compile.js +214 -0
- package/rhemyn/parse.js +321 -0
- package/rhemyn/test/parse.js +59 -0
- package/runner/index.js +54 -33
- package/runner/info.js +37 -2
- package/runner/repl.js +8 -13
- package/runner/transform.js +5 -26
- package/runner/version.js +10 -0
- package/t.js +31 -0
- package/tmp.c +61 -0
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
|
+
|