lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mhern...@apache.org
Subject [2/2] git commit: adding BroadWord class and initial test.
Date Sat, 09 Aug 2014 03:46:29 GMT
adding BroadWord class and initial test.


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

Branch: refs/heads/pcl
Commit: a5d9e83f8e4675f6a711036dc41aaccbac2bc4df
Parents: 477b922
Author: Michael Herndon <mherndon@michaelherndon.com>
Authored: Fri Aug 8 23:45:06 2014 -0400
Committer: Michael Herndon <mherndon@michaelherndon.com>
Committed: Fri Aug 8 23:45:06 2014 -0400

----------------------------------------------------------------------
 Lucene.vs2013.sln                               | 25 -----
 src/Lucene.Net.Core/Lucene.Net.Core.csproj      | 11 ++-
 .../Support/NumberExtensionMethods.cs           | 97 ++++++++++++++++++++
 .../Support/SupportExtensionMethods.cs          |  3 +
 src/Lucene.Net.Core/Util/BitUtil.cs             | 20 ++--
 src/Lucene.Net.Core/Util/BroadWord.cs           | 87 ++++++++++++++++++
 src/Lucene.Net.Core/Util/SystemProps.cs         |  7 +-
 src/Lucene.Net.Core/packages.config             |  2 +-
 src/Lucene.Net.Core/project.json                |  6 +-
 .../Lucene.Net.Core.Tests.csproj                |  1 +
 .../Lucene.Net.Core.Tests/Util/TestBroadWord.cs | 32 +++++++
 11 files changed, 247 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/Lucene.vs2013.sln
----------------------------------------------------------------------
diff --git a/Lucene.vs2013.sln b/Lucene.vs2013.sln
index c9972ff..9170178 100644
--- a/Lucene.vs2013.sln
+++ b/Lucene.vs2013.sln
@@ -3,16 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2013
 VisualStudioVersion = 12.0.30723.0
 MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C90AB34C-AFCE-4CA1-8AB6-F25FC241639C}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E7E53642-2EDA-49CE-B730-95242CCF608D}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Lucene.Net.TestFramework", "test\Lucene.Net.TestFramework\Lucene.Net.TestFramework.kproj",
