[libc-commits] [PATCH] D151234: [libc] Change UInt integer conversion operators to use standard types.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue May 23 11:13:05 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7cbcc581a5bf: [libc] Change UInt integer conversion operators to use standard types. (authored by lntue).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151234/new/

https://reviews.llvm.org/D151234

Files:
  libc/src/__support/UInt.h


Index: libc/src/__support/UInt.h
===================================================================
--- libc/src/__support/UInt.h
+++ libc/src/__support/UInt.h
@@ -77,18 +77,24 @@
       val[i] = words[i];
   }
 
-  constexpr explicit operator uint64_t() const { return val[0]; }
+  constexpr explicit operator unsigned long long() const {
+    return static_cast<unsigned long long>(val[0]);
+  }
+
+  constexpr explicit operator unsigned long() const {
+    return static_cast<unsigned long>(val[0]);
+  }
 
-  constexpr explicit operator uint32_t() const {
-    return uint32_t(uint64_t(*this));
+  constexpr explicit operator unsigned int() const {
+    return static_cast<unsigned int>(val[0]);
   }
 
-  constexpr explicit operator uint16_t() const {
-    return uint16_t(uint64_t(*this));
+  constexpr explicit operator unsigned short() const {
+    return static_cast<unsigned short>(val[0]);
   }
 
-  constexpr explicit operator uint8_t() const {
-    return uint8_t(uint64_t(*this));
+  constexpr explicit operator unsigned char() const {
+    return static_cast<unsigned char>(val[0]);
   }
 
   constexpr explicit operator bool() const { return !is_zero(); }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151234.524808.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230523/2d69a184/attachment.bin>


More information about the libc-commits mailing list