blob: 9536d050478e7255e81a2a304de471d514e308e1 (
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
|
#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;
}
}
|