-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcount_loop.mdtlbl
More file actions
69 lines (63 loc) · 1.51 KB
/
count_loop.mdtlbl
File metadata and controls
69 lines (63 loc) · 1.51 KB
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
#**
* 循环指定次数的循环, 利用奇怪的展开来优化运行时性能
* 输入循环次数必须不小于0, 且为整数
*#
Builtin.BindSep! '.';
Builtin.MissesMatch! 1;
const CountLoop = (const match @ {
*Count Chunk F {
match Builtin.EvalNum[Chunk] {
[`__`] {
Builtin.Err! "Invalid chunk size, can not eval:";
Builtin.Debug! Chunk;
Builtin.Exit! 2;
}
_ { take Chunk = Chunk; }
}
take+I C=0;
const match ([&F](inline:x setres F;)) => @ {}
inline 0@ {
take*C=C+1;
const match C {
[?_0 < Chunk] { const match @ F => @ {} }
_ {
Builtin.StopRepeat!;
const match @ () => @ {}
I = 0;
Builtin.MakeSelect! (*Chunk - Count%Chunk);
I += Chunk;
goto inline:x I <= Count;
}
}
}
}
});
i = 0; do {
print i":";
CountLoop! i 4 const(
print i;
);
print "\n";
} while (*++i) < 10;
printflush message1;
#* Lil >>>
set i 0
___0:
print i
print ":"
set __7 0
op mod __32 i 4
op sub __31 4 __32
op add @counter @counter __31
__0_const_CountLoop_x:
print i
print i
print i
print i
op add __7 __7 4
jump __0_const_CountLoop_x lessThanEq __7 i
print "\n"
op add i i 1
jump ___0 lessThan i 10
printflush message1
*#