[libc-commits] [libc] [Libc] Turn implicit to explicit conversion (PR #130615)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Mar 10 07:37:34 PDT 2025


https://github.com/jhuber6 updated https://github.com/llvm/llvm-project/pull/130615

>From 56c53f7a639b85f59aeddef30e2a9a3e777ed3a3 Mon Sep 17 00:00:00 2001
From: JP Lehr <JanPatrick.Lehr at amd.com>
Date: Mon, 10 Mar 2025 09:28:41 -0500
Subject: [PATCH 1/2] [Libc] Turn implicit to explicit conversion

This fixes a build issue on the AMDGPU libc bot after https://github.com/llvm/llvm-project/pull/126846
landed that introduced a warning.
---
 libc/src/__support/high_precision_decimal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h
index 922dce484aa6b..d5bf179e80f83 100644
--- a/libc/src/__support/high_precision_decimal.h
+++ b/libc/src/__support/high_precision_decimal.h
@@ -401,7 +401,7 @@ class HighPrecisionDecimal {
         this->right_shift(MAX_SHIFT_AMOUNT);
         shift_amount += MAX_SHIFT_AMOUNT;
       }
-      this->right_shift(-shift_amount);
+      this->right_shift(-static_cast<uint32_t>(shift_amount));
     }
   }
 

>From 526a0506952d37640465adade8f6d86745bd4e37 Mon Sep 17 00:00:00 2001
From: Joseph Huber <huberjn at outlook.com>
Date: Mon, 10 Mar 2025 09:37:21 -0500
Subject: [PATCH 2/2] Update libc/src/__support/high_precision_decimal.h

---
 libc/src/__support/high_precision_decimal.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/__support/high_precision_decimal.h b/libc/src/__support/high_precision_decimal.h
index d5bf179e80f83..b203ca00cb26e 100644
--- a/libc/src/__support/high_precision_decimal.h
+++ b/libc/src/__support/high_precision_decimal.h
@@ -401,7 +401,7 @@ class HighPrecisionDecimal {
         this->right_shift(MAX_SHIFT_AMOUNT);
         shift_amount += MAX_SHIFT_AMOUNT;
       }
-      this->right_shift(-static_cast<uint32_t>(shift_amount));
+      this->right_shift(static_cast<uint32_t>(-shift_amount));
     }
   }
 



More information about the libc-commits mailing list