Fixed the commstime.rain testcase so that it now just about works (except for one disallowed cast)
This commit is contained in:
parent
fc4cac736b
commit
38aca16514
|
@ -36,22 +36,31 @@ function [uint8] : int_to_str(int: src)
|
||||||
[uint8]: r;
|
[uint8]: r;
|
||||||
x = src;
|
x = src;
|
||||||
|
|
||||||
while (src > 0)
|
while (x > 0)
|
||||||
{
|
{
|
||||||
r = ['0' + (uint8: src % 10)] + r;
|
r = ['0' + (uint8: x % 10)] + r;
|
||||||
src /= 10;
|
x /= 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process out_str(!uint8: out, [uint8]: val)
|
||||||
|
{
|
||||||
|
seqeach (c : val)
|
||||||
|
{
|
||||||
|
out ! c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
process consume_int(?int: in, !uint8: out) ### uses (time)
|
process consume_int(?int: in, !uint8: out) ### uses (time)
|
||||||
{
|
{
|
||||||
### Warm-up:
|
### Warm-up:
|
||||||
|
|
||||||
seqeach (n : [1..100])
|
seqeach (n : [1..100])
|
||||||
{
|
{
|
||||||
in ? _;
|
int: _x;
|
||||||
|
in ? _x;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
|
@ -59,20 +68,20 @@ process consume_int(?int: in, !uint8: out) ### uses (time)
|
||||||
int: n;
|
int: n;
|
||||||
time: t0,t1;
|
time: t0,t1;
|
||||||
n = 0;
|
n = 0;
|
||||||
now t;
|
now t0;
|
||||||
while (n < 1000000)
|
while (n < 1000000)
|
||||||
{
|
{
|
||||||
in ? _;
|
int: _x;
|
||||||
|
in ? _x;
|
||||||
n += 1;
|
n += 1;
|
||||||
}
|
}
|
||||||
now t1;
|
now t1;
|
||||||
|
|
||||||
int: m;
|
int: m;
|
||||||
m = toMicros(t1 - t0) / 1000000;
|
m = toNanos(t1 - t0) / 1000000;
|
||||||
|
|
||||||
out ! "Time per commstime iteration in micro-seconds: ";
|
run out_str(out, "Time per commstime iteration in nano-seconds: "
|
||||||
out ! int_to_str(m);
|
+ int_to_str(m) + "\n");
|
||||||
out ! "\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user