blob: 871e2128108940e045a215a81c349d8ea2bae4eb (
plain)
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
|
#include <cmath>
#include <algorithm>
#include <emscripten.h>
extern "C" {
int EMSCRIPTEN_KEEPALIVE check_if(int x) {
if (x < 10) x++;
return x;
}
int EMSCRIPTEN_KEEPALIVE check_loop(int x) {
while (x < 100) x *= 2;
return x;
}
int EMSCRIPTEN_KEEPALIVE check_loop_break(int x) {
while (x < 100) {
x *= 2;
if (x > 30) break;
x++;
}
return x;
}
int EMSCRIPTEN_KEEPALIVE check_loop_continue(int x) {
while (x < 100) {
x *= 2;
if (x > 30) continue;
x++;
}
return x;
}
int EMSCRIPTEN_KEEPALIVE check_do_loop(int x) {
do {
x *= 2;
if (x > 1000) break;
x--;
if (x > 30) continue;
x++;
} while (x < 100);
return x;
}
int EMSCRIPTEN_KEEPALIVE check_do_once(int x) {
do {
x *= 2;
if (x > 1000) break;
x--;
if (x > 30) continue;
x++;
} while (0);
return x;
}
int EMSCRIPTEN_KEEPALIVE check_while_forever(int x) {
while (1) {
x *= 2;
if (x > 1000) break;
x--;
if (x > 30) continue;
x++;
}
return x;
}
}
|