mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Casting runtime: Use the runtime's constant for reserved bits in an ObjC pointer.
Previously, we had a predicate that only worked properly for 64-bit architectures; the 32-bit platforms don't have tagged pointers, and have an annoying tendency to allocate objects with the high bit of the address set. Fixes <rdar://problem/17544277>. Swift SVN r19523
This commit is contained in:
@@ -87,7 +87,8 @@ uint8_t swift::swift_classShift = 0;
|
||||
#if SWIFT_OBJC_INTEROP
|
||||
/// Does this object use a tagged-pointer representation?
|
||||
static bool isTaggedPointerOrNull(const void *object) {
|
||||
return ((long)object & 1) || ((long)object <= 0);
|
||||
return ((uintptr_t)object & heap_object_abi::ObjCReservedBitsMask) ||
|
||||
object == nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user