Re: zend_mm_small_size_to_bit

[email protected] (Dmitry Stogov)
Newsgroups php.internals
Message-ID <CA+9eiLuJpn1sUKp-AWJObFenxYY=q7+6+aM3T9S+vp8zCj9BCw@mail.gmail.com>
Hi Matt,

You are right about zend_mm_small_size_to_bit(). It's result must be
undefined for 0 and corresponding part of non-GCC version may be removed as
well. I'll do it.

Thanks. Dmitry.


On Fri, Sep 5, 2014 at 8:00 PM, Matt Wilmas <[email protected]> wrote:

> Hi Dmitry, all,
>
> I was looking through a few parts of the new MM last week (cool, thanks! I
> will try soon on my Windows XP), and wasn't sure about the function in the
> subject...
>
> This:
>
> /* higher set bit number (0->0, 1->1, 2->2, 4->3, 8->4, 127->7, 128->8
> etc) */
> static zend_always_inline int zend_mm_small_size_to_bit(int size)
> {
> #if defined(__GNUC__)
> return (__builtin_clz(size) ^ 0x1f) + 1;
>
> Will never return 0, right? (Against the comment...)  That's OK I guess
> since, for now, it's only called with size >= 8.
>
> But in that case, this can be removed from the non-GCC version:
>
> if (size == 0) return 0;
>
> Shouldn't have just one version able to return 0? :-/  Unless I'm missing
> something!  Let me know...
>
>
> Thanks,
> Matt
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.