Skip to content

Commit abb1148

Browse files
stdlib: repair 32bit non-Darwin build for TypeLayout
glibc's `uintptr_t` and `uint64_t` are both `unsigned long int`, but `uint32_t` is `unsigned int`, so BitVector overloads cannot be resoled on 32-bit platforms by following compilation error: error: call to member function 'add' is ambiguous bv.add(heap_object_abi::SwiftSpareBitsMask); darwin 32-bit platforms use stdint types defined in SwiftStdint.h, so they are identical
1 parent 60952b8 commit abb1148

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

stdlib/toolchain/CompatibilityBytecodeLayouts/BytecodeLayouts.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ size_t BitVector::count() const {
7575
return total;
7676
}
7777

78+
void BitVector::add(uintptr_t byte) {
79+
#if __POINTER_WIDTH__ == 64
80+
add((uint64_t)byte);
81+
#else
82+
add((uint32_t)byte);
83+
#endif
84+
}
85+
7886
void BitVector::add(uint64_t byte) {
7987
for (size_t i = 0; i < 64; i++)
8088
data.push_back(byte >> (63 - i) & 0x1);

stdlib/toolchain/CompatibilityBytecodeLayouts/BytecodeLayouts.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ struct BitVector {
159159
/// Append on a 64bit value
160160
void add(uint64_t values);
161161

162+
/// Append on a pointer-size value
163+
void add(uintptr_t values);
164+
162165
/// Append on a vector of bytes
163166
void add(std::vector<uint8_t> values);
164167

0 commit comments

Comments
 (0)