Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75225 invoked from network); 1 Mar 2012 17:26:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Mar 2012 17:26:09 -0000 Authentication-Results: pb1.pair.com smtp.mail=adi_mutu06@yahoo.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=adi_mutu06@yahoo.com; sender-id=unknown; domainkeys=good Received-SPF: error (pb1.pair.com: domain yahoo.com from 98.139.91.79 cause and error) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: adi_mutu06@yahoo.com X-Host-Fingerprint: 98.139.91.79 nm9.bullet.mail.sp2.yahoo.com Received: from [98.139.91.79] ([98.139.91.79:26534] helo=nm9.bullet.mail.sp2.yahoo.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A6/1E-46815-031BF4F4 for ; Thu, 01 Mar 2012 12:26:09 -0500 Received: from [98.139.91.65] by nm9.bullet.mail.sp2.yahoo.com with NNFMP; 01 Mar 2012 17:26:06 -0000 Received: from [98.139.91.42] by tm5.bullet.mail.sp2.yahoo.com with NNFMP; 01 Mar 2012 17:26:06 -0000 Received: from [127.0.0.1] by omp1042.mail.sp2.yahoo.com with NNFMP; 01 Mar 2012 17:26:06 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 336212.27940.bm@omp1042.mail.sp2.yahoo.com Received: (qmail 29909 invoked by uid 60001); 1 Mar 2012 17:26:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1330622765; bh=bWxK6m9ZYpeupaI1dt2u6Q+9GSY0iWYSBp8QntPyO1o=; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=01HVK6TVzzSaacpQ3CfK6Fsd2iaXQgRToTGbxmMYgD9PzCtwhZscbSaZuQPXzsHGAmdk37bHCO8zotybakMfP67BhYdKVWJZeYhsWCi7iTgQkjVakjz0C+XAe+OvVEdZZEr6JfLpjgZEtqmiPkgKANt8PVq4dHDpuJBuTChNGrA= DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=M01c8DYtbN9sX7rZ9KtGucdNxQLfshNeinT98wd4TY6RgM1HvQ0OwiHEsDIFi4mLEyJxTIr2Ts6inU+SF/ffpo4Q3GAeVGc1q6QAED4YDGy1l6KGR2JO880EnxFa9QDMla1pf4bq3VbWD5x4sUNV23T8ClSHIYlNxD2ftAZrqUE=; X-YMail-OSG: muySejQVM1l4bnOju34pqHlbX7D2YbqMXdO5mJzw.zoBWXQ vXmkf2M9WWs_tfEGWC1K.r0OUokjrS.7aGcUaYaBhM6.B7hMPWB1Y3tAu0UP E3Ps9OAy_Rews3mSkeDHzUVC9J4gPHvpDj6YNcFQS8CDDEFo0iEEzxn.fvyO 1r92wMHrSPINro_jck6Lay0512FAQyiF2S4i5t5Z0.nDflBUcVR5Y83QgnK_ Mqm2Gq7PTylmM8RUUx4UbEvrhw_gr8VdfeQZONvAtitMYn0AF1AmJPh8l0nk r7j1oeESKxo9_EY7sEWXikP88lz4bMB.F8OytcYDN38cy6IYFsHR1gBdt85W SWIGstisxDKZLPDEQzRBbaTar6ldGzPGF.Q6GXiYMQVQxmyCeheoCEiX1IsI NW4CIdoUAwID.j.ikDGBK3R6zchlhWH_6 Received: from [92.80.10.11] by web43507.mail.sp1.yahoo.com via HTTP; Thu, 01 Mar 2012 09:26:05 PST X-Mailer: YahooMailWebService/0.8.116.338427 References: <1330618943.51670.YahooMailNeo@web43505.mail.sp1.yahoo.com> Message-ID: <1330622765.21753.YahooMailNeo@web43507.mail.sp1.yahoo.com> Date: Thu, 1 Mar 2012 09:26:05 -0800 (PST) Reply-To: Adi Mutu To: Gustavo Lopes , "internals@lists.php.net" In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="686268854-80020659-1330622765=:21753" Subject: Re: [PHP-DEV] question about Zend MM From: adi_mutu06@yahoo.com (Adi Mutu) --686268854-80020659-1330622765=:21753 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable =0A=0A=0AAh, now i got it......so it can also return size, if size is direc= tly a multiple of =A0ZEND_MM_ALIGNMENT.=0AI was convinced that it has to be= stricly > than size, i guess i was wrong.=0A=0A=0A________________________= ________=0A From: Gustavo Lopes =0ATo: Adi Mutu ; internals@lists.php.net =0ASent: Thursday, March 1, 20= 12 6:44 PM=0ASubject: Re: [PHP-DEV] question about Zend MM =0A =0AOn Thu, 0= 1 Mar 2012 17:22:23 +0100, Adi Mutu wrote:=0A=0A> I = want to understand how Zend MM works, so i'm looking trought the sources an= d i see this:=0A> =0A> #define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1= ) #define ZEND_MM_ALIGNED_SIZE(size)=A0=A0=A0 (((size) + ZEND_MM_ALIGNMENT = - 1) & ZEND_MM_ALIGNMENT_MASK)=0A> =0A> =0A> I understand that the first de= fine will create something like 11111000 ( it will clear last 3 bits)=0A> b= ut what does the 2nd define? Before clearing the last 3 bytes why does it a= dd ZEND_MM_ALIGNMENT- 1=0A> to size?=0A> =0A=0AIt basically just rounds to = the next multiple of ZEND_MM_ALIGNMENT, assuming ZEND_MM_ALIGNMENT is a pow= er of 2.=0A=0AZEND_MM_ALIGNMENT is a power of 2, so it has 1 bit set. Subtr= acting 1 will zero that bit and and flip on all the other less significant = bits. Then negating flips the bits so that now the bits less significant th= an the log2(ZEND_MM_ALIGNMENT)-th will be zero and the others will be one.= =0A=0AZEND_MM_ALIGNED_SIZE adds ZEND_MM_ALIGNMENT - 1 and applies the mask.= The effect is that the result will be >=3D size and it will be a multiple = of ZEND_MM_ALIGNMENT (in particular the smallest multiple of ZEND_MM_ALIGNM= ENT that's >=3D the argument) because the bits less significant than the lo= g2(ZEND_MM_ALIGNMENT)-th will be zero. "a & n-1" is the same as "a mod n" w= ith n being a power of 2. So if a & ZEND_MM_ALIGNMENT - 1 =3D=3D 0 then a m= od ZEND_MM_ALIGNMENT =3D=3D 0 and a is a multiple of ZEND_MM_ALIGNMENT.=0A= =0A--Gustavo Lopes --686268854-80020659-1330622765=:21753--