File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,13 @@ extern "C" {
21
21
# endif
22
22
#endif
23
23
24
+ // Make sure we get the limit macros, even in C++ mode
25
+ #ifndef __STDC_LIMIT_MACROS
26
+ # define __STDC_LIMIT_MACROS
27
+ #endif
24
28
25
29
#include < stdint.h>
30
+ #include < limits.h>
26
31
#include < stddef.h>
27
32
#include < sys/types.h>
28
33
#include " Availability.h"
@@ -751,11 +756,19 @@ BOOL objc_registerSmallObjectClass_np(Class cls, uintptr_t classId);
751
756
* systems, we use the low 3 bits. In both cases, the lowest bit must be 1.
752
757
* This restriction may be relaxed in the future on 64-bit systems.
753
758
*/
754
- #define OBJC_SMALL_OBJECT_MASK ((sizeof (id ) == 4 ) ? 1 : 7 )
759
+ #if UINTPTR_MAX < UINT64_MAX
760
+ # define OBJC_SMALL_OBJECT_MASK 1
761
+ #else
762
+ # define OBJC_SMALL_OBJECT_MASK 7
763
+ #endif
755
764
/* *
756
765
* The number of bits reserved for the class identifier in a small object.
757
766
*/
758
- #define OBJC_SMALL_OBJECT_SHIFT ((sizeof (id ) == 4 ) ? 1 : 3 )
767
+ #if UINTPTR_MAX < UINT64_MAX
768
+ # define OBJC_SMALL_OBJECT_SHIFT 1
769
+ #else
770
+ # define OBJC_SMALL_OBJECT_SHIFT 3
771
+ #endif
759
772
760
773
761
774
/* *
You can’t perform that action at this time.
0 commit comments