[libc-commits] [libc] [libc][FPUtil] fixup missing explicit cast (PR #86736)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue Mar 26 13:44:00 PDT 2024


https://github.com/nickdesaulniers created https://github.com/llvm/llvm-project/pull/86736

The arm32 buildbot reports an error because UInt::operator bool() is explicit,
thus an explicit cast is necessary.

Link: #85940


>From a18ce4785903b863007ca55de2ad7fac8ed3750f Mon Sep 17 00:00:00 2001
From: Nick Desaulniers <ndesaulniers at google.com>
Date: Tue, 26 Mar 2024 13:41:50 -0700
Subject: [PATCH] [libc][FPUtil] fixup missing explicit cast

The arm32 buildbot reports an error because UInt::operator bool() is explicit,
thus an explicit cast is necessary.

Link: #85940
---
 libc/src/__support/FPUtil/BasicOperations.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/src/__support/FPUtil/BasicOperations.h b/libc/src/__support/FPUtil/BasicOperations.h
index 405755f8b57d9b..f746d7ac6ad41f 100644
--- a/libc/src/__support/FPUtil/BasicOperations.h
+++ b/libc/src/__support/FPUtil/BasicOperations.h
@@ -199,7 +199,7 @@ LIBC_INLINE int canonicalize(T &cx, const T &x) {
     //  Values    |            |           | (−1)**s × m × 2**−16382
     bool bit63 = sx.get_implicit_bit();
     UInt128 mantissa = sx.get_explicit_mantissa();
-    bool bit62 = ((mantissa & (1ULL << 62)) >> 62);
+    bool bit62 = static_cast<bool>((mantissa & (1ULL << 62)) >> 62);
     int exponent = sx.get_biased_exponent();
     if (exponent == 0x7FFF) {
       if (!bit63 && !bit62) {



More information about the libc-commits mailing list