Ver Fonte

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

Kosma Moczek há 11 anos atrás
pai
commit
03fd0b399c
1 ficheiros alterados com 2 adições e 0 exclusões
  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)
         return 0;
+    if (from == to)
+        return value;
     return (value * to + from / 2) / from;
 }