فهرست منبع

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

Kosma Moczek 11 سال پیش
والد
کامیت
03fd0b399c
1فایلهای تغییر یافته به همراه2 افزوده شده و 0 حذف شده
  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;
 }