Skip to content

Commit dd7b663

Browse files
committed
TypeRefID: Only add high bits of a pointer if on 64-bit
Adding another 0 to the TypeRefID bits is useless on 32-bit platforms.
1 parent 50440ab commit dd7b663

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

include/swift/Reflection/TypeRef.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ class TypeRefID {
5656

5757
template <typename T>
5858
void addPointer(const T *Pointer) {
59-
auto Raw = reinterpret_cast<uintptr_t>(Pointer);
60-
Bits.push_back((uint32_t)Raw);
61-
Bits.push_back(Raw >> 32);
59+
auto Raw = reinterpret_cast<uint32_t *>(&Pointer);
60+
Bits.push_back(Raw[0]);
61+
if (sizeof(const T *) > 4) {
62+
Bits.push_back(Raw[1]);
63+
}
6264
}
6365

6466
void addInteger(uint32_t Integer) {

0 commit comments

Comments
 (0)