[libc-commits] [libc] [libc][NFC] fix int warnings in float conversion (PR #74379)

via libc-commits libc-commits at lists.llvm.org
Mon Dec 4 16:23:03 PST 2023


================
@@ -290,7 +290,7 @@ LIBC_INLINE cpp::UInt<MID_INT_SIZE> get_table_negative(int exponent, size_t i) {
     } else {
       ten_blocks = 0;
       five_blocks = i;
-      shift_amount = static_cast<int>(shift_amount + (i * BLOCK_SIZE));
+      shift_amount = shift_amount + (static_cast<int>(i) * BLOCK_SIZE);
----------------
michaelrj-google wrote:

personally I prefer to have parentheses when an equation is ambiguous. Even if operator precedence does the correct thing, it's less cognitive load to clarify with parentheses.

https://github.com/llvm/llvm-project/pull/74379


More information about the libc-commits mailing list