Skip to content

Commit 9d790b4

Browse files
committed
Fix long vs size_t error on Windows.
On win64, long is 32 bits, not 64 bits as it is everywhere else.
1 parent d443809 commit 9d790b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arc.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,11 @@ static TLS_CALLBACK(cleanupPools)(struct arc_tls* tls)
205205
* ever had a weak reference taken. This lets us avoid acquiring the weak
206206
* table lock for most objects on deallocation.
207207
*/
208-
static const long weak_mask = ((size_t)1)<<((sizeof(size_t)*8)-refcount_shift);
208+
static const size_t weak_mask = ((size_t)1)<<((sizeof(size_t)*8)-refcount_shift);
209209
/**
210210
* All of the bits other than the top bit are the real reference count.
211211
*/
212-
static const long refcount_mask = ~weak_mask;
212+
static const size_t refcount_mask = ~weak_mask;
213213

214214
OBJC_PUBLIC size_t object_getRetainCount_np(id obj)
215215
{
@@ -225,7 +225,7 @@ OBJC_PUBLIC id objc_retain_fast_np(id obj)
225225
uintptr_t newVal = refCountVal;
226226
do {
227227
refCountVal = newVal;
228-
long realCount = refCountVal & refcount_mask;
228+
size_t realCount = refCountVal & refcount_mask;
229229
// If this object's reference count is already less than 0, then
230230
// this is a spurious retain. This can happen when one thread is
231231
// attempting to acquire a strong reference from a weak reference
@@ -708,7 +708,7 @@ static BOOL setObjectHasWeakRefs(id obj)
708708
uintptr_t newVal = refCountVal;
709709
do {
710710
refCountVal = newVal;
711-
long realCount = refCountVal & refcount_mask;
711+
size_t realCount = refCountVal & refcount_mask;
712712
// If this object has already been deallocated (or is in the
713713
// process of being deallocated) then don't bother storing it.
714714
if (realCount < 0)

0 commit comments

Comments
 (0)