zend_mm_small_size_to_bit
| From: | Matt Wilmas | Date: | Fri, 05 Sep 2014 16:00:26 +0000 |
| Subject: | zend_mm_small_size_to_bit | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-77074@lists.php.net to get a copy of this message | ||
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