[libc-commits] [libc] [libc] Fix incorrect unsigned comparison (PR #135595)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Apr 15 17:09:44 PDT 2025
================
@@ -192,7 +192,7 @@ template <WriteMode write_mode> class FloatWriter {
RET_IF_RESULT_NEGATIVE(writer->write({block_buffer, digits_to_write}));
}
RET_IF_RESULT_NEGATIVE(writer->write(DECIMAL_POINT));
- if (buffered_digits - digits_to_write > 0) {
+ if (buffered_digits > digits_to_write) {
----------------
michaelrj-google wrote:
I agree that the underflow shouldn't be possible, but the proposed change improves clarity.
https://github.com/llvm/llvm-project/pull/135595
More information about the libc-commits
mailing list