lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [20/26] lucenenet git commit: fix old sbyte
Date Fri, 14 Nov 2014 11:59:35 GMT
fix old sbyte


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/70e1c54d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/70e1c54d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/70e1c54d

Branch: refs/heads/master
Commit: 70e1c54dd5c3f40961e251f031c38820da8bce09
Parents: e01bbc0
Author: eladmarg <eladmarg@gmail.com>
Authored: Wed Nov 12 18:48:14 2014 -0800
Committer: eladmarg <eladmarg@gmail.com>
Committed: Wed Nov 12 18:48:14 2014 -0800

----------------------------------------------------------------------
 Lucene.Net.Facet/FacetsConfig.cs                | 42 ++++++++++----------
 .../Taxonomy/DocValuesOrdinalsReader.cs         |  4 +-
 .../Taxonomy/FastTaxonomyFacetCounts.cs         |  6 +--
 .../Taxonomy/IntAssociationFacetField.cs        | 11 ++---
 .../TaxonomyFacetSumFloatAssociations.cs        |  2 +-
 .../Taxonomy/TaxonomyFacetSumIntAssociations.cs |  2 +-
 6 files changed, 34 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/FacetsConfig.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/FacetsConfig.cs b/Lucene.Net.Facet/FacetsConfig.cs
index b8f8140..ae4ac36 100644
--- a/Lucene.Net.Facet/FacetsConfig.cs
+++ b/Lucene.Net.Facet/FacetsConfig.cs
@@ -487,7 +487,7 @@ namespace Lucene.Net.Facet
         {
             foreach (KeyValuePair<string, IList<AssociationFacetField>> ent in
byField)
             {
-                sbyte[] bytes = new sbyte[16];
+                byte[] bytes = new byte[16];
                 int upto = 0;
                 string indexFieldName = ent.Key;
                 foreach (AssociationFacetField field in ent.Value)
@@ -501,10 +501,10 @@ namespace Lucene.Net.Facet
                         bytes = ArrayUtil.Grow(bytes, upto + 4);
                     }
                     // big-endian:
-                    bytes[upto++] = (sbyte)(ordinal >> 24);
-                    bytes[upto++] = (sbyte)(ordinal >> 16);
-                    bytes[upto++] = (sbyte)(ordinal >> 8);
-                    bytes[upto++] = (sbyte)ordinal;
+                    bytes[upto++] = (byte)(ordinal >> 24);
+                    bytes[upto++] = (byte)(ordinal >> 16);
+                    bytes[upto++] = (byte)(ordinal >> 8);
+                    bytes[upto++] = (byte)ordinal;
                     if (upto + field.assoc.Length > bytes.Length)
                     {
                         bytes = ArrayUtil.Grow(bytes, upto + field.assoc.Length);
@@ -529,7 +529,7 @@ namespace Lucene.Net.Facet
         protected internal virtual BytesRef DedupAndEncode(IntsRef ordinals)
         {
             Array.Sort(ordinals.Ints, ordinals.Offset, ordinals.Length);
-            sbyte[] bytes = new sbyte[5 * ordinals.Length];
+            byte[] bytes = new byte[5 * ordinals.Length];
             int lastOrd = -1;
             int upto = 0;
             for (int i = 0; i < ordinals.Length; i++)
@@ -549,37 +549,37 @@ namespace Lucene.Net.Facet
                     }
                     if ((delta & ~0x7F) == 0)
                     {
-                        bytes[upto] = (sbyte)delta;
+                        bytes[upto] = (byte)delta;
                         upto++;
                     }
                     else if ((delta & ~0x3FFF) == 0)
                     {
-                        bytes[upto] = unchecked((sbyte)(0x80 | ((delta & 0x3F80) >>
7)));
-                        bytes[upto + 1] = (sbyte)(delta & 0x7F);
+                        bytes[upto] = unchecked((byte)(0x80 | ((delta & 0x3F80) >>
7)));
+                        bytes[upto + 1] = (byte)(delta & 0x7F);
                         upto += 2;
                     }
                     else if ((delta & ~0x1FFFFF) == 0)
                     {
-                        bytes[upto] = unchecked((sbyte)(0x80 | ((delta & 0x1FC000) >>
14)));
-                        bytes[upto + 1] = unchecked((sbyte)(0x80 | ((delta & 0x3F80)
>> 7)));
-                        bytes[upto + 2] = (sbyte)(delta & 0x7F);
+                        bytes[upto] = unchecked((byte)(0x80 | ((delta & 0x1FC000) >>
14)));
+                        bytes[upto + 1] = unchecked((byte)(0x80 | ((delta & 0x3F80) >>
7)));
+                        bytes[upto + 2] = (byte)(delta & 0x7F);
                         upto += 3;
                     }
                     else if ((delta & ~0xFFFFFFF) == 0)
                     {
-                        bytes[upto] = unchecked((sbyte)(0x80 | ((delta & 0xFE00000) >>
21)));
-                        bytes[upto + 1] = unchecked((sbyte)(0x80 | ((delta & 0x1FC000)
>> 14)));
-                        bytes[upto + 2] = unchecked((sbyte)(0x80 | ((delta & 0x3F80)
>> 7)));
-                        bytes[upto + 3] = (sbyte)(delta & 0x7F);
+                        bytes[upto] = unchecked((byte)(0x80 | ((delta & 0xFE00000) >>
21)));
+                        bytes[upto + 1] = unchecked((byte)(0x80 | ((delta & 0x1FC000)
>> 14)));
+                        bytes[upto + 2] = unchecked((byte)(0x80 | ((delta & 0x3F80) >>
7)));
+                        bytes[upto + 3] = (byte)(delta & 0x7F);
                         upto += 4;
                     }
                     else
                     {
-                        bytes[upto] = unchecked((sbyte)(0x80 | ((delta & 0xF0000000)
>> 28)));
-                        bytes[upto + 1] = unchecked((sbyte)(0x80 | ((delta & 0xFE00000)
>> 21)));
-                        bytes[upto + 2] = unchecked((sbyte)(0x80 | ((delta & 0x1FC000)
>> 14)));
-                        bytes[upto + 3] = unchecked((sbyte)(0x80 | ((delta & 0x3F80)
>> 7)));
-                        bytes[upto + 4] = (sbyte)(delta & 0x7F);
+                        bytes[upto] = unchecked((byte)(0x80 | ((delta & 0xF0000000) >>
28)));
+                        bytes[upto + 1] = unchecked((byte)(0x80 | ((delta & 0xFE00000)
>> 21)));
+                        bytes[upto + 2] = unchecked((byte)(0x80 | ((delta & 0x1FC000)
>> 14)));
+                        bytes[upto + 3] = unchecked((byte)(0x80 | ((delta & 0x3F80) >>
7)));
+                        bytes[upto + 4] = (byte)(delta & 0x7F);
                         upto += 5;
                     }
                     lastOrd = ord;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs b/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs
index 72a68ed..3d50275 100644
--- a/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs
+++ b/Lucene.Net.Facet/Taxonomy/DocValuesOrdinalsReader.cs
@@ -111,8 +111,8 @@
             int prev = 0;
             while (offset < upto)
             {
-                sbyte b = buf.Bytes[offset++];
-                if (b >= 0)
+                byte b = buf.Bytes[offset++];
+                if ((sbyte)b >= 0)
                 {
                     ordinals.Ints[ordinals.Length] = ((value << 7) | b) + prev;
                     value = 0;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/Taxonomy/FastTaxonomyFacetCounts.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/Taxonomy/FastTaxonomyFacetCounts.cs b/Lucene.Net.Facet/Taxonomy/FastTaxonomyFacetCounts.cs
index 01545f0..f0d5fa0 100644
--- a/Lucene.Net.Facet/Taxonomy/FastTaxonomyFacetCounts.cs
+++ b/Lucene.Net.Facet/Taxonomy/FastTaxonomyFacetCounts.cs
@@ -76,15 +76,15 @@ namespace Lucene.Net.Facet.Taxonomy
                 while ((doc = docs.NextDoc()) != DocIdSetIterator.NO_MORE_DOCS)
                 {
                     dv.Get(doc,bytesRef);
-                    sbyte[] bytes = bytesRef.Bytes;
+                    var bytes = bytesRef.Bytes;
                     int end = bytesRef.Offset + bytesRef.Length;
                     int ord = 0;
                     int offset = bytesRef.Offset;
                     int prev = 0;
                     while (offset < end)
                     {
-                        sbyte b = bytes[offset++];
-                        if (b >= 0)
+                        byte b = bytes[offset++];
+                        if ((sbyte)b >= 0)
                         {
                             prev = ord = ((ord << 7) | b) + prev;
                             ++values[ord];

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/Taxonomy/IntAssociationFacetField.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/Taxonomy/IntAssociationFacetField.cs b/Lucene.Net.Facet/Taxonomy/IntAssociationFacetField.cs
index b3f1ddd..61d8177 100644
--- a/Lucene.Net.Facet/Taxonomy/IntAssociationFacetField.cs
+++ b/Lucene.Net.Facet/Taxonomy/IntAssociationFacetField.cs
@@ -49,12 +49,13 @@ namespace Lucene.Net.Facet.Taxonomy
         /// </summary>
         public static BytesRef intToBytesRef(int v)
         {
-            sbyte[] bytes = new sbyte[4];
+            
+            byte[] bytes = new byte[4];
             // big-endian:
-            bytes[0] = (sbyte)(v >> 24);
-            bytes[1] = (sbyte)(v >> 16);
-            bytes[2] = (sbyte)(v >> 8);
-            bytes[3] = (sbyte)v;
+            bytes[0] = (byte)(v >> 24);
+            bytes[1] = (byte)(v >> 16);
+            bytes[2] = (byte)(v >> 8);
+            bytes[3] = (byte)v;
             return new BytesRef(bytes);
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs b/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs
index bf0d417..7d5188e 100644
--- a/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs
+++ b/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumFloatAssociations.cs
@@ -79,7 +79,7 @@ namespace Lucene.Net.Facet.Taxonomy
                     // BytesRef getAssociation()?
                     BytesRef bytesRef = new BytesRef();
                     dv.Get(doc, bytesRef);
-                    sbyte[] bytes = bytesRef.Bytes;
+                    byte[] bytes = bytesRef.Bytes;
                     int end = bytesRef.Offset + bytesRef.Length;
                     int offset = bytesRef.Offset;
                     while (offset < end)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/70e1c54d/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumIntAssociations.cs
----------------------------------------------------------------------
diff --git a/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumIntAssociations.cs b/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumIntAssociations.cs
index 849cb30..9942be6 100644
--- a/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumIntAssociations.cs
+++ b/Lucene.Net.Facet/Taxonomy/TaxonomyFacetSumIntAssociations.cs
@@ -77,7 +77,7 @@ namespace Lucene.Net.Facet.Taxonomy
                     // BytesRef getAssociation()?
                     BytesRef bytesRef = new BytesRef();
                     dv.Get(doc, bytesRef);
-                    sbyte[] bytes = bytesRef.Bytes;
+                    byte[] bytes = bytesRef.Bytes;
                     int end = bytesRef.Offset + bytesRef.Length;
                     int offset = bytesRef.Offset;
                     while (offset < end)


Mime
View raw message