Rearranged some expressions to avoid triggering a cc65 bug.

This commit is contained in:
Oliver Schmidt 2013-10-05 21:26:28 +02:00
parent d79ac1558a
commit 7134da0915
4 changed files with 10 additions and 10 deletions

View file

@ -187,8 +187,8 @@ print_local_stats(struct stats *s)
printf(" Total transfer time: %lu.%02lu seconds, %lu.%02lu packets/second\n",
(s->end - s->start) / CLOCK_SECOND,
((10 * (s->end - s->start)) / CLOCK_SECOND) % 10,
((1UL * CLOCK_SECOND * s->sent) / (s->end - s->start)),
(((100UL * CLOCK_SECOND * s->sent) / (s->end - s->start)) % 100));
((s->sent * 1UL * CLOCK_SECOND) / (s->end - s->start)),
(((s->sent * 100UL * CLOCK_SECOND) / (s->end - s->start)) % 100));
printf(" Average round-trip-time: %lu ms (%lu + %lu)\n",
(1000 * (s->total_rx_latency + s->total_tx_latency) / s->received) /
@ -206,8 +206,8 @@ print_local_stats(struct stats *s)
((10000 * (s->power.tx - s->power0.tx))/total_time) % 100);
printf(" Packets received: %d.%lu%%, %d of %d\n",
100 * s->received / s->sent,
(10000L * s->received / s->sent) % 10,
s->received * 100 / s->sent,
(s->received * 10000L / s->sent) % 10,
s->received, s->sent);
}
/*---------------------------------------------------------------------------*/

View file

@ -141,7 +141,7 @@ recv_ruc(struct runicast_conn *c, const rimeaddr_t *from, uint8_t seqno)
printf("runicast message received from %d.%d, latency %lu ms, seqno %d, data '%.*s'\n",
from->u8[0], from->u8[1],
(1000L * latency) / RTIMER_ARCH_SECOND,
(latency * 1000L) / RTIMER_ARCH_SECOND,
seqno,
packetbuf_datalen() - COLLECT_MSG_HDRSIZE,
msg->data);

View file

@ -129,7 +129,7 @@ recv_broadcast(struct broadcast_conn *c, const rimeaddr_t *from)
printf("broadcast message received from %d.%d, latency %lu ms, data '%.*s'\n",
from->u8[0], from->u8[1],
(1000L * latency) / RTIMER_ARCH_SECOND,
(latency * 1000L) / RTIMER_ARCH_SECOND,
packetbuf_datalen() - COLLECT_MSG_HDRSIZE,
msg->data);
}
@ -201,7 +201,7 @@ recv_uc(struct unicast_conn *c, const rimeaddr_t *from)
printf("unicast message received from %d.%d, latency %lu ms, data '%.*s'\n",
from->u8[0], from->u8[1],
(1000L * latency) / RTIMER_ARCH_SECOND,
(latency * 1000L) / RTIMER_ARCH_SECOND,
packetbuf_datalen() - COLLECT_MSG_HDRSIZE,
msg->data);
}

View file

@ -145,9 +145,9 @@ recv_mesh(struct mesh_conn *c, const rimeaddr_t *from, uint8_t hops)
pingrecvtime = rtimer_arch_now();
#endif
snprintf(buf, sizeof(buf), "%lu ms (%lu + %lu), %d hops.",
(1000L * (pingrecvtime - ping.pingtime)) / RTIMER_ARCH_SECOND,
(1000L * (ping.pongtime - ping.pingtime)) / RTIMER_ARCH_SECOND,
(1000L * (pingrecvtime - ping.pongtime)) / RTIMER_ARCH_SECOND,
((pingrecvtime - ping.pingtime) * 1000L) / RTIMER_ARCH_SECOND,
((ping.pongtime - ping.pingtime) * 1000L) / RTIMER_ARCH_SECOND,
((pingrecvtime - ping.pongtime) * 1000L) / RTIMER_ARCH_SECOND,
hops);
shell_output_str(&rime_ping_command,