-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlong_sorting.yasm
53 lines (41 loc) · 1.06 KB
/
long_sorting.yasm
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
#import lib.yasm
#define character_set a
#define inchar b
#define unsorted i
#define output d
#define tmp1 e
#define z_char f
#define move_char_from_input_fallthrough(set, inchar) {
continue_if(set!=(set-inchar))
set-=inchar;
output+=inchar
}
#define move_char_from_input_if(set, inchar) {
ifunsorted!=(set-inchar)then
set-=inchar;
output+=inchar;
end
}
#define move_char_from_input_magic(set, inchar) {
output+=set!=(set-inchar)+inchar-(0+inchar)-1
set-=inchar
}
@restart:
a="yxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA9876543210 "
output=""
@restart2:
unsorted=:i;
inchar=pop_char(character_set);
@move:
move_char_from_input_fallthrough(unsorted, inchar);
move_char_from_input_fallthrough(unsorted, inchar);
move_char_from_input_fallthrough(unsorted, inchar);
goto@
@newc:
inchar=pop_char(character_set)
move_char_from_input_magic(unsorted, inchar);
move_char_from_input_magic(unsorted, inchar);
goto{move}+(unsorted<0)
@finish:
:o=output+unsorted;
goto:done++