13{
16
18 {
20
21 };
22
23 struct tape
24 {
27 } tape[4];
28
29
30
31 tape[0].count = tape[1].count = 0
L;
35 {
42 }
43
44
45
46
49 {
51 struct tape *tape0, *tape1;
53 tape1 = tape +
base + 1;
55 tape[
dest].count = tape[
dest+1].count = 0;
56 for (; tape0->count != 0;
dest ^= 1)
57 {
59 struct tape *output_tape = tape +
dest;
61 while (1)
62 {
63 struct record *chosen_record;
64 struct tape *chosen_tape;
65 if (n0 == 0 || tape0->count == 0)
66 {
67 if (
n1 == 0 || tape1->count == 0)
68 break;
69 chosen_tape = tape1;
71 }
72 else if (
n1 == 0 || tape1->count == 0)
73 {
74 chosen_tape = tape0;
75 n0--;
76 }
77 else if ((*
compare)(tape0->first, tape1->first) > 0)
78 {
79 chosen_tape = tape1;
81 }
82 else
83 {
84 chosen_tape = tape0;
85 n0--;
86 }
87 chosen_tape->count--;
88 chosen_record = chosen_tape->first;
89 chosen_tape->first = chosen_record->next[
index];
90 if (output_tape->count == 0)
91 output_tape->first = chosen_record;
92 else
93 output_tape->last->next[
index] = chosen_record;
94 output_tape->last = chosen_record;
96 }
97 }
98 }
99
102 return tape[
base].first;
103}
GLuint GLuint GLsizei count
static DWORD block_size(DWORD block)
static unsigned __int64 next