lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charlie <charlie...@gmail.com>
Subject (byte)((i & 0x7f) | 0x80) == (byte)(i | 0x80)
Date Wed, 26 Apr 2006 16:24:44 GMT
Hello,

In:

   public abstract class IndexOutput
   public void writeVInt(int i)
   writeByte((byte)((i & 0x7f) | 0x80));

I thought

  (byte)((i & 0x7f) | 0x80) == (byte)(i | 0x80)

As (byte) is able to truncate the last byte for us already, no need of
(& 0x7f). If so, we may change that line to

   writeByte((byte)(i | 0x80));

and may speed up a little bit. Correct me if (i & 0x7f) is necessary.
Thank you.

-- 
Best regards,
 Charlie


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message