Re: zend_mm_small_size_to_bit

From: Date: Mon, 08 Sep 2014 07:06:01 +0000
Subject: Re: zend_mm_small_size_to_bit
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-77094@lists.php.net to get a copy of this message
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 <php_lists@realplain.com> 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 >

« previous php.internals (#77094) next »