diff options
-rw-r--r-- | src/doom/statdump.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/doom/statdump.c b/src/doom/statdump.c index 0e83df8d..e80641c8 100644 --- a/src/doom/statdump.c +++ b/src/doom/statdump.c @@ -152,7 +152,12 @@ static void PrintPercentage(FILE *stream, int amount, int total) {
fprintf(stream, "%i / %i", amount, total);
- fprintf(stream, " (%i%%)", (amount * 100) / total);
+ // statdump.exe is a 16-bit program, so very occasionally an
+ // integer overflow can occur when doing this calculation with
+ // a large value. Therefore, cast to short to give the same
+ // output.
+
+ fprintf(stream, " (%i%%)", (short) (amount * 100) / total);
}
}
|