This is an automated email from the ASF dual-hosted git repository. nightowl888 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit d0f676d936ca090c7dba052995ef4064a055e185 Author: Shad Storhaug <[email protected]> AuthorDate: Fri Sep 11 11:31:09 2020 +0700 Directory.Build.targets: Added FEATURE_BITARRAY_COPYTO and implemented throughout solution --- Directory.Build.targets | 1 + src/Lucene.Net/Support/BitArrayExtensions.cs | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 53ac6ed..0cf8024 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -61,6 +61,7 @@ <DefineConstants>$(DefineConstants);FEATURE_APPDOMAIN_GETASSEMBLIES</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_APPDOMAIN_ISFULLYTRUSTED</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_ASSEMBLY_GETCALLINGASSEMBLY</DefineConstants> + <DefineConstants>$(DefineConstants);FEATURE_BITARRAY_COPYTO</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_CONCURRENTMERGESCHEDULER</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_CULTUREINFO_GETCULTURES</DefineConstants> <DefineConstants>$(DefineConstants);FEATURE_DTD_PROCESSING</DefineConstants> diff --git a/src/Lucene.Net/Support/BitArrayExtensions.cs b/src/Lucene.Net/Support/BitArrayExtensions.cs index c607d5d..353556d 100644 --- a/src/Lucene.Net/Support/BitArrayExtensions.cs +++ b/src/Lucene.Net/Support/BitArrayExtensions.cs @@ -153,13 +153,7 @@ namespace Lucene.Net.Support throw new ArgumentNullException(nameof(bits)); int count = 0; -#if NETSTANDARD1_6 - for (int i = 0; i < bits.Length; i++) - { - if (bits[i]) - count++; - } -#else +#if FEATURE_BITARRAY_COPYTO int bitsLength = bits.Length; int[] ints = new int[(bitsLength >> 5) + 1]; int intsLength = ints.Length; @@ -184,6 +178,12 @@ namespace Lucene.Net.Support count += c; } +#else + for (int i = 0; i < bits.Length; i++) + { + if (bits[i]) + count++; + } #endif return count; }
