WILD GUESS ALERT!

I'm guessing that this is for byte-alignment on big-endian versus
little-endian...

So it's more like 11110000 and 00001111 as masks to flip-flop bytes by
some binary logic / magic.

The -1 is to "wrap" the byte to binary inversion.

You might want to grep the code and see how they are actually used.

That helps me a lot when I'm totally lost what the Magic Numbers are
used for.

Not knowing what the initial value of ZEND_MM_ALIGNMENT is in the
first place, this is just wild guess...

On Thu, March 1, 2012 10:22 am, Adi Mutu wrote:
>
>
> Hello,
>
> I want to understand how Zend MM works, so i'm looking trought the
> sources and i see this:
>
> #define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1) #define
> ZEND_MM_ALIGNED_SIZE(size)    (((size) + ZEND_MM_ALIGNMENT - 1) &
> ZEND_MM_ALIGNMENT_MASK)
>
>
> I understand that the first define will create something like 11111000
> ( it will clear last 3 bits)
> but what does the 2nd define? Before clearing the last 3 bytes why
> does it add ZEND_MM_ALIGNMENT- 1
> to size?
>
> Thanks,


-- 
brain cancer update:
http://richardlynch.blogspot.com/search/label/brain%20tumor
Donate:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FS9NLTNEEKWBE



-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to