On Mon, Nov 16, 2015 at 01:20:11PM -0500, Richard Heck wrote:
> On 11/15/2015 05:27 PM, Scott Kostyshak wrote:
> >
> >The following is not a critique (so please push because of Richard's 
> >positive feedback), but if you have time I am curious about the following:
> >
> >strwidth_cache_(1 << 19)
> >
> >How did you decide on 19? And why the trick of 1 << 19 instead of just the 
> >following?
> >
> >strwidth_cache_(19)
> >
> >I'm guessing this is a C++ trick I should know.
> 
> 1 << 19 is a 1 with 19 zeros after it, in binary notation, so is equivalent
> to 2^19 = 512K but much faster to calculate. This trick is used extensively
> in debug.h.

Thanks for this explanation, Richard. Now I understand.

I'm still curious how 512K was chosen.

Scott

Attachment: signature.asc
Description: PGP signature

Reply via email to