| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -Wstrict-overflow" } */ |
| 3 |
|
| 4 |
unsigned int |
| 5 |
do_scrolling (unsigned int window_size, unsigned int writecost) |
| 6 |
{ |
| 7 |
unsigned int i = window_size; |
| 8 |
|
| 9 |
int terminal_window_p = 0; |
| 10 |
unsigned int queue = 0; |
| 11 |
|
| 12 |
for (i = window_size; i; i--) |
| 13 |
{ |
| 14 |
if (writecost < i) |
| 15 |
++queue; |
| 16 |
else if (writecost & 1) |
| 17 |
terminal_window_p = 1; |
| 18 |
} |
| 19 |
|
| 20 |
if (queue > 0) |
| 21 |
{ |
| 22 |
if (!terminal_window_p) |
| 23 |
{ |
| 24 |
terminal_window_p = 1; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
if (terminal_window_p) |
| 29 |
return 100; |
| 30 |
return 0; |
| 31 |
} |