Skip to content

Commit c711df6

Browse files
authoredDec 10, 2024
Merge pull request swiftlang#78060 from compnerd/truncatio
SIL: avoid truncation warnings on Windows (NFCI)
2 parents 2e337ae + a3b60ed commit c711df6

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed
 

Diff for: ‎include/swift/SIL/SILBasicBlock.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,9 @@ public SwiftObjectHeader {
153153
~SILBasicBlock();
154154

155155
enum { numCustomBits = std::numeric_limits<CustomBitsType>::digits };
156-
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() };
156+
157+
constexpr static const size_t maxBitfieldID =
158+
std::numeric_limits<uint64_t>::max();
157159

158160
/// Gets the ID (= index in the function's block list) of the block.
159161
///

Diff for: ‎include/swift/SIL/SILNode.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ class alignas(8) SILNode :
127127
enum { NumMarkDependenceKindBits = 2 };
128128

129129
enum { numCustomBits = 20 };
130-
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() >> numCustomBits };
130+
131+
constexpr static const size_t maxBitfieldID =
132+
std::numeric_limits<uint64_t>::max() >> numCustomBits;
131133

132134
protected:
133135
friend class SILInstruction;

Diff for: ‎include/swift/SIL/SILValue.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,9 @@ ValueOwnershipKind::getForwardingOperandOwnership(bool allowUnowned) const {
10211021
class Operand {
10221022
public:
10231023
enum { numCustomBits = 8 };
1024-
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() >> numCustomBits };
1024+
1025+
constexpr static const size_t maxBitfieldID =
1026+
std::numeric_limits<uint64_t>::max() >> numCustomBits;
10251027

10261028
private:
10271029
template <class, class> friend class SILBitfield;

0 commit comments

Comments
 (0)