[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:12:16 PDT 2023


lntue added inline comments.


================
Comment at: libc/src/__support/UInt.h:80
 
-  constexpr explicit operator uint64_t() const { return val[0]; }
+  constexpr explicit operator unsigned long long() const {
+    return static_cast<unsigned long long>(val[0]);
----------------
michaelrj wrote:
> nit: it might be best to have both the `uint` and the standard int types for casting
Adding other `uint` overload will actually cause ambiguity, as they are simply aliases of these on many platforms.  We had similar issues when adding built-in wrappers https://github.com/llvm/llvm-project/blob/main/libc/src/__support/builtin_wrappers.h


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151234



More information about the libc-commits mailing list