145
|
1 /* { dg-skip-if "exceeds eBPF stack limit" { bpf-*-* } } */
|
111
|
2
|
|
3 struct w
|
|
4 {
|
|
5 int top;
|
|
6 int left;
|
|
7 int height;
|
|
8 int width;
|
|
9 struct w *next;
|
|
10 struct w *parent;
|
|
11 struct w *child;
|
|
12 };
|
|
13
|
|
14 extern struct w *Qnil;
|
|
15
|
|
16 void
|
|
17 set_size (struct w *w, int new_size, int nodelete, int set_height)
|
|
18 {
|
|
19 int old_size = set_height? w->height : w->width;
|
|
20
|
|
21 if (nodelete || w->parent == Qnil)
|
|
22 {
|
|
23 int last_pos, last_old_pos, pos, old_pos, first;
|
|
24 int div_val = old_size << 1;
|
|
25 struct w *c;
|
|
26
|
|
27 last_pos = first = set_height? w->top : w->left;
|
|
28 last_old_pos = 0;
|
|
29
|
|
30 for (c = w->child; c != Qnil; c = c->next)
|
|
31 {
|
|
32 if (set_height)
|
|
33 old_pos = last_old_pos + c->height;
|
|
34 else
|
|
35 old_pos = last_old_pos + c->width;
|
|
36
|
|
37 pos = (((old_pos * new_size) << 1) + old_size) / div_val;
|
|
38 set_size (c, pos + first - last_pos, 1, set_height);
|
|
39 last_pos = pos + first;
|
|
40 last_old_pos = old_pos;
|
|
41 }
|
|
42
|
|
43 if (!nodelete)
|
|
44 for (c = w->child; c != Qnil; c = c->next)
|
|
45 use (c);
|
|
46 }
|
|
47 }
|
|
48
|