Clean up PathPredictor()

Change parameters from int to uint_8, since that is what the callers
pass in. Then the returns do not need to cast anymore. Add a cast to
promote the uint_8 to int when needed.

Change-Id: I736ea5414b6e097c05197115ce4b20a0315e39f6
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/119230
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fxcodec/flate/flatemodule.cpp b/core/fxcodec/flate/flatemodule.cpp
index bd8ae54..7aa3b15 100644
--- a/core/fxcodec/flate/flatemodule.cpp
+++ b/core/fxcodec/flate/flatemodule.cpp
@@ -298,16 +298,15 @@
   return dest_byte_pos_ != 0;
 }
 
-uint8_t PathPredictor(int a, int b, int c) {
-  int p = a + b - c;
+uint8_t PathPredictor(uint8_t a, uint8_t b, uint8_t c) {
+  int p = static_cast<int>(a) + b - c;
   int pa = abs(p - a);
   int pb = abs(p - b);
   int pc = abs(p - c);
-  if (pa <= pb && pa <= pc)
-    return (uint8_t)a;
-  if (pb <= pc)
-    return (uint8_t)b;
-  return (uint8_t)c;
+  if (pa <= pb && pa <= pc) {
+    return a;
+  }
+  return pb <= pc ? b : c;
 }
 
 void PNG_PredictLine(pdfium::span<uint8_t> dest_span,