Skip to content

Commit 3b06474

Browse files
committed
fix(uikitformac): IsObjcObject tagged pointers can have their highest bit unset
It seems like a tagged pointer can now be any pointer above 2^53 (not only above 2^63)
1 parent 0e42586 commit 3b06474

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/NativeScript/ObjC/IsObjcObject.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@
4343
#define _OBJC_TAG_EXT_INDEX_MASK 0xff
4444

4545
#if OBJC_MSB_TAGGED_POINTERS
46+
#if TARGET_OS_UIKITFORMAC
47+
#define _OBJC_TAG_MASK (-1ULL >> (64 - 53))
48+
#else
4649
#define _OBJC_TAG_MASK (1ULL << 63)
50+
#endif // TARGET_OS_UIKITFORMAC
4751
#define _OBJC_TAG_INDEX_SHIFT 60
4852
#define _OBJC_TAG_EXT_INDEX_SHIFT 52
4953
#else
@@ -90,7 +94,7 @@ typedef enum {
9094
} objc_tag_index_t;
9195

9296
static inline bool _objc_isTaggedPointer(const void* ptr) {
93-
return ((intptr_t)ptr & _OBJC_TAG_MASK) == _OBJC_TAG_MASK;
97+
return ((intptr_t)ptr & _OBJC_TAG_MASK) != 0;
9498
}
9599

96100
static inline objc_tag_index_t _objc_getTaggedPointerTag(const void* ptr) {

0 commit comments

Comments
 (0)