Messages in this thread | | | Date | Fri, 5 Sep 2003 09:34:22 +0300 | From | Muli Ben-Yehuda <> | Subject | Re: [PATCH] Stop mprotect() changing MAP_SHARED and other cleanup |
| |
On Thu, Sep 04, 2003 at 11:04:35PM +0100, Jamie Lokier wrote: > Muli Ben-Yehuda wrote: > > > +/* Optimisation macro. */ > > > +#define _calc_vm_trans(x,bit1,bit2) \ > > > + ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \ > > > + : ((x) & (bit1)) / ((bit1) / (bit2)) > > > > Why is this necessary? the original version of the macro was much > > simpler. If this isn't just for shaving a couple of optimization,
I meant "shaving a couple of instructions", of course.
> > please document it. If it is, I urge you to reconsider ;-) > > When the bits don't match, mine reduces to a mask-and-shift. The > original reduces to a mask-and-conditional, which is usually slower.
Ok. Your version is also incomprehensible (to me, at least) without working it out using a pen and paper, whereas the original is clear and concise. Are the saved CPU cycles worth the wasted programmer cycles in this case? I doubt it. -- Muli Ben-Yehuda http://www.mulix.org
[unhandled content-type:application/pgp-signature] | |