[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to correctly determine a small object?
From: |
Maxthon Chan |
Subject: |
Re: How to correctly determine a small object? |
Date: |
Sun, 09 Jun 2013 01:20:24 +0800 |
So I can safely do this? (Macro rewritten as inline function)
static inline __attribute__((always_inline)) BOOL objc_isSmallObject(id obj)
{
return (((intptr_t)obj) & 1) ? YES : NO;
}
在 2013-6-8,上午4:10,David Chisnall <address@hidden> 写道:
> 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.
>
> David
>
>
> _______________________________________________
> Gnustep-dev mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/gnustep-dev
- How to correctly determine a small object?, Luboš Doležel, 2013/06/07
- Re: How to correctly determine a small object?, Stefan Bidi, 2013/06/07
- Re: How to correctly determine a small object?, David Chisnall, 2013/06/07
- Re: How to correctly determine a small object?, David Chisnall, 2013/06/07
- Re: How to correctly determine a small object?, Luboš Doležel, 2013/06/08
- Re: How to correctly determine a small object?,
Maxthon Chan <=
- Re: How to correctly determine a small object?, David Chisnall, 2013/06/08
- Re: How to correctly determine a small object?, Chan Maxthon, 2013/06/08
- Re: How to correctly determine a small object?, Ivan Vučica, 2013/06/08
- Re: How to correctly determine a small object?, Chan Maxthon, 2013/06/08
- Re: How to correctly determine a small object?, Ivan Vučica, 2013/06/08
- Re: How to correctly determine a small object?, Chan Maxthon, 2013/06/08
- Re: How to correctly determine a small object?, David Chisnall, 2013/06/09
- Re: How to correctly determine a small object?, Graham Lee, 2013/06/09
- Re: How to correctly determine a small object?, Graham Lee, 2013/06/09
- Re: How to correctly determine a small object?, Maxthon Chan, 2013/06/09