db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel John Debrunner <...@apache.org>
Subject Re: Some questions about FormatableBitSet
Date Mon, 11 Dec 2006 16:52:43 GMT
Dyre.Tjeldvoll@Sun.COM wrote:
> There are a couple of things in the implementation of this class that
> I just don't understand:

> - A minor nit: This class appears to do a lot of division and
>   remainder calculations with powers of 2 (frequently 8). Is it not
>   generally preferably to do this with shifts and  bitwise ANDs?

I prefer the approach that leads to code that is easy to understand.
If the purpose of the code is to divide by two I prefer clear code like:

   a = b / 2;


   a = b >> 1;

Good compilers typically compile multiplication down to shift 
instructions, why have the human do it?


View raw message