Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 894031079B for ; Fri, 11 Apr 2014 17:57:18 +0000 (UTC) Received: (qmail 34151 invoked by uid 500); 11 Apr 2014 17:57:17 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 34138 invoked by uid 99); 11 Apr 2014 17:57:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2014 17:57:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2014 17:57:16 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 92B9523888E2; Fri, 11 Apr 2014 17:56:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1586729 - in /lucene/dev/branches/branch_4x: ./ lucene/ lucene/analysis/ lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ Date: Fri, 11 Apr 2014 17:56:53 -0000 To: commits@lucene.apache.org From: rmuir@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140411175653.92B9523888E2@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rmuir Date: Fri Apr 11 17:56:53 2014 New Revision: 1586729 URL: http://svn.apache.org/r1586729 Log: extract another zigzag encode/decode Modified: lucene/dev/branches/branch_4x/ (props changed) lucene/dev/branches/branch_4x/lucene/ (props changed) lucene/dev/branches/branch_4x/lucene/analysis/ (props changed) lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java Modified: lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java?rev=1586729&r1=1586728&r2=1586729&view=diff ============================================================================== --- lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java (original) +++ lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/ConnectionCosts.java Fri Apr 11 17:56:53 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/branches/branch_4x/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java?rev=1586729&r1=1586728&r2=1586729&view=diff ============================================================================== --- lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java (original) +++ lucene/dev/branches/branch_4x/lucene/analysis/kuromoji/src/tools/java/org/apache/lucene/analysis/ja/util/ConnectionCostsWriter.java Fri Apr 11 17:56:53 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]; } }