Torsten Curdt wrote:
buf.length << 1 is a shift operation which is the same as buf.length*2. The Max() chooses the bigger value.
So that method is fine ;)
But a little too clever for my taste ;-). It reminds me of the old days with C compilers who weren't smart enough to convert a multiplication/division by a power of 2 into a left/right shift. I thought those days had passed forever, but it seems there's always someone thinking he can outsmart the compiler ;-).
...I thought so too until I had a look into BCEL ;)
We could use that to see if the compiler is smart enough to optimize that on his own :) ...at least it would be interesting to know for the future. -- Torsten
