lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1586728 - in /lucene/dev/trunk/lucene/analysis/kuromoji/src: java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java
Date Fri, 11 Apr 2014 17:55:25 GMT
Author: rmuir
Date: Fri Apr 11 17:55:25 2014
New Revision: 1586728

URL: http://svn.apache.org/r1586728
Log:
extract another zigzag encode/decode

Modified:
    lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java
    lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java

Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java?rev=1586728&r1=1586727&r2=1586728&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java
(original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java
Fri Apr 11 17:55:25 2014
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.store.DataInput;
 import org.apache.lucene.store.InputStreamDataInput;
+import org.apache.lucene.util.BitUtil;
 import org.apache.lucene.util.IOUtils;
 
 /**
@@ -53,8 +54,7 @@ public final class ConnectionCosts {
       for (int j = 0; j < costs.length; j++) {
         final short[] a = costs[j];
         for (int i = 0; i < a.length; i++) {
-          int raw = in.readVInt();
-          accum += (raw >>> 1) ^ -(raw & 1);
+          accum += BitUtil.zigZagDecode(in.readVInt());
           a[i] = (short)accum;
         }
       }

Modified: lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java?rev=1586728&r1=1586727&r2=1586728&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java
(original)
+++ lucene/dev/trunk/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java
Fri Apr 11 17:55:25 2014
@@ -28,6 +28,7 @@ import org.apache.lucene.analysis.ja.dic
 import org.apache.lucene.codecs.CodecUtil;
 import org.apache.lucene.store.DataOutput;
 import org.apache.lucene.store.OutputStreamDataOutput;
+import org.apache.lucene.util.BitUtil;
 
 public final class ConnectionCostsWriter {
   
@@ -64,7 +65,7 @@ public final class ConnectionCostsWriter
         assert a.length == forwardSize;
         for (int i = 0; i < a.length; i++) {
           int delta = (int)a[i] - last;
-          out.writeVInt((delta >> 31) ^ (delta << 1));
+          out.writeVInt(BitUtil.zigZagEncode(delta));
           last = a[i];
         }
       }



Mime
View raw message