zend_mm_small_size_to_bit

[email protected] ("Matt Wilmas")
Newsgroups php.internals
Message-ID <82DDEFF351B5484A85DD56599B8E8988@pc1>
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.