"{E8C34852-CE11-4CD0-A34A-E777B0BD705A}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Lucene.Net.Core", "src\Lucene.Net.Core\Lucene.Net.Core.kproj",
"{CAF32BEA-5560-4E4A-A81F-11AA377F9929}"
-EndProject
-Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Lucene.Net.Core.Tests", "test\Lucene.Net.Core.Tests\Lucene.Net.Core.Tests.kproj",
"{46467889-DCDD-4E2B-B583-6AACCE996EAC}"
-EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "portable-src", "portable-src", "{CD84C1EF-B845-4914-A9DD-D0F9ACC7DE6F}"
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "portable-test", "portable-test", "{4B0484AA-03E4-47A5-9989-AC42DDE1E06B}"
@@ -29,18 +19,6 @@ Global
 		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{E8C34852-CE11-4CD0-A34A-E777B0BD705A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{E8C34852-CE11-4CD0-A34A-E777B0BD705A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{E8C34852-CE11-4CD0-A34A-E777B0BD705A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{E8C34852-CE11-4CD0-A34A-E777B0BD705A}.Release|Any CPU.Build.0 = Release|Any CPU
-		{CAF32BEA-5560-4E4A-A81F-11AA377F9929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{CAF32BEA-5560-4E4A-A81F-11AA377F9929}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{CAF32BEA-5560-4E4A-A81F-11AA377F9929}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{CAF32BEA-5560-4E4A-A81F-11AA377F9929}.Release|Any CPU.Build.0 = Release|Any CPU
-		{46467889-DCDD-4E2B-B583-6AACCE996EAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{46467889-DCDD-4E2B-B583-6AACCE996EAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{46467889-DCDD-4E2B-B583-6AACCE996EAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{46467889-DCDD-4E2B-B583-6AACCE996EAC}.Release|Any CPU.Build.0 = Release|Any CPU
 		{AD8901C0-209D-4132-80AA-257DBACEECB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{AD8901C0-209D-4132-80AA-257DBACEECB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{AD8901C0-209D-4132-80AA-257DBACEECB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -58,9 +36,6 @@ Global
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
-		{E8C34852-CE11-4CD0-A34A-E777B0BD705A} = {E7E53642-2EDA-49CE-B730-95242CCF608D}
-		{CAF32BEA-5560-4E4A-A81F-11AA377F9929} = {C90AB34C-AFCE-4CA1-8AB6-F25FC241639C}
-		{46467889-DCDD-4E2B-B583-6AACCE996EAC} = {E7E53642-2EDA-49CE-B730-95242CCF608D}
 		{AD8901C0-209D-4132-80AA-257DBACEECB4} = {CD84C1EF-B845-4914-A9DD-D0F9ACC7DE6F}
 		{F0D68FEA-B118-43B6-B760-3FB75CDE766D} = {4B0484AA-03E4-47A5-9989-AC42DDE1E06B}
 		{C879C7A6-FBE5-4F22-B363-A4356C7B8E76} = {4B0484AA-03E4-47A5-9989-AC42DDE1E06B}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Lucene.Net.Core.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.Core.csproj b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
index 03fa1d0..aed403a 100644
--- a/src/Lucene.Net.Core/Lucene.Net.Core.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
@@ -62,6 +62,7 @@
     <Compile Include="Support\EnumUtil.cs" />
     <Compile Include="Support\HashMap.cs" />
     <Compile Include="Support\ICloneable.cs" />
+    <Compile Include="Support\NumberExtensionMethods.cs" />
     <Compile Include="Support\SerializableAttribute.cs" />
     <Compile Include="Support\ShallowCloneNotSupportedException.cs" />
     <Compile Include="Support\StringExtensionMethods.cs" />
@@ -69,6 +70,8 @@
     <Compile Include="Util\ArrayInPlaceMergeSorter`.cs" />
     <Compile Include="Util\ArrayUtil.cs" />
     <Compile Include="Util\Bits.cs" />
+    <Compile Include="Util\BitUtil.cs" />
+    <Compile Include="Util\BroadWord.cs" />
     <Compile Include="Util\Constants.cs" />
     <Compile Include="Util\IAccountable.cs" />
     <Compile Include="Util\IAttribute.cs" />
@@ -80,12 +83,12 @@
     <Compile Include="Util\Version.cs" />
   </ItemGroup>
   <ItemGroup>
-    <Reference Include="Microsoft.Framework.ConfigurationModel">
-      <HintPath>..\..\packages\Microsoft.Framework.ConfigurationModel.1.0.0-alpha3-10137\lib\portable-net451+win81+wpa81\Microsoft.Framework.ConfigurationModel.dll</HintPath>
-    </Reference>
+    <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="packages.config" />
+    <Reference Include="Microsoft.Framework.ConfigurationModel">
+      <HintPath>..\..\packages\Microsoft.Framework.ConfigurationModel\1.0.0-alpha4-10193\lib\portable-net451+win81+wpa81\Microsoft.Framework.ConfigurationModel.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets"
/>
   <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')"
/>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs b/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
new file mode 100644
index 0000000..7d610fb
--- /dev/null
+++ b/src/Lucene.Net.Core/Support/NumberExtensionMethods.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.Support
+{
+    public static class NumberExtensionMethods
+    {
+        /// <summary>
+        /// FFS bit positions with De Bruijn sequences.
+        /// </summary>
+        static class DeBruijn32
+        {
+            static int[] s_positions = new int[32]
+	        {
+	            0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
+	            31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
+	        };
+
+            /// <summary>
+            /// Returns the first set bit (FFS), or 0 if no bits are set.
+            /// </summary>
+            public static int Position(int number)
+            {
+                uint res = unchecked((uint)(number & -number) * 0x077CB531U) >>
27;
+                return s_positions[res];
+            }
+        }
+
+
+        static class DeBruijn64
+        {
+
+
+            static int[] s_positions = new int[64] {
+                0,  1,  2, 53,  3,  7, 54, 27, 4, 38, 41,  8, 34, 55, 48, 28,
+                62,  5, 39, 46, 44, 42, 22,  9, 24, 35, 59, 56, 49, 18, 29, 11,
+                63, 52,  6, 26, 37, 40, 33, 47, 61, 45, 43, 21, 23, 58, 17, 10,
+                51, 25, 36, 32, 60, 20, 57, 16, 50, 31, 19, 15, 30, 14, 13, 12,
+            };
+
+            public static int Position(long value)
+            {
+
+                var result = unchecked((uint)(value & -value) * 0x022fdd63cc95386d) >>
58;
+                return s_positions[result];
+            }
+        }
+
+
+        /// <summary>
+        /// Returns the number of trailing zeros. i.e 100 has two trailing zeros.
+        /// </summary>
+        /// <param name="value">The value to be inspected for trailing zeros.</param>
+        /// <remarks>
+        ///     <para>
+        ///         We're using the De Bruijn sequences based upon the various bit twiddling
hacks found in 
+        ///         an online paper stanford <see cref="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup"
/>
+        ///     </para>
+        ///     <para>
+        ///          It should be faster than Java's native 
+        ///          <see href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/Integer.java#Integer.numberOfTrailingZeros%28int%29">
+        ///          Long.numberOfTrailingZeros
+        ///          </see> which uses the binary search method of finding trailing
zeros.  
+        ///     </para>
+        /// </remarks>
+        /// <returns>The number of trailing zeros.</returns>
+        public static int NumberOfTrailingZeros(this int value)
+        {
+            return DeBruijn32.Position(value);
+        }
+
+        /// <summary>
+        /// Returns the number of trailing zeros. i.e 100 has two trailing zeros.
+        /// </summary>
+        /// <param name="value">The value to be inspected for trailing zeros.</param>
+        /// <remarks>
+        ///     <para>
+        ///         We're using the De Bruijn sequences based upon the various bit twiddling
hacks found in 
+        ///         an online paper stanford <see cref="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup"
/>
+        ///     </para>
+        ///     <para>
+        ///          It should be faster than Java's native 
+        ///          <see href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/Integer.java#Integer.numberOfTrailingZeros%28int%29">
+        ///          Long.numberOfTrailingZeros
+        ///          </see> which uses the binary search method of finding trailing
zeros.  
+        ///     </para>
+        /// </remarks>
+        /// <returns>The number of trailing zeros.</returns>
+        public static int NumberOfTrailingZeros(this long value)
+        {
+            return DeBruijn64.Position(value);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs b/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
index 5bdff41..76e82e4 100644
--- a/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
+++ b/src/Lucene.Net.Core/Support/SupportExtensionMethods.cs
@@ -25,6 +25,9 @@ namespace Lucene.Net.Support
     /// </summary>
     public static class SupportExtensionMethods
     {
+
+
+
         /// <summary>
         /// Clones and casts the new instance to the same type of the old instance. 
         /// </summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Util/BitUtil.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/BitUtil.cs b/src/Lucene.Net.Core/Util/BitUtil.cs
index bb2e8e9..da5f735 100644
--- a/src/Lucene.Net.Core/Util/BitUtil.cs
+++ b/src/Lucene.Net.Core/Util/BitUtil.cs
@@ -277,16 +277,24 @@ namespace Lucene.Net.Util
             return value;
         }
 
-        /** Decode an int previously encoded with {@link #zigZagEncode(int)}. */
+        /// <summary>
+        /// Decode a long previously encoded with <see cref="ZigZagEndcode"/>.
+        /// </summary>
+        /// <param name="value">The value to be decoded.</param>
+        /// <returns>The decoded value.</returns>
         public static int ZigZagDecode(int value) 
         {
             return (int)(((uint)value >> 1) ^ -(value & 1));
         }
 
-        /** Decode a long previously encoded with {@link #zigZagEncode(long)}. */
-        public static long zigZagDecode(long value) 
+        /// <summary>
+        /// Decode a long previously encoded with <see cref="ZigZagEndcode"/>.
+        /// </summary>
+        /// <param name="value">The value to be decoded.</param>
+        /// <returns>The decoded value.</returns>
+        public static long ZigZagDecode(long value) 
         {
-            return ((value >>> 1) ^ -(value & 1));
+            return ((long)((ulong)value >> 1) ^ -(value & 1));
         }
 
         /// <summary>
@@ -320,7 +328,7 @@ namespace Lucene.Net.Util
         /// </remarks>
         /// <param name="value">The value that will be encoded.</param>
         /// <returns>The encoded value.</returns>
-        public static long zigZagEncode(long value)
+        public static long ZigZagEncode(long value)
         {
             return (value >> 63) ^ (value << 1);
         }
@@ -331,7 +339,7 @@ namespace Lucene.Net.Util
         /// <param name="value">The value to be inspected.</param>
         /// <returns></returns>
         /// <seealso href="http://docs.oracle.com/javase/6/docs/api/java/lang/Long.html#bitCount(long)"/>
-        private static long BitCount(long value)
+        public static long BitCount(long value)
         {
             return SparseBitCount(value);
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Util/BroadWord.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/BroadWord.cs b/src/Lucene.Net.Core/Util/BroadWord.cs
new file mode 100644
index 0000000..239cbe6
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/BroadWord.cs
@@ -0,0 +1,87 @@
+/*
+    * Licensed to the Apache Software Foundation (ASF) under one or more
+    * contributor license agreements.  See the NOTICE file distributed with
+    * this work for additional information regarding copyright ownership.
+    * The ASF licenses this file to You under the Apache License, Version 2.0
+    * (the "License"); you may not use this file except in compliance with
+    * the License.  You may obtain a copy of the License at
+    *
+    *     http://www.apache.org/licenses/LICENSE-2.0
+    *
+    * Unless required by applicable law or agreed to in writing, software
+    * distributed under the License is distributed on an "AS IS" BASIS,
+    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    * See the License for the specific language governing permissions and
+    * limitations under the License.
+    */
+
+
+
+namespace Lucene.Net.Util
+{
+
+    using System.Diagnostics;
+    using Lucene.Net.Support;
+
+    /// <summary>
+    /// Methods and constants inspired by the article
+    /// "Broadword Implementation of Rank/Select Queries" by Sebastiano Vigna, January 30,
2012:
+    /// </summary>
+    public sealed class BroadWord
+    {
+
+        private BroadWord() // no instance
+        {
+        }
+
+        /// <summary>
+        ///  L8  denotes the constant of 8-byte-counts or 8k.
+        ///  _L denotes that the number is an long format. 
+        /// </summary>
+        public const long L8_L = 0x0101010101010101L;
+
+        /// <summary>
+        ///  L9  denotes the constant of 8-byte-counts or 9k.
+        ///  _L denotes that the number is an long format. 
+        /// </summary>
+        public const long L9_L = unchecked((long)0x8040201008040201L);
+
+        /// <summary>
+        ///  L16  denotes the constant of 16-byte-counts or 16k.
+        ///  _L denotes that the number is an long format. 
+        /// </summary>
+        public const long L16_L = 0x0001000100010001L;
+
+        /// <summary>
+        /// H8 = L8 << (8-1) .
+        ///  These contain the high bit of each group of k bits.
+        ///  The suffix _L indicates the long implementation.
+        /// </summary>
+        public static readonly long H8_L = L8_L << 7;
+
+        /// H16 = L16 << (16-1) .
+        ///  These contain the high bit of each group of k bits.
+        ///  The suffix _L indicates the long implementation.
+        public static readonly long H16_L = L16_L << 15;
+
+        /// <summary>
+        /// Bit count of a long.
+        /// Only here to compare the implementation with <seealso cref="Select(long,int)"/>,
+        /// normally <seealso cref="Lucene.Net.Util.BitUtil.BitCount"/> is preferable.
</summary>
+        /// <returns> The total number of 1 bits in x. </returns>
+        public static int BitCount(long value)
+        {
+            ulong x = (ulong)value;
+            // Step 0 leaves in each pair of bits the number of ones originally contained
in that pair:
+            x = x - ((x & 0xAAAAAAAAAAAAAAAAL) >> 1);
+            // Step 1, idem for each nibble:
+            x = (x & 0x3333333333333333L) + ((x >> 2) & 0x3333333333333333L);
+            // Step 2, idem for each byte:
+            x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0FL;
+            // Multiply to sum them all into the high byte, and return the high byte:
+            return (int)((x * L8_L) >> 56);
+        }
+
+       
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/Util/SystemProps.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/SystemProps.cs b/src/Lucene.Net.Core/Util/SystemProps.cs
index f5fbf70..4f8338b 100644
--- a/src/Lucene.Net.Core/Util/SystemProps.cs
+++ b/src/Lucene.Net.Core/Util/SystemProps.cs
@@ -40,9 +40,8 @@ namespace Lucene.Net.Util
         /// Adds the <see cref="IConfigurationSource"/> to what is available in <see
cref="SystemProps"/>.
         /// </summary>
         /// <param name="configurationSource"></param>
-#pragma warning disable "CS3001"
+        [CLSCompliant(false)]
         public static void Add(IConfigurationSource configurationSource)
-#pragma warning restore "CS3001"
         {
             s_config.Add(configurationSource);
         }
@@ -89,10 +88,8 @@ namespace Lucene.Net.Util
         /// 
         /// </summary>
         /// <param name="configuration"></param>
-
-#pragma warning disable "CS3001"
+        [CLSCompliant(false)]
         public static void UseConfiguration(Configuration configuration)
-#pragma warning restore "CS3001"
         {
             s_config = configuration;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/packages.config
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/packages.config b/src/Lucene.Net.Core/packages.config
index 80dad80..9c1a013 100644
--- a/src/Lucene.Net.Core/packages.config
+++ b/src/Lucene.Net.Core/packages.config
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Microsoft.Framework.ConfigurationModel" version="1.0.0-alpha3-10137" targetFramework="portable-net451+win81+wpa81"
/>
+  <package id="Microsoft.Framework.ConfigurationModel" version="1.0.0-alpha4-10193" targetFramework="portable-net451+win81+wpa81"
/>
 </packages>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/src/Lucene.Net.Core/project.json
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/project.json b/src/Lucene.Net.Core/project.json
index eebe593..8025e0e 100644
--- a/src/Lucene.Net.Core/project.json
+++ b/src/Lucene.Net.Core/project.json
@@ -1,8 +1,8 @@
 {
-    "licenses": ["apache 2.0"],
-     "version": "5.0.0.0",
+    "licenses": [ "apache 2.0" ],
+    "version": "5.0.0.0",
     "dependencies": {
-        "Microsoft.Framework.ConfigurationModel": "1.0.0-alpha2"
+        "Microsoft.Framework.ConfigurationModel": "1.0.0-alpha4-10193" 
     },
     "license": "apache 2.0",
     "configurations" : {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
index 3e31131..ec3e52c 100644
--- a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
+++ b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
@@ -62,6 +62,7 @@
     <Compile Include="Util\BaseSorterTestCase.cs" />
     <Compile Include="Util\TestArrayUtil.cs" />
     <Compile Include="Util\TestBits.cs" />
+    <Compile Include="Util\TestBroadWord.cs" />
     <Compile Include="Util\TestConstants.cs" />
     <Compile Include="Util\TestInPlaceMergeSorter.cs" />
     <Compile Include="Util\TestRamEstimatorUsage.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a5d9e83f/test/Lucene.Net.Core.Tests/Util/TestBroadWord.cs
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Util/TestBroadWord.cs b/test/Lucene.Net.Core.Tests/Util/TestBroadWord.cs
new file mode 100644
index 0000000..bca2806
--- /dev/null
+++ b/test/Lucene.Net.Core.Tests/Util/TestBroadWord.cs
@@ -0,0 +1,32 @@
+
+
+namespace Lucene.Net.Util
+{
+    using System;
+
+    using Lucene.Net.Support;
+
+
+    public class TestBroadWord : LuceneTestCase
+    {
+
+
+        [Test]
+        public void TestRank()
+        {
+            AssertRank(0L);
+            AssertRank(1L);
+            AssertRank(3L);
+            AssertRank(0x100L);
+            AssertRank(0x300L);
+            AssertRank(unchecked((long)0x8000000000000001L));
+        }
+
+
+
+        private void AssertRank(long value)
+        {
+            Equal(BitUtil.BitCount(value), BroadWord.BitCount(value));
+        }
+    }
+}


Mime
View raw message