Browse Source

minmea.h: short-cirtuit no-rescale case in minmea_rescale()

Kosma Moczek 11 years ago
parent
commit
03fd0b399c
1 changed files with 2 additions and 0 deletions
  1. 2 0
      minmea.h

+ 2 - 0
minmea.h

@@ -102,6 +102,8 @@ static inline int minmea_rescale(int value, int from, int to)
 {
 {
     if (from == 0)
     if (from == 0)
         return 0;
         return 0;
+    if (from == to)
+        return value;
     return (value * to + from / 2) / from;
     return (value * to + from / 2) / from;
 }
 }