Skip to content

Commit

Permalink
Merge pull request swiftlang#78060 from compnerd/truncatio
Browse files Browse the repository at this point in the history
SIL: avoid truncation warnings on Windows (NFCI)
  • Loading branch information
compnerd authored Dec 10, 2024
2 parents 2e337ae + a3b60ed commit c711df6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion include/swift/SIL/SILBasicBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ public SwiftObjectHeader {
~SILBasicBlock();

enum { numCustomBits = std::numeric_limits<CustomBitsType>::digits };
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() };

constexpr static const size_t maxBitfieldID =
std::numeric_limits<uint64_t>::max();

/// Gets the ID (= index in the function's block list) of the block.
///
Expand Down
4 changes: 3 additions & 1 deletion include/swift/SIL/SILNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ class alignas(8) SILNode :
enum { NumMarkDependenceKindBits = 2 };

enum { numCustomBits = 20 };
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() >> numCustomBits };

constexpr static const size_t maxBitfieldID =
std::numeric_limits<uint64_t>::max() >> numCustomBits;

protected:
friend class SILInstruction;
Expand Down
4 changes: 3 additions & 1 deletion include/swift/SIL/SILValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,9 @@ ValueOwnershipKind::getForwardingOperandOwnership(bool allowUnowned) const {
class Operand {
public:
enum { numCustomBits = 8 };
enum { maxBitfieldID = std::numeric_limits<uint64_t>::max() >> numCustomBits };

constexpr static const size_t maxBitfieldID =
std::numeric_limits<uint64_t>::max() >> numCustomBits;

private:
template <class, class> friend class SILBitfield;
Expand Down

0 comments on commit c711df6

Please sign in to comment.