fmt/pl: cast pl_i32/64 before negation
fixes "-fsanitize=undefined"
src/fmt/pl.c:94:15: runtime error: negation of cannot be
represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate
this value to itself
@@ -91,7 +91,7 @@ int32_t pl_i32(const struct pl *pl)
}
}
- return neg ? -v : v;
+ return neg ? -(uint32_t)v : v;
}
@@ -132,7 +132,7 @@ int64_t pl_i64(const struct pl *pl)
}
}
- return neg ? -v : v;
+ return neg ? -(uint64_t)v : v;
}
