mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 01:53:05 +02:00
Bugfix: Off-by-one bug in subtracting UINT. Fixes #1557
This commit is contained in:
@@ -14,6 +14,7 @@ public class UintUtils {
|
||||
* @return diff
|
||||
*/
|
||||
public static long diff(long a, long b, final long UINT_MAX) {
|
||||
|
||||
if (a < 0 || b < 0) {
|
||||
throw new RuntimeException("a or b cannot be less than zero.");
|
||||
}
|
||||
@@ -25,6 +26,6 @@ public class UintUtils {
|
||||
return a - b;
|
||||
}
|
||||
|
||||
return (UINT_MAX - b) + a;
|
||||
return (UINT_MAX + 1 - b) + a;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user