| 1 | module Busy; |
| 2 | (* Profiled by test/check.sh, with RAZ_PROFILE set: spin takes nearly |
| 3 | all its time. Not listed, having no .expect. *) |
| 4 | import Out; |
| 5 | |
| 6 | proc spin(n: I64): I64; |
| 7 | var i, s: I64; |
| 8 | begin |
| 9 | for i := 1 to n do s := s + i * i mod 7; end; |
| 10 | return s; |
| 11 | end; |
| 12 | |
| 13 | proc main*; |
| 14 | begin |
| 15 | Out.int(spin(100000000)); Out.ln; |
| 16 | end; |
| 17 | |
| 18 | end Busy. |