[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to correctly determine a small object?

From: Luboš Doležel
Subject: Re: How to correctly determine a small object?
Date: Sat, 08 Jun 2013 19:10:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 06/07/2013 10:10 PM, David Chisnall wrote:
On 7 Jun 2013, at 16:29, Luboš Doležel <address@hidden> wrote:

for toll-free bridging in CoreBase, I need a way to detect whether
the incoming pointer is a small object encoded in a pointer and act
accordingly (treat it as an ObjC object and avoid reading it).

In objc/runtime.h, there is a constant SMALL_OBJECT_MASK.  If ptr &
SMALL_OBJECT_MASK == 0, then the pointer is not a small object.

On 32-bit platforms, the low bit of the pointer will be 0.  On 64-bit
platforms, the low 3 bits will always be zero.


It seems to have helped. Thanks!

Luboš Doležel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]