[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 10:36:02 PDT 2023
lntue created this revision.
lntue added reviewers: michaelrj, sivachandra.
Herald added subscribers: ecnelises, tschuett.
Herald added projects: libc-project, All.
lntue requested review of this revision.
This fixes an issue with missing `unsigned long` conversion on macOS.
Repository:
rG LLVM Github Monorepo
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.524798.patch
Type: text/x-patch
Size: 1173 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230523/7fcf9827/attachment.bin>
More information about the libc-commits
mailing list