From 83ffd96251d748efacea84cd6d2311192f2d5469 Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 14 Dec 2013 23:10:37 +0100 Subject: [PATCH] Surface position: mm->velocity is int so avoid useless ops. --- dump1090.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dump1090.c b/dump1090.c index b5ae5ab..e751332 100644 --- a/dump1090.c +++ b/dump1090.c @@ -1069,12 +1069,11 @@ void decodeModesMessage(struct modesMessage *mm, unsigned char *msg) { if (mvt == 0) { /* unknown */ mm->velocity = 0; } else if (mvt == 1) { /* less than 0.125 kt */ - mm->velocity = 0.124; + mm->velocity = 0; } else if (mvt == 124) { mm->velocity = 175; } else if (mvt >= 2 && mvt <= 8) { - mm->velocity = 0.125; - mm->velocity += (mvt-2) * 0.125; + mm->velocity = 0.125+((mvt-2) * 0.125); } else if (mvt >= 9 && mvt <= 12) { mm->velocity = 1; mm->velocity += (mvt-9) * 0.25;