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

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Mon Dec 4 14:40:17 PST 2023


================
@@ -34,7 +34,9 @@ LIBC_INLINE double as_double(uint64_t x) { return cpp::bit_cast<double>(x); }
 
 LIBC_INLINE uint32_t top12_bits(float x) { return as_uint32_bits(x) >> 20; }
 
-LIBC_INLINE uint32_t top12_bits(double x) { return as_uint64_bits(x) >> 52; }
+LIBC_INLINE uint32_t top12_bits(double x) {
+  return static_cast<uint32_t>(as_uint64_bits(x) >> 52);
+}
----------------
nickdesaulniers wrote:

does this function have any users in tree?

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


More information about the libc-commits mailing